Skip to content

Commit

Permalink
Merge 47ef407 into 97ccb97
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored Oct 28, 2022
2 parents 97ccb97 + 47ef407 commit 8df0552
Show file tree
Hide file tree
Showing 63 changed files with 661 additions and 329 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/statuses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
- run: |
declare -a CONTEXT_LIST=(
"buildbot/tester_freebsd64"
"buildbot/tester_win32"
"buildbot/tester_win64"
)
for CONTEXT in "${CONTEXT_LIST[@]}"
do
Expand Down
6 changes: 3 additions & 3 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1391,13 +1391,13 @@ define symlink_target # (from, to-dir, to-name)
CLEAN_TARGETS += clean-$$(abspath $(2)/$(3))
clean-$$(abspath $(2)/$(3)):
ifeq ($(BUILD_OS), WINNT)
-cmd //C rmdir $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&)
-cmd //C rmdir $$(call cygpath_w,$(2)/$(3))
else
-rm -r $$(abspath $(2)/$(3))
endif
$$(abspath $(2)/$(3)): | $$(abspath $(2))
ifeq ($$(BUILD_OS), WINNT)
@cmd //C mklink //J $$(call mingw_to_dos,$(2)/$(3),cd $(2) &&) $$(call mingw_to_dos,$(1),)
@cmd //C mklink //J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifneq (,$$(findstring CYGWIN,$$(BUILD_OS)))
@cmd /C mklink /J $$(call cygpath_w,$(2)/$(3)) $$(call cygpath_w,$(1))
else ifdef JULIA_VAGRANT_BUILD
Expand All @@ -1415,7 +1415,7 @@ WINE ?= wine
# many of the following targets must be = not := because the expansion of the makefile functions (and $1) shouldn't happen until later
ifeq ($(BUILD_OS), WINNT) # MSYS
spawn = $(1)
cygpath_w = $(1)
cygpath_w = `cygpath -w $(1)`
else ifneq (,$(findstring CYGWIN,$(BUILD_OS))) # Cygwin
spawn = $(1)
cygpath_w = `cygpath -w $(1)`
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ endif
endif
endif

# Note that we disable MSYS2's path munging here, as otherwise
# it replaces our `:`-separated list as a `;`-separated one.
define stringreplace
$(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
MSYS2_ARG_CONV_EXCL='*' $(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)"
endef


Expand Down Expand Up @@ -446,8 +448,9 @@ endif


exe:
# run Inno Setup to compile installer
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
# run Inno Setup to compile installer.
# Note that we disable MSYS2 path munging, as it interferes with the `/` options:
MSYS2_ARG_CONV_EXCL='*' $(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"

app:
Expand Down Expand Up @@ -572,7 +575,7 @@ win-extras:
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) https://www.jrsoftware.org/download.php/is.exe && \
chmod a+x is.exe && \
$(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)
MSYS2_ARG_CONV_EXCL='*' $(call spawn, $(JULIAHOME)/dist-extras/is.exe /DIR="$(call cygpath_w,$(JULIAHOME)/dist-extras/inno)" /PORTABLE=1 /CURRENTUSER /VERYSILENT)

# various statistics about the build that may interest the user
ifeq ($(USE_SYSTEM_LLVM), 1)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ New library features
* `extrema` now accepts an `init` keyword argument ([#36265], [#43604]).
* `Iterators.countfrom` now accepts any type that defines `+` ([#37747]).
* `@time` now separates out % time spent recompiling invalidated methods ([#45015]).
* An issue with order of operations in `fld1` is now fixed ([#28973]).

Standard library changes
------------------------
Expand Down
6 changes: 3 additions & 3 deletions base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ setproperty!(x::Tuple, f::Int, v, order::Symbol) = setfield!(x, f, v, order) # t
getproperty(x, f::Symbol, order::Symbol) = (@inline; getfield(x, f, order))
setproperty!(x, f::Symbol, v, order::Symbol) = (@inline; setfield!(x, f, convert(fieldtype(typeof(x), f), v), order))

swapproperty!(x, f::Symbol, v, order::Symbol=:notatomic) =
swapproperty!(x, f::Symbol, v, order::Symbol=:not_atomic) =
(@inline; Core.swapfield!(x, f, convert(fieldtype(typeof(x), f), v), order))
modifyproperty!(x, f::Symbol, op, v, order::Symbol=:notatomic) =
modifyproperty!(x, f::Symbol, op, v, order::Symbol=:not_atomic) =
(@inline; Core.modifyfield!(x, f, op, v, order))
replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:notatomic, fail_order::Symbol=success_order) =
replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order) =
(@inline; Core.replacefield!(x, f, expected, convert(fieldtype(typeof(x), f), desired), success_order, fail_order))

convert(::Type{Any}, Core.@nospecialize x) = x
Expand Down
7 changes: 4 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ function unsafe_getindex(A::AbstractArray, I...)
r
end

struct CanonicalIndexError
struct CanonicalIndexError <: Exception
func::String
type::Any
CanonicalIndexError(func::String, @nospecialize(type)) = new(func, type)
Expand Down Expand Up @@ -3187,8 +3187,9 @@ function circshift!(a::AbstractVector, shift::Integer)
n == 0 && return
shift = mod(shift, n)
shift == 0 && return
reverse!(a, 1, shift)
reverse!(a, shift+1, length(a))
l = lastindex(a)
reverse!(a, firstindex(a), l-shift)
reverse!(a, l-shift+1, lastindex(a))
reverse!(a)
return a
end
5 changes: 4 additions & 1 deletion base/compiler/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ function retrieve_code_info(linfo::MethodInstance)
end
if c === nothing && isdefined(m, :source)
src = m.source
if isa(src, Array{UInt8,1})
if src === nothing
# can happen in images built with --strip-ir
return nothing
elseif isa(src, Array{UInt8,1})
c = ccall(:jl_uncompress_ir, Any, (Any, Ptr{Cvoid}, Any), m, C_NULL, src)
else
c = copy(src::CodeInfo)
Expand Down
10 changes: 6 additions & 4 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2144,11 +2144,13 @@ end
end
for chi in includes
f, ftime_req = chi.filename, chi.mtime
# Issue #13606: compensate for Docker images rounding mtimes
# Issue #20837: compensate for GlusterFS truncating mtimes to microseconds
# The `ftime != 1.0` condition below provides compatibility with Nix mtime.
ftime = mtime(f)
if ftime != ftime_req && ftime != floor(ftime_req) && ftime != trunc(ftime_req, digits=6) && ftime != 1.0
is_stale = ( ftime != ftime_req ) &&
( ftime != floor(ftime_req) ) && # Issue #13606, PR #13613: compensate for Docker images rounding mtimes
( ftime != trunc(ftime_req, digits=6) ) && # Issue #20837, PR #20840: compensate for GlusterFS truncating mtimes to microseconds
( ftime != 1.0 ) && # PR #43090: provide compatibility with Nix mtime.
!( 0 < (ftime_req - ftime) < 1e-6 ) # PR #45552: Compensate for Windows tar giving mtimes that may be incorrect by up to one microsecond
if is_stale
@debug "Rejecting stale cache file $cachefile (mtime $ftime_req) because file $f (mtime $ftime) has changed"
return true
end
Expand Down
2 changes: 1 addition & 1 deletion base/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ function handle_message(logger::SimpleLogger, level::LogLevel, message, _module,
remaining > 0 || return
end
buf = IOBuffer()
stream = logger.stream
stream::IO = logger.stream
if !(isopen(stream)::Bool)
stream = stderr
end
Expand Down
2 changes: 1 addition & 1 deletion base/namedtuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function NamedTuple{names}(nt::NamedTuple) where {names}
types = Tuple{(fieldtype(nt, idx[n]) for n in 1:length(idx))...}
Expr(:new, :(NamedTuple{names, $types}), Any[ :(getfield(nt, $(idx[n]))) for n in 1:length(idx) ]...)
else
length_names = length(names)::Integer
length_names = length(names::Tuple)
types = Tuple{(fieldtype(typeof(nt), names[n]) for n in 1:length_names)...}
NamedTuple{names, types}(map(Fix1(getfield, nt), names))
end
Expand Down
2 changes: 1 addition & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ julia> x == (fld1(x, y) - 1) * y + mod1(x, y)
true
```
"""
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld(x + y - m, y))
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld((x - m) + y, y))
function fld1(x::T, y::T) where T<:Integer
d = div(x, y)
return d + (!signbit(x y) & (d * y != x))
Expand Down
15 changes: 7 additions & 8 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1392,14 +1392,13 @@ function sum(r::AbstractRange{<:Real})
end

function _in_range(x, r::AbstractRange)
if !isfinite(x)
return false
elseif iszero(step(r))
return !isempty(r) && first(r) == x
else
n = round(Integer, (x - first(r)) / step(r)) + 1
return n >= 1 && n <= length(r) && r[n] == x
end
isempty(r) && return false
f, l = first(r), last(r)
# check for NaN, Inf, and large x that may overflow in the next calculation
f <= x <= l || l <= x <= f || return false
iszero(step(r)) && return true
n = round(Integer, (x - f) / step(r)) + 1
n >= 1 && n <= length(r) && r[n] == x
end
in(x::Real, r::AbstractRange{<:Real}) = _in_range(x, r)
# This method needs to be defined separately since -(::T, ::T) can be implemented
Expand Down
38 changes: 22 additions & 16 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,9 @@ function dump(arg; maxdepth=DUMP_DEFAULT_MAXDEPTH)
dump(IOContext(stdout, :limit => true, :module => mod), arg; maxdepth=maxdepth)
end

nocolor(io::IO) = IOContext(io, :color => false)
alignment_from_show(io::IO, x::Any) =
textwidth(sprint(show, x, context=nocolor(io), sizehint=0))

"""
`alignment(io, X)` returns a tuple (left,right) showing how many characters are
Expand All @@ -2732,35 +2735,38 @@ julia> Base.alignment(stdout, 1 + 10im)
(3, 5)
```
"""
alignment(io::IO, x::Any) = (0, length(sprint(show, x, context=io, sizehint=0)))
alignment(io::IO, x::Number) = (length(sprint(show, x, context=io, sizehint=0)), 0)
alignment(io::IO, x::Integer) = (length(sprint(show, x, context=io, sizehint=0)), 0)
alignment(io::IO, x::Any) = (0, alignment_from_show(io, x))
alignment(io::IO, x::Number) = (alignment_from_show(io, x), 0)
alignment(io::IO, x::Integer) = (alignment_from_show(io, x), 0)
function alignment(io::IO, x::Real)
m = match(r"^(.*?)((?:[\.eEfF].*)?)$", sprint(show, x, context=io, sizehint=0))
m === nothing ? (length(sprint(show, x, context=io, sizehint=0)), 0) :
(length(m.captures[1]), length(m.captures[2]))
s = sprint(show, x, context=nocolor(io), sizehint=0)
m = match(r"^(.*?)((?:[\.eEfF].*)?)$", s)
m === nothing ? (textwidth(s), 0) :
(textwidth(m.captures[1]), textwidth(m.captures[2]))
end
function alignment(io::IO, x::Complex)
m = match(r"^(.*[^ef][\+\-])(.*)$", sprint(show, x, context=io, sizehint=0))
m === nothing ? (length(sprint(show, x, context=io, sizehint=0)), 0) :
(length(m.captures[1]), length(m.captures[2]))
s = sprint(show, x, context=nocolor(io), sizehint=0)
m = match(r"^(.*[^ef][\+\-])(.*)$", s)
m === nothing ? (textwidth(s), 0) :
(textwidth(m.captures[1]), textwidth(m.captures[2]))
end
function alignment(io::IO, x::Rational)
m = match(r"^(.*?/)(/.*)$", sprint(show, x, context=io, sizehint=0))
m === nothing ? (length(sprint(show, x, context=io, sizehint=0)), 0) :
(length(m.captures[1]), length(m.captures[2]))
s = sprint(show, x, context=nocolor(io), sizehint=0)
m = match(r"^(.*?/)(/.*)$", s)
m === nothing ? (textwidth(s), 0) :
(textwidth(m.captures[1]), textwidth(m.captures[2]))
end

function alignment(io::IO, x::Pair)
s = sprint(show, x, context=io, sizehint=0)
fullwidth = alignment_from_show(io, x)
if !isdelimited(io, x) # i.e. use "=>" for display
ctx = IOContext(io, :typeinfo => gettypeinfos(io, x)[1])
left = length(sprint(show, x.first, context=ctx, sizehint=0))
left = alignment_from_show(ctx, x.first)
left += 2 * !isdelimited(ctx, x.first) # for parens around p.first
left += !(get(io, :compact, false)::Bool) # spaces are added around "=>"
(left+1, length(s)-left-1) # +1 for the "=" part of "=>"
(left+1, fullwidth-left-1) # +1 for the "=" part of "=>"
else
(0, length(s)) # as for x::Any
(0, fullwidth) # as for x::Any
end
end

Expand Down
2 changes: 1 addition & 1 deletion base/sort.jl
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ function sortperm(v::AbstractVector;
min, max = extrema(v)
(diff, o1) = sub_with_overflow(max, min)
(rangelen, o2) = add_with_overflow(diff, oneunit(diff))
if !o1 && !o2 && rangelen < div(n,2)
if (!o1 && !o2)::Bool && rangelen < div(n,2)
return sortperm_int_range(v, rangelen, min)
end
end
Expand Down
8 changes: 8 additions & 0 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ endif
# Build list of dependent libraries that must be opened
SHIPFLAGS += -DDEP_LIBS="\"$(LOADER_BUILD_DEP_LIBS)\""
DEBUGFLAGS += -DDEP_LIBS="\"$(LOADER_DEBUG_BUILD_DEP_LIBS)\""
ifneq (,$(findstring MINGW,$(shell uname)))
# In MSYS2, do not perform path conversion for `DEP_LIBS`.
# https://www.msys2.org/wiki/Porting/#filesystem-namespaces
# We define this environment variable for only these two object files,
# as they're the only ones that require it at the time of writing.
$(BUILDDIR)/loader_lib.o: export MSYS2_ARG_CONV_EXCL = -DDEP_LIBS=
$(BUILDDIR)/loader_lib.dbg.obj: export MSYS2_ARG_CONV_EXCL = -DDEP_LIBS=
endif # MSYS2

EXE_OBJS := $(BUILDDIR)/loader_exe.o
EXE_DOBJS := $(BUILDDIR)/loader_exe.dbg.obj
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e62b7c98591daeddeefc775c67a5a174
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10552c210f4152611e65aa7a6f92e382ab3aea51abfd712ca8eb1f42826b1f0c9358bb98a0e54a8b4167f9cb9f9a84a98020be4922084480a3faeae76c072eaf

This file was deleted.

This file was deleted.

66 changes: 61 additions & 5 deletions doc/src/devdocs/build/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,67 @@ MinGW-w64 compilers available through Cygwin's package manager.

### Compiling with MinGW/MSYS2

Compiling Julia from source using [MSYS2](https://msys2.github.io) has worked in the past
but is not actively supported. Pull requests to restore support would be welcome. See a
[past version of this
file](https://github.com/JuliaLang/julia/blob/v0.6.0/README.windows.md) for the former
instructions for compiling using MSYS2.
> MSYS2 provides a robust MSYS experience.

Note: MSYS2 requires **64 bit** Windows 7 or newer.

1. Install and configure [MSYS2](https://www.msys2.org/), Software Distribution
and Building Platform for Windows.

1. Download and run the latest installer for the
[64-bit](https://github.com/msys2/msys2-installer/releases/latest) distribution.
The installer will have a name like `msys2-x86_64-yyyymmdd.exe`.

2. Open MSYS2. Update package database and base packages:
```sh
pacman -Syu
```

3. Exit and restart MSYS2, Update the rest of the base packages:
```sh
pacman -Syu
```

3. Then install tools required to build julia:
```sh
# tools
pacman -S cmake diffutils git m4 make patch tar p7zip curl python

# For 64 bit Julia, install x86_64
pacman -S mingw-w64-x86_64-gcc
# For 32 bit Julia, install i686
pacman -S mingw-w64-i686-gcc
```

4. Configuration of MSYS2 is complete. Now `exit` the MSYS2 shell.


2. Build Julia and its dependencies with pre-build dependencies.

1. Open a new [**MINGW64/MINGW32 shell**](https://www.msys2.org/docs/environments/#overview).
Currently we can't use both mingw32 and mingw64,
so if you want to build the x86_64 and i686 versions,
you'll need to build them in each environment separately.

2. and clone the Julia sources
```sh
git clone https://github.com/JuliaLang/julia.git
cd julia
```

3. Start the build
```sh
make -j$(nproc)
```

> Protip: build in dir
> ```sh
> make O=julia-mingw-w64 configure
> echo 'ifeq ($(BUILDROOT),$(JULIAHOME))
> $(error "in-tree build disabled")
> endif' >> Make.user
> make -C julia-mingw-w64
> ```


### Cross-compiling from Unix (Linux/Mac/WSL)
Expand Down
8 changes: 4 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ OSLIBS += $(SRCDIR)/mach_dyld_atfork.tbd
endif

COMMON_LIBPATHS := -L$(build_libdir) -L$(build_shlibdir)
RT_LIBS := $(LIBUV) $(LIBUTF8PROC) $(NO_WHOLE_ARCHIVE) $(LIBUNWIND) $(RT_LLVMLINK) $(OSLIBS)
CG_LIBS := $(NO_WHOLE_ARCHIVE) $(LIBUV) $(LIBUNWIND) $(CG_LLVMLINK) $(OSLIBS)
RT_LIBS := $(WHOLE_ARCHIVE) $(LIBUV) $(WHOLE_ARCHIVE) $(LIBUTF8PROC) $(NO_WHOLE_ARCHIVE) $(LIBUNWIND) $(RT_LLVMLINK) $(OSLIBS)
CG_LIBS := $(LIBUNWIND) $(CG_LLVMLINK) $(OSLIBS)
RT_DEBUG_LIBS := $(COMMON_LIBPATHS) $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp-debug.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport-debug.a -ljulia-debug $(RT_LIBS)
CG_DEBUG_LIBS := $(COMMON_LIBPATHS) $(WHOLE_ARCHIVE) $(WHOLE_ARCHIVE) $(CG_LIBS) -ljulia-debug -ljulia-internal-debug
CG_DEBUG_LIBS := $(COMMON_LIBPATHS) $(CG_LIBS) -ljulia-debug -ljulia-internal-debug
RT_RELEASE_LIBS := $(COMMON_LIBPATHS) $(WHOLE_ARCHIVE) $(BUILDDIR)/flisp/libflisp.a $(WHOLE_ARCHIVE) $(BUILDDIR)/support/libsupport.a -ljulia $(RT_LIBS)
CG_RELEASE_LIBS := $(COMMON_LIBPATHS) $(WHOLE_ARCHIVE) $(WHOLE_ARCHIVE) $(CG_LIBS) -ljulia -ljulia-internal
CG_RELEASE_LIBS := $(COMMON_LIBPATHS) $(CG_LIBS) -ljulia -ljulia-internal

OBJS := $(SRCS:%=$(BUILDDIR)/%.o)
DOBJS := $(SRCS:%=$(BUILDDIR)/%.dbg.obj)
Expand Down
Loading

0 comments on commit 8df0552

Please sign in to comment.