You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.9 KiB
Bash
67 lines
2.9 KiB
Bash
#!/bin/bash
|
|
[% c("var/set_default_env") -%]
|
|
distdir=/var/tmp/dist/[% project %]
|
|
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
|
|
# Set up compiler
|
|
|
|
mkdir -p /var/tmp/build
|
|
tar -C /var/tmp/build -xf [% c('input_files_by_name/python') %]
|
|
tar -C /var/tmp/build -xf [% c('input_files_by_name/meson') %]
|
|
tar -C /var/tmp/build -xf [% c('input_files_by_name/ninja') %]
|
|
tar -C /var/tmp/build -xf [% c('input_files_by_name/python-buildscript') %]
|
|
# Unpack dependencies
|
|
PATH=/var/tmp/build/meson-[% c("meson_version") %]:"$PATH"
|
|
PATH=/var/tmp/build/ninja:"$PATH"
|
|
# Add dependencies to PATH
|
|
|
|
patch /var/tmp/build/Python-[% c("version") %]/Modules/getbuildinfo.c < $rootdir/omit-build-timestamp.patch
|
|
# Python includes build timestamp by default
|
|
patch /var/tmp/build/cross-python-[% c("cp_githash") %]/meson.build << 'EOF'
|
|
113c113
|
|
< add_project_link_arguments('-municode', '-mconsole', '-static-libgcc', language:'c')
|
|
---
|
|
> add_project_link_arguments('-municode', '-mconsole', '-static-libgcc', '-Wl,-Bstatic', '-lwinpthread', '-Wl,-Bdynamic', language:'c')
|
|
1076c1076
|
|
< python_libraries = both_libraries(
|
|
---
|
|
> libpython = shared_library(
|
|
1086,1087d1085
|
|
<
|
|
< libpython = python_libraries.get_shared_lib()
|
|
EOF
|
|
# Patch build script to statically link pthread
|
|
ranlib /var/tmp/dist/mingw-w64/[% c("arch") %]-w64-mingw32/lib/libwinpthread.a
|
|
# Prepare libwinpthread for static linking
|
|
|
|
# This is a hack. (TODO: refactor)
|
|
# We need to link this statically, because we aren't shipping the mingw runtime.
|
|
# https://stackoverflow.com/questions/14665691/static-linking-with-libwinpthread
|
|
|
|
|
|
mkdir -p /var/tmp/build/cross-python-[% c("cp_githash") %]/subprojects/packagecache
|
|
cp [% c('input_files_by_name/sqlite-src') %] /var/tmp/build/cross-python-[% c("cp_githash") %]/subprojects/packagecache/sqlite-amalgamation-3250100.zip
|
|
cp [% c('input_files_by_name/sqlite-patch') %] /var/tmp/build/cross-python-[% c("cp_githash") %]/subprojects/packagecache/sqlite-3250100-1-wrap.zip
|
|
cp [% c('input_files_by_name/zlib-src') %] /var/tmp/build/cross-python-[% c("cp_githash") %]/subprojects/packagecache/zlib-1.2.11.tar.gz
|
|
cp [% c('input_files_by_name/zlib-patch') %] /var/tmp/build/cross-python-[% c("cp_githash") %]/subprojects/packagecache/zlib-1.2.11-4-wrap.zip
|
|
# Project pulls in sqlite, zlib, and build files.
|
|
# Download them outside, in rbm, to avoid container network access.
|
|
|
|
cd /var/tmp/build/cross-python-[% c("cp_githash") %]
|
|
# Enter the build directory
|
|
|
|
LDFLAGS="-Wl,--no-insert-timestamp" meson.py -Dsource=../Python-[% c("version") %] --cross-file cross-files/x86_64-w64-mingw32.txt --prefix=$distdir builddir
|
|
# cf. ./configure
|
|
ninja -C builddir
|
|
# cf. make
|
|
ninja -C builddir install
|
|
# cf. make install
|
|
|
|
find $distdir -name '*.a' -exec rm '{}' +
|
|
# These files don't reproduce, and are useless
|
|
|
|
cd /var/tmp/dist
|
|
[% c('tar', {
|
|
tar_src => [ project ],
|
|
tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
|
|
}) %]
|