1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
#!/usr/bin/make -f
include /usr/share/dpkg/default.mk
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# Disable unaligned access on armhf
ifneq (,$(filter $(DEB_HOST_ARCH),armhf))
export DEB_CFLAGS_MAINT_APPEND += -mno-unaligned-access
endif
# Ensure pcre_h.jl and errno_h.jl are sorted reproducibly
export LC_ALL=C.UTF-8
# HOME is needed to avoid "mkdir(): Permission denied" while building docs.
# Some tests also need a HOME directory.
export HOME=/tmp
# If you want to do a custom build of Julia against MKL, set it to 1.
export CUSTOM_MKL ?= 0
# If you want to do a custom build for native machine architecture
export CUSTOM_NATIVE ?= 0
# NOTES:
# 1. Some of these flags come from upstream's Make.inc .
# 2. To enable USE_BLAS64=0 (ILP64), we need to set INTERFACE64=1 for OpenBLAS.
# 3. Julia is tightly coupled with a specific libuv1 version. we cannot use the one provided in archive.
# 4. ∴ is unicode "therefore", ⛬ is unicode "historic site" https://unicode-table.com/en/26EC/
COMMON_FLAGS = \
prefix=/usr \
sysconfdir=/etc \
MULTIARCH=$(DEB_HOST_MULTIARCH) \
MULTIARCH_INSTALL=1 \
NO_GIT=1 \
TAGGED_RELEASE_BANNER='$(DEB_VENDOR) ⛬ julia/$(DEB_VERSION)' \
USE_BLAS64=0 \
USE_LLVM_SHLIB=1 \
USE_SYSTEM_BLAS=1 \
USE_SYSTEM_CURL=1 \
USE_SYSTEM_DSFMT=1 \
USE_SYSTEM_GMP=1 \
USE_SYSTEM_LAPACK=1 \
USE_SYSTEM_LIBGIT2=1 \
USE_SYSTEM_LIBSSH2=1 \
USE_SYSTEM_LIBUNWIND=1 \
USE_SYSTEM_LIBUV=0 \
USE_SYSTEM_LLVM=0 \
USE_SYSTEM_MBEDTLS=1 \
USE_SYSTEM_MPFR=1 \
USE_SYSTEM_OPENSPECFUN=1 \
USE_SYSTEM_PATCHELF=1 \
USE_SYSTEM_PCRE=1 \
USE_SYSTEM_SUITESPARSE=1 \
USE_SYSTEM_UTF8PROC=1 \
VERBOSE=1
# Set architecture specific CPU targets. See: #910784
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 kfreebsd-amd64 x32))
COMMON_FLAGS += MARCH=x86-64 \
JULIA_CPU_TARGET="generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)"
else ifneq (,$(filter $(DEB_HOST_ARCH),i386 hurd-i386 kfreebsd-i386))
COMMON_FLAGS += MARCH=pentium4 \
JULIA_CPU_TARGET="pentium4;sandybridge,-xsaveopt,clone_all"
else ifneq (,$(filter $(DEB_HOST_ARCH),armhf))
COMMON_FLAGS += JULIA_CPU_TARGET="armv7-a;armv7-a,neon;armv7-a,neon,vfp4"
else ifneq (,$(filter $(DEB_HOST_ARCH),ppc64el))
COMMON_FLAGS += JULIA_CPU_TARGET="pwr8"
else
COMMON_FLAGS += JULIA_CPU_TARGET="generic"
endif
# Use libopenlibm on architectures that have it
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 kfreebsd-amd64 x32))
COMMON_FLAGS += USE_SYSTEM_OPENLIBM=1 USE_SYSTEM_LIBM=0
else ifneq (,$(filter $(DEB_HOST_ARCH),i386 hurd-i386 kfreebsd-i386))
COMMON_FLAGS += USE_SYSTEM_OPENLIBM=1 USE_SYSTEM_LIBM=0
else ifneq (,$(filter $(DEB_HOST_ARCH),arm64 armhf mips mips64el mipsel powerpc ppc64 ppc64el))
COMMON_FLAGS += USE_SYSTEM_OPENLIBM=1 USE_SYSTEM_LIBM=0
else
# Use libm elsewhere
COMMON_FLAGS += USE_SYSTEM_OPENLIBM=0 USE_SYSTEM_LIBM=1
endif
# Use libopenblas on architectures that have it
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64 armhf i386 kfreebsd-amd64 kfreebsd-i386 mips64el ppc64el s390x))
COMMON_FLAGS += LIBBLAS=-lopenblas LIBBLASNAME=libopenblas \
LIBLAPACK=-lopenblas LIBLAPACKNAME=libopenblas
else
# Use libblas and liblapack elsewhere
COMMON_FLAGS += LIBBLAS=-lblas LIBBLASNAME=libblas \
LIBLAPACK=-llapack LIBLAPACKNAME=liblapack
endif
# [s390x] Disable libunwind
ifneq (,$(filter $(DEB_HOST_ARCH),s390x))
COMMON_FLAGS += DISABLE_LIBUNWIND=1
endif
# Set number of parallel workers for tests
ifneq (,$(filter parallel=1,$(DEB_BUILD_OPTIONS)))
TESTS_ENV += JULIA_CPU_THREADS=2
else ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
TESTS_ENV += JULIA_CPU_THREADS=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
TESTS_ENV += JULIA_CPU_THREADS=2
endif
# Restart workers exceeding maximum resident memory size (requires JULIA_CPU_THREADS >= 2)
TESTS_ENV += JULIA_TEST_MAXRSS_MB=500
ifeq (1,$(CUSTOM_MKL))
COMMON_FLAGS += USE_INTEL_MKL=1 USE_BLAS64=1 \
LIBBLAS=-lmkl_rt LIBBLASNAME=libmkl_rt \
LIBLAPACK=-lmkl_rt LIBLAPACKNAME=libmkl_rt \
MKLROOT=/usr MKLLIB=/usr/lib/$(DEB_HOST_MULTIARCH)
endif
ifeq (1,$(CUSTOM_NATIVE))
COMMON_FLAGS += MARCH=native JULIA_CPU_TARGET=native
endif
%:
dh $@
override_dh_auto_build-arch:
dh_auto_build -- $(COMMON_FLAGS)
override_dh_auto_build-indep:
dh_auto_build -- $(COMMON_FLAGS)
-$(MAKE) -C doc pdf
override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
ifeq (,$(filter $(DEB_HOST_ARCH),amd64 i386))
-env $(TESTS_ENV) make -C test $(COMMON_FLAGS)
else
env $(TESTS_ENV) make -C test $(COMMON_FLAGS)
endif
endif
override_dh_auto_test-indep:
override_dh_auto_clean:
make $(COMMON_FLAGS) distcleanall
make -f debian/shlibdeps.mk $(COMMON_FLAGS) clean
override_dh_auto_install:
make $(COMMON_FLAGS) install
# FIXME: any better solution than this hack?
find deps -type f -name 'libLLVM*so*' -exec cp -v '{}' debian/tmp/usr/lib/$(shell gcc -print-multiarch)/julia/ \;
-ln -s libLLVM-6.0.so debian/tmp/usr/lib/$(shell gcc -print-multiarch)/julia/libLLVM-6.0.0.so
-ln -s libLLVM-6.0.so debian/tmp/usr/lib/$(shell gcc -print-multiarch)/julia/libLLVM.so
rm -rf usr # Otherwise dh_install does not see debian/tmp/usr
find debian -type f -name '*.so.debug' -delete
find debian -type f -name .gitignore -delete
find debian -type f -name 'LICENSE.md' -delete
override_dh_missing:
dh_missing --list-missing
override_dh_link-arch:
# Create *.so symlinks for dlopen'd libraries in private libdir.
make -f debian/shlibdeps.mk $(COMMON_FLAGS)
dh_link
override_dh_shlibdeps:
# Generate dependencies for dlopen'd libraries using dummy executable.
# Suppress useless dependency warnings caused by unused library symbols.
dh_shlibdeps -- --warnings=1 debian/shlibdeps
override_dh_compress:
dh_compress --exclude=examples/
override_dh_install-indep:
dh_install --exclude=build_h.jl --exclude=build.h
override_dh_fixperms:
dh_fixperms
# Fix shebang and mode bits
find debian \( -type f -name '*.jl' \
-exec grep -q '..usr/bin/env julia' '{}' \; \
-a -exec sed -i -e 's@#!/usr/bin/env julia@#!/usr/bin/julia@g' '{}' \; \
-a -exec chmod +x '{}' \; -print \)
# Don't strip sys.so and libjulia.so.* to keep the sanity of this program.
# https://github.com/JuliaLang/julia/issues/23115#issuecomment-320715030
#
# Julia sysimage (i.e. sys.so) sys.so is NOT compiled from any compiled
# language such as C/C++, but from Julia scripts instead. Julia precompiles .jl
# scripts under the base and stdlib directories into this ELF-formated shared
# object sys.so to speedup program startup time. A glance at the symbol table
# (readelf -sW sys.so) would illustrate that. For more detail about how such
# debugging information is useful, please refer the official documentation:
# https://docs.julialang.org/en/v1.0.0/manual/stacktraces/
#
override_dh_strip:
dh_strip -X"sys.so"
override_dh_makeshlibs:
dh_makeshlibs --no-scripts -XLLVM
|