Skip to content

Commit

Permalink
Merge pull request JuliaLang#31440 from JuliaLang/jn/nfc-2
Browse files Browse the repository at this point in the history
Various other tiny changes and QOL enhancements
  • Loading branch information
vtjnash authored Mar 26, 2019
2 parents c0b40d8 + 818c576 commit a90629a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 60 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/dist
/dist-extras
/julia
/julia.bat
/usr
/oprofile_data
/usr-staging
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ $(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUI
@$(MAKE) docs

julia-symlink: julia-ui-$(JULIA_BUILD_MODE)
ifneq ($(OS),WINNT)
ifeq ($(OS),WINNT)
@echo '@"%~dp0"\'"$(shell $(JULIAHOME)/contrib/relative_path.sh "$(BUILDROOT)" "$(JULIA_EXECUTABLE)" | tr / '\\')" '%*' > $(BUILDROOT)/julia.bat
chmod a+x $(BUILDROOT)/julia.bat
else
ifndef JULIA_VAGRANT_BUILD
@ln -sf "$(shell $(JULIAHOME)/contrib/relative_path.sh "$(BUILDROOT)" "$(JULIA_EXECUTABLE)")" $(BUILDROOT)/julia
endif
Expand Down Expand Up @@ -427,7 +430,7 @@ ifeq ($(OS), WINNT)
cd $(BUILDROOT)/julia-$(JULIA_COMMIT) && find * | sed -e 's/\//\\/g' -e 's/$$/\r/g' > etc/uninstall.log

# build nsis package
cd $(BUILDROOT) && $(call spawn,$(JULIAHOME)/dist-extras/nsis/makensis.exe) -NOCD -DVersion=$(JULIA_VERSION) -DArch=$(ARCH) -DCommit=$(JULIA_COMMIT) -DMUI_ICON="$(call cygpath_w,$(JULIAHOME)/contrib/windows/julia.ico)" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.nsi)
cd $(BUILDROOT) && $(call spawn,$(JULIAHOME)/dist-extras/nsis/makensis.exe) -NOCD -DVersion=$(JULIA_VERSION) -DArch=$(ARCH) -DCommit=$(JULIA_COMMIT) -DMUI_ICON="$(call cygpath_w,$(JULIAHOME)/contrib/windows/julia.ico)" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.nsi) | iconv -f latin1

# compress nsis installer and combine with 7zip self-extracting header
cd $(BUILDROOT) && $(JULIAHOME)/dist-extras/7z a -mx9 "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" julia-installer.exe
Expand Down
2 changes: 1 addition & 1 deletion contrib/windows/install-cygwin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ mkdir -Force C:\cygdownloads | Out-Null
"https://cache.julialang.org/https://cygwin.com/$setup", "C:\cygdownloads\$setup")
& "C:\cygdownloads\$setup" -q -n -R C:\cygwin-$env:ARCH `
-l C:\cygdownloads -s http://mirrors.kernel.org/sourceware/cygwin -g -I `
-P "make,curl,time,p7zip,ccache,mingw64-$env:ARCH-gcc-g++,mingw64-$env:ARCH-gcc-fortran" | Where-Object `
-P "make,libiconv,curl,time,p7zip,ccache,mingw64-$env:ARCH-gcc-g++,mingw64-$env:ARCH-gcc-fortran" | Where-Object `
-FilterScript {$_ -notlike "Installing file *"} | Write-Output
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ SHIPFLAGS += $(FLAGS)
SHIPFLAGS += "-DJL_SYSTEM_IMAGE_PATH=\"$(build_private_libdir_rel)/sys.$(SHLIB_EXT)\""
DEBUGFLAGS += "-DJL_SYSTEM_IMAGE_PATH=\"$(build_private_libdir_rel)/sys-debug.$(SHLIB_EXT)\""

FLISP_EXECUTABLE_debug := $(BUILDDIR)/flisp/flisp-debug
FLISP_EXECUTABLE_release := $(BUILDDIR)/flisp/flisp
FLISP_EXECUTABLE_debug := $(BUILDDIR)/flisp/flisp-debug$(EXE)
FLISP_EXECUTABLE_release := $(BUILDDIR)/flisp/flisp$(EXE)
ifeq ($(OS),WINNT)
FLISP_EXECUTABLE := $(FLISP_EXECUTABLE_release)
else
Expand Down
14 changes: 7 additions & 7 deletions src/flisp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ SHIPFLAGS += $(FLAGS)

default: release

release: $(BUILDDIR)/$(EXENAME)
release: $(BUILDDIR)/$(EXENAME)$(EXE)

debug: $(BUILDDIR)/$(EXENAME)-debug
debug: $(BUILDDIR)/$(EXENAME)-debug$(EXE)

$(BUILDDIR):
mkdir -p $(BUILDDIR)
Expand Down Expand Up @@ -78,10 +78,10 @@ else
CCLD := $(LD)
endif

$(BUILDDIR)/$(EXENAME)-debug: $(DOBJS) $(LIBFILES_debug) $(BUILDDIR)/$(LIBTARGET)-debug.a $(BUILDDIR)/flmain.dbg.obj | $(BUILDDIR)/flisp.boot
$(BUILDDIR)/$(EXENAME)-debug$(EXE): $(DOBJS) $(LIBFILES_debug) $(BUILDDIR)/$(LIBTARGET)-debug.a $(BUILDDIR)/flmain.dbg.obj | $(BUILDDIR)/flisp.boot
@$(call PRINT_LINK, $(CCLD) $(DEBUGFLAGS) $(JLDFLAGS) $(DOBJS) $(BUILDDIR)/flmain.dbg.obj -o $@ $(BUILDDIR)/$(LIBTARGET)-debug.a $(LIBFILES_debug) $(LIBS) $(OSLIBS))

$(BUILDDIR)/$(EXENAME): $(OBJS) $(LIBFILES_release) $(BUILDDIR)/$(LIBTARGET).a $(BUILDDIR)/flmain.o | $(BUILDDIR)/flisp.boot
$(BUILDDIR)/$(EXENAME)$(EXE): $(OBJS) $(LIBFILES_release) $(BUILDDIR)/$(LIBTARGET).a $(BUILDDIR)/flmain.o | $(BUILDDIR)/flisp.boot
@$(call PRINT_LINK, $(CCLD) $(SHIPFLAGS) $(JLDFLAGS) $(OBJS) $(BUILDDIR)/flmain.o -o $@ $(BUILDDIR)/$(LIBTARGET).a $(LIBFILES_release) $(LIBS) $(OSLIBS))

ifneq ($(BUILDDIR),.)
Expand All @@ -91,12 +91,12 @@ endif

test:
ifneq ($(USEMSVC), 1)
$(call spawn,./$(EXENAME)) unittest.lsp
$(call spawn,./$(EXENAME)$(EXE)) unittest.lsp
endif

clean:
rm -f $(BUILDDIR)/*.o
rm -f $(BUILDDIR)/*.dbg.obj
rm -f $(BUILDDIR)/*.a
rm -f $(BUILDDIR)/$(EXENAME)
rm -f $(BUILDDIR)/$(EXENAME)-debug
rm -f $(BUILDDIR)/$(EXENAME)$(EXE)
rm -f $(BUILDDIR)/$(EXENAME)-debug$(EXE)
58 changes: 12 additions & 46 deletions stdlib/Libdl/src/Libdl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ File extension for dynamic libraries (e.g. dll, dylib, so) on the current platfo
"""
dlext

if Sys.islinux()
if (Sys.islinux() || Sys.isbsd()) && !Sys.isapple()
struct dl_phdr_info
# Base address of object
addr::Cuint
Expand All @@ -224,51 +224,18 @@ if Sys.islinux()
phnum::Cshort
end

# This callback function called by dl_iterate_phdr() on Linux
function dl_phdr_info_callback(di::dl_phdr_info, size::Csize_t, dynamic_libraries::Array{String,1})
# Skip over objects without a path (as they represent this own object)
name = unsafe_string(di.name)
if !isempty(name)
push!(dynamic_libraries, name)
end
return convert(Cint, 0)::Cint
end
end # linux-only

if Sys.isbsd() && !Sys.isapple()
# This callback function called by dl_iterate_phdr() on Linux and BSD's
# DL_ITERATE_PHDR(3) on freebsd
struct dl_phdr_info
# Base address of object
addr::Cuint

# Null-terminated name of object
name::Ptr{UInt8}

# Pointer to array of ELF program headers for this object
phdr::Ptr{Cvoid}

# Number of program headers for this object
phnum::Cshort
end

function dl_phdr_info_callback(di::dl_phdr_info, size::Csize_t, dy_libs::Vector{String})
function dl_phdr_info_callback(di::dl_phdr_info, size::Csize_t, dynamic_libraries::Array{String,1})
name = unsafe_string(di.name)
if !isempty(name)
push!(dy_libs, name)
end
return convert(Cint, 0)::Cint
push!(dynamic_libraries, name)
return Cint(0)
end
end # bsd family
end

function dllist()
dynamic_libraries = Vector{String}()

@static if Sys.islinux()
callback = @cfunction(dl_phdr_info_callback, Cint,
(Ref{dl_phdr_info}, Csize_t, Ref{Vector{String}}))
ccall(:dl_iterate_phdr, Cint, (Ptr{Cvoid}, Ref{Vector{String}}), callback, dynamic_libraries)
end

@static if Sys.isapple()
numImages = ccall(:_dyld_image_count, Cint, ())

Expand All @@ -277,17 +244,16 @@ function dllist()
name = unsafe_string(ccall(:_dyld_get_image_name, Cstring, (UInt32,), i))
push!(dynamic_libraries, name)
end
end

@static if Sys.iswindows()
ccall(:jl_dllist, Cint, (Any,), dynamic_libraries)
end

@static if Sys.isbsd() && !Sys.isapple()
elseif Sys.islinux() || Sys.isbsd()
callback = @cfunction(dl_phdr_info_callback, Cint,
(Ref{dl_phdr_info}, Csize_t, Ref{Vector{String}}))
ccall(:dl_iterate_phdr, Cint, (Ptr{Cvoid}, Ref{Vector{String}}), callback, dynamic_libraries)
popfirst!(dynamic_libraries)
filter!(!isempty, dynamic_libraries)
elseif Sys.iswindows()
ccall(:jl_dllist, Cint, (Any,), dynamic_libraries)
else
# unimplemented
end

return dynamic_libraries
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Libdl/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dlls = Libdl.dllist()
@test length(dlls) > 3 # at a bare minimum, probably have some version of libstdc, libgcc, libjulia, ...
if !Sys.iswindows() || Sys.windows_version() >= Sys.WINDOWS_VISTA_VER
for dl in dlls
if isfile(dl) && (Libdl.dlopen(dl; throw_error=false) != C_NULL)
if isfile(dl) && (Libdl.dlopen(dl; throw_error=false) !== nothing)
@test Base.samefile(Libdl.dlpath(dl), dl)
end
end
Expand Down
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/src/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import Libdl
let lib = C_NULL
global function determine_vendor()
if lib == C_NULL
lib = Libdl.dlopen(Base.libblas_name; throw_error=false)
lib = something(Libdl.dlopen(Base.libblas_name; throw_error=false), C_NULL)
end
vend = :unknown
if lib != C_NULL
Expand Down

0 comments on commit a90629a

Please sign in to comment.