Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new packages to gpkg #94

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions gpkg/bash/build.sh
Original file line number Diff line number Diff line change
@@ -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
}
30 changes: 30 additions & 0 deletions gpkg/bash/config-top.h.patch
Original file line number Diff line number Diff line change
@@ -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" */
12 changes: 12 additions & 0 deletions gpkg/bash/error.c.patch
Original file line number Diff line number Diff line change
@@ -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;
12 changes: 12 additions & 0 deletions gpkg/bash/lib-malloc-stats.c.patch
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions gpkg/bash/lib-malloc-table.c.patch
Original file line number Diff line number Diff line change
@@ -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 ()
12 changes: 12 additions & 0 deletions gpkg/bash/lib-malloc-trace.c.patch
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions gpkg/bash/lib-readline-rlconf.h.patch
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions gpkg/bash/lib-readline-util.c.patch
Original file line number Diff line number Diff line change
@@ -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);
21 changes: 21 additions & 0 deletions gpkg/bash/lib-sh-tmpfile.c.patch
Original file line number Diff line number Diff line change
@@ -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;

16 changes: 16 additions & 0 deletions gpkg/bash/pathnames.h.in.patch
Original file line number Diff line number Diff line change
@@ -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@"
19 changes: 19 additions & 0 deletions gpkg/bash/shell.c.patch
Original file line number Diff line number Diff line change
@@ -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__ */
3 changes: 3 additions & 0 deletions gpkg/bash/system.bash_logout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
# @TERMUX_PREFIX@/etc/bash.bash_logout
#
25 changes: 25 additions & 0 deletions gpkg/bash/system.bashrc
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions gpkg/bash/system.profile
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions gpkg/coreutils/build.sh
Original file line number Diff line number Diff line change
@@ -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
"
14 changes: 14 additions & 0 deletions gpkg/coreutils/date.c.patch
Original file line number Diff line number Diff line change
@@ -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)
Loading