forked from skiselkov/libacfutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_deps
executable file
·210 lines (199 loc) · 5.64 KB
/
build_deps
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#!/bin/bash
# CDDL HEADER START
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
# CDDL HEADER END
# Copyright 2023 Saso Kiselkov. All rights reserved.
# Prior to building the included dependencies, make sure the following
# packages are installed (tested on Ubuntu 18.04):
# autoconf automake build-essential cmake gcc-multilib g++-multilib
# mingw-w64 libgl1-mesa-dev libglu1-mesa-dev libtool libx11-dev
# pkg-config qt5-default qt5-qmake unzip
export minimal=0
build_jpeg=1
build_png=1
build_freetype=1
build_cairo=1
build_opus=1
build_shape=1
build_glew=1
build_openal=1
build_cglm=1
build_geographic=1
build_lzma=1
while getopts "cdmf:h" opt; do
case $opt in
c) export do_clean=1 ;;
d) export do_dll=1 ;;
m)
export minimal=1
build_jpeg=0
build_png=0
build_freetype=0
build_cairo=0
build_opus=0
build_shape=0
build_glew=0
build_openal=0
build_cglm=0
build_geographic=0
build_lzma=0
touch .minimal-deps
;;
f)
case $OPTARG in
jpeg)
build_png=1
;;
png)
build_png=1
;;
freetype)
build_freetype=1
;;
cairo)
build_png=1
build_freetype=1
build_cairo=1
;;
opus)
build_opus=1
;;
shape)
build_shape=1
;;
glew)
build_glew=1
;;
openal)
build_openal=1
;;
cglm)
build_cglm=1
;;
geographic)
build_geographic=1
;;
lzma)
build_lzma=1
;;
*)
echo "Unknown feature. Try $0 -h for help." >&2
exit 1
;;
esac
;;
h|*)
cat << EOF
Usage: $0 [-cdm] [-f <feature>]
-c : clean dependencies instead of building
-d : build DLL versions of dependencies (with exported symbols)
-m : minimal build, with lots of features disabled and only
built for the current platform instead of cross-compiling.
Note that this disables many feature modules. You can re-enable
them by specifying `-f <feature>' flags after `-m'.
-f <feature> : enable building of feature. This can be used together
with -m to enable minimal mode and then selectively only enable
desired features. <feature> must be one of:
"cairo" - enable building libcairo. Implies "png" and "freetype" below.
"cglm" - enable building CGLM.
"freetype" - enable building freetype.
"geographic" - enable building GeographicLib.
"glew" - enable building libGLEW.
"jpeg" - enable building libjpeg.
"lzma" - enable building LZMA.
"openal" - enable building openal-soft.
"opus" - enable building libopus and libogg.
"png" - enable building libpng.
"shape" - enable building libshp.
EOF
exit
;;
esac
done
if [[ "$minimal" == 0 ]]; then
rm -f .minimal-deps
fi
if [[ "$do_clean" != 1 ]]; then
git submodule init mingw-std-threads && \
git submodule update --merge --recursive && \
( cd mingw-std-threads && git checkout 6c2061b7da41d6aa1b2162ff4383ec3ece864bc6 )
fi
function check_brew_install() {
if ! which "$1" &> /dev/null; then
if ! brew install "$2"; then
echo "Required utility '$1' not found" \
"and cannot be installed." >&2
return 1
fi
fi
return 0
}
function build_lzma() {
cd lzma/qmake
if [ $(uname) = Darwin ]; then
if [[ "$do_clean" == 1 ]]; then
rm -f mac-64/liblzma.a
elif ! [ -f mac-64/liblzma.a ]; then
echo "Building LZMA ..."
./build-mac
fi
else
if [[ "$do_clean" == 1 ]]; then
rm -f -f win-64/liblzma.a linux-64/liblzma.a
elif ( ! [ -f win-64/liblzma.a ] && [ "$minimal" -eq 0 ] ) || \
! [ -f linux-64/liblzma.a ];
then
echo "Building LZMA ..."
./build-win-lin
fi
fi
}
case $(uname) in
Darwin)
if [ -z "$do_clean" ]; then
check_brew_install qmake "qt" || exit 1
check_brew_install pkg-config "pkg-config" || exit 1
check_brew_install gsed "gnu-sed" || exit 1
check_brew_install cmake "cmake" || exit 1
fi
;;
*)
;;
esac
( cd zlib && ./build_zlib_deps ) && \
( echo "Building libiconv ..."; cd libiconv && ./build_libiconv_deps ) && \
( echo "Building libclipboard ..."; \
cd libclipboard && ./build_libclipboard_deps ) && \
( [ $build_png -ne 1 ] || ( echo "Building libpng ..."; \
cd libpng && ./build_libpng_deps ) ) && \
( [ $build_jpeg -ne 1 ] || ( echo "Building libjpeg ..."; \
cd libjpeg && ./build_libjpeg_deps ) ) && \
( echo "Building libxml2 ..."; cd libxml2 && ./build_libxml2_deps ) && \
( [ $build_freetype -ne 1 ] || ( echo "Building Freetype ..."; \
cd freetype && ./build_freetype_deps ) ) && \
( [ $build_cairo -ne 1 ] || ( echo "Building Cairo ..."; \
cd cairo && ./build_cairo_deps ) ) && \
( [ $build_opus -ne 1 ] || ( echo "Building Opus ..."; \
cd opus && ./build_opus_deps ) ) && \
( echo "Building OpenSSL ..."; cd ssl && ./build_ssl_deps ) && \
( echo "Building cURL ..."; cd curl && ./build_curl_deps ) && \
( [ $build_shape -ne 1 ] || ( echo "Building shapelib ..."; \
cd shapelib && ./build_shapelib_deps ) ) && \
( echo "Building PCRE2 ..."; cd pcre2 && ./build_pcre2_deps ) && \
( [ $build_glew -ne 1 ] || ( echo "Building GLEW ..."; \
cd glew && ./build_glew_deps ) ) && \
( [ $build_openal -ne 1 ] || ( echo "Building OpenAL ..."; \
cd openal-soft && ./build_openal ) ) && \
( [ $build_cglm -ne 1 ] || ( echo "Building cglm ..."; cd cglm && ./build_cglm ) ) && \
( [ $build_geographic -ne 1 ] || ( echo "Building geographiclib ..."; \
cd geographiclib && ./build_geographiclib ) ) && \
( [ $build_lzma -ne 1 ] || build_lzma )