|
13 | 13 |
|
14 | 14 | echo Building for architecture $arch
|
15 | 15 |
|
| 16 | +export "LTO_OPTS=-flto=thin" |
| 17 | +export "LTO=1" |
| 18 | +if [[ $1 == "--no-lto" ]]; then |
| 19 | + export "LTO_OPTS=" |
| 20 | + export "LTO=0" |
| 21 | + shift |
| 22 | +fi |
| 23 | + |
16 | 24 | # The dependencies must be outside of the build folder because
|
17 | 25 | # the python build process ends up running a find -delete that
|
18 | 26 | # happens to also delete all the static libraries that we built.
|
19 | 27 | export "PREFIX=$(pwd)/../Nuitka-Python-Deps"
|
20 | 28 | export "PYTHON_BASE=$(pwd)"
|
21 | 29 | export "PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${PREFIX}/share/pkgconfig"
|
22 |
| -export "CFLAGS=-arch $arch -mmacosx-version-min=10.9 -I${PREFIX}/include -I${PYTHON_BASE}/Include -fPIC -flto=thin" |
23 |
| -export "CXXFLAGS=-arch $arch -mmacosx-version-min=10.9 -I${PREFIX}/include -fPIC -flto=thin" |
24 |
| -export "LDFLAGS=-arch $arch -L${PREFIX}/lib -flto=thin" |
| 30 | +export "CFLAGS=-arch $arch -mmacosx-version-min=10.9 -I${PREFIX}/include -I${PYTHON_BASE}/Include -fPIC ${LTO_OPTS}" |
| 31 | +export "CXXFLAGS=-arch $arch -mmacosx-version-min=10.9 -I${PREFIX}/include -fPIC ${LTO_OPTS}" |
| 32 | +export "LDFLAGS=-arch $arch -L${PREFIX}/lib ${LTO_OPTS}" |
25 | 33 | export "MACOSX_DEPLOYMENT_TARGET=10.9"
|
26 | 34 |
|
27 | 35 | # Allow to overload the compiler used via CC environment variable
|
|
36 | 44 | export CC
|
37 | 45 | export CXX
|
38 | 46 |
|
| 47 | +# Have this as a standard path. We are not yet relocatable, but that will come hopefully. |
| 48 | +target=~/Library/Nuitka-Python${short_version}-$arch |
| 49 | + |
| 50 | +if [ ! -z "$1" ] |
| 51 | +then |
| 52 | + target="$1" |
| 53 | +fi |
| 54 | + |
39 | 55 | ELEVATE=
|
40 | 56 | if [ ! -w "$(dirname "$target")" ]
|
41 | 57 | then
|
@@ -256,25 +272,21 @@ cd ..
|
256 | 272 | long_version=$(git branch --show-current 2>/dev/null || git symbolic-ref --short HEAD)
|
257 | 273 | short_version=$(echo $long_version | sed -e 's#\.##')
|
258 | 274 |
|
259 |
| -# Have this as a standard path. We are not yet relocatable, but that will come hopefully. |
260 |
| -target=~/Library/Nuitka-Python${short_version}-$arch |
261 |
| - |
262 |
| -if [ ! -z "$1" ] |
263 |
| -then |
264 |
| - target="$1" |
265 |
| -fi |
266 |
| - |
267 | 275 | cp Modules/Setup.macos Modules/Setup
|
268 | 276 |
|
269 | 277 | export "LDFLAGS=-L${PREFIX}/lib"
|
270 | 278 |
|
| 279 | +if [[ "$LTO" == "1" ]]; then |
| 280 | + LTO_BUILD_OPT=--with-lto |
| 281 | +fi |
| 282 | + |
271 | 283 | ./configure "--prefix=$target" --disable-shared --enable-ipv6 --enable-unicode=ucs4 \
|
272 |
| - --enable-optimizations --with-lto --with-computed-gotos --with-fpectl --without-readline \ |
| 284 | + --enable-optimizations $LTO_BUILD_OPT --with-computed-gotos --with-fpectl --without-readline \ |
273 | 285 | --with-system-expat --with-system-libmpdec \
|
274 | 286 | CC="$CC" \
|
275 | 287 | CXX="$CXX" \
|
276 | 288 | CFLAGS="-g $CFLAGS" \
|
277 |
| - LDFLAGS="-arch $arch -g -Xlinker $LDFLAGS -flto=thin" \ |
| 289 | + LDFLAGS="-arch $arch -g -Xlinker $LDFLAGS ${LTO_OPTS}" \ |
278 | 290 | LIBS="-lffi -lbz2 -lsqlite3 -llzma -lnp_embed -lssl -lcrypto " \
|
279 | 291 | ax_cv_c_float_words_bigendian=no \
|
280 | 292 | ___ORIG_DEPS_PREFIX=${PREFIX}___
|
|
0 commit comments