-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_tarballs.jl
140 lines (120 loc) · 4.04 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
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
# 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 = "Libtask"
version = v"1.0.0"
# Collection of sources required to build Libtask
sources = [
"https://github.com/TuringLang/Libtask.git" =>
"fbe2feb0dab2f9d3d59f7710ff95c0cb2e61a835",
]
# Bash recipe for building across all platforms
script = raw"""
if [ $target = "arm-linux-gnueabihf" ]; then
cd $WORKSPACE/srcdir
wget "https://julialang-s3.julialang.org/bin/linux/armv7l/1.0/julia-1.0.0-linux-armv7l.tar.gz"
tar xzvf julia-1.0.0-linux-armv7l.tar.gz
rm *.tar.gz
mv julia* julia
LIBS="`pwd`/julia/lib"
LIBSJL="`pwd`/julia/lib/julia"
INCLUDES="`pwd`/julia/include/julia"
cd Libtask
gcc -O2 -shared -std=gnu99 -I$INCLUDES -DJULIA_ENABLE_THREADING=1 -fPIC -L$LIBSJL -L$LIBS -Wl,--export-dynamic -ljulia task.c -o libtask.so
mkdir $prefix/lib
mv libtask.so $prefix/lib
exit
fi
if [ $target = "i686-linux-gnu" ]; then
cd $WORKSPACE/srcdir
wget "https://julialang-s3.julialang.org/bin/linux/x86/1.0/julia-1.0.0-linux-i686.tar.gz"
tar xzvf julia-1.0.0-linux-i686.tar.gz
rm *.tar.gz
mv julia* julia
LIBS="`pwd`/julia/lib"
LIBSJL="`pwd`/julia/lib/julia"
INCLUDES="`pwd`/julia/include/julia"
cd Libtask
gcc -march=pentium4 -O2 -shared -std=gnu99 -I$INCLUDES -DJULIA_ENABLE_THREADING=1 -fPIC -L$LIBSJL -L$LIBS -Wl,--export-dynamic -ljulia task.c -o libtask.so
mkdir $prefix/lib
mv libtask.so $prefix/lib
exit
fi
if [ $target = "x86_64-linux-gnu" ]; then
cd $WORKSPACE/srcdir
wget "https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.0-linux-x86_64.tar.gz"
tar xzvf julia-1.0.0-linux-x86_64.tar.gz
rm *.tar.gz
mv julia* julia
LIBS="`pwd`/julia/lib"
LIBSJL="`pwd`/julia/lib/julia"
INCLUDES="`pwd`/julia/include/julia"
cd Libtask
gcc -O2 -shared -std=gnu99 -I$INCLUDES -DJULIA_ENABLE_THREADING=1 -fPIC -L$LIBSJL -L$LIBS -Wl,--export-dynamic -ljulia task.c -o libtask.so
mkdir $prefix/lib
mv libtask.so $prefix/lib
exit
fi
if [ $target = "x86_64-w64-mingw32" ]; then
cd $WORKSPACE/srcdir
wget "http://mlg.eng.cam.ac.uk/hong/julia-1.0.0-win64.tar.gz"
tar xzvf julia-1.0.0-win64.tar.gz
rm *.tar.gz
mv julia* julia
LIBS="`pwd`/julia/bin"
INCLUDES="`pwd`/julia/include/julia"
cd Libtask
gcc -O2 -shared -std=gnu99 -I$INCLUDES -DJULIA_ENABLE_THREADING=1 -fPIC -L$LIBS -Wl,--export-all-symbols -ljulia -lopenlibm task.c -o libtask.dll
mkdir $prefix/bin
mv libtask.dll $prefix/bin
exit
fi
if [ $target = "i686-w64-mingw32" ]; then
cd $WORKSPACE/srcdir
wget "http://mlg.eng.cam.ac.uk/hong/julia-1.0.0-win32.tar.gz"
tar xzvf julia-1.0.0-win32.tar.gz
rm *.tar.gz
mv julia* julia
LIBS="`pwd`/julia/bin"
INCLUDES="`pwd`/julia/include/julia"
cd Libtask
gcc -march=pentium4 -O2 -shared -std=gnu99 -I$INCLUDES -DJULIA_ENABLE_THREADING=1 -fPIC -L$LIBS -Wl,--export-all-symbols -ljulia -lopenlibm task.c -o libtask.dll
mkdir $prefix/bin
mv libtask.dll $prefix/bin
exit
fi
if [ $target = "x86_64-apple-darwin14" ]; then
cd $WORKSPACE/srcdir
wget "http://mlg.eng.cam.ac.uk/hong/julia-1.0.0-mac64.tar.gz"
tar xzvf julia-1.0.0-mac64.tar.gz
rm *.tar.gz
mv julia* julia
LIBS="`pwd`/julia/Contents/Resources/julia/lib"
LIBSJL="`pwd`/julia/Contents/Resources/julia/lib/julia"
INCLUDES="`pwd`/julia/Contents/Resources/julia/include/julia"
cd Libtask
gcc -O2 -shared -std=gnu99 -I$INCLUDES -DJULIA_ENABLE_THREADING=1 -fPIC -L$LIBSJL -L$LIBS -ljulia task.c -o libtask.dylib
mkdir $prefix/lib
mv libtask.dylib $prefix/lib
exit
fi
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Linux(:i686, :glibc),
Linux(:x86_64, :glibc),
Linux(:armv7l, :glibc, :eabihf),
MacOS(:x86_64),
Windows(:i686),
Windows(:x86_64)
]
# The products that we will ensure are always built
products(prefix) = [
LibraryProduct(prefix, "libtask", :libtask)
]
# Dependencies that must be installed before this package can be built
dependencies = [
]
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)