diff --git a/Makefile b/Makefile index fec90a9..ae49928 100644 --- a/Makefile +++ b/Makefile @@ -89,5 +89,15 @@ bash: vim: @./package/vim/make.sh || exit 1 +.PHONY: python3 +python3: + @./package/libffi/make.sh || exit 1 + @./package/autoconf-archive/make-host.sh || exit 1 + @./package/expat/make-host.sh || exit 1 + @./package/libffi/make-host.sh || exit 1 + @./package/python3/make-host.sh || exit 1 + @./package/python3/make.sh || exit 1 + @./package/snake/make.sh || exit 1 + clean: rm -rf output/ diff --git a/build.sh b/build.sh index 254c827..0d79594 100755 --- a/build.sh +++ b/build.sh @@ -12,5 +12,6 @@ make sysvinit || exit 1 make coreutils || exit 1 make bash || exit 1 make vim || exit 1 +make python3 || exit 1 make before-target-image || exit 1 make rebuild-target-image || exit 1 diff --git a/package/autoconf-archive/make-host.sh b/package/autoconf-archive/make-host.sh new file mode 100755 index 0000000..9a8d169 --- /dev/null +++ b/package/autoconf-archive/make-host.sh @@ -0,0 +1,39 @@ +#!/usr/bin/bash +source $(dirname "$0")/../common.sh + +PKGNAME=autoconf-archive +PKGVERSION=2023.02.20 +PKGSOURCE_DIR=autoconf-archive +PKGSOURCE=autoconf-archive-2023.02.20.tar.xz +PKGURL=http://mirrors.ustc.edu.cn/gnu/autoconf-archive/autoconf-archive-2023.02.20.tar.xz + +PKGBUILDNAME=host-${PKGNAME} +PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION} + +echo "----> Building ${PKGBUILDNAME} ..." + +stamp_downloaded + +step_start extract +mkdir -p ${PKGBUILD_DIR} +xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf - +chmod -R +rw ${PKGBUILD_DIR} +step_end extract + +stamp_patched autotools + +step_start configure +(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking") +step_end configure + +step_start build +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}" +step_end build + +step_start install-host +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} aclocaldir=${HOST_DIR}/share/autoconf-archive install -C ${PKGBUILD_DIR}" +step_end install-host + +stamp_installed + +echo "<---- ${PKGBUILDNAME} build complete." diff --git a/package/expat/make-host.sh b/package/expat/make-host.sh new file mode 100755 index 0000000..cb96ae1 --- /dev/null +++ b/package/expat/make-host.sh @@ -0,0 +1,39 @@ +#!/usr/bin/bash +source $(dirname "$0")/../common.sh + +PKGNAME=expat +PKGVERSION=2.7.2 +PKGSOURCE_DIR=expat +PKGSOURCE=expat-2.7.2.tar.xz +PKGURL=https://github.com/libexpat/libexpat/releases/download/R_2_7_2/expat-2.7.2.tar.xz + +PKGBUILDNAME=host-${PKGNAME} +PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION} + +echo "----> Building ${PKGBUILDNAME} ..." + +stamp_downloaded + +step_start extract +mkdir -p ${PKGBUILD_DIR} +xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf - +chmod -R +rw ${PKGBUILD_DIR} +step_end extract + +stamp_patched autotools + +step_start configure +(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --without-docbook --without-examples --without-tests") +step_end configure + +step_start build +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}" +step_end build + +step_start install-host +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}" +step_end install-host + +stamp_installed + +echo "<---- ${PKGBUILDNAME} build complete." diff --git a/package/libffi/0001-Fix-use-of-compact-eh-frames-on-MIPS.patch b/package/libffi/0001-Fix-use-of-compact-eh-frames-on-MIPS.patch new file mode 100644 index 0000000..7786b98 --- /dev/null +++ b/package/libffi/0001-Fix-use-of-compact-eh-frames-on-MIPS.patch @@ -0,0 +1,47 @@ +From 31b6b6bc14197cd4183bdbd311fddeb36b5ae100 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Krause?= +Date: Sat, 19 Sep 2015 22:53:29 +0200 +Subject: [PATCH] Fix use of compact eh frames on MIPS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Newer MIPS toolchains use a different (compact) eh_frame format. +libffi don't like them, so we have to switch to the older format. + +This patch add -mno-compact-eh to CFLAGS when compiling for +Mips and compiler support it. + +Signed-off-by: Jérôme Pouiller +[unfuzz for 3.2.1] +Signed-off-by: Jörg Krause +[rebased for 3.4.6] +Signed-off-by: Bernd Kuhls +--- + configure.ac | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/configure.ac b/configure.ac +index a7bf5ee..36cd0d4 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -238,6 +238,16 @@ esac + AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1) + AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE) + ++if test x$TARGET = xMIPS; then ++ save_CFLAGS="$CFLAGS" ++ CFLAGS=-mno-compact-eh ++ AC_MSG_CHECKING([whether the C compiler needs -mno-compact-eh]) ++ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], ++ [AC_MSG_RESULT([yes])]; [save_CFLAGS="$save_CFLAGS -mno-compact-eh"], ++ [AC_MSG_RESULT([no])]) ++ CFLAGS="$save_CFLAGS" ++fi ++ + if test x$TARGET = xX86_64; then + AC_CACHE_CHECK([toolchain supports unwind section type], + libffi_cv_as_x86_64_unwind_section_type, [ +-- +2.5.3 + diff --git a/package/libffi/make-host.sh b/package/libffi/make-host.sh new file mode 100755 index 0000000..909fde3 --- /dev/null +++ b/package/libffi/make-host.sh @@ -0,0 +1,44 @@ +#!/usr/bin/bash +source $(dirname "$0")/../common.sh + +PKGNAME=libffi +PKGVERSION=3.4.8 +PKGSOURCE_DIR=libffi +PKGSOURCE=libffi-3.4.8.tar.gz +PKGURL=https://github.com/libffi/libffi/releases/download/v3.4.8/libffi-3.4.8.tar.gz + +PKGBUILDNAME=host-${PKGNAME} +PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION} + +echo "----> Building ${PKGBUILDNAME} ..." + +stamp_downloaded + +step_start extract +mkdir -p ${PKGBUILD_DIR} +gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf - +chmod -R +rw ${PKGBUILD_DIR} +step_end extract + +step_start patch +TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch +step_end patch autotools ignore_libtool_patch + +step_start configure +echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring" +cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i" +patch_libtool ${PKGBUILD_DIR} +(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking") +step_end configure + +step_start build +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}" +step_end build + +step_start install-host +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}" +step_end install-host + +stamp_installed + +echo "<---- ${PKGBUILDNAME} build complete." diff --git a/package/libffi/make.sh b/package/libffi/make.sh new file mode 100755 index 0000000..848198b --- /dev/null +++ b/package/libffi/make.sh @@ -0,0 +1,48 @@ +#!/usr/bin/bash +source $(dirname "$0")/../common.sh + +PKGNAME=libffi +PKGVERSION=3.4.8 +PKGSOURCE_DIR=libffi +PKGSOURCE=libffi-3.4.8.tar.gz +PKGURL=https://github.com/libffi/libffi/releases/download/v3.4.8/libffi-3.4.8.tar.gz + +PKGBUILDNAME=${PKGNAME} +PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION} + +echo "----> Building ${PKGBUILDNAME} ..." + +stamp_downloaded + +step_start extract +mkdir -p ${PKGBUILD_DIR} +gzip -d -c ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf - +chmod -R +rw ${PKGBUILD_DIR} +step_end extract + +step_start patch +TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch +step_end patch autotools ignore_libtool_patch + +step_start configure +echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring" +cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i" +patch_libtool ${PKGBUILD_DIR} +(cd ${PKGBUILD_DIR} && rm -rf config.cache && eval "${TARGET_CONFIGURE_OPTS} CXX=no ac_cv_lbl_unaligned_fail=yes ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_memcmp_working=yes ac_cv_have_decl_malloc=yes gl_cv_func_malloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ac_cv_func_calloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes lt_cv_sys_lib_search_path_spec=\"\" ac_cv_c_bigendian=no CONFIG_SITE=/dev/null ./configure --target=${GNU_TARGET_NAME} --host=${GNU_TARGET_NAME} --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix=\"\" --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --disable-nls --disable-static --enable-shared --disable-multi-os-directory --disable-exec-static-tramp") +step_end configure + +step_start build +eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}" +step_end build + +step_start install-staging +eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${STAGING_DIR} install -C ${PKGBUILD_DIR}" +step_end install-staging + +step_start install-target +eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${TARGET_DIR} install -C ${PKGBUILD_DIR}" +step_end install-target + +stamp_installed + +echo "<---- ${PKGBUILDNAME} build complete." diff --git a/package/python3/0001-Make-the-build-of-pyc-files-conditional.patch b/package/python3/0001-Make-the-build-of-pyc-files-conditional.patch new file mode 100644 index 0000000..30ad414 --- /dev/null +++ b/package/python3/0001-Make-the-build-of-pyc-files-conditional.patch @@ -0,0 +1,63 @@ +From 52bb6f2a3ef352cda16d95a588a0356da562de8e Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 16:21:31 -0800 +Subject: [PATCH] Make the build of pyc files conditional + +This commit adds a new configure option --disable-pyc-build to disable +the compilation of pyc. + +Upstream: N/A + +Signed-off-by: Thomas Petazzoni +[ Andrey Smrinov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.12.0 ] +Signed-off-by: Adam Duskett +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +--- + Makefile.pre.in | 2 ++ + configure.ac | 7 +++++++ + 2 files changed, 9 insertions(+) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index a7dc9709d62..a1d460b36f4 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2570,6 +2570,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c + patch --force --reject-file "$(abs_builddir)/app-store-compliance.rej" --strip 2 --directory "$(DESTDIR)$(LIBDEST)" --input "$(abs_srcdir)/$(APP_STORE_COMPLIANCE_PATCH)" || true ; \ + fi + @ # Build PYC files for the 3 optimization levels (0, 1, 2) ++ifeq (@PYC_BUILD@,yes) + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \ +@@ -2579,6 +2580,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \ + -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ++endif + + # bpo-21536: Misc/python-config.sh is generated in the build directory + # from $(srcdir)Misc/python-config.sh.in. +diff --git a/configure.ac b/configure.ac +index 597a44b331a..edac73ec5d3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1513,6 +1513,13 @@ fi + + AC_MSG_CHECKING([LDLIBRARY]) + ++AC_SUBST(PYC_BUILD) ++ ++AC_ARG_ENABLE(pyc-build, ++ AS_HELP_STRING([--disable-pyc-build], [disable build of pyc files]), ++ [ PYC_BUILD="${enableval}" ], [ PYC_BUILD=yes ]) ++ ++ + # Apple framework builds need more magic. LDLIBRARY is the dynamic + # library that we build, but we do not want to link against it (we + # will find it with a -framework option). For this reason there is an +-- +2.50.1 + diff --git a/package/python3/0002-Add-an-option-to-disable-pydoc.patch b/package/python3/0002-Add-an-option-to-disable-pydoc.patch new file mode 100644 index 0000000..6692561 --- /dev/null +++ b/package/python3/0002-Add-an-option-to-disable-pydoc.patch @@ -0,0 +1,88 @@ +From 8ba9dc9a12687d37454dd949409599f108f1ce44 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:07:56 -0800 +Subject: [PATCH] Add an option to disable pydoc + +It removes 0.5 MB of data from the target plus the pydoc script +itself. + +Upstream: N/A + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +[ Adam Duskett: ported to Python 3.12.1 ] +Signed-off-by: Adam Duskett +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +--- + Makefile.pre.in | 9 ++++++++- + configure.ac | 6 ++++++ + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index a1d460b36f4..81f3fd54ee4 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2281,7 +2281,9 @@ bininstall: commoninstall altbininstall + -rm -f $(DESTDIR)$(BINDIR)/idle3 + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) + -rm -f $(DESTDIR)$(BINDIR)/pydoc3 ++ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) ++endif + if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ + rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \ + (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \ +@@ -2331,7 +2333,6 @@ LIBSUBDIRS= asyncio \ + logging \ + multiprocessing multiprocessing/dummy \ + pathlib \ +- pydoc_data \ + re \ + site-packages \ + sqlite3 \ +@@ -2490,6 +2491,10 @@ TESTSUBDIRS= idlelib/idle_test \ + + COMPILEALL_OPTS=-j0 + ++ifeq (@PYDOC@,yes) ++LIBSUBDIRS += pydoc_data ++endif ++ + TEST_MODULES=@TEST_MODULES@ + + .PHONY: libinstall +@@ -2717,7 +2722,9 @@ libainstall: all scripts + $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py + $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config + $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) ++ifeq (@PYDOC@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) ++endif + @if [ -s Modules/python.exp -a \ + "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ + echo; echo "Installing support files for building shared extension modules on AIX:"; \ +diff --git a/configure.ac b/configure.ac +index edac73ec5d3..7ed4fa578f3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4749,6 +4749,12 @@ AS_VAR_IF([posix_threads], [stub], [ + AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support]) + ]) + ++AC_SUBST(PYDOC) ++ ++AC_ARG_ENABLE(pydoc, ++ AS_HELP_STRING([--disable-pydoc], [disable pydoc]), ++ [ PYDOC="${enableval}" ], [ PYDOC=yes ]) ++ + # Check for enable-ipv6 + AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +-- +2.50.1 + diff --git a/package/python3/0003-Add-an-option-to-disable-IDLE.patch b/package/python3/0003-Add-an-option-to-disable-IDLE.patch new file mode 100644 index 0000000..afef612 --- /dev/null +++ b/package/python3/0003-Add-an-option-to-disable-IDLE.patch @@ -0,0 +1,87 @@ +From 463c64020b288b8ddfd32a63c4a23ab7369b9669 Mon Sep 17 00:00:00 2001 +From: Maxime Ripard +Date: Wed, 22 Feb 2017 17:45:14 -0800 +Subject: [PATCH] Add an option to disable IDLE + +IDLE is an IDE embedded into python, written using Tk, so it doesn't make +much sense to have it into our build. + +Upstream: N/A + +Signed-off-by: Maxime Ripard +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +[ Adam Duskett: ported to Python 3.12.1 ] +Signed-off-by: Adam Duskett +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +--- + Makefile.pre.in | 9 ++++++++- + configure.ac | 6 ++++++ + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 81f3fd54ee4..2d067730633 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2279,7 +2279,9 @@ bininstall: commoninstall altbininstall + -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc + (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc) + -rm -f $(DESTDIR)$(BINDIR)/idle3 ++ifeq (@IDLE@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) ++endif + -rm -f $(DESTDIR)$(BINDIR)/pydoc3 + ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) +@@ -2327,7 +2329,6 @@ LIBSUBDIRS= asyncio \ + ensurepip ensurepip/_bundled \ + html \ + http \ +- idlelib idlelib/Icons \ + importlib importlib/resources importlib/metadata \ + json \ + logging \ +@@ -2495,6 +2496,10 @@ ifeq (@PYDOC@,yes) + LIBSUBDIRS += pydoc_data + endif + ++ifeq (@IDLE@,yes) ++LIBSUBDIRS += idlelib idlelib/Icons ++endif ++ + TEST_MODULES=@TEST_MODULES@ + + .PHONY: libinstall +@@ -2721,7 +2726,9 @@ libainstall: all scripts + $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh + $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py + $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config ++ifeq (@IDLE@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) ++endif + ifeq (@PYDOC@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) + endif +diff --git a/configure.ac b/configure.ac +index 7ed4fa578f3..d5dac4bf8bc 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -7927,6 +7927,12 @@ PY_STDLIB_MOD([xxlimited_35], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_d + # substitute multiline block, must come after last PY_STDLIB_MOD() + AC_SUBST([MODULE_BLOCK]) + ++AC_SUBST(IDLE) ++ ++AC_ARG_ENABLE(idle3, ++ AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]), ++ [ IDLE="${enableval}" ], [ IDLE=yes ]) ++ + # generate output files + AC_CONFIG_FILES(m4_normalize([ + Makefile.pre +-- +2.50.1 + diff --git a/package/python3/0004-configure.ac-move-PY_STDLIB_MOD_SET_NA-further-up.patch b/package/python3/0004-configure.ac-move-PY_STDLIB_MOD_SET_NA-further-up.patch new file mode 100644 index 0000000..c52ff62 --- /dev/null +++ b/package/python3/0004-configure.ac-move-PY_STDLIB_MOD_SET_NA-further-up.patch @@ -0,0 +1,51 @@ +From 930c4763ac46d180880615eceeb68698e9b35e85 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 6 Feb 2024 22:46:59 +0100 +Subject: [PATCH] configure.ac: move PY_STDLIB_MOD_SET_NA further up + +We will need PY_STDLIB_MOD_SET_NA in next patches further up in the +configure.ac script. + +Upstream: N/A + +Signed-off-by: Thomas Petazzoni +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +--- + configure.ac | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d5dac4bf8bc..6635aaa134d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -95,6 +95,12 @@ AC_DEFUN([PY_CHECK_EMSCRIPTEN_PORT], [ + AS_VAR_POPDEF([py_libs]) + ]) + ++# stdlib ++AC_DEFUN([PY_STDLIB_MOD_SET_NA], [ ++ m4_foreach([mod], [$@], [ ++ AS_VAR_SET([py_cv_module_]mod, [n/a])]) ++]) ++ + AC_SUBST([BASECPPFLAGS]) + if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then + # If we're building out-of-tree, we need to make sure the following +@@ -7595,13 +7601,6 @@ AS_VAR_IF([ac_cv_libatomic_needed], [yes], + LIBATOMIC=${LIBATOMIC-"-latomic"}]) + _RESTORE_VAR([CPPFLAGS]) + +- +-# stdlib +-AC_DEFUN([PY_STDLIB_MOD_SET_NA], [ +- m4_foreach([mod], [$@], [ +- AS_VAR_SET([py_cv_module_]mod, [n/a])]) +-]) +- + # stdlib not available + dnl Modules that are not available on some platforms + AS_CASE([$ac_sys_system], +-- +2.50.1 + diff --git a/package/python3/0005-Add-option-to-disable-the-sqlite3-module.patch b/package/python3/0005-Add-option-to-disable-the-sqlite3-module.patch new file mode 100644 index 0000000..df79837 --- /dev/null +++ b/package/python3/0005-Add-option-to-disable-the-sqlite3-module.patch @@ -0,0 +1,65 @@ +From 8f6beca556599479705444af7cc7c49b2b964af8 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 6 Feb 2024 22:12:20 +0100 +Subject: [PATCH] Add option to disable the sqlite3 module + +Upstream: N/A + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +Signed-off-by: Thomas Petazzoni +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +--- + Makefile.pre.in | 5 ++++- + configure.ac | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 2d067730633..a45a76cce45 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2336,7 +2336,6 @@ LIBSUBDIRS= asyncio \ + pathlib \ + re \ + site-packages \ +- sqlite3 \ + sysconfig \ + tkinter \ + tomllib \ +@@ -2500,6 +2499,10 @@ ifeq (@IDLE@,yes) + LIBSUBDIRS += idlelib idlelib/Icons + endif + ++ifeq (@SQLITE3@,yes) ++LIBSUBDIRS += sqlite3 ++endif ++ + TEST_MODULES=@TEST_MODULES@ + + .PHONY: libinstall +diff --git a/configure.ac b/configure.ac +index 6635aaa134d..8153b738b2f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4755,6 +4755,13 @@ AS_VAR_IF([posix_threads], [stub], [ + AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support]) + ]) + ++AC_SUBST(SQLITE3) ++AC_ARG_ENABLE(sqlite3, ++ AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]), ++ [ SQLITE3="${enableval}" ], [ SQLITE3=yes ]) ++AS_IF([test "$SQLITE3" = "no"], ++ [PY_STDLIB_MOD_SET_NA([_sqlite3])]) ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.50.1 + diff --git a/package/python3/0006-Add-an-option-to-disable-the-tk-module.patch b/package/python3/0006-Add-an-option-to-disable-the-tk-module.patch new file mode 100644 index 0000000..e67f06f --- /dev/null +++ b/package/python3/0006-Add-an-option-to-disable-the-tk-module.patch @@ -0,0 +1,87 @@ +From b53a2758ac431bc2493a460e6c886561e2397518 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:23:42 -0800 +Subject: [PATCH] Add an option to disable the tk module + +Upstream: N/A + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +[ Bernd Kuhls: ported to Python 3.11.4] +Signed-off-by: Bernd Kuhls +[ Adam Duskett: ported to Python 3.12.1 ] +Signed-off-by: Adam Duskett +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +[ Vincent Fazio: fix Python 3.13.3 conflict ] +Signed-off-by: Vincent Fazio +--- + Makefile.pre.in | 8 +++++--- + configure.ac | 7 +++++++ + 2 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index a45a76cce45..76d67ce7185 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2337,7 +2337,6 @@ LIBSUBDIRS= asyncio \ + re \ + site-packages \ + sysconfig \ +- tkinter \ + tomllib \ + turtledemo \ + unittest \ +@@ -2445,7 +2444,6 @@ TESTSUBDIRS= idlelib/idle_test \ + test/test_pydoc \ + test/test_pyrepl \ + test/test_sqlite3 \ +- test/test_tkinter \ + test/test_tomllib \ + test/test_tomllib/data \ + test/test_tomllib/data/invalid \ +@@ -2467,7 +2465,6 @@ TESTSUBDIRS= idlelib/idle_test \ + test/test_tools \ + test/test_tools/i18n_data \ + test/test_tools/msgfmt_data \ +- test/test_ttk \ + test/test_unittest \ + test/test_unittest/testmock \ + test/test_warnings \ +@@ -2489,6 +2486,11 @@ TESTSUBDIRS= idlelib/idle_test \ + test/xmltestdata/c14n-20 \ + test/zipimport_data + ++ifeq (@TK@,yes) ++LIBSUBDIRS += tkinter ++TESTSUBDIRS += test/test_tkinter test/test_ttk ++endif ++ + COMPILEALL_OPTS=-j0 + + ifeq (@PYDOC@,yes) +diff --git a/configure.ac b/configure.ac +index 8153b738b2f..0cf06a50c71 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4768,6 +4768,13 @@ AC_ARG_ENABLE(pydoc, + AS_HELP_STRING([--disable-pydoc], [disable pydoc]), + [ PYDOC="${enableval}" ], [ PYDOC=yes ]) + ++AC_SUBST(TK) ++AC_ARG_ENABLE(tk, ++ AS_HELP_STRING([--disable-tk], [disable tk]), ++ [ TK="${enableval}" ], [ TK=yes ]) ++AS_IF([test "$TK" = "no"], ++ [PY_STDLIB_MOD_SET_NA([_tkinter])]) ++ + # Check for enable-ipv6 + AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +-- +2.50.1 + diff --git a/package/python3/0007-Add-an-option-to-disable-the-curses-module.patch b/package/python3/0007-Add-an-option-to-disable-the-curses-module.patch new file mode 100644 index 0000000..05bb126 --- /dev/null +++ b/package/python3/0007-Add-an-option-to-disable-the-curses-module.patch @@ -0,0 +1,64 @@ +From baef276faa676d1b0faf64a91fa627b5f8fcc5e0 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:31:51 -0800 +Subject: [PATCH] Add an option to disable the curses module + +Upstream: N/A + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +--- + Makefile.pre.in | 5 ++++- + configure.ac | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 76d67ce7185..bfb6cb65354 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2322,7 +2322,6 @@ LIBSUBDIRS= asyncio \ + concurrent concurrent/futures \ + csv \ + ctypes ctypes/macholib \ +- curses \ + dbm \ + email email/mime \ + encodings \ +@@ -2491,6 +2490,10 @@ LIBSUBDIRS += tkinter + TESTSUBDIRS += test/test_tkinter test/test_ttk + endif + ++ifeq (@CURSES@,yes) ++LIBSUBDIRS += curses ++endif ++ + COMPILEALL_OPTS=-j0 + + ifeq (@PYDOC@,yes) +diff --git a/configure.ac b/configure.ac +index 0cf06a50c71..0895dc57808 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4762,6 +4762,13 @@ AC_ARG_ENABLE(sqlite3, + AS_IF([test "$SQLITE3" = "no"], + [PY_STDLIB_MOD_SET_NA([_sqlite3])]) + ++AC_SUBST(CURSES) ++AC_ARG_ENABLE(curses, ++ AS_HELP_STRING([--disable-curses], [disable curses]), ++ [ CURSES="${enableval}" ], [ CURSES=yes ]) ++AS_IF([test "$CURSES" = "no"], ++ [PY_STDLIB_MOD_SET_NA([_curses], [_curses_panel])]) ++ + AC_SUBST(PYDOC) + + AC_ARG_ENABLE(pydoc, +-- +2.50.1 + diff --git a/package/python3/0008-Add-an-option-to-disable-expat.patch b/package/python3/0008-Add-an-option-to-disable-expat.patch new file mode 100644 index 0000000..8f3143d --- /dev/null +++ b/package/python3/0008-Add-an-option-to-disable-expat.patch @@ -0,0 +1,87 @@ +From 2a7412e43554830ffbc831454de8df903e765b73 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:40:45 -0800 +Subject: [PATCH] Add an option to disable expat + +This patch replaces the existing --with-system-expat option with a +--with-expat={system,builtin,none} option, which allows to tell Python +whether we want to use the system expat (already installed), the expat +builtin the Python sources, or no expat at all (which disables the +installation of XML modules). + +Upstream: N/A + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +[ Vincent Fazio: ported to Python 3.13.2 ] +Signed-off-by: Vincent Fazio +--- + Makefile.pre.in | 5 ++++- + configure.ac | 24 +++++++++++++----------- + 2 files changed, 17 insertions(+), 12 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index bfb6cb65354..7a662ea4b32 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2342,7 +2342,6 @@ LIBSUBDIRS= asyncio \ + urllib \ + venv venv/scripts venv/scripts/common venv/scripts/posix \ + wsgiref \ +- $(XMLLIBSUBDIRS) \ + xmlrpc \ + zipfile zipfile/_path \ + zoneinfo \ +@@ -2508,6 +2507,10 @@ ifeq (@SQLITE3@,yes) + LIBSUBDIRS += sqlite3 + endif + ++ifeq (@EXPAT@,yes) ++LIBSUBDIRS += $(XMLLIBSUBDIRS) ++endif ++ + TEST_MODULES=@TEST_MODULES@ + + .PHONY: libinstall +diff --git a/configure.ac b/configure.ac +index 0895dc57808..34e4d5dd244 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4058,17 +4058,19 @@ LIBS="$withval $LIBS" + [AC_MSG_RESULT([no])]) + + # Check for use of the system expat library +-AC_MSG_CHECKING([for --with-system-expat]) +-AC_ARG_WITH( +- [system_expat], +- [AS_HELP_STRING( +- [--with-system-expat], +- [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)] +- )], [], [with_system_expat="no"]) +- +-AC_MSG_RESULT([$with_system_expat]) +- +-AS_VAR_IF([with_system_expat], [yes], [ ++AC_MSG_CHECKING(for --with-expat) ++AC_ARG_WITH(expat, ++ AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]), ++ [], ++ [with_expat="builtin"]) ++AC_MSG_RESULT($with_expat) ++AS_IF([test "$with_expat" != "none"], ++ [EXPAT=yes], ++ [PY_STDLIB_MOD_SET_NA([pyexpat]) ++ EXPAT=no]) ++AC_SUBST(EXPAT) ++ ++AS_VAR_IF([with_expat], [system], [ + LIBEXPAT_CFLAGS=${LIBEXPAT_CFLAGS-""} + LIBEXPAT_LDFLAGS=${LIBEXPAT_LDFLAGS-"-lexpat"} + LIBEXPAT_INTERNAL= +-- +2.50.1 + diff --git a/package/python3/make-host.sh b/package/python3/make-host.sh new file mode 100755 index 0000000..680a04e --- /dev/null +++ b/package/python3/make-host.sh @@ -0,0 +1,46 @@ +#!/usr/bin/bash +source $(dirname "$0")/../common.sh + +PKGNAME=python3 +PKGVERSION=3.13.7 +PKGSOURCE_DIR=python3 +PKGSOURCE=Python-3.13.7.tar.xz +PKGURL=https://python.org/ftp/python/3.13.7/Python-3.13.7.tar.xz + +PKGBUILDNAME=host-${PKGNAME} +PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION} + +echo "----> Building ${PKGBUILDNAME} ..." + +stamp_downloaded + +step_start extract +mkdir -p ${PKGBUILD_DIR} +xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf - +chmod -R +rw ${PKGBUILD_DIR} +step_end extract + +step_start patch +TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch +step_end patch autotools ignore_libtool_patch + +step_start configure +echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring" +cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i --include=${HOST_DIR}/share/autoconf-archive" +patch_libtool ${PKGBUILD_DIR} +(cd ${PKGBUILD_DIR} && rm -rf config.cache; eval "${HOST_CONFIGURE_OPTS} LDFLAGS=\"-L${HOST_DIR}/lib -Wl,-rpath,${HOST_DIR}/lib -Wl,--enable-new-dtags\" py_cv_module_unicodedata=yes py_cv_module__codecs_cn=n/a py_cv_module__codecs_hk=n/a py_cv_module__codecs_iso2022=n/a py_cv_module__codecs_jp=n/a py_cv_module__codecs_kr=n/a py_cv_module__codecs_tw=n/a py_cv_module__uuid=n/a py_cv_module_nis=n/a py_cv_module_ossaudiodev=n/a py_cv_module__bz2=n/a py_cv_module__lzma=n/a py_cv_module__hashlib=n/a py_cv_module__ssl=n/a CONFIG_SITE=/dev/null ./configure --prefix=\"${HOST_DIR}\" --sysconfdir=\"${HOST_DIR}/etc\" --localstatedir=\"${HOST_DIR}/var\" --enable-shared --disable-static --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls --disable-dependency-tracking --without-ensurepip --without-cxx-main --disable-sqlite3 --disable-tk --with-expat=system --disable-test-modules --disable-idle3 --disable-curses") +step_end configure + +step_start build +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}" +step_end build + +step_start install-host +eval "${HOST_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} install -C ${PKGBUILD_DIR}" +ln -fs python3 ${HOST_DIR}/bin/python +ln -fs python3-config ${HOST_DIR}/bin/python-config +step_end install-host + +stamp_installed + +echo "<---- ${PKGBUILDNAME} build complete." diff --git a/package/python3/make.sh b/package/python3/make.sh new file mode 100755 index 0000000..d8a3253 --- /dev/null +++ b/package/python3/make.sh @@ -0,0 +1,54 @@ +#!/usr/bin/bash +source $(dirname "$0")/../common.sh + +PKGNAME=python3 +PKGVERSION=3.13.7 +PKGSOURCE_DIR=python3 +PKGSOURCE=Python-3.13.7.tar.xz +PKGURL=https://python.org/ftp/python/3.13.7/Python-3.13.7.tar.xz + +PKGBUILDNAME=${PKGNAME} +PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION} + +echo "----> Building ${PKGBUILDNAME} ..." + +stamp_downloaded + +step_start extract +mkdir -p ${PKGBUILD_DIR} +xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf - +chmod -R +rw ${PKGBUILD_DIR} +step_end extract + +step_start patch +TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch +step_end patch autotools ignore_libtool_patch + +step_start configure +echo ">>> ${PKGBUILDNAME} ${PKGVERSION} Autoreconfiguring" +cd ${PKGBUILD_DIR} && eval "AUTOPOINT=/bin/true ${AUTORECONF_OPTS} ${HOST_DIR}/bin/autoreconf -f -i --include=${HOST_DIR}/share/autoconf-archive" +patch_libtool ${PKGBUILD_DIR} +(cd ${PKGBUILD_DIR} && rm -rf config.cache && eval "${TARGET_CONFIGURE_OPTS} CXX=no ac_cv_lbl_unaligned_fail=yes ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_memcmp_working=yes ac_cv_have_decl_malloc=yes gl_cv_func_malloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ac_cv_func_calloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes lt_cv_sys_lib_search_path_spec=\"\" ac_cv_c_bigendian=no py_cv_module__dbm=n/a py_cv_module__decimal=n/a py_cv_module__hashlib=n/a py_cv_module__ssl=n/a py_cv_module__codecs_cn=n/a py_cv_module__codecs_hk=n/a py_cv_module__codecs_iso2022=n/a py_cv_module__codecs_jp=n/a py_cv_module__codecs_kr=n/a py_cv_module__codecs_tw=n/a py_cv_module__uuid=n/a py_cv_module__bz2=n/a py_cv_module__lzma=n/a py_cv_module_zlib=n/a py_cv_module_ossaudiodev=n/a ac_cv_have_long_long_format=yes ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=yes ac_cv_working_tzset=yes py_cv_module_nis=n/a ac_cv_little_endian_double=yes CFLAGS=\"-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_FORTIFY_SOURCE=1\" CONFIG_SITE=/dev/null ./configure --target=${GNU_TARGET_NAME} --host=${GNU_TARGET_NAME} --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix=\"\" --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --disable-nls --disable-static --enable-shared --disable-lib2to3 --without-readline --with-expat=none --disable-sqlite3 --without-ensurepip --without-cxx-main --with-build-python=${HOST_DIR}/bin/python3 --with-system-ffi --disable-pydoc --disable-test-modules --disable-tk --disable-idle3 --disable-pyc-build") +step_end configure + +step_start build +eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}" +step_end build + +step_start install-staging +eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${STAGING_DIR} install -C ${PKGBUILD_DIR}" +step_end install-staging + +step_start install-target +eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${TARGET_DIR} install -C ${PKGBUILD_DIR}" +rm -f ${TARGET_DIR}/usr/bin/python3.13-config +rm -f ${TARGET_DIR}/usr/bin/python3-config +find ${TARGET_DIR}/usr/lib/python3.13/config-3.13*/ -depth -type f -not -name Makefile -exec rm -rf {} \; +find ${TARGET_DIR}/usr/lib/python3.13/ -depth -type d -name __pycache__ -exec rm -rf {} \; +chmod u+w ${TARGET_DIR}/usr/lib/libpython3.13*.so +ln -fs python3 ${TARGET_DIR}/usr/bin/python +step_end install-target + +stamp_installed + +echo "<---- ${PKGBUILDNAME} build complete." diff --git a/package/rootfs-ext2/make.sh b/package/rootfs-ext2/make.sh index b4f5a65..de71b96 100755 --- a/package/rootfs-ext2/make.sh +++ b/package/rootfs-ext2/make.sh @@ -1,7 +1,7 @@ #!/usr/bin/bash source $(dirname "$0")/../common.sh -ROOTFS_EXT2_SIZE=60M +ROOTFS_EXT2_SIZE=128M echo ">>> Generating root filesystems common tables" rm -rf ${BUILD_DIR}/buildroot-fs @@ -64,6 +64,7 @@ echo ${QEMU_CMD} > ${IMAGES_DIR}/start-qemu.sh chmod +x ${IMAGES_DIR}/start-qemu.sh # 如果是 initramfs 启动,在构建出 initrd.img 后可以采用如下 -QEMU_CMD_INITRAMFS="qemu-system-riscv64 -M virt -m 256M -nographic -bios fw_jump.bin -kernel Image -initrd initrd.img -append \"nokaslr rdinit=/sbin/init console=ttyS0\" -netdev user,id=net0 -device virtio-net-device,netdev=net0" +# 注意这里使用 512M 内存启动,否则可能会因为内存不足导致启动失败:"Initramfs unpacking failed: write error" +QEMU_CMD_INITRAMFS="qemu-system-riscv64 -M virt -m 512M -nographic -bios fw_jump.bin -kernel Image -initrd initrd.img -append \"nokaslr rdinit=/sbin/init console=ttyS0\" -netdev user,id=net0 -device virtio-net-device,netdev=net0" echo ${QEMU_CMD_INITRAMFS} > ${IMAGES_DIR}/start-qemu-initramfs.sh chmod +x ${IMAGES_DIR}/start-qemu-initramfs.sh diff --git a/package/snake/make.sh b/package/snake/make.sh new file mode 100755 index 0000000..cec91bb --- /dev/null +++ b/package/snake/make.sh @@ -0,0 +1,32 @@ +#!/usr/bin/bash +source $(dirname "$0")/../common.sh + +PKGNAME=snake +PKGVERSION= +PKGSOURCE_DIR= +PKGSOURCE= + +PKGBUILDNAME=${PKGNAME} +PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME} + +echo "----> Building ${PKGBUILDNAME} ..." + +stamp_downloaded + +stamp_extracted + +stamp_patched + +stamp_configured + +stamp_built + +step_start install-target +# 传统上用于存放用户游戏的可执行文件(系统安装的游戏)。 +mkdir -p ${TARGET_DIR}/usr/games +cp ${PROJECT_DIR}/package/${PKGNAME}/snake.py ${TARGET_DIR}/usr/games/ +step_end install-target + +stamp_installed + +echo "<---- ${PKGBUILDNAME} build complete." diff --git a/package/snake/snake.py b/package/snake/snake.py new file mode 100644 index 0000000..562358d --- /dev/null +++ b/package/snake/snake.py @@ -0,0 +1,164 @@ +# https://gist.github.com/darkSasori/b8f7acbc54e45fe3ac3b5a26e1715a90 + +""" +这个代码实现了一个经典的贪吃蛇游戏。 +使用 curses 库在终端中创建图形界面。 +游戏支持方向键控制蛇的移动,空格键暂停,ESC 键退出。 +蛇可以穿过边界,吃到食物会变长并得分,撞到自己身体游戏结束。 +""" +import time +import curses +from curses import KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN +from random import randint + +WIDTH = 60 +HEIGHT = 20 + +def walk_left(snake): + snake.insert(0, [snake[0][0], snake[0][1]-1]) + if snake[0][1] <= 1: snake[0][1] = WIDTH - 1 + return snake + + +def walk_right(snake): + snake.insert(0, [snake[0][0], snake[0][1]+1]) + if snake[0][1] >= WIDTH - 1: snake[0][1] = 1 + return snake + + +def walk_up(snake): + snake.insert(0, [snake[0][0] -1, snake[0][1]]) + if snake[0][0] <= 0: snake[0][0] = 18 + return snake + + +def walk_down(snake): + snake.insert(0, [snake[0][0] +1, snake[0][1]]) + if snake[0][0] >= HEIGHT - 1: snake[0][0] = 1 + return snake + + +def generate_food(snake): + food = [] + while food == []: + food = [randint(1, HEIGHT - 2), randint(1, WIDTH - 2)] + if food in snake[1:]: food = [] + return food + + +def draw_snake(screen, snake, remove_last = True): + # 绘制蛇头为'O' + screen.addstr(snake[0][0], snake[0][1], 'O') + # 绘制蛇身为'#' + for segment in snake[1:]: + screen.addstr(segment[0], segment[1], '#') + + if remove_last == False: return snake + last = snake.pop() + screen.addstr(last[0], last[1], ' ') + return snake + + +def main(screen): + #curses.curs_set(0) + try: + curses.curs_set(0) # Try to make cursor invisible + except curses.error: + # Terminal doesn't support cursor visibility changes + # The cursor will remain visible, but your program can continue + pass + screen.clear() + screen.nodelay(1) + screen.keypad(1) + screen.timeout(150) + screen.border(0) + + direction_functions = { + KEY_LEFT: walk_left, + KEY_RIGHT: walk_right, + KEY_UP: walk_up, + KEY_DOWN: walk_down + } + + score = 0 + snake = [[4,4],[4,3],[4,2]] + food = generate_food(snake) + direction = KEY_RIGHT + paused = False + + while True: + screen.border(0) + event = screen.getch() + if event == 27: + break + + if event == 32: + paused = False if paused else True + + if paused: + screen.addstr(0, 1, 'Paused') + continue + + if event in [KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN]: + direction = event + + snake = direction_functions[direction](snake) + if snake[0] in snake[1:]: + break + + screen.addstr(0, 1, 'Score: {}'.format(score)) + snake = draw_snake(screen, snake, snake[0] != food) + + if snake[0] == food: + food = generate_food(snake) + score = score + 1 + + screen.addstr(food[0], food[1], '*') + + return score + +def show_intro(): + """在控制台中显示游戏介绍和开始提示""" + print("\n" + "="*60) + print(" " * 20 + "SNAKE GAME") + print("="*60) + print("\nWelcome to the classic Snake game!") + print("\nControl the snake using arrow keys:") + print(" - UP, DOWN, LEFT, RIGHT") + print("\nRules:") + print(" - Guide the snake to eat the food (*)") + print(" - Each food increases your score by 1") + print(" - The snake grows longer when it eats") + print(" - Game ends if the snake hits itself") + print(" - Snake can pass through walls") + print("\nControls:") + print(" - SPACE: Pause/Resume game") + print(" - ESC: Quit game") + + # 等待用户输入 + while True: + print("\nDo you want to start the game? [Y/n]: ", end="") + try: + key = input().strip().lower() + if key == "" or key == "y": # 回车或输入 y 都确认开始 + return True + elif key == "n": + return False + else: + print("Please enter 'y' for yes or 'n' for no.") + except (EOFError, KeyboardInterrupt): + return False + +if __name__ == '__main__': + if not show_intro(): + print("Game cancelled.") + exit(0) + + curses.initscr() + win = curses.newwin(HEIGHT, WIDTH, 0, 0) + score = main(win) + curses.endwin() + print("\n" + "="*60) + print('GAME OVER!') + print('Congratulations, your score is: {}'.format(score)) + print("="*60) \ No newline at end of file diff --git a/package/target-finalize/make.sh b/package/target-finalize/make.sh index 758145c..2c94ad5 100755 --- a/package/target-finalize/make.sh +++ b/package/target-finalize/make.sh @@ -3,6 +3,8 @@ source $(dirname "$0")/../common.sh PKGNAME=target-finalize +PYTHON3_BUILD_DIR=${BUILD_DIR}/python3-3.13.7 + mkdir -p ${TARGET_DIR}/etc echo ">>> Installing ifupdown-scripts" @@ -28,6 +30,9 @@ if grep -q CONFIG_HUSH=y ${BUILD_DIR}/busybox-1.37.0/.config; then grep -qsE '^/ grep -qsE '^/bin/sh$' ${TARGET_DIR}/etc/shells || echo "/bin/sh" >> ${TARGET_DIR}/etc/shells grep -qsE '^/bin/bash$' ${TARGET_DIR}/etc/shells || echo "/bin/bash" >> ${TARGET_DIR}/etc/shells ln -sf bash ${TARGET_DIR}/bin/sh +PYTHONPATH="${STAGING_DIR}/usr/lib/python3.13/" ${HOST_DIR}/bin/python3.13 ${PYTHON3_BUILD_DIR}/Lib/compileall.py -b -s ${TARGET_DIR} -p / ${TARGET_DIR}/usr/lib/python3.13 +find ${TARGET_DIR}/usr/lib/python3.13 -name '*.py' -print0 | xargs -0 --no-run-if-empty rm -f +find ${TARGET_DIR}/usr/lib/python3.13 -name '*.opt-1.pyc' -print0 -o -name '*.opt-2.pyc' -print0 | xargs -0 --no-run-if-empty rm -f echo "buildlinux" > ${TARGET_DIR}/etc/hostname /usr/bin/sed -i -e '$a \127.0.1.1\tbuildlinux' -e '/^127.0.1.1/d' ${TARGET_DIR}/etc/hosts echo "Welcome to Build Linux System From Scratch" > ${TARGET_DIR}/etc/issue diff --git a/source.sh b/source.sh index 3edf5e1..5b34397 100755 --- a/source.sh +++ b/source.sh @@ -35,3 +35,7 @@ export ONLY_DOWNLOAD=y ./package/readline/make.sh || exit 1 ./package/bash/make.sh || exit 1 ./package/vim/make.sh || exit 1 +./package/libffi/make.sh || exit 1 +./package/autoconf-archive/make-host.sh || exit 1 +./package/expat/make-host.sh || exit 1 +./package/python3/make-host.sh || exit 1