Skip to content

Commit

Permalink
fix python build error
Browse files Browse the repository at this point in the history
  • Loading branch information
danielk117 authored Jan 28, 2024
1 parent 3b65186 commit 88c014e
Showing 1 changed file with 44 additions and 40 deletions.
84 changes: 44 additions & 40 deletions packages/python3/package.mk
Original file line number Diff line number Diff line change
@@ -1,68 +1,72 @@
PACKAGE_NAME="python3"
PACKAGE_VERSION="3.9.1"
PACKAGE_VERSION="3.9.18"
PACKAGE_SRC="https://www.python.org/ftp/python/${PACKAGE_VERSION}/Python-${PACKAGE_VERSION}.tar.xz"
PACKAGE_DEPENDS="glibc ncurses"

preconfigure_package() {
# build on self host
mkdir -p build-host
cp -a * build-host/
cd build-host
# build on self host
mkdir -p build-host
cp -a * build-host/
cd build-host

./configure
make -j${MAKE_JOBS} python Parser/pgen
make install
./configure
make -j${MAKE_JOBS} python Parser/pgen
make install

if [ $? -gt 0 ]; then
return 1
fi
if [ $? -gt 0 ]; then
return 1
fi

cd ..
cd ..
}

configure_package() {
CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" LDFLAGS="${BUILD_LDFLAGS}" \
CXX="${BUILD_CXX}" CXXFLAGS="${BUILD_CFLAGS}" CPPFLAGS="${BUILD_CFLAGS}" \
PKG_CONFIG_LIBDIR="${BUILD_PKG_CONFIG_LIBDIR}" PKG_CONFIG_SYSROOT_DIR="${BUILD_PKG_CONFIG_SYSROOT_DIR}" \
./configure --build=${MACHTYPE} --host=${BUILD_TARGET} --target=${BUILD_TARGET} \
--prefix=${INSTALL_PREFIX} \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no \
ac_cv_have_long_long_format=yes \
--enable-optimizations \
--with-lto \
--enable-shared \
CC="${BUILD_CC}" CFLAGS="${BUILD_CFLAGS}" LDFLAGS="${BUILD_LDFLAGS}" \
CXX="${BUILD_CXX}" CXXFLAGS="${BUILD_CFLAGS}" CPPFLAGS="${BUILD_CFLAGS}" \
PKG_CONFIG_LIBDIR="${BUILD_PKG_CONFIG_LIBDIR}" PKG_CONFIG_SYSROOT_DIR="${BUILD_PKG_CONFIG_SYSROOT_DIR}" \
./configure --build=${MACHTYPE} --host=${BUILD_TARGET} --target=${BUILD_TARGET} \
--prefix=${INSTALL_PREFIX} \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no \
ac_cv_have_long_long_format=yes \
--enable-optimizations \
--with-lto \
--enable-shared \
--disable-ipv6 \
--disable-test-modules \
--without-doc-strings \
--with-ensurepip=no
--with-ensurepip=install
}

make_package() {
make -j${MAKE_JOBS} \
HOSTPYTHON=${PACKAGE_SRC_DIR}/build-host/python \
HOSTPGEN=${PACKAGE_SRC_DIR}/build-host/Parser/pgen \
CROSS_COMPILE_TARGET=yes \
LDFLAGS="${BUILD_LDFLAGS} -static" LINKFORSHARED=" "
make -j${MAKE_JOBS} \
HOSTPYTHON=${PACKAGE_SRC_DIR}/build-host/python \
HOSTPGEN=${PACKAGE_SRC_DIR}/build-host/Parser/pgen \
CROSS_COMPILE_TARGET=yes \
LDFLAGS="${BUILD_LDFLAGS}" LINKFORSHARED=" "
}

install_package() {
make DESTDIR=${STAGING_DIR} install

# optimize size
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/pydoc_data
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/ensurepip
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/pydoc_data
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/ensurepip

rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/asyncio/windows_*.py
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/_osx_support.py
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/asyncio/windows_*.py
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/_osx_support.py

rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/test
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/**/test
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/test
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/test
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/*/test

rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/unittest
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/idle_test
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/tests
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/unittest
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/idle_test
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/tests

rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/__pycache__
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/__pycache__
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/*/__pycache__
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/*/*/*/__pycache__

rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/__pycache__
rm -rvf /xiaoai/build-packages/staging/armv7/usr/lib/python3.*/**/__pycache__
}

0 comments on commit 88c014e

Please sign in to comment.