Skip to content

Commit

Permalink
Start to fix python cross-compiled linux build, WIP
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Dec 30, 2023
1 parent 106df20 commit ba8f1a5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 28 deletions.
24 changes: 20 additions & 4 deletions bootstrap-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,20 @@ function build_conf_openssl() {
elif [ "${WIN32}" -eq 1 ]; then
export MACHINE="i686"
export SYSTEM="mingw"
else
export MACHINE="$(uname -m)"
elif [ -n "${LINUX_TARGET}" ]; then
if [ "${LINUX_TARGET}" = "linux-armhf" ]; then
export MACHINE="armv4"
elif [ "${LINUX_TARGET}" = "linux-aarch64" ]; then
export MACHINE="aarch64"
elif [ "${LINUX_TARGET}" = "linux-i686" ]; then
export MACHINE="i686"
elif [ "${LINUX_TARGET}" = "linux-riscv64" ]; then
export MACHINE="riscv64"
elif [ "${LINUX_TARGET}" = "linux-x86_64" ]; then
export MACHINE="x86_64"
else
export MACHINE="$(uname -m)"
fi
export SYSTEM="linux2"
fi
export RELEASE="whatever"
Expand Down Expand Up @@ -111,7 +123,7 @@ if [ -z "${PAWPAW_SKIP_OPENSSL}" ]; then
OPENSSL_URL="https://www.openssl.org/source"
OPENSSL_VERSION="1.1.1w"

OPENSSL_EXTRAFLAGS="no-shared no-hw threads no-zlib no-capieng no-pinshared"
OPENSSL_EXTRAFLAGS="no-capieng no-pinshared no-shared no-hw no-zlib threads"
if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
OPENSSL_EXTRAFLAGS+=" no-asm"
fi
Expand Down Expand Up @@ -229,7 +241,7 @@ if [ "${MACOS}" -eq 1 ]; then
elif [ "${WIN32}" -eq 1 ]; then
export EXTRA_CFLAGS=" -fwrapv -D_WIN32_WINNT=0x0601"
export EXTRA_CXXFLAGS=" -fwrapv -D_WIN32_WINNT=0x0601"
PYTHON_EXTRAFLAGS="--with-nt-threads"
PYTHON_EXTRAFLAGS+=" --with-nt-threads"
PYTHON_EXTRAFLAGS+=" --without-ensurepip"
PYTHON_EXTRAFLAGS+=" --without-c-locale-coercion"
# Workaround for conftest error on 64-bit builds
Expand All @@ -246,6 +258,10 @@ elif [ "${WIN32}" -eq 1 ]; then
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_MEMBER=no"
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_NODELETE=no"
PYTHON_EXTRAFLAGS+=" ac_cv_have_decl_RTLD_NOLOAD=no"
elif [ "${CROSS_COMPILING}" -eq 1 ]; then
PYTHON_EXTRAFLAGS+=" --disable-ipv6"
PYTHON_EXTRAFLAGS+=" ac_cv_file__dev_ptc=no"
PYTHON_EXTRAFLAGS+=" ac_cv_file__dev_ptmx=no"
fi

download Python "${PYTHON_VERSION}" "https://www.python.org/ftp/python/${PYTHON_VERSION}" "tgz"
Expand Down
48 changes: 24 additions & 24 deletions setup/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function git_clone() {
# ---------------------------------------------------------------------------------------------------------------------

function _prebuild() {
local name="${1}"
local pkgname="${1}"
local pkgdir="${2}"

export AR="${TARGET_AR}"
Expand All @@ -137,35 +137,35 @@ function _prebuild() {
export OLD_PATH="${PATH}"
export PATH="${TARGET_PATH}"

if [ -d "${PAWPAW_ROOT}/patches/${name}" ] && [ ! -f "${pkgdir}/.stamp_cleanup" ]; then
for p in $(ls "${PAWPAW_ROOT}/patches/${name}/" | grep "\.patch$" | sort); do
if [ -e "${PAWPAW_ROOT}/patches/${pkgname}" ] && [ ! -f "${pkgdir}/.stamp_cleanup" ] && [ ! -f "${pkgdir}/.stamp_configured" ]; then
local patchtargets="${PAWPAW_TARGET}"
if [[ "${PAWPAW_TARGET}" = "linux-"* ]]; then
patchtargets+=" linux"
elif [ "${PAWPAW_TARGET}" = "macos-universal-10.15" ]; then
patchtargets+=" macos-10.15 macos-universal"
elif [ "${PAWPAW_TARGET}" = "win64" ]; then
patchtargets+=" win32"
fi

for target in ${patchtargets[@]}; do
if [ -e "${PAWPAW_ROOT}/patches/${pkgname}/${target}" ]; then
for p in $(ls "${PAWPAW_ROOT}/patches/${pkgname}/${target}/" | grep "\.patch$" | sort); do
if [ ! -f "${pkgdir}/.stamp_applied_${p}" ]; then
patch -p1 -d "${pkgdir}" -i "${PAWPAW_ROOT}/patches/${pkgname}/${target}/${p}"
touch "${pkgdir}/.stamp_applied_${p}"
fi
done
fi
done

for p in $(ls "${PAWPAW_ROOT}/patches/${pkgname}/" | grep "\.patch$" | sort); do
if [ ! -f "${pkgdir}/.stamp_applied_${p}" ]; then
patch -p1 -d "${pkgdir}" -i "${PAWPAW_ROOT}/patches/${name}/${p}"
patch -p1 -d "${pkgdir}" -i "${PAWPAW_ROOT}/patches/${pkgname}/${p}"
touch "${pkgdir}/.stamp_applied_${p}"
fi
done
fi

local patchtargets="${PAWPAW_TARGET}"
if [ "${PAWPAW_TARGET}" = "linux-"* ]; then
patchtargets+=" linux"
elif [ "${PAWPAW_TARGET}" = "macos-universal-10.15" ]; then
patchtargets+=" macos-10.15 macos-universal"
elif [ "${PAWPAW_TARGET}" = "win64" ]; then
patchtargets+=" win32"
fi

for target in ${patchtargets[@]}; do
if [ -d "${PAWPAW_ROOT}/patches/${name}/${target}" ] && [ ! -f "${pkgdir}/.stamp_cleanup" ]; then
for p in $(ls "${PAWPAW_ROOT}/patches/${name}/${target}/" | grep "\.patch$" | sort); do
if [ ! -f "${pkgdir}/.stamp_applied_${p}" ]; then
patch -p1 -d "${pkgdir}" -i "${PAWPAW_ROOT}/patches/${name}/${target}/${p}"
touch "${pkgdir}/.stamp_applied_${p}"
fi
done
fi
done

if [ ! -f "${pkgdir}/.stamp_configured" ]; then
rm -f "${pkgdir}/.stamp_built"
rm -f "${pkgdir}/.stamp_installed"
Expand Down

0 comments on commit ba8f1a5

Please sign in to comment.