Skip to content

Commit

Permalink
new pkgs to gpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxython committed Oct 10, 2023
1 parent b7a8c1e commit 93738b7
Show file tree
Hide file tree
Showing 17 changed files with 400 additions and 0 deletions.
28 changes: 28 additions & 0 deletions gpkg-disabled/python/Makefile.pre.in.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- Python-3.12.0/Makefile.pre.in 2023-10-02 14:48:14.000000000 +0300
+++ Python-3.12.0/Makefile.pre.in.patch 2023-10-08 22:14:41.535861772 +0300
@@ -613,11 +613,11 @@

.PHONY: build_all
build_all: check-clean-src $(BUILDPYTHON) platform sharedmods \
- gdbhooks Programs/_testembed scripts checksharedmods rundsymutil
+ gdbhooks Programs/_testembed scripts rundsymutil

.PHONY: build_wasm
build_wasm: check-clean-src $(BUILDPYTHON) platform sharedmods \
- python-config checksharedmods
+ python-config

# Check that the source is clean when building out of source.
.PHONY: check-clean-src
@@ -987,11 +987,6 @@
fi; \
done

-# dependency on BUILDPYTHON ensures that the target is run last
-.PHONY: checksharedmods
-checksharedmods: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON)
- @$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/Tools/build/check_extension_modules.py
-
.PHONY: rundsymutil
rundsymutil: sharedmods $(PYTHON_FOR_BUILD_DEPS) $(BUILDPYTHON)
@if [ ! -z $(DSYMUTIL) ] ; then \
51 changes: 51 additions & 0 deletions gpkg-disabled/python/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
TERMUX_PKG_HOMEPAGE=https://www.python.org/
TERMUX_PKG_DESCRIPTION="The Python programming language"
TERMUX_PKG_LICENSE="custom"
TERMUX_PKG_LICENSE_FILE="LICENSE"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=3.12.0
_MAJOR_VERSION="${TERMUX_PKG_VERSION%.*}"
TERMUX_PKG_SRCURL=https://www.python.org/ftp/python/${TERMUX_PKG_VERSION%rc*}/Python-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=795c34f44df45a0e9b9710c8c71c15c671871524cd412ca14def212e8ccb155d
TERMUX_PKG_DEPENDS="libbz2-glibc, libexpat-glibc, gdbm-glibc, libffi-glibc, libnsl-glibc, libxcrypt-glibc, openssl-glibc, zlib-glibc"
TERMUX_PKG_BUILD_DEPENDS="sqlite-glibc, mpdecimal-glibc"
TERMUX_PKG_PROVIDES="python3-glibc"
TERMUX_PKG_BUILD_IN_SRC=true

termux_step_pre_configure() {
rm -rf Modules/expat
rm -rf Modules/_decimal/libmpdec

export CFLAGS="${CFLAGS/-O2/-O3}"
}

termux_step_configure() {
./configure --prefix=${TERMUX_PREFIX} \
--host=${TERMUX_HOST_PLATFORM} \
--build=${TERMUX_HOST_PLATFORM} \
--target=${TERMUX_HOST_PLATFORM} \
--enable-shared \
--with-computed-gotos \
--without-lto \
--enable-ipv6 \
--with-system-expat \
--with-dbmliborder=gdbm:ndbm \
--with-system-libmpdec \
--enable-loadable-sqlite-extensions \
--without-ensurepip \
LN='ln -s'
}

termux_step_make_install() {
make install

ln -sf python3 ${TERMUX_PREFIX}/bin/python
ln -sf python3-config ${TERMUX_PREFIX}/bin/python-config
ln -sf idle3 ${TERMUX_PREFIX}/bin/idle
ln -sf pydoc3 ${TERMUX_PREFIX}/bin/pydoc
ln -sf python${_MAJOR_VERSION}.1 ${TERMUX_PREFIX}/share/man/man1/python.1

install -dm755 ${TERMUX_PREFIX}/lib/python${_MAJOR_VERSION}/Tools/{i18n,scripts}
install -m755 Tools/i18n/{msgfmt,pygettext}.py ${TERMUX_PREFIX}/lib/python${_MAJOR_VERSION}/Tools/i18n/
install -m755 Tools/scripts/{README,*py} ${TERMUX_PREFIX}/lib/python${_MAJOR_VERSION}/Tools/scripts/
}
90 changes: 90 additions & 0 deletions gpkg-disabled/python/setdirs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
diff --git a/Lib/aifc.py b/Lib/aifc.py
index 5254987..1a67752 100644
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -961,7 +961,7 @@ def open(f, mode=None):
if __name__ == '__main__':
import sys
if not sys.argv[1:]:
- sys.argv.append('/usr/demos/data/audio/bach.aiff')
+ sys.argv.append('@TERMUX_PREFIX@/demos/data/audio/bach.aiff')
fn = sys.argv[1]
with open(fn, 'r') as f:
print("Reading", fn)
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 0c2510e..8c78013 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -209,7 +209,7 @@ elif os.name == "posix":
expr = os.fsencode(expr)

try:
- proc = subprocess.Popen(('/sbin/ldconfig', '-r'),
+ proc = subprocess.Popen(('@TERMUX_PREFIX@/bin/ldconfig', '-r'),
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)
except OSError: # E.g. command not found
diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py
index f6c43b3..b573915 100644
--- a/Lib/mimetypes.py
+++ b/Lib/mimetypes.py
@@ -55,6 +55,7 @@ knownfiles = [
"/usr/local/lib/netscape/mime.types",
"/usr/local/etc/httpd/conf/mime.types", # Apache 1.2
"/usr/local/etc/mime.types", # Apache 1.3
+ "@TERMUX_PREFIX@/etc/mime.types",
]

inited = False
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 5b4d78b..89f7ee6 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -18,7 +18,7 @@ pardir = '..'
extsep = '.'
sep = '/'
pathsep = ':'
-defpath = '/bin:/usr/bin'
+defpath = '@TERMUX_PREFIX@/bin'
altsep = None
devnull = '/dev/null'

diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 6df5dd5..1624442 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1809,8 +1809,7 @@ class Popen:

if shell:
# On Android the default shell is at '/system/bin/sh'.
- unix_shell = ('/system/bin/sh' if
- hasattr(sys, 'getandroidapilevel') else '/bin/sh')
+ unix_shell = ('@TERMUX_PREFIX@/bin/sh')
args = [unix_shell, "-c"] + args
if executable:
args[0] = executable
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 480c172..989c615 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -170,7 +170,7 @@ def _candidate_tempdir_list():
_os.path.expandvars(r'%SYSTEMROOT%\Temp'),
r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
else:
- dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])
+ dirlist.extend([ '@TERMUX_PREFIX_CLASSICAL@/tmp' ])

# As a last resort, the current directory.
try:
diff --git a/Lib/uuid.py b/Lib/uuid.py
index e863b63..3cbd75b 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -362,7 +362,6 @@ def _get_command_stdout(command, *args):

try:
path_dirs = os.environ.get('PATH', os.defpath).split(os.pathsep)
- path_dirs.extend(['/sbin', '/usr/sbin'])
executable = shutil.which(command, path=os.pathsep.join(path_dirs))
if executable is None:
return None
23 changes: 23 additions & 0 deletions gpkg/libdb/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
TERMUX_PKG_HOMEPAGE=https://www.oracle.com/database/berkeley-db
TERMUX_PKG_DESCRIPTION="The Berkeley DB embedded database system (library)"
TERMUX_PKG_LICENSE="AGPL-V3"
# We override TERMUX_PKG_SRCDIR termux_step_pre_configure so need to do
# this hack to be able to find the license file.
TERMUX_PKG_LICENSE_FILE="../LICENSE"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=18.1.40
TERMUX_PKG_SRCURL=https://fossies.org/linux/misc/db-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=0cecb2ef0c67b166de93732769abdeba0555086d51de1090df325e18ee8da9c8
TERMUX_PKG_DEPENDS="gcc-libs-glibc, bash-glibc"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--enable-compat185
--enable-shared
--enable-static
--enable-cxx
--enable-dbm
--enable-stl
"

termux_step_pre_configure() {
TERMUX_PKG_SRCDIR=$TERMUX_PKG_SRCDIR/dist
}
2 changes: 2 additions & 0 deletions gpkg/libdb/db.subpackage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TERMUX_SUBPKG_INCLUDE="glibc/bin/"
TERMUX_SUBPKG_DESCRIPTION="The Berkeley DB embedded database system"
16 changes: 16 additions & 0 deletions gpkg/libdb/fix-tmpdir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff -uNr db-6.2.32/src/os/os_tmpdir.c db-6.2.32.mod/src/os/os_tmpdir.c
--- db-6.2.32/src/os/os_tmpdir.c 2017-04-13 17:06:21.000000000 +0300
+++ db-6.2.32.mod/src/os/os_tmpdir.c 2019-03-02 02:06:03.557665103 +0200
@@ -125,9 +125,9 @@
DB_TEMP_DIRECTORY("C:/temp");
DB_TEMP_DIRECTORY("C:/tmp");
#else
- DB_TEMP_DIRECTORY("/var/tmp");
- DB_TEMP_DIRECTORY("/usr/tmp");
- DB_TEMP_DIRECTORY("/tmp");
+ DB_TEMP_DIRECTORY("@TERMUX_PREFIX@/var/tmp");
+ DB_TEMP_DIRECTORY("@TERMUX_PREFIX_CLASSICAL@/usr/tmp");
+ DB_TEMP_DIRECTORY("@TERMUX_PREFIX_CLASSICAL@/tmp");
#if defined(ANDROID) || defined(DB_ANDROID)
DB_TEMP_DIRECTORY("/cache");
#endif
12 changes: 12 additions & 0 deletions gpkg/libdb/no-install-docs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -uNr db-18.1.40/dist/Makefile.in db-18.1.40.mod/dist/Makefile.in
--- db-18.1.40/dist/Makefile.in 2020-05-29 20:58:22.000000000 +0300
+++ db-18.1.40.mod/dist/Makefile.in 2020-06-26 02:52:37.740818006 +0300
@@ -1215,7 +1215,7 @@
# Library and standard utilities install.
##################################################
library_install: install_setup
-library_install: install_include install_lib install_utilities @ADDITIONAL_INSTALL@ install_docs
+library_install: install_include install_lib install_utilities @ADDITIONAL_INSTALL@

uninstall: uninstall_include uninstall_lib uninstall_utilities @ADDITIONAL_UNINSTALL@ uninstall_docs

8 changes: 8 additions & 0 deletions gpkg/libedit/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
TERMUX_PKG_HOMEPAGE=https://thrysoee.dk/editline/
TERMUX_PKG_DESCRIPTION="Library providing line editing, history, and tokenization functions"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=20230828-3.1
TERMUX_PKG_SRCURL=https://thrysoee.dk/editline/libedit-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=4ee8182b6e569290e7d1f44f0f78dac8716b35f656b76528f699c69c98814dad
TERMUX_PKG_DEPENDS="ncurses-glibc"
11 changes: 11 additions & 0 deletions gpkg/libedit/readline.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- libedit-20230828-3.1/src/readline.c 2023-08-27 10:31:37.000000000 +0300
+++ libedit-20230828-3.1/src/readline.c.patch 2023-10-08 22:56:32.815860814 +0300
@@ -1281,7 +1281,7 @@
return max_input_history != INT_MAX;
}

-static const char _history_tmp_template[] = "/tmp/.historyXXXXXX";
+static const char _history_tmp_template[] = "@TERMUX_PREFIX_CLASSICAL@/tmp/.historyXXXXXX";

int
history_truncate_file (const char *filename, int nlines)
11 changes: 11 additions & 0 deletions gpkg/libedit/vi.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- libedit-20230828-3.1/src/vi.c 2021-09-10 19:39:30.000000000 +0300
+++ libedit-20230828-3.1/src/vi.c.patch 2023-10-08 22:55:29.445860838 +0300
@@ -1004,7 +1004,7 @@
pid_t pid;
ssize_t st;
int status;
- char tempfile[] = "/tmp/histedit.XXXXXXXXXX";
+ char tempfile[] = "@TERMUX_PREFIX_CLASSICAL@/tmp/histedit.XXXXXXXXXX";
char *cp = NULL;
size_t len;
wchar_t *line = NULL;
16 changes: 16 additions & 0 deletions gpkg/mpdecimal/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
TERMUX_PKG_HOMEPAGE=https://www.bytereef.org/mpdecimal/index.html
TERMUX_PKG_DESCRIPTION="Package for correctly-rounded arbitrary precision decimal floating point arithmetic"
TERMUX_PKG_LICENSE="BSD"
TERMUX_PKG_MAINTAINER="@termux-pacman"
TERMUX_PKG_VERSION=2.5.1
TERMUX_PKG_SRCURL=https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=9f9cd4c041f99b5c49ffb7b59d9f12d95b683d88585608aa56a6307667b2b21f
TERMUX_PKG_DEPENDS="gcc-libs-glibc"
TERMUX_PKG_BUILD_IN_SRC=true

termux_step_pre_configure() {
if [ "$TERMUX_ARCH" = "i686" ]; then
# error of ld: undefined reference to `__stack_chk_fail_local'
LDFLAGS+=" -lc"
fi
}
11 changes: 11 additions & 0 deletions gpkg/mpdecimal/configure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/configure 2023-10-07 21:14:22.595827945 +0300
+++ src/configure.patch 2023-10-07 21:20:05.875827814 +0300
@@ -2695,7 +2695,7 @@
LIBNAME="libmpdec.so"
LIBSONAME="libmpdec.so.3"
LIBSHARED="libmpdec.so.2.5.1"
- CONFIGURE_LDFLAGS="-shared -Wl,-soname,$LIBSONAME"
+ CONFIGURE_LDFLAGS="-shared -soname $LIBSONAME"
;;
esac

10 changes: 10 additions & 0 deletions gpkg/perl/Configure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- src/Configure 2023-06-02 04:12:22.000000000 +0300
+++ src/Configure.patch 2023-10-09 10:27:43.280935150 +0300
@@ -3534,7 +3534,6 @@
case "$3" in
*) osvers="$3" ;;
esac
- $test -f /system/lib/libandroid.so && osname=linux-android
;;
MiNT) osname=mint
;;
65 changes: 65 additions & 0 deletions gpkg/perl/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
TERMUX_PKG_HOMEPAGE=https://www.perl.org/
TERMUX_PKG_DESCRIPTION="Capable, feature-rich programming language"
TERMUX_PKG_LICENSE="Artistic-License-2.0"
TERMUX_PKG_MAINTAINER="@termux-pacman"
# Packages which should be rebuilt after version change:
# - exiftool
# - irssi
# - libapt-pkg-perl
# - libregexp-assemble-perl
# - psutils
# - subversion
TERMUX_PKG_VERSION=5.38.0
_MAJOR_VERSION="${TERMUX_PKG_VERSION%.*}"
TERMUX_PKG_SRCURL=https://www.cpan.org/src/5.0/perl-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=eca551caec3bc549a4e590c0015003790bdd1a604ffe19cc78ee631d51f7072e
TERMUX_PKG_DEPENDS="gdbm-glibc, libdb-glibc, glibc, libxcrypt-glibc"
TERMUX_PKG_BUILD_DEPENDS="binutils-glibc"
TERMUX_MAKE_PROCESSES=1
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_RM_AFTER_INSTALL="bin/perl${TERMUX_PKG_VERSION}"

termux_step_configure() {
./Configure \
-Darchname=$TERMUX_HOST_PLATFORM \
-Dcc=$CC -Dranlib=$RANLIB -Dld=$TERMUX_PREFIX/bin/ld -Dar=$AR \
-Dlocincpth=$TERMUX_PREFIX/include \
-Dloclibpth=$TERMUX_PREFIX/lib \
-Dglibpth=$TERMUX_PREFIX/lib \
-Dxlibpth=$TERMUX_PREFIX/lib \
-Dplibpth=$TERMUX_PREFIX/lib \
-Dlibpth=$TERMUX_PREFIX/lib \
-Dsh=$TERMUX_PREFIX/bin/sh \
-des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \
-Dprefix=$TERMUX_PREFIX -Dvendorprefix=$TERMUX_PREFIX \
-Dprivlib=$TERMUX_PREFIX/share/perl5 \
-Darchlib=$TERMUX_PREFIX/lib/perl5/$_MAJOR_VERSION \
-Dsitelib=$TERMUX_PREFIX/share/perl5 \
-Dsitearch=$TERMUX_PREFIX/lib/perl5/$_MAJOR_VERSION \
-Dvendorlib=$TERMUX_PREFIX/share/perl5 \
-Dvendorarch=$TERMUX_PREFIX/lib/perl5/$_MAJOR_VERSION \
-Dscriptdir=$TERMUX_PREFIX/bin \
-Dsitescript=$TERMUX_PREFIX/bin \
-Dvendorscript=$TERMUX_PREFIX/bin \
-Dinc_version_list=none \
-Dman1ext=1perl -Dman3ext=3perl \
-Dosname=linux \
-Dlddlflags="-shared ${LDFLAGS}" -Dldflags="${LDFLAGS}"
}

termux_step_post_make_install() {
(
cd $TERMUX_PREFIX/share/man/man1
rm perlbug.1perl
ln -s perlthanks.1perl perlbug.1perl
)

sed -e '/^man1ext=/ s/1perl/1p/' -e '/^man3ext=/ s/3perl/3pm/' \
-e "/^cf_email=/ s/'.*'/''/" \
-e "/^perladmin=/ s/'.*'/''/" \
-i "${TERMUX_PREFIX}/lib/perl5/$_MAJOR_VERSION/Config_heavy.pl"

sed -e '/(makepl_arg =>/ s/""/"INSTALLDIRS=site"/' \
-e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
-i "${TERMUX_PREFIX}/share/perl5/CPAN/FirstTime.pm"
}
12 changes: 12 additions & 0 deletions gpkg/perl/file-spec-unix.pm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -u -r ../perl-5.22.1/dist/PathTools/lib/File/Spec/Unix.pm ./dist/PathTools/lib/File/Spec/Unix.pm
--- ../perl-5.22.1/dist/PathTools/lib/File/Spec/Unix.pm 2015-10-17 08:38:37.000000000 -0400
+++ ./dist/PathTools/lib/File/Spec/Unix.pm 2016-04-19 16:46:41.651532097 -0400
@@ -210,7 +210,7 @@
sub tmpdir {
my $cached = $_[0]->_cached_tmpdir('TMPDIR');
return $cached if defined $cached;
- $_[0]->_cache_tmpdir($_[0]->_tmpdir( $ENV{TMPDIR}, "/tmp" ), 'TMPDIR');
+ $_[0]->_cache_tmpdir($_[0]->_tmpdir( $ENV{TMPDIR}, "@TERMUX_PREFIX_CLASSICAL@/tmp" ), 'TMPDIR');
}

=item updir
14 changes: 14 additions & 0 deletions gpkg/perl/no-sudo.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
https://github.com/termux/termux-packages/issues/16467

--- a/cpan/CPAN/lib/CPAN/FirstTime.pm
+++ b/cpan/CPAN/lib/CPAN/FirstTime.pm
@@ -1110,7 +1110,8 @@
# as long as Windows needs $self->_build_command, we cannot
# support sudo on windows :-)
my $default = $CPAN::Config->{make} || "";
- if ( $default && $CPAN::Config->{install_help} eq 'sudo' ) {
+ # https://github.com/termux/termux-packages/issues/16467
+ if ( 0 && $default && $CPAN::Config->{install_help} eq 'sudo' ) {
if ( find_exe('sudo') ) {
$default = "sudo $default";
delete $CPAN::Config->{make_install_make_command}
Loading

0 comments on commit 93738b7

Please sign in to comment.