Skip to content

Commit

Permalink
Add libjulia 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Oct 13, 2020
1 parent 8c439ce commit 5267bc1
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 29 deletions.
71 changes: 42 additions & 29 deletions L/libjulia/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg.Types

# Collection of sources required to build GMP
# Collection of sources required to build Julia
function configure(version)
name = "libjulia"

Expand All @@ -21,6 +21,7 @@ function configure(version)
apk add coreutils libuv-dev utf8proc
cd $WORKSPACE/srcdir/julia*
version=$(cat VERSION)
# Apply patches
if [ -d $WORKSPACE/srcdir/patches ]; then
Expand Down Expand Up @@ -58,27 +59,23 @@ function configure(version)
override OS=Linux
EOM
LLVM_CXXFLAGS="-I${prefix}/include -std=c++14 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
LLVM_LDFLAGS="-L${prefix}/lib"
LDFLAGS="-L${prefix}/lib"
CFLAGS="-I${prefix}/include"
CXXFLAGS="-I${prefix}/include"
if [[ "${target}" == *mingw* ]]; then
LLVMLINK="-L${prefix}/bin -lLLVM"
LLVM_CXXFLAGS="-I${prefix}/include -std=c++14 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
LLVM_LDFLAGS="-L${prefix}/bin"
LDFLAGS="-L${prefix}/bin"
CFLAGS="-I${prefix}/include"
CXXFLAGS="-I${prefix}/include"
elif [[ "${target}" == *apple* ]]; then
LLVMLINK="-L${prefix}/lib -lLLVM"
LLVM_CXXFLAGS="-I${prefix}/include -std=c++14 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
LLVM_LDFLAGS="-L${prefix}/lib"
LDFLAGS="-L${prefix}/lib"
CFLAGS="-I${prefix}/include"
CXXFLAGS="-I${prefix}/include"
else
LLVMLINK="-L${prefix}/lib -lLLVM-9jl"
LLVM_CXXFLAGS="-I${prefix}/include -std=c++14 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
LLVM_LDFLAGS="-L${prefix}/lib"
LDFLAGS="-L${prefix}/lib"
CFLAGS="-I${prefix}/include"
CXXFLAGS="-I${prefix}/include"
if [[ "${version}" == 1.4.* ]]; then
LLVMLINK="-L${prefix}/lib -lLLVM-8jl"
else
LLVMLINK="-L${prefix}/lib -lLLVM-9jl"
fi
fi
cat << EOM >Make.user
Expand All @@ -88,11 +85,7 @@ function configure(version)
USE_SYSTEM_PCRE=1
USE_SYSTEM_OPENLIBM=1
USE_SYSTEM_DSFMT=1
USE_SYSTEM_BLAS=1
LIBBLASNAME=libopenblas
USE_SYSTEM_LAPACK=1
LIBLAPACKNAME=libopenblas
# USE_SYSTEM_GMP=1
USE_SYSTEM_GMP=1
USE_SYSTEM_MPFR=1
USE_SYSTEM_SUITESPARSE=1
USE_SYSTEM_LIBUV=1
Expand Down Expand Up @@ -131,6 +124,15 @@ function configure(version)
LOCALBASE=${prefix}
EOM
if [[ "${target}" != *apple* ]]; then
cat << EOM >>Make.user
USE_SYSTEM_BLAS=1
LIBBLASNAME=libopenblas
USE_SYSTEM_LAPACK=1
LIBLAPACKNAME=libopenblas
EOM
fi
# Add file to one of the `STD_LIB_PATH`
if [[ "${target}" == *mingw* ]]; then
cp /opt/*-w64-mingw32/*-w64-mingw32/sys-root/bin/libwinpthread-1.dll /opt/*-w64-mingw32/*-mingw32/sys-root/lib/
Expand Down Expand Up @@ -167,20 +169,31 @@ function configure(version)

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
#
platforms = supported_platforms()
# For now skip FreeBSD...
filter!(!Sys.isfreebsd, platforms)
if version < v"1.5"
# in Julia <= 1.4 skip all musl builds
filter!(p -> !(Sys.islinux(p) && libc(p) == "musl"), platforms)
# in Julia <= 1.4 skip 32bit ARM builds
filter!(p -> !(Sys.islinux(p) && arch(p) == "armv7l"), platforms)
else
# in Julia >= 1.5 skip 32bit musl builds
filter!(p -> !(Sys.islinux(p) && libc(p) == "musl" && arch(p) == "i686"), platforms)
end

# While the "official" Julia kernel ABI itself does not involve any C++
# symbols on the linker level, `libjulia` still exports "unofficial" symbols
# dependent on the C++ strings ABI (coming from LLVM related code). This
# doesn't matter if the client code is pure C, but as soon as there are
# other (actual) C++ dependencies, we must make sure to use the matching C++
# strings ABI. Hence we must use `expand_cxxstring_abis` below.
platforms = supported_platforms()
filter!(!=(Linux(:i686, libc=:musl)), platforms)

# For now skip FreeBSD...
filter!(!Sys.isfreebsd, platforms)
platforms = expand_cxxstring_abis(platforms)

for p in platforms
p["julia_version"] = "$(version.major).$(version.minor)"
end

# The products that we will ensure are always built
products = [
LibraryProduct("libjulia", :libjulia; dont_dlopen=true),
Expand All @@ -206,19 +219,19 @@ function configure(version)
push!(dependencies, Dependency(PackageSpec(name="OpenBLAS_jll", version=v"0.3.5")))
push!(dependencies, Dependency(PackageSpec(name="libLLVM_jll", version=v"8.0.1")))
push!(dependencies, Dependency(PackageSpec(name="MPFR_jll", version=v"4.0.2")))
# push!(dependencies, Dependency(PackageSpec(name="GMP_jll", version=v"6.1.2")))
push!(dependencies, Dependency(PackageSpec(name="GMP_jll", version=v"6.1.2")))
push!(dependencies, Dependency(PackageSpec(name="LibGit2_jll", version=v"0.28.2")))
elseif version.major == 1 && version.minor == 5
push!(dependencies, Dependency(PackageSpec(name="OpenBLAS_jll", version=v"0.3.9")))
push!(dependencies, Dependency(PackageSpec(name="libLLVM_jll", version=v"9.0.1")))
push!(dependencies, Dependency(PackageSpec(name="MPFR_jll", version=v"4.1.0")))
# push!(dependencies, Dependency(PackageSpec(name="GMP_jll", version=v"6.1.2")))
push!(dependencies, Dependency(PackageSpec(name="GMP_jll", version=v"6.1.2")))
push!(dependencies, Dependency(PackageSpec(name="LibGit2_jll", version=v"0.28.2")))
elseif version.major == 1 && version.minor == 6
push!(dependencies, Dependency(PackageSpec(name="OpenBLAS_jll", version=v"0.3.10")))
push!(dependencies, Dependency(PackageSpec(name="libLLVM_jll", version=v"9.0.1")))
push!(dependencies, Dependency(PackageSpec(name="MPFR_jll", version=v"4.1.0")))
# push!(dependencies, Dependency(PackageSpec(name="GMP_jll", version=v"6.2.0")))
push!(dependencies, Dependency(PackageSpec(name="GMP_jll", version=v"6.2.0")))
push!(dependencies, Dependency(PackageSpec(name="LibGit2_jll", version=v"1.0.1")))
end

Expand Down
7 changes: 7 additions & 0 deletions L/libjulia/libjulia@1.4/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include("../common.jl")

name, version, sources, script, platforms, products, dependencies = configure(v"1.4.2")

# Build the tarballs.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version=v"7", lock_microarchitecture=false)

40 changes: 40 additions & 0 deletions L/libjulia/libjulia@1.4/bundled/patches/0001-flisp-system.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 30c32040d81ba909242b6e5786772efa94e8120f Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Wed, 23 Sep 2020 16:48:49 -0400
Subject: [PATCH] Allow flips to be built against system UTF8PROC

---
src/flisp/Makefile | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/flisp/Makefile b/src/flisp/Makefile
index 2158e2a5b2..42c4e11ed4 100644
--- a/src/flisp/Makefile
+++ b/src/flisp/Makefile
@@ -32,13 +32,21 @@ OBJS := $(SRCS:%.c=$(BUILDDIR)/%.o)
DOBJS := $(SRCS:%.c=$(BUILDDIR)/%.dbg.obj)
LLT_release := $(LLT_BUILDDIR)/libsupport.a
LLT_debug := $(LLT_BUILDDIR)/libsupport-debug.a
-LIBFILES_release := $(LLT_release) $(LIBUV) $(LIBUTF8PROC)
-LIBFILES_debug := $(LLT_debug) $(LIBUV) $(LIBUTF8PROC)
+LIBFILES_release := $(LLT_release) $(LIBUV)
+LIBFILES_debug := $(LLT_debug) $(LIBUV)
LIBS :=
ifneq ($(OS),WINNT)
LIBS += -lpthread
endif

+ifeq ($(USE_SYSTEM_UTF8PROC),0)
+LIBFILES_release += $(LIBUTF8PROC)
+LIBFILES_debug += $(LIBUTF8PROC)
+else
+LIBS += $(LIBUTF8PROC)
+endif
+
+
FLAGS := -I$(LLTSRCDIR) $(JCFLAGS) $(HFILEDIRS:%=-I%) \
-I$(LIBUV_INC) -I$(UTF8PROC_INC) -I$(build_includedir) $(LIBDIRS:%=-L%) \
-DLIBRARY_EXPORTS -DUTF8PROC_EXPORTS
--
2.28.0

25 changes: 25 additions & 0 deletions L/libjulia/libjulia@1.4/bundled/patches/0002-libuv-system.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 85eb6fe1d4dc2d98974c5d3e78b735e887b7b439 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Wed, 23 Sep 2020 16:59:34 -0400
Subject: [PATCH] Use universal LIBUV_INC instead of build_includedir

---
base/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base/Makefile b/base/Makefile
index efcf835de7..13bb3ee53d 100644
--- a/base/Makefile
+++ b/base/Makefile
@@ -42,7 +42,7 @@ $(BUILDDIR)/errno_h.jl:
$(BUILDDIR)/file_constants.jl: $(SRCDIR)/../src/file_constants.h
@$(call PRINT_PERL, $(CPP_STDOUT) -DJULIA $< | perl -nle 'print "$$1 0o$$2" if /^(\s*const\s+[A-z_]+\s+=)\s+(0[0-9]*)\s*$$/; print "$$1" if /^\s*(const\s+[A-z_]+\s+=\s+([1-9]|0x)[0-9A-z]*)\s*$$/' > $@)

-$(BUILDDIR)/uv_constants.jl: $(SRCDIR)/../src/uv_constants.h $(build_includedir)/uv/errno.h
+$(BUILDDIR)/uv_constants.jl: $(SRCDIR)/../src/uv_constants.h $(LIBUV_INC)/uv/errno.h
@$(call PRINT_PERL, $(CPP_STDOUT) "-I$(LIBUV_INC)" -DJULIA $< | tail -n 16 > $@)

$(BUILDDIR)/build_h.jl.phony:
--
2.28.0

31 changes: 31 additions & 0 deletions L/libjulia/libjulia@1.4/bundled/patches/0003-flisp.boot.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 242ff9a084fe790ac589c55045efc1d5c5f95f4b Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Wed, 23 Sep 2020 18:28:01 -0400
Subject: [PATCH] stage flisp.boot into host

---
src/flisp/Makefile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/flisp/Makefile b/src/flisp/Makefile
index 42c4e11ed4..50566a0258 100644
--- a/src/flisp/Makefile
+++ b/src/flisp/Makefile
@@ -115,9 +115,13 @@ $(BUILDDIR)/host/Makefile:
@echo 'BUILDING_HOST_TOOLS=1' >> $@
@echo 'include $(SRCDIR)/Makefile' >> $@

-$(BUILDDIR)/host/$(EXENAME): $(BUILDDIR)/host/Makefile
+$(BUILDDIR)/host/$(EXENAME): $(BUILDDIR)/host/Makefile | ${BUILDDIR}/host/flisp.boot
make -C $(BUILDDIR)/host $(EXENAME)

+
+$(BUILDDIR)/host/flisp.boot: $(SRCDIR)/flisp.boot | $(BUILDDIR)/host/Makefile
+ cp $< $@
+
ifneq ($(BUILDDIR),.)
ifneq ($(BUILDDIR),$(SRCDIR))
$(BUILDDIR)/flisp.boot: $(SRCDIR)/flisp.boot | $(BUILDDIR)
--
2.28.0

42 changes: 42 additions & 0 deletions L/libjulia/libjulia@1.4/bundled/patches/0004-musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From f0dd7818f04ea3d68d534f460b69a6c3b4afbfd2 Mon Sep 17 00:00:00 2001
From: Julian Samaroo <jpsamaroo@jpsamaroo.me>
Date: Mon, 18 May 2020 20:58:07 -0500
Subject: [PATCH] Make processor_arm.cpp compile on musl (#34777)

---
src/processor_arm.cpp | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/processor_arm.cpp b/src/processor_arm.cpp
index 7b5fe0003bb5..96ca1789f593 100644
--- a/src/processor_arm.cpp
+++ b/src/processor_arm.cpp
@@ -10,10 +10,16 @@
#include <fstream>
#include <algorithm>

-#if defined(_CPU_AARCH64_) || __GLIBC_PREREQ(2, 16)
+// This nesting is required to allow compilation on musl
+#define USE_DYN_GETAUXVAL
+#if defined(_CPU_AARCH64_)
+# undef USE_DYN_GETAUXVAL
# include <sys/auxv.h>
-#else
-# define DYN_GETAUXVAL
+#elif defined(__GLIBC_PREREQ)
+# if __GLIBC_PREREQ(2, 16)
+# undef USE_DYN_GETAUXVAL
+# include <sys/auxv.h>
+# endif
#endif

namespace ARM {
@@ -498,7 +504,7 @@ static constexpr size_t ncpu_names = sizeof(cpus) / sizeof(cpus[0]);
# define AT_HWCAP2 26
#endif

-#if defined(DYN_GETAUXVAL)
+#if defined(USE_DYN_GETAUXVAL)
static unsigned long getauxval_procfs(unsigned long type)
{
int fd = open("/proc/self/auxv", O_RDONLY);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 956cf8fa2f07f43ffb0a91bd23741e83838f9e7a Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy@gmail.com>
Date: Thu, 24 Sep 2020 09:41:49 -0400
Subject: [PATCH] use BUILD_EXE for flisp

---
src/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 578677b3e1..2852b0ac86 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -139,8 +139,8 @@ FLISPDIR := $(BUILDDIR)/flisp/host
else
FLISPDIR := $(BUILDDIR)/flisp
endif
-FLISP_EXECUTABLE_debug := $(FLISPDIR)/flisp-debug$(EXE)
-FLISP_EXECUTABLE_release := $(FLISPDIR)/flisp$(EXE)
+FLISP_EXECUTABLE_debug := $(FLISPDIR)/flisp-debug$(BUILD_EXE)
+FLISP_EXECUTABLE_release := $(FLISPDIR)/flisp$(BUILD_EXE)
ifeq ($(OS),WINNT)
FLISP_EXECUTABLE := $(FLISP_EXECUTABLE_release)
else
--
2.28.0

0 comments on commit 5267bc1

Please sign in to comment.