0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-08-01 16:45:56 +00:00
Files
termux-packages/packages/pacman/makepkg.sh.in.patch
2024-09-15 14:53:17 +03:00

165 lines
4.2 KiB
Diff

--- pacman-7.0.0/scripts/makepkg.sh.in 2024-07-14 12:11:18.000000000 +0300
+++ pacman-7.0.0/scripts/makepkg.sh.in.patch 2024-09-15 13:41:42.798175166 +0300
@@ -26,7 +26,7 @@
# makepkg uses quite a few external programs during its execution. You
# need to have at least the following installed for makepkg to function:
-# awk, bsdtar (libarchive), bzip2, coreutils, fakeroot, file, find (findutils),
+# awk, bsdtar (libarchive), bzip2, coreutils, file, find (findutils),
# gettext, gpg, grep, gzip, sed, tput (ncurses), xz
# gettext initialization
@@ -59,7 +59,7 @@
GENINTEG=0
HOLDVER=0
IGNOREARCH=0
-INFAKEROOT=0
+PKGCREATION=0
INSTALL=0
LOGGING=0
NEEDED=0
@@ -107,7 +107,7 @@
trap_exit() {
local signal=$1; shift
- if (( ! INFAKEROOT )); then
+ if (( ! PKGCREATION )); then
echo
error "$@"
fi
@@ -125,7 +125,7 @@
clean_up() {
local EXIT_CODE=$?
- if (( INFAKEROOT )); then
+ if (( PKGCREATION )); then
# Don't clean up when leaving fakeroot, we're not done yet.
return 0
fi
@@ -184,9 +184,9 @@
fi
}
-enter_fakeroot() {
- msg "$(gettext "Entering %s environment...")" "fakeroot"
- fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
+pkg_creation() {
+ msg "$(gettext "Package creation...")"
+ "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
}
# Automatically update pkgver variable if a pkgver() function is provided
@@ -242,10 +242,6 @@
else
cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}")
fi
- elif type -p sudo >/dev/null; then
- cmd=(sudo -k "${cmd[@]}")
- else
- cmd=(su root -c "$cmdescape")
fi
local lockfile="$(pacman-conf DBPath)/db.lck"
while [[ -f $lockfile ]]; do
@@ -493,7 +489,6 @@
generate_autodeps
printf "# Generated by makepkg %s\n" "$makepkg_version"
- printf "# using %s\n" "$(fakeroot -v)"
write_kv_pair "pkgname" "$pkgname"
write_kv_pair "pkgbase" "$pkgbase"
@@ -848,7 +843,8 @@
run_single_packaging() {
local pkgdir="$pkgdirbase/$pkgname"
- mkdir "$pkgdir"
+ local terdir="$pkgdir@TERMUX_BASE_DIR@"
+ mkdir -p "$terdir"
if [[ -n $1 ]] || (( PKGFUNC )); then
run_package $1
fi
@@ -985,7 +981,7 @@
-D|--dir) shift; CHDIR=$1 ;;
-e|--noextract) NOEXTRACT=1 ;;
-f|--force) FORCE=1 ;;
- -F) INFAKEROOT=1 ;;
+ -F) PKGCREATION=1 ;;
# generating integrity checks does not depend on architecture
-g|--geninteg) BUILDPKG=0 GENINTEG=1 IGNOREARCH=1;;
--holdver) HOLDVER=1 ;;
@@ -1107,17 +1103,10 @@
exit $E_FS_PERMISSIONS
fi
-if (( ! INFAKEROOT )); then
- if (( EUID == 0 )); then
- error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
+if (( EUID == 0 )); then
+ error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
catastrophic damage to your system.")" "makepkg"
- exit $E_ROOT
- fi
-else
- if [[ -z $FAKEROOTKEY ]]; then
- error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg"
- exit $E_INVALID_OPTION
- fi
+ exit $E_ROOT
fi
unset pkgname "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}"
@@ -1175,6 +1164,13 @@
# set pkgdir to something "sensible" for (not recommended) use during build()
pkgdir="$pkgdirbase/$pkgbase"
+# the second pkgdir but from the termux system directory
+terdir="$pkgdir@TERMUX_BASE_DIR@"
+
+# adding home and prefix to compile correctly
+prefix="@TERMUX_PREFIX@"
+home="@TERMUX_HOME@"
+
if (( GENINTEG )); then
mkdir -p "$srcdir"
chmod a-s "$srcdir"
@@ -1233,10 +1229,10 @@
fi
# Run the bare minimum in fakeroot
-if (( INFAKEROOT )); then
+if (( PKGCREATION )); then
if (( SOURCEONLY )); then
create_srcpackage
- msg "$(gettext "Leaving %s environment.")" "fakeroot"
+ msg "$(gettext "Package creation.")"
exit $E_OK
fi
@@ -1251,7 +1247,7 @@
create_debug_package
- msg "$(gettext "Leaving %s environment.")" "fakeroot"
+ msg "$(gettext "Package creation.")"
exit $E_OK
fi
@@ -1294,7 +1290,7 @@
check_source_integrity all
cd_safe "$startdir"
- enter_fakeroot
+ pkg_creation
if [[ $SIGNPKG = 'y' ]]; then
msg "$(gettext "Signing package...")"
@@ -1398,7 +1394,7 @@
cd_safe "$startdir"
fi
- enter_fakeroot
+ pkg_creation
create_package_signatures || exit $E_PRETTY_BAD_PRIVACY
fi