changeset 1300:54eb69996f73

python/python: improve our FHS
author David Demelier <markand@malikania.fr>
date Thu, 11 Nov 2021 14:34:32 +0100
parents 52a393cf8949
children c842a9702bdd
files python/python/patch-fhs.patch python/python/python.sh
diffstat 2 files changed, 53 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/python/patch-fhs.patch	Thu Nov 11 14:34:32 2021 +0100
@@ -0,0 +1,28 @@
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -142,9 +142,9 @@
+ LIBDIR=		@libdir@
+ MANDIR=		@mandir@
+ INCLUDEDIR=	@includedir@
+-CONFINCLUDEDIR=	$(exec_prefix)/include
++CONFINCLUDEDIR=	@includedir@
+ PLATLIBDIR=	@PLATLIBDIR@
+-SCRIPTDIR=	$(prefix)/$(PLATLIBDIR)
++SCRIPTDIR=	/$(PLATLIBDIR)
+ ABIFLAGS=	@ABIFLAGS@
+ # Variable used by ensurepip
+ WHEEL_PKG_DIR=	@WHEEL_PKG_DIR@
+--- a/configure.ac
++++ b/configure.ac
+@@ -4857,9 +4857,9 @@
+ dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
+ AC_SUBST(PY_ENABLE_SHARED)
+ if test x$PLATFORM_TRIPLET = x; then
+-  LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
++  LIBPL="/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}"
+ else
+-  LIBPL='$(prefix)'"/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
++  LIBPL="/${PLATLIBDIR}/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+ fi
+ AC_SUBST(LIBPL)
+ 
--- a/python/python/python.sh	Thu Nov 11 13:01:01 2021 +0100
+++ b/python/python/python.sh	Thu Nov 11 14:34:32 2021 +0100
@@ -21,18 +21,28 @@
 PKGLICENSE="PSF-2.0"
 PKGSUMMARY="high-level scripting language"
 PKGDOWNLOAD="https://www.python.org/ftp/python/$PKGVERSION/Python-$PKGVERSION.tar.xz"
-PKGDEPENDS="bzip2 gdbm libffi expat zlib libressl xz"
-PKGOPTIONS="IPV6"
+PKGDEPENDS="autoconf-archive:build bzip2 gdbm libffi expat zlib libressl xz"
+PKGOPTIONS="COMPLETION IPV6"
 
 : ${CHOST:=$(uname -m)-linux-musl}
 : ${CBUILD:=$(uname -m)-linux-musl}
 : ${CTARGET:=$(uname -m)-linux-musl}
 : ${CC:=clang}
 : ${CFLAGS:=-O2}
+: ${CXX:=clang++}
+: ${CXXFLAGS:=-O2}
 : ${LDFLAGS:=}
 : ${LIBS:=}
+: ${COMPLETION:=yes}
 : ${IPV6:=yes}
 
+if [ "$COMPLETION" = "yes" ]; then
+	PKGDEPENDS="libedit $PKGDEPENDS"
+	with_completion="--with-readline=editline"
+else
+	with_completion="--without-readline"
+fi
+
 if [ "$IPV6" = "yes" ]; then
 	with_ipv6="--enable-ipv6"
 else
@@ -45,19 +55,31 @@
 	tar -xvf Python-$PKGVERSION.tar.xz
 	cd Python-$PKGVERSION
 
+	patch -p1 < ../patch-fhs.patch
+	autoreconf -vif
 	CC="$CC" \
 	CFLAGS="$CFLAGS" \
+	CXX="$CXX" \
 	LDFLAGS="$LDFLAGS" \
 	LIBS="$LIBS" \
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
 		--target=$CTARGET \
-		--prefix=/. \
+		--prefix=/ \
+		--exec-prefix=/ \
+		--bindir=/bin \
+		--datadir=/share \
+		--datarootdir=/share \
+		--includedir=/include \
+		--libdir=/lib \
+		--mandir=/share/man \
+		--sbindir=/bin \
 		--enable-shared \
 		--with-system-expat \
 		--with-system-ffi \
 		--without-ensurepip \
+		$with_completion \
 		$with_ipv6
 	make
 	make DESTDIR=$DESTDIR install maninstall