-
Notifications
You must be signed in to change notification settings - Fork 564
/
Copy pathbuild_tarballs.jl
69 lines (58 loc) · 2.3 KB
/
build_tarballs.jl
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
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder
name = "ASL"
version = v"0.1.3"
# Collection of sources required to build ThinASLBuilder
sources = [
ArchiveSource("http://netlib.org/ampl/solvers.tgz",
"2d599272e22fc66673cb03d2065f53f587140493fb50501adde5acf6be2adc93"),
DirectorySource("./bundled")
]
# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/solvers/
head -17 asl.h > LICENSE.txt
mkdir -p ${includedir}
mkdir -p ${libdir}
all_load="--whole-archive"
noall_load="--no-whole-archive"
makefile="makefile.u"
cflags=""
if [[ -f $WORKSPACE/srcdir/asl-extra/arith.h.$target ]]; then
cp $WORKSPACE/srcdir/asl-extra/arith.h.$target ./arith.h
fi
if [[ "${target}" == "arm-linux-musleabihf" ]]; then
cp $WORKSPACE/srcdir/asl-extra/arith.h.arm-linux-gnueabihf ./arith.h
elif [[ $target == "i686-linux-musl" ]]; then
cp $WORKSPACE/srcdir/asl-extra/arith.h.i686-linux-gnu ./arith.h
elif [[ "${target}" == "aarch64-linux-musl" ]]; then
cp $WORKSPACE/srcdir/asl-extra/arith.h.aarch64-linux-gnu ./arith.h
elif [[ "${target}" == *-freebsd* ]]; then
cp $WORKSPACE/srcdir/asl-extra/arith.h.x86_64-linux-gnu ./arith.h
cflags="-D__XSI_VISIBLE=1"
elif [[ "${target}" == *-mingw* ]]; then
makefile="$WORKSPACE/srcdir/asl-extra/makefile.mingw"
elif [[ "${target}" == *-apple-* ]]; then
all_load="-all_load"
noall_load="-noall_load"
fi
make -f $makefile CC="$CC" CFLAGS="-O -fPIC $cflags"
c++ -fPIC -shared -I$WORKSPACE/srcdir/asl-extra -I. $WORKSPACE/srcdir/asl-extra/aslinterface.cc -Wl,${all_load} amplsolver.a -Wl,${noall_load} -o libasl.${dlext}
cp libasl.${dlext} ${libdir}
cp *.h ${includedir}
cp *.hd ${includedir}
install_license LICENSE.txt
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms(;experimental=true)
# The products that we will ensure are always built
products = [
LibraryProduct("libasl", :libasl)
]
# Dependencies that must be installed before this package can be built
dependencies = Dependency[
]
# Build the tarballs
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies, julia_compat = "1.6")