diff --git a/gpkg/bash/build.sh b/gpkg/bash/build.sh new file mode 100644 index 000000000..219a23532 --- /dev/null +++ b/gpkg/bash/build.sh @@ -0,0 +1,65 @@ +TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/bash/ +TERMUX_PKG_DESCRIPTION="A sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh)" +TERMUX_PKG_LICENSE="GPL-3.0" +TERMUX_PKG_MAINTAINER="@termux-pacman" +_MAIN_VERSION=5.2 +_PATCH_VERSION=15 +TERMUX_PKG_VERSION=${_MAIN_VERSION}.${_PATCH_VERSION} +TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/bash/bash-${_MAIN_VERSION}.tar.gz +TERMUX_PKG_SHA256=a139c166df7ff4471c5e0733051642ee5556c1cc8a4a78f145583c5c81ab32fb +TERMUX_PKG_DEPENDS="readline-glibc, ncurses-glibc" +TERMUX_PKG_RECOMMENDS="bash-completion-glibc" +TERMUX_PKG_ESSENTIAL=true +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--with-curses +--enable-readline +--without-bash-malloc +--with-installed-readline +" +TERMUX_PKG_CONFFILES="glibc/etc/bash.bashrc glibc/etc/bash.bash_logout glibc/etc/profile" +TERMUX_PKG_RM_AFTER_INSTALL="share/man/man1/bashbug.1 bin/bashbug" + +termux_step_pre_configure() { + declare -A PATCH_CHECKSUMS + + PATCH_CHECKSUMS[001]=f42f2fee923bc2209f406a1892772121c467f44533bedfe00a176139da5d310a + PATCH_CHECKSUMS[002]=45cc5e1b876550eee96f95bffb36c41b6cb7c07d33f671db5634405cd00fd7b8 + PATCH_CHECKSUMS[003]=6a090cdbd334306fceacd0e4a1b9e0b0678efdbbdedbd1f5842035990c8abaff + PATCH_CHECKSUMS[004]=38827724bba908cf5721bd8d4e595d80f02c05c35f3dd7dbc4cd3c5678a42512 + PATCH_CHECKSUMS[005]=ece0eb544368b3b4359fb8464caa9d89c7a6743c8ed070be1c7d599c3675d357 + PATCH_CHECKSUMS[006]=d1e0566a257d149a0d99d450ce2885123f9995e9c01d0a5ef6df7044a72a468c + PATCH_CHECKSUMS[007]=2500a3fc21cb08133f06648a017cebfa27f30ea19c8cbe8dfefdf16227cfd490 + PATCH_CHECKSUMS[008]=6b4bd92fd0099d1bab436b941875e99e0cb3c320997587182d6267af1844b1e8 + PATCH_CHECKSUMS[009]=f95a817882eaeb0cb78bce82859a86bbb297a308ced730ebe449cd504211d3cd + PATCH_CHECKSUMS[010]=c7705e029f752507310ecd7270aef437e8043a9959e4d0c6065a82517996c1cd + PATCH_CHECKSUMS[011]=831b5f25bf3e88625f3ab315043be7498907c551f86041fa3b914123d79eb6f4 + PATCH_CHECKSUMS[012]=2fb107ce1fb8e93f36997c8b0b2743fc1ca98a454c7cc5a3fcabec533f67d42c + PATCH_CHECKSUMS[013]=094b4fd81bc488a26febba5d799689b64d52a5505b63e8ee854f48d356bc7ce6 + PATCH_CHECKSUMS[014]=3ef9246f2906ef1e487a0a3f4c647ae1c289cbd8459caa7db5ce118ef136e624 + PATCH_CHECKSUMS[015]=ef73905169db67399a728e238a9413e0d689462cb9b72ab17a05dba51221358a + + for PATCH_NUM in $(seq -f '%03g' ${_PATCH_VERSION}); do + PATCHFILE=$TERMUX_PKG_CACHEDIR/bash_patch_${PATCH_NUM}.patch + termux_download \ + "https://mirrors.kernel.org/gnu/bash/bash-${_MAIN_VERSION}-patches/bash${_MAIN_VERSION/./}-$PATCH_NUM" \ + $PATCHFILE \ + ${PATCH_CHECKSUMS[$PATCH_NUM]} + patch -p0 -i $PATCHFILE + done + unset PATCH_CHECKSUMS PATCHFILE PATCH_NUM +} + +termux_step_post_make_install() { + ln -sf bash "${TERMUX_PREFIX}/bin/sh" + ln -sf bash "${TERMUX_PREFIX}/bin/rbash" + + sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \ + $TERMUX_PKG_BUILDER_DIR/system.bash_logout > $TERMUX_PREFIX/etc/bash.bash_logout + + sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \ + $TERMUX_PKG_BUILDER_DIR/system.bashrc > $TERMUX_PREFIX/etc/bash.bashrc + + sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \ + $TERMUX_PKG_BUILDER_DIR/system.profile > $TERMUX_PREFIX/etc/profile +} diff --git a/gpkg/bash/config-top.h.patch b/gpkg/bash/config-top.h.patch new file mode 100644 index 000000000..3f9ebaaca --- /dev/null +++ b/gpkg/bash/config-top.h.patch @@ -0,0 +1,30 @@ +diff -uNr bash-5.0/config-top.h bash-5.0.mod/config-top.h +--- bash-5.0/config-top.h 2018-10-12 22:35:23.000000000 +0300 ++++ bash-5.0.mod/config-top.h 2019-02-20 14:15:53.266802311 +0200 +@@ -63,7 +63,7 @@ + /* The default value of the PATH variable. */ + #ifndef DEFAULT_PATH_VALUE + #define DEFAULT_PATH_VALUE \ +- "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:." ++ "@TERMUX_PREFIX@/bin:." + #endif + + /* If you want to unconditionally set a value for PATH in every restricted +@@ -74,7 +74,7 @@ + the Posix.2 confstr () function, or CS_PATH define are not present. */ + #ifndef STANDARD_UTILS_PATH + #define STANDARD_UTILS_PATH \ +- "/bin:/usr/bin:/sbin:/usr/sbin:/etc:/usr/etc" ++ "@TERMUX_PREFIX@/bin" + #endif + + /* Default primary and secondary prompt strings. */ +@@ -91,7 +91,7 @@ + #define DEFAULT_BASHRC "~/.bashrc" + + /* System-wide .bashrc file for interactive shells. */ +-/* #define SYS_BASHRC "/etc/bash.bashrc" */ ++#define SYS_BASHRC "@TERMUX_PREFIX@/etc/bash.bashrc" + + /* System-wide .bash_logout for login shells. */ + /* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */ diff --git a/gpkg/bash/error.c.patch b/gpkg/bash/error.c.patch new file mode 100644 index 000000000..3cad2a027 --- /dev/null +++ b/gpkg/bash/error.c.patch @@ -0,0 +1,12 @@ +diff -uNr bash-5.0/error.c bash-5.0.mod/error.c +--- bash-5.0/error.c 2018-10-08 22:16:07.000000000 +0300 ++++ bash-5.0.mod/error.c 2019-02-20 14:19:39.265261705 +0200 +@@ -430,7 +430,7 @@ + static FILE *tracefp = (FILE *)NULL; + + if (tracefp == NULL) +- tracefp = fopen("/tmp/bash-trace.log", "a+"); ++ tracefp = fopen("@TERMUX_PREFIX_CLASSICAL@/tmp/bash-trace.log", "a+"); + + if (tracefp == NULL) + tracefp = stderr; diff --git a/gpkg/bash/lib-malloc-stats.c.patch b/gpkg/bash/lib-malloc-stats.c.patch new file mode 100644 index 000000000..2d54d4e0c --- /dev/null +++ b/gpkg/bash/lib-malloc-stats.c.patch @@ -0,0 +1,12 @@ +diff -uNr bash-5.0/lib/malloc/stats.c bash-5.0.mod/lib/malloc/stats.c +--- bash-5.0/lib/malloc/stats.c 2018-06-19 22:24:52.000000000 +0300 ++++ bash-5.0.mod/lib/malloc/stats.c 2019-02-20 14:17:52.094412438 +0200 +@@ -142,7 +142,7 @@ + _print_malloc_stats (s, fp); + } + +-#define TRACEROOT "/var/tmp/maltrace/stats." ++#define TRACEROOT "@TERMUX_PREFIX@/var/tmp/maltrace/stats." + + void + trace_malloc_stats (s, fn) diff --git a/gpkg/bash/lib-malloc-table.c.patch b/gpkg/bash/lib-malloc-table.c.patch new file mode 100644 index 000000000..dfe2a30f1 --- /dev/null +++ b/gpkg/bash/lib-malloc-table.c.patch @@ -0,0 +1,12 @@ +diff -uNr bash-5.0/lib/malloc/table.c bash-5.0.mod/lib/malloc/table.c +--- bash-5.0/lib/malloc/table.c 2016-01-15 15:47:26.000000000 +0200 ++++ bash-5.0.mod/lib/malloc/table.c 2019-02-20 14:18:05.854521552 +0200 +@@ -390,7 +390,7 @@ + _location_dump_table (stderr); + } + +-#define LOCROOT "/var/tmp/maltrace/locations." ++#define LOCROOT "@TERMUX_PREFIX@/var/tmp/maltrace/locations." + + void + mlocation_write_table () diff --git a/gpkg/bash/lib-malloc-trace.c.patch b/gpkg/bash/lib-malloc-trace.c.patch new file mode 100644 index 000000000..33f9f3d30 --- /dev/null +++ b/gpkg/bash/lib-malloc-trace.c.patch @@ -0,0 +1,12 @@ +diff -uNr bash-5.0/lib/malloc/trace.c bash-5.0.mod/lib/malloc/trace.c +--- bash-5.0/lib/malloc/trace.c 2016-01-15 15:48:23.000000000 +0200 ++++ bash-5.0.mod/lib/malloc/trace.c 2019-02-20 14:17:59.184468664 +0200 +@@ -108,7 +108,7 @@ + #endif + } + +-#define TRACEROOT "/var/tmp/maltrace/trace." ++#define TRACEROOT "@TERMUX_PREFIX@/var/tmp/maltrace/trace." + + void + malloc_set_tracefn (s, fn) diff --git a/gpkg/bash/lib-readline-rlconf.h.patch b/gpkg/bash/lib-readline-rlconf.h.patch new file mode 100644 index 000000000..c21011240 --- /dev/null +++ b/gpkg/bash/lib-readline-rlconf.h.patch @@ -0,0 +1,12 @@ +diff -uNr bash-5.0/lib/readline/rlconf.h bash-5.0.mod/lib/readline/rlconf.h +--- bash-5.0/lib/readline/rlconf.h 2017-02-21 17:25:30.000000000 +0200 ++++ bash-5.0.mod/lib/readline/rlconf.h 2019-02-20 14:16:17.230326111 +0200 +@@ -43,7 +43,7 @@ + #define DEFAULT_INPUTRC "~/.inputrc" + + /* The ultimate last-ditch filename for an init file -- system-wide. */ +-#define SYS_INPUTRC "/etc/inputrc" ++#define SYS_INPUTRC "@TERMUX_PREFIX@/etc/inputrc" + + /* If defined, expand tabs to spaces. */ + #define DISPLAY_TABS diff --git a/gpkg/bash/lib-readline-util.c.patch b/gpkg/bash/lib-readline-util.c.patch new file mode 100644 index 000000000..c32e11d07 --- /dev/null +++ b/gpkg/bash/lib-readline-util.c.patch @@ -0,0 +1,12 @@ +diff -uNr bash-5.0/lib/readline/util.c bash-5.0.mod/lib/readline/util.c +--- bash-5.0/lib/readline/util.c 2017-06-15 23:27:17.000000000 +0300 ++++ bash-5.0.mod/lib/readline/util.c 2019-02-20 14:18:24.271334221 +0200 +@@ -506,7 +506,7 @@ + if (x == 0) + x = "."; + #else +- x = "/var/tmp"; ++ x = "@TERMUX_PREFIX_CLASSICAL@/var/tmp"; + #endif + snprintf (fnbuf, sizeof (fnbuf), "%s/rltrace.%ld", x, (long)getpid()); + unlink(fnbuf); diff --git a/gpkg/bash/lib-sh-tmpfile.c.patch b/gpkg/bash/lib-sh-tmpfile.c.patch new file mode 100644 index 000000000..dbdcbcf66 --- /dev/null +++ b/gpkg/bash/lib-sh-tmpfile.c.patch @@ -0,0 +1,21 @@ +diff -uNr bash-5.0/lib/sh/tmpfile.c bash-5.0.mod/lib/sh/tmpfile.c +--- bash-5.0/lib/sh/tmpfile.c 2016-08-11 18:05:58.000000000 +0300 ++++ bash-5.0.mod/lib/sh/tmpfile.c 2019-02-20 14:17:08.270731426 +0200 +@@ -74,15 +74,11 @@ + return sys_tmpdir; + #endif + +- sys_tmpdir = "/tmp"; ++ sys_tmpdir = "@TERMUX_PREFIX_CLASSICAL@/tmp"; + if (file_iswdir (sys_tmpdir)) + return sys_tmpdir; + +- sys_tmpdir = "/var/tmp"; +- if (file_iswdir (sys_tmpdir)) +- return sys_tmpdir; +- +- sys_tmpdir = "/usr/tmp"; ++ sys_tmpdir = "@TERMUX_PREFIX_CLASSICAL@/var/tmp"; + if (file_iswdir (sys_tmpdir)) + return sys_tmpdir; + diff --git a/gpkg/bash/pathnames.h.in.patch b/gpkg/bash/pathnames.h.in.patch new file mode 100644 index 000000000..89310df74 --- /dev/null +++ b/gpkg/bash/pathnames.h.in.patch @@ -0,0 +1,16 @@ +diff -uNr bash-5.0/pathnames.h.in bash-5.0.mod/pathnames.h.in +--- bash-5.0/pathnames.h.in 2009-01-04 21:32:40.000000000 +0200 ++++ bash-5.0.mod/pathnames.h.in 2019-02-20 14:15:56.880164371 +0200 +@@ -22,10 +22,10 @@ + #define _PATHNAMES_H_ + + /* The default file for hostname completion. */ +-#define DEFAULT_HOSTS_FILE "/etc/hosts" ++#define DEFAULT_HOSTS_FILE "@TERMUX_PREFIX@/etc/hosts" + + /* The default login shell startup file. */ +-#define SYS_PROFILE "/etc/profile" ++#define SYS_PROFILE "@TERMUX_PREFIX@/etc/profile" + + /* The default location of the bash debugger initialization/startup file. */ + #define DEBUGGER_START_FILE "@DEBUGGER_START_FILE@" diff --git a/gpkg/bash/shell.c.patch b/gpkg/bash/shell.c.patch new file mode 100644 index 000000000..5677225b7 --- /dev/null +++ b/gpkg/bash/shell.c.patch @@ -0,0 +1,19 @@ +diff -uNr bash-5.0/shell.c bash-5.0.mod/shell.c +--- bash-5.0/shell.c 2018-12-06 18:28:21.000000000 +0200 ++++ bash-5.0.mod/shell.c 2019-02-20 14:19:29.808520144 +0200 +@@ -339,12 +339,12 @@ + { + struct stat sb; + +- if (stat ("/tmp", &sb) < 0) +- internal_warning (_("could not find /tmp, please create!")); ++ if (stat ("@TERMUX_PREFIX_CLASSICAL@/tmp", &sb) < 0) ++ internal_warning (_("could not find @TERMUX_PREFIX_CLASSICAL@/tmp, please create!")); + else + { + if (S_ISDIR (sb.st_mode) == 0) +- internal_warning (_("/tmp must be a valid directory name")); ++ internal_warning (_("@TERMUX_PREFIX_CLASSICAL@/tmp must be a valid directory name")); + } + } + #endif /* __CYGWIN__ */ diff --git a/gpkg/bash/system.bash_logout b/gpkg/bash/system.bash_logout new file mode 100644 index 000000000..6a5737a2b --- /dev/null +++ b/gpkg/bash/system.bash_logout @@ -0,0 +1,3 @@ +# +# @TERMUX_PREFIX@/etc/bash.bash_logout +# diff --git a/gpkg/bash/system.bashrc b/gpkg/bash/system.bashrc new file mode 100644 index 000000000..9996486f4 --- /dev/null +++ b/gpkg/bash/system.bashrc @@ -0,0 +1,25 @@ +# +# @TERMUX_PREFIX@/etc/bash.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +[[ $DISPLAY ]] && shopt -s checkwinsize + +#PS1='[\u@\h \W]\$ ' +PS1='\[\e[0;32m\]\w\[\e[0m\] \[\e[0;97m\]\$\[\e[0m\] ' + +case ${TERM} in + Eterm*|alacritty*|aterm*|foot*|gnome*|konsole*|kterm*|putty*|rxvt*|tmux*|xterm*) + PROMPT_COMMAND+=('printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"') + + ;; + screen*) + PROMPT_COMMAND+=('printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"') + ;; +esac + +if [[ -r @TERMUX_PREFIX@/share/bash-completion/bash_completion ]]; then + . @TERMUX_PREFIX@/share/bash-completion/bash_completion +fi diff --git a/gpkg/bash/system.profile b/gpkg/bash/system.profile new file mode 100644 index 000000000..d4ca7280b --- /dev/null +++ b/gpkg/bash/system.profile @@ -0,0 +1,19 @@ +# +# @TERMUX_PREFIX@/etc/profile +# + +for i in @TERMUX_PREFIX@/etc/profile.d/*.sh; do + if [ -r $i ]; then + . $i + fi +done +unset i + +# Source etc/bash.bashrc and ~/.bashrc also for interactive bash login shells: +if [ "$BASH" ]; then + if [[ "$-" == *"i"* ]]; then + if [ -r @TERMUX_PREFIX@/etc/bash.bashrc ]; then + . @TERMUX_PREFIX@/etc/bash.bashrc + fi + fi +fi diff --git a/gpkg/coreutils/build.sh b/gpkg/coreutils/build.sh new file mode 100644 index 000000000..5b73d84f6 --- /dev/null +++ b/gpkg/coreutils/build.sh @@ -0,0 +1,14 @@ +TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/coreutils/ +TERMUX_PKG_DESCRIPTION="Basic file, shell and text manipulation utilities from the GNU project" +TERMUX_PKG_LICENSE="GPL-3.0" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_VERSION=9.3 +TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/coreutils/coreutils-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=adbcfcfe899235b71e8768dcf07cd532520b7f54f9a8064843f8d199a904bbaa +TERMUX_PKG_DEPENDS="openssl-glibc, libacl-glibc, libgmp-glibc, libcap-glibc" +TERMUX_PKG_ESSENTIAL=true + +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--with-openssl +--enable-no-install-program=groups,hostname,kill,uptime +" diff --git a/gpkg/coreutils/date.c.patch b/gpkg/coreutils/date.c.patch new file mode 100644 index 000000000..19251a890 --- /dev/null +++ b/gpkg/coreutils/date.c.patch @@ -0,0 +1,14 @@ +diff -uNr coreutils-8.32/src/date.c coreutils-8.32.mod/src/date.c +--- coreutils-8.32/src/date.c 2020-01-01 16:13:12.000000000 +0200 ++++ coreutils-8.32.mod/src/date.c 2021-07-30 17:57:00.571867917 +0300 +@@ -559,6 +559,10 @@ + + if (set_date) + { ++ if (getuid() != 0) ++ { ++ die (EXIT_FAILURE, 0, "only root user can change date/time"); ++ } + /* Set the system clock to the specified date, then regardless of + the success of that operation, format and print that date. */ + if (settime (&when) != 0) diff --git a/gpkg/coreutils/fix-paths.patch b/gpkg/coreutils/fix-paths.patch new file mode 100644 index 000000000..99472ebb9 --- /dev/null +++ b/gpkg/coreutils/fix-paths.patch @@ -0,0 +1,96 @@ +diff -uNr coreutils-8.32/lib/getusershell.c coreutils-8.32.mod/lib/getusershell.c +--- coreutils-8.32/lib/getusershell.c 2020-01-01 16:14:23.000000000 +0200 ++++ coreutils-8.32.mod/lib/getusershell.c 2020-05-05 14:13:10.980279936 +0300 +@@ -56,7 +56,7 @@ + static char const* const default_shells[] = + { + ADDITIONAL_DEFAULT_SHELLS +- "/bin/sh", "/bin/csh", "/usr/bin/sh", "/usr/bin/csh", NULL ++ "@TERMUX_PREFIX@/bin/sh", "@TERMUX_PREFIX@/bin/bash", "@TERMUX_PREFIX@/bin/ash", "@TERMUX_PREFIX@/bin/csh", NULL + }; + + /* Index of the next shell in 'default_shells' to return. +diff -uNr coreutils-9.2/lib/tmpdir.c coreutils-9.2.mod/lib/tmpdir.c +--- coreutils-9.2/lib/tmpdir.c 2023-03-13 18:12:12.000000000 +0000 ++++ coreutils-9.2.mod/lib/tmpdir.c 2023-03-23 06:56:30.519517214 +0000 +@@ -35,7 +35,7 @@ + # ifdef _P_tmpdir /* native Windows */ + # define P_tmpdir _P_tmpdir + # else +-# define P_tmpdir "/tmp" ++# define P_tmpdir "@TERMUX_PREFIX_CLASSICAL@/tmp" + # endif + #endif + +@@ -135,8 +135,8 @@ + #endif + if (direxists (P_tmpdir)) + dir = P_tmpdir; +- else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) +- dir = "/tmp"; ++ else if (strcmp (P_tmpdir, "@TERMUX_PREFIX_CLASSICAL@/tmp") != 0 && direxists ("@TERMUX_PREFIX_CLASSICAL@/tmp")) ++ dir = "@TERMUX_PREFIX_CLASSICAL@/tmp"; + else + { + __set_errno (ENOENT); +diff -uNr coreutils-8.32/src/mktemp.c coreutils-8.32.mod/src/mktemp.c +--- coreutils-8.32/src/mktemp.c 2020-01-01 16:13:12.000000000 +0200 ++++ coreutils-8.32.mod/src/mktemp.c 2020-05-05 14:13:10.984279966 +0300 +@@ -270,7 +270,7 @@ + else if (dest_dir_arg && *dest_dir_arg) + dest_dir = dest_dir_arg; + else +- dest_dir = "/tmp"; ++ dest_dir = "@TERMUX_PREFIX_CLASSICAL@/tmp"; + + if (last_component (template) != template) + die (EXIT_FAILURE, 0, +@@ -284,7 +284,7 @@ + else + { + char *env = getenv ("TMPDIR"); +- dest_dir = (env && *env ? env : "/tmp"); ++ dest_dir = (env && *env ? env : "@TERMUX_PREFIX_CLASSICAL@/tmp"); + } + if (IS_ABSOLUTE_FILE_NAME (template)) + die (EXIT_FAILURE, 0, +diff -uNr coreutils-8.32/src/sort.c coreutils-8.32.mod/src/sort.c +--- coreutils-8.32/src/sort.c 2020-01-01 16:33:34.000000000 +0200 ++++ coreutils-8.32.mod/src/sort.c 2020-05-05 14:14:09.200728018 +0300 +@@ -92,9 +92,7 @@ + + #define UCHAR_LIM (UCHAR_MAX + 1) + +-#ifndef DEFAULT_TMPDIR +-# define DEFAULT_TMPDIR "/tmp" +-#endif ++#define DEFAULT_TMPDIR "@TERMUX_PREFIX_CLASSICAL@/tmp" + + /* Maximum number of lines to merge every time a NODE is taken from + the merge queue. Node is at LEVEL in the binary merge tree, +diff -uNr coreutils-8.32/src/split.c coreutils-8.32.mod/src/split.c +--- coreutils-8.32/src/split.c 2020-01-01 16:13:12.000000000 +0200 ++++ coreutils-8.32.mod/src/split.c 2020-05-05 14:13:10.984279966 +0300 +@@ -482,7 +482,7 @@ + pid_t child_pid; + char const *shell_prog = getenv ("SHELL"); + if (shell_prog == NULL) +- shell_prog = "/bin/sh"; ++ shell_prog = "@TERMUX_PREFIX@/bin/sh"; + if (setenv ("FILE", name, 1) != 0) + die (EXIT_FAILURE, errno, + _("failed to set FILE environment variable")); +diff -uNr coreutils-8.32/src/tac.c coreutils-8.32.mod/src/tac.c +--- coreutils-8.32/src/tac.c 2020-01-01 16:13:12.000000000 +0200 ++++ coreutils-8.32.mod/src/tac.c 2020-05-05 14:14:18.384798638 +0300 +@@ -66,9 +66,7 @@ + #endif + + +-#ifndef DEFAULT_TMPDIR +-# define DEFAULT_TMPDIR "/tmp" +-#endif ++#define DEFAULT_TMPDIR "@TERMUX_PREFIX_CLASSICAL@/tmp" + + /* The number of bytes per atomic read. */ + #define INITIAL_READSIZE 8192 diff --git a/gpkg/coreutils/src-ls.c.patch b/gpkg/coreutils/src-ls.c.patch new file mode 100644 index 000000000..9c6dfd988 --- /dev/null +++ b/gpkg/coreutils/src-ls.c.patch @@ -0,0 +1,13 @@ +diff -uNr coreutils-8.32/src/ls.c coreutils-8.32.mod/src/ls.c +--- coreutils-8.32/src/ls.c 2020-03-01 14:30:46.000000000 +0200 ++++ coreutils-8.32.mod/src/ls.c 2020-03-08 19:48:36.132565243 +0200 +@@ -1958,6 +1958,9 @@ + } + } + ++ /* Termux patch: Default to colors if terminal. The --color option may override this. */ ++ print_with_color = isatty(STDOUT_FILENO); ++ + while (true) + { + int oi = -1; diff --git a/gpkg/coreutils/tests/tails-c-flag.sh b/gpkg/coreutils/tests/tails-c-flag.sh new file mode 100644 index 000000000..2c06c33eb --- /dev/null +++ b/gpkg/coreutils/tests/tails-c-flag.sh @@ -0,0 +1,8 @@ +# https://github.com/termux/termux-app/issues/232 +set -e -u + +RESULT=$(echo -n 123456 | tail -c 3) +if [ "$RESULT" != 456 ]; then + echo "Test failed - expectd 456, got $RESULT" + exit 1 +fi diff --git a/gpkg/gdbm/build.sh b/gpkg/gdbm/build.sh new file mode 100644 index 000000000..dc6fb0ceb --- /dev/null +++ b/gpkg/gdbm/build.sh @@ -0,0 +1,9 @@ +TERMUX_PKG_HOMEPAGE=https://www.gnu.org.ua/software/gdbm/ +TERMUX_PKG_DESCRIPTION="Library of database functions that use extensible hashing" +TERMUX_PKG_LICENSE="GPL-3.0" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_VERSION=1.23 +TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/gdbm/gdbm-${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=74b1081d21fff13ae4bd7c16e5d6e504a4c26f7cde1dca0d963a484174bbcacd +TERMUX_PKG_DEPENDS="readline-glibc" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-libgdbm-compat" diff --git a/gpkg/libbz2/build.sh b/gpkg/libbz2/build.sh index 2f9fdc782..0e1fe8961 100644 --- a/gpkg/libbz2/build.sh +++ b/gpkg/libbz2/build.sh @@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="BZ2 format compression library" TERMUX_PKG_LICENSE="BSD" TERMUX_PKG_MAINTAINER="@termux-pacman" TERMUX_PKG_VERSION=1.0.8 -TERMUX_PKG_REVISION=6 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://fossies.org/linux/misc/bzip2-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=47fd74b2ff83effad0ddf62074e6fad1f6b4a77a96e121ab421c20a216371a1f -TERMUX_PKG_DEPENDS="glibc, bash, gcc-glibc-libs-dev" +TERMUX_PKG_DEPENDS="glibc, bash-glibc" TERMUX_PKG_ESSENTIAL=true TERMUX_PKG_EXTRA_MAKE_ARGS="PREFIX=$TERMUX_PREFIX" TERMUX_PKG_BUILD_IN_SRC=true diff --git a/gpkg/libcap-ng/build.sh b/gpkg/libcap-ng/build.sh new file mode 100644 index 000000000..9e72c2281 --- /dev/null +++ b/gpkg/libcap-ng/build.sh @@ -0,0 +1,16 @@ +TERMUX_PKG_HOMEPAGE=https://people.redhat.com/sgrubb/libcap-ng/ +TERMUX_PKG_DESCRIPTION="Library making programming with POSIX capabilities easier than traditional libcap" +TERMUX_PKG_LICENSE="LGPL-2.1" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_VERSION="0.8.3" +TERMUX_PKG_SRCURL=https://github.com/stevegrubb/libcap-ng/archive/v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=e542e9139961f0915ab5878427890cdc7762949fbe216bd0cb4ceedb309bb854 +TERMUX_PKG_DEPENDS="glibc, gcc-glibc-libs-dev" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--without-python +--without-python3 +" + +termux_step_pre_configure() { + ./autogen.sh +} diff --git a/gpkg/libcap/Makefile.patch b/gpkg/libcap/Makefile.patch new file mode 100644 index 000000000..fea490be4 --- /dev/null +++ b/gpkg/libcap/Makefile.patch @@ -0,0 +1,11 @@ +diff -u -r ../libcap-2.28/Makefile ./Makefile +--- ../libcap-2.28/Makefile 2019-12-07 19:45:11.000000000 +0000 ++++ ./Makefile 2019-12-11 23:43:35.404511000 +0000 +@@ -16,7 +16,6 @@ + ifeq ($(GOLANG),yes) + $(MAKE) -C go $@ + endif +- $(MAKE) -C tests $@ + $(MAKE) -C progs $@ + $(MAKE) -C doc $@ + $(MAKE) -C kdebug $@ diff --git a/gpkg/libcap/build.sh b/gpkg/libcap/build.sh new file mode 100644 index 000000000..00b60f901 --- /dev/null +++ b/gpkg/libcap/build.sh @@ -0,0 +1,20 @@ +TERMUX_PKG_HOMEPAGE=https://sites.google.com/site/fullycapable/ +TERMUX_PKG_DESCRIPTION="POSIX 1003.1e capabilities" +TERMUX_PKG_LICENSE="BSD 3-Clause, GPL-2.0" +TERMUX_PKG_LICENSE_FILE="License" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_VERSION=2.69 +TERMUX_PKG_SRCURL=https://kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=f311f8f3dad84699d0566d1d6f7ec943a9298b28f714cae3c931dfd57492d7eb +TERMUX_PKG_DEPENDS="glibc, gcc-glibc-libs-dev" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_make() { + # At the moment we don't have pam-glibc + make CC="$CC" PREFIX="$TERMUX_PREFIX" PAM_CAP=no +} + +termux_step_make_install() { + # At the moment we don't have pam-glibc + make CC="$CC" prefix="$TERMUX_PREFIX" RAISE_SETFCAP=no lib=/lib install PAM_CAP=no +} diff --git a/gpkg/libcap/progs-capsh.c.patch b/gpkg/libcap/progs-capsh.c.patch new file mode 100644 index 000000000..6f0ab41a4 --- /dev/null +++ b/gpkg/libcap/progs-capsh.c.patch @@ -0,0 +1,12 @@ +diff -u -r ../libcap-2.34/progs/capsh.c ./progs/capsh.c +--- ../libcap-2.34/progs/capsh.c 2020-05-02 22:47:28.000000000 +0000 ++++ ./progs/capsh.c 2020-05-11 08:14:15.943279000 +0000 +@@ -26,7 +26,7 @@ + #include + + #ifndef SHELL +-#define SHELL "/bin/bash" ++#define SHELL "@TERMUX_PREFIX@/bin/bash" + #endif /* ndef SHELL */ + + #define MAX_GROUPS 100 /* max number of supplementary groups for user */ diff --git a/gpkg/libjansson/build.sh b/gpkg/libjansson/build.sh new file mode 100644 index 000000000..fde037c31 --- /dev/null +++ b/gpkg/libjansson/build.sh @@ -0,0 +1,13 @@ +TERMUX_PKG_HOMEPAGE=http://www.digip.org/jansson/ +TERMUX_PKG_DESCRIPTION="C library for encoding, decoding and manipulating JSON data" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_VERSION=2.14 +TERMUX_PKG_SRCURL=https://github.com/akheron/jansson/archive/v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=c739578bf6b764aa0752db9a2fdadcfe921c78f1228c7ec0bb47fa804c55d17b +TERMUX_PKG_DEPENDS="glibc" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_pre_configure() { + autoreconf -fi +} diff --git a/gpkg/liblzma/build.sh b/gpkg/liblzma/build.sh index b9b955775..7db0228ef 100644 --- a/gpkg/liblzma/build.sh +++ b/gpkg/liblzma/build.sh @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="LGPL-2.1, GPL-2.0, GPL-3.0" TERMUX_PKG_LICENSE_FILE="COPYING, COPYING.GPLv2, COPYING.GPLv3, COPYING.LGPLv2.1" TERMUX_PKG_MAINTAINER="@termux-pacman" TERMUX_PKG_VERSION=5.4.4 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://tukaani.org/xz/xz-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=aae39544e254cfd27e942d35a048d592959bd7a79f9a624afb0498bb5613bdf8 -TERMUX_PKG_DEPENDS="glibc, bash" +TERMUX_PKG_DEPENDS="glibc, bash-glibc" diff --git a/gpkg/libxcrypt/build.sh b/gpkg/libxcrypt/build.sh new file mode 100644 index 000000000..02af084d4 --- /dev/null +++ b/gpkg/libxcrypt/build.sh @@ -0,0 +1,13 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/besser82/libxcrypt +TERMUX_PKG_DESCRIPTION="Modern library for one-way hashing of passwords" +TERMUX_PKG_LICENSE="LGPL-3.0" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_VERSION=4.4.36 +TERMUX_PKG_SRCURL=https://github.com/besser82/libxcrypt/releases/download/v${TERMUX_PKG_VERSION}/libxcrypt-${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SHA256=e5e1f4caee0a01de2aee26e3138807d6d3ca2b8e67287966d1fefd65e1fd8943 +TERMUX_PKG_DEPENDS="glibc" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--enable-hashes=strong,glibc +--enable-obsolete-api=no +--disable-failure-tokens +" diff --git a/gpkg/ncurses/build.sh b/gpkg/ncurses/build.sh new file mode 100644 index 000000000..33ab77d85 --- /dev/null +++ b/gpkg/ncurses/build.sh @@ -0,0 +1,43 @@ +TERMUX_PKG_HOMEPAGE=https://invisible-island.net/ncurses/ncurses.html +TERMUX_PKG_DESCRIPTION="System V Release 4.0 curses emulation library" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux-pacman" +_PKG_VERSION=6.4 +_DATE_VERSION=20230520 +TERMUX_PKG_VERSION=${_PKG_VERSION}.${_DATE_VERSION} +TERMUX_PKG_SRCURL=https://invisible-mirror.net/archives/ncurses/current/ncurses-${_PKG_VERSION}-${_DATE_VERSION}.tgz +TERMUX_PKG_SHA256=a04f69bde2f1b1325d1fb460db7cea28b6da97786ead8ce645daacfb0bcbc004 +TERMUX_PKG_DEPENDS="glibc, gcc-glibc-libs-dev" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--disable-root-access +--disable-root-environ +--disable-setuid-environ +--enable-widec +--enable-pc-files +--mandir=$TERMUX_PREFIX/share/man +--with-cxx-binding +--with-cxx-shared +--with-manpage-format=normal +--with-pkg-config-libdir=$TERMUX_PREFIX/lib/pkgconfig +--with-shared +--with-versioned-syms +--with-xterm-kbs=del +--without-ada +" + +termux_step_post_make_install() { + for lib in ncurses ncurses++ form panel menu; do + printf "INPUT(-l%sw)\n" "${lib}" > $TERMUX_PREFIX/lib/lib${lib}.so + ln -sv ${lib}w.pc $TERMUX_PREFIX/lib/pkgconfig/${lib}.pc + done + + printf 'INPUT(-lncursesw)\n' > $TERMUX_PREFIX/lib/libcursesw.so + ln -sv libncurses.so $TERMUX_PREFIX/lib/libcurses.so + + for lib in tic tinfo; do + printf "INPUT(libncursesw.so.%s)\n" "${_PKG_VERSION:0:1}" > $TERMUX_PREFIX/lib/lib${lib}.so + ln -sv libncursesw.so.${TERMUX_PKG_VERSION:0:1} $TERMUX_PREFIX/lib/lib${lib}.so.${_PKG_VERSION:0:1} + ln -sv ncursesw.pc $TERMUX_PREFIX/lib/pkgconfig/${lib}.pc + done +} diff --git a/gpkg/ncurses/fix-paths.patch b/gpkg/ncurses/fix-paths.patch new file mode 100644 index 000000000..e79fa3baf --- /dev/null +++ b/gpkg/ncurses/fix-paths.patch @@ -0,0 +1,35 @@ +diff -uNr ncurses-6.1-20181117/progs/tic.c ncurses-6.1-20181117.mod/progs/tic.c +--- ncurses-6.1-20181117/progs/tic.c 2018-03-18 02:05:10.000000000 +0200 ++++ ncurses-6.1-20181117.mod/progs/tic.c 2019-03-01 20:40:56.193173489 +0200 +@@ -386,7 +386,7 @@ + { + FILE *result = 0; + +- _nc_STRCPY(filename, "/tmp/XXXXXX", PATH_MAX); ++ _nc_STRCPY(filename, "@TERMUX_PREFIX_CLASSICAL@/tmp/XXXXXX", PATH_MAX); + #if HAVE_MKSTEMP + { + int oldmask = (int) umask(077); +@@ -900,7 +900,7 @@ + } else { + if (infodump == TRUE) { + /* captoinfo's no-argument case */ +- source_file = "/etc/termcap"; ++ source_file = "@TERMUX_PREFIX@/etc/termcap"; + if ((termcap = getenv("TERMCAP")) != 0 + && (namelst = make_namelist(getenv("TERM"))) != 0) { + if (access(termcap, F_OK) == 0) { +diff -uNr ncurses-6.1-20181117/progs/tset.c ncurses-6.1-20181117.mod/progs/tset.c +--- ncurses-6.1-20181117/progs/tset.c 2017-10-08 03:01:29.000000000 +0300 ++++ ncurses-6.1-20181117.mod/progs/tset.c 2019-03-01 20:40:15.049476720 +0200 +@@ -566,8 +566,8 @@ + goto map; + } + #else +- if ((fp = fopen("/etc/ttytype", "r")) != 0 +- || (fp = fopen("/etc/ttys", "r")) != 0) { ++ if ((fp = fopen("@TERMUX_PREFIX@/etc/ttytype", "r")) != 0 ++ || (fp = fopen("@TERMUX_PREFIX@/etc/ttys", "r")) != 0) { + char buffer[BUFSIZ]; + char *s, *t, *d; + diff --git a/gpkg/ncurses/ncurses-ui-libs-static.subpackage.sh b/gpkg/ncurses/ncurses-ui-libs-static.subpackage.sh new file mode 100644 index 000000000..9d5099c8b --- /dev/null +++ b/gpkg/ncurses/ncurses-ui-libs-static.subpackage.sh @@ -0,0 +1,3 @@ +TERMUX_SUBPKG_INCLUDE="glibc/lib/libform*.a glibc/lib/libmenu*.a glibc/lib/libpanel*.a" +TERMUX_SUBPKG_DESCRIPTION="Static libraries for terminal user interfaces based on ncurses" +TERMUX_SUBPKG_DEPENDS="ncurses-ui-libs" diff --git a/gpkg/ncurses/ncurses-ui-libs.subpackage.sh b/gpkg/ncurses/ncurses-ui-libs.subpackage.sh new file mode 100644 index 000000000..a10d13f0e --- /dev/null +++ b/gpkg/ncurses/ncurses-ui-libs.subpackage.sh @@ -0,0 +1,11 @@ +TERMUX_SUBPKG_INCLUDE=" +glibc/lib/libform*.so* +glibc/lib/libmenu*.so* +glibc/lib/libpanel*.so* +glibc/lib/pkgconfig/form*.pc +glibc/lib/pkgconfig/menu*.pc +glibc/lib/pkgconfig/panel*.pc +" +TERMUX_SUBPKG_DESCRIPTION="Libraries for terminal user interfaces based on ncurses" +TERMUX_SUBPKG_BREAKS="ncurses (<< 6.4)" +TERMUX_SUBPKG_REPLACES="ncurses (<< 6.4)" diff --git a/gpkg/ncurses/ncurses-utils.subpackage.sh b/gpkg/ncurses/ncurses-utils.subpackage.sh new file mode 100644 index 000000000..9f077413e --- /dev/null +++ b/gpkg/ncurses/ncurses-utils.subpackage.sh @@ -0,0 +1,17 @@ +TERMUX_SUBPKG_INCLUDE=" +glibc/bin/captoinfo +glibc/bin/infotocap +glibc/bin/toe +glibc/bin/tput +glibc/bin/tabs +glibc/bin/infocmp +glibc/bin/tic +glibc/share/man/man1/captoinfo.1.gz +glibc/share/man/man1/infotocap.1.gz +glibc/share/man/man1/toe.1.gz +glibc/share/man/man1/tput.1.gz +glibc/share/man/man1/tabs.1.gz +glibc/share/man/man1/infocmp.1.gz +glibc/share/man/man1/tic.1.gz +" +TERMUX_SUBPKG_DESCRIPTION="Tools for working with terminals" diff --git a/gpkg/readline/build.sh b/gpkg/readline/build.sh new file mode 100644 index 000000000..f7a6af740 --- /dev/null +++ b/gpkg/readline/build.sh @@ -0,0 +1,34 @@ +TERMUX_PKG_HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html" +TERMUX_PKG_DESCRIPTION="Library that allow users to edit command lines as they are typed in" +TERMUX_PKG_LICENSE="GPL-3.0" +TERMUX_PKG_MAINTAINER="@termux-pacman" +TERMUX_PKG_DEPENDS="ncurses-glibc" +_MAIN_VERSION=8.2 +_PATCH_VERSION=1 +TERMUX_PKG_VERSION=$_MAIN_VERSION.$_PATCH_VERSION +TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/readline/readline-${_MAIN_VERSION}.tar.gz +TERMUX_PKG_SHA256=3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35 +TERMUX_PKG_CONFFILES="glibc/etc/inputrc" + +termux_step_pre_configure() { + declare -A PATCH_CHECKSUMS + + PATCH_CHECKSUMS[001]=bbf97f1ec40a929edab5aa81998c1e2ef435436c597754916e6a5868f273aff7 + + for PATCH_NUM in $(seq -f '%03g' ${_PATCH_VERSION}); do + PATCHFILE=$TERMUX_PKG_CACHEDIR/readline_patch_${PATCH_NUM}.patch + termux_download \ + "http://mirrors.kernel.org/gnu/readline/readline-$_MAIN_VERSION-patches/readline${_MAIN_VERSION/./}-$PATCH_NUM" \ + $PATCHFILE \ + ${PATCH_CHECKSUMS[$PATCH_NUM]} + patch -p0 -i $PATCHFILE + done +} + +termux_step_post_make_install() { + mkdir -p $TERMUX_PREFIX/lib/pkgconfig + cp readline.pc $TERMUX_PREFIX/lib/pkgconfig/ + + mkdir -p $TERMUX_PREFIX/etc + cp $TERMUX_PKG_BUILDER_DIR/inputrc $TERMUX_PREFIX/etc/ +} diff --git a/gpkg/readline/inputrc b/gpkg/readline/inputrc new file mode 100644 index 000000000..fd13a673b --- /dev/null +++ b/gpkg/readline/inputrc @@ -0,0 +1,36 @@ +# do not bell on tab-completion +#set bell-style none + +set meta-flag on +set input-meta on +set convert-meta off +set output-meta on + +$if mode=emacs + +# for linux console and RH/Debian xterm +"\e[1~": beginning-of-line +"\e[4~": end-of-line +"\e[5~": beginning-of-history +"\e[6~": end-of-history +"\e[7~": beginning-of-line +"\e[3~": delete-char +"\e[2~": quoted-insert +"\e[5C": forward-word +"\e[5D": backward-word +"\e\e[C": forward-word +"\e\e[D": backward-word +"\e[1;5C": forward-word +"\e[1;5D": backward-word + +# for rxvt +"\e[8~": end-of-line + +# for non RH/Debian xterm, can't hurt for RH/DEbian xterm +"\eOH": beginning-of-line +"\eOF": end-of-line + +# for freebsd console +"\e[H": beginning-of-line +"\e[F": end-of-line +$endif diff --git a/gpkg/readline/rlconf.h.patch b/gpkg/readline/rlconf.h.patch new file mode 100644 index 000000000..03156a5a5 --- /dev/null +++ b/gpkg/readline/rlconf.h.patch @@ -0,0 +1,11 @@ +--- readline-8.0/rlconf.h 2017-02-21 20:55:30.000000000 +0530 ++++ readline-8.0-mod/rlconf.h 2019-02-20 20:45:45.583654990 +0530 +@@ -43,7 +43,7 @@ + #define DEFAULT_INPUTRC "~/.inputrc" + + /* The ultimate last-ditch filename for an init file -- system-wide. */ +-#define SYS_INPUTRC "/etc/inputrc" ++#define SYS_INPUTRC "@TERMUX_PREFIX@/etc/inputrc" + + /* If defined, expand tabs to spaces. */ + #define DISPLAY_TABS