This repository has been archived by the owner on Jan 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_tarballs.jl
118 lines (99 loc) · 3.32 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
# 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 = "LBFGSB"
version = v"3.0"
# Collection of sources required to build LBFGSB
sources = [
"http://users.iems.northwestern.edu/~nocedal/Software/Lbfgsb.3.0.tar.gz" =>
"f5b9a1c8c30ff6bcc8df9b5d5738145f4cbe4c7eadec629220e808dcf0e54720",
]
# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir
cd Lbfgsb.3.0/
cat > Makefile.patch << 'END'
--- Makefile
+++ Makefile
@@ -1,37 +1,30 @@
+VERSION = 3
+
FC = gfortran
+FFLAGS = -O3 -fPIC -shared -Wall -fbounds-check -g -Wno-uninitialized
-FFLAGS = -O -Wall -fbounds-check -g -Wno-uninitialized
+LIB_SEARCH_PATH = lib
-DRIVER1_77 = driver1.f
-DRIVER2_77 = driver2.f
-DRIVER3_77 = driver3.f
-
-DRIVER1_90 = driver1.f90
-DRIVER2_90 = driver2.f90
-DRIVER3_90 = driver3.f90
+OS := $(shell uname)
+ifeq ($(OS), Linux)
+ SHLIB_EXT := so
+else ifeq ($(OS), Darwin)
+ SHLIB_EXT := dylib
+else
+ SHLIB_EXT := dll
+ LIB_SEARCH_PATH = bin
+endif
LBFGSB = lbfgsb.f
LINPACK = linpack.f
BLAS = blas.f
TIMER = timer.f
-all : lbfgsb_77_1 lbfgsb_77_2 lbfgsb_77_3 lbfgsb_90_1 lbfgsb_90_2 lbfgsb_90_3
-
-
-lbfgsb_77_1 : $(DRIVER1_77) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER)
- $(FC) $(FFLAGS) $(DRIVER1_77) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER) -o x.lbfgsb_77_1
-
-lbfgsb_77_2 : $(DRIVER2_77) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER)
- $(FC) $(FFLAGS) $(DRIVER2_77) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER) -o x.lbfgsb_77_2
-
-lbfgsb_77_3 : $(DRIVER3_77) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER)
- $(FC) $(FFLAGS) $(DRIVER3_77) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER) -o x.lbfgsb_77_3
-
-lbfgsb_90_1 : $(DRIVER1_90) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER)
- $(FC) $(FFLAGS) $(DRIVER1_90) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER) -o x.lbfgsb_90_1
+lbfgsb : $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER)
+ $(FC) $(FFLAGS) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER) -o liblbfgsb-$(VERSION).$(SHLIB_EXT)
-lbfgsb_90_2 : $(DRIVER2_90) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER)
- $(FC) $(FFLAGS) $(DRIVER2_90) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER) -o x.lbfgsb_90_2
+all : lbfgsb
-lbfgsb_90_3 : $(DRIVER3_90) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER)
- $(FC) $(FFLAGS) $(DRIVER3_90) $(LBFGSB) $(LINPACK) $(BLAS) $(TIMER) -o x.lbfgsb_90_3
+install :
+ mkdir -p $(WORKSPACE)/destdir/$(LIB_SEARCH_PATH)
+ cp -f liblbfgsb*$(SHLIB_EXT) $(WORKSPACE)/destdir/$(LIB_SEARCH_PATH)/
END
patch --ignore-whitespace < Makefile.patch
make -j${nproc}
make install
"""
# 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(:aarch64, :glibc),
Linux(:armv7l, :glibc, :eabihf),
Linux(:powerpc64le, :glibc),
Linux(:i686, :musl),
Linux(:x86_64, :musl),
Linux(:aarch64, :musl),
Linux(:armv7l, :musl, :eabihf),
MacOS(:x86_64),
FreeBSD(:x86_64),
Windows(:i686),
Windows(:x86_64)
]
# The products that we will ensure are always built
products(prefix) = [
LibraryProduct(prefix, "liblbfgsb", :liblbfgsb)
]
# 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)