diff --git a/pacman/0001-Msysize.patch b/pacman/0001-Msysize.patch deleted file mode 100644 index 2385b35f..00000000 --- a/pacman/0001-Msysize.patch +++ /dev/null @@ -1,939 +0,0 @@ -From e9ce0316ebcbddcc07d0ee0a47324d94c70ca8c7 Mon Sep 17 00:00:00 2001 -From: Christoph Reiter -Date: Thu, 3 Jun 2021 16:22:43 +0200 -Subject: [PATCH 01/N] Msysize - ---- - lib/libalpm/add.c | 2 + - .../lint_package/build_references.sh.in | 8 + - scripts/libmakepkg/tidy/staticlibs.sh.in | 4 +- - scripts/libmakepkg/tidy/strip.sh.in | 180 ++++++++++++------ - scripts/libmakepkg/utils_fixed_path.sh.in | 34 ++++ - scripts/makepkg.sh.in | 174 +++++++---------- - scripts/pacman-db-upgrade.sh.in | 12 +- - scripts/pacman-key.sh.in | 22 +-- - scripts/repo-add.sh.in | 11 +- - scripts/wrapper.sh.in | 2 +- - src/pacman/callback.c | 7 +- - src/pacman/check.c | 2 + - src/pacman/pacman.c | 4 + - test/pacman/pmtest.py | 19 +- - 14 files changed, 283 insertions(+), 198 deletions(-) - create mode 100644 scripts/libmakepkg/utils_fixed_path.sh.in - -diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c -index f806e5b..f0af886 100644 ---- a/lib/libalpm/add.c -+++ b/lib/libalpm/add.c -@@ -266,6 +266,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, - "filesystem: %o package: %o\n", filename, lsbuf.st_mode & mask, - entrymode & mask); - } -+#ifndef __MSYS__ - - #if 0 - /* Disable this warning until our user management in packages has improved. -@@ -283,6 +284,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, - } - #endif - -+#endif - _alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n", - filename); - archive_read_data_skip(archive); -diff --git a/scripts/libmakepkg/lint_package/build_references.sh.in b/scripts/libmakepkg/lint_package/build_references.sh.in -index 9b7ffab..a5fc455 100644 ---- a/scripts/libmakepkg/lint_package/build_references.sh.in -+++ b/scripts/libmakepkg/lint_package/build_references.sh.in -@@ -37,5 +37,13 @@ warn_build_references() { - printf '%s\n' "${refs[@]#"$pkgdir/"}" >&2 - fi - done -+ -+ # Check for Windows-style MSYS2 root path -+ if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -m /)" ; then -+ warning "$(gettext "Package contains reference to %s")" "\$(cygpath -m /)" -+ fi -+ if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -w /)" ; then -+ warning "$(gettext "Package contains reference to %s")" "\$(cygpath -w /)" -+ fi - return 0 - } -diff --git a/scripts/libmakepkg/tidy/staticlibs.sh.in b/scripts/libmakepkg/tidy/staticlibs.sh.in -index 498518c..e9d514a 100644 ---- a/scripts/libmakepkg/tidy/staticlibs.sh.in -+++ b/scripts/libmakepkg/tidy/staticlibs.sh.in -@@ -35,9 +35,9 @@ tidy_staticlibs() { - msg2 "$(gettext "Removing static library files...")" - local l - while IFS= read -rd '' l; do -- if [[ -f "${l%.a}.so" || -h "${l%.a}.so" ]]; then -+ if [[ -f "${l%.a}.dll.a" || -h "${l%.a}.dll.a" ]]; then - rm "$l" - fi -- done < <(find . ! -type d -name "*.a" -print0) -+ done < <(find . ! -type d \( -name "*.a" ! -name "*.dll.a" \) -print0) - fi - } -diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in -index 9660253..c376a39 100644 ---- a/scripts/libmakepkg/tidy/strip.sh.in -+++ b/scripts/libmakepkg/tidy/strip.sh.in -@@ -31,10 +31,6 @@ packaging_options+=('strip' 'debug') - tidy_modify+=('tidy_strip') - - --build_id() { -- LANG=C readelf -n "$1" | sed -n '/Build ID/ { s/.*: //p; q; }' --} -- - source_files() { - LANG=C readelf "$1" --debug-dump 2>/dev/null | \ - awk '/DW_AT_name +:/{name=$NF}/DW_AT_comp_dir +:/{{if (name == "") next}{if (name !~ /^[<\/]/) {printf "%s/", $NF}}{print name}}' -@@ -43,58 +39,63 @@ source_files() { - strip_file() { - local binary=$1; shift - -- if check_option "debug" "y"; then -- local bid=$(build_id "$binary") -- -- # has this file already been stripped -- if [[ -n "$bid" ]]; then -- if [[ -f "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" ]]; then -+ case "$(file -bi "$binary")" in -+ *application/x-dosexec*) -+ if check_option "debug" "y"; then -+ if [[ -f "$dbgdir/$binary.debug" ]]; then - return - fi -- elif [[ -f "$dbgdir/$binary.debug" ]]; then -- return -- fi - -- # copy source files to debug directory -- local file dest t -- while IFS= read -r t; do -- file=${t/${dbgsrcdir}/"$srcdir"} -- dest="${dbgsrc/"$dbgsrcdir"/}$t" -- if ! [[ -f $dest ]]; then -- mkdir -p "${dest%/*}" -- cp -- "$file" "$dest" -- fi -- done < <(source_files "$binary") -+ # copy source files to debug directory -+ local file dest t -+ while IFS= read -r t; do -+ file=${t/${dbgsrcdir}/"$srcdir"} -+ dest="${dbgsrc/"$dbgsrcdir"/}$t" -+ if ! [[ -f $dest ]]; then -+ mkdir -p "${dest%/*}" -+ cp -- "$file" "$dest" -+ fi -+ done < <(source_files "$binary") -+ -+ # copy debug symbols to debug directory -+ mkdir -p "$dbgdir/${binary%/*}" -+ msg2 "Separating debug info from $binary into $dbgdir/$binary.debug" -+ # create a dbg file with proper debug info: -+ objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" -+ -+ msg2 "Creating a debuginfo link to $dbgdir/$binary.debug in $binary" -+ local tempfile=$(mktemp "$binary.XXXXXX") -+ objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile" -+ cat "$tempfile" > "$binary" -+ rm "$tempfile" -+ -+ msg2 "Separating (again) debug info from $binary into $dbgdir/$binary.debug" -+ objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" -+ -+ msg2 "Removing old .gnu_debuglink section from $binary" -+ objcopy --remove-section=.gnu_debuglink "$binary" -+ -+ # strip debug-info from the original file -+ objcopy --strip-debug "$binary" -+ msg2 "Creating (again) a debuginfo link to $dbgdir/$binary.debug in $binary" -+ tempfile=$(mktemp "$binary.XXXXXX") -+ objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile" -+ cat "$tempfile" > "$binary" -+ rm "$tempfile" -+ # This way dbg file gets a .gnu_debuglink section (doesn't matter where -+ # it's pointing), and its contents pass the CRC32 check -+ -+ # create any needed hardlinks -+ while IFS= read -rd '' file ; do -+ if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then -+ mkdir -p "$dbgdir/${file%/*}" -+ ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug" -+ fi -+ done < <(find . -type f -perm -u+w -print0 2>/dev/null) - -- # copy debug symbols to debug directory -- mkdir -p "$dbgdir/${binary%/*}" -- objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" -- local tempfile=$(mktemp "$binary.XXXXXX") -- objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile" -- cat "$tempfile" > "$binary" -- rm "$tempfile" -- -- # create any needed hardlinks -- while IFS= read -rd '' file ; do -- if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then -- mkdir -p "$dbgdir/${file%/*}" -- ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug" -- fi -- done < <(find . -type f -perm -u+w -print0 2>/dev/null) -- -- if [[ -n "$bid" ]]; then -- local target -- mkdir -p "$dbgdir/.build-id/${bid:0:2}" -- -- target="../../../../../${binary#./}" -- target="${target/..\/..\/usr\/lib\/}" -- target="${target/..\/usr\/}" -- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}" -- -- target="../../${binary#./}.debug" -- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" - fi -- fi -+ ;; -+ esac - - local tempfile=$(mktemp "$binary.XXXXXX") - if strip "$@" "$binary" -o "$tempfile"; then -@@ -123,17 +124,86 @@ tidy_strip() { - - if check_option "debug" "y"; then - -- dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug" -+ dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@" - dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}" - dbgsrc="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@$dbgsrcdir" - mkdir -p "$dbgdir" "$dbgsrc" - fi - - local binary strip_flags -- find . -type f -perm -u+w -print0 2>/dev/null | while IFS= read -rd '' binary ; do -+ # *.so: Apache2 modules, OCaml stublibs, Ruby modules -+ # *.oct: Octave modules -+ # *.cmxs: OCaml natdynlink modules: http://gallium.inria.fr/~frisch/ndl.txt -+ find * -type f ! -name '*.dll.a' ! -name '*.lib' \ -+ -a \( -name '*.a' -o -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.oct' -o -name '*.cmxs' \) -print0 \ -+ -o -type f -executable ! -name '*.dll' ! -name '*.exe' ! -name '*.so' ! -name '*.so.[0-9]*' ! -name '*.oct' ! -name '*.cmxs' ! -name '*.a' ! -name '*.la' ! -name '*.lib' ! -name '*.exe.manifest' ! -name '*.exe.config' ! -name '*.dll.config' ! -name '*.mdb' ! -name '*-config' ! -name '*.csh' ! -name '*.sh' ! -name '*.pl' ! -name '*.pm' ! -name '*.py' ! -name '*.rb' ! -name '*.tcl' -print0 | \ -+ while IFS= read -d $'\0' binary -+ do - local STRIPLTO=0 -- case "$(LC_ALL=C readelf -h "$binary" 2>/dev/null)" in -- *Type:*'DYN (Shared object file)'*) # Libraries (.so) or Relocatable binaries -+ # Skip thin archives from stripping -+ case "${binary##*/}" in -+ *.a) -+ if [ "$(head -c 7 "${binary}")" = '!' ] -+ then -+ continue -+ fi -+ ;; -+ esac -+ -+ # assure this is actually a binary object -+ if [ "$(head -c 2 "${binary}")" = '#!' ] -+ then -+ # sometimes .exe will be appended where it does not belong -+ case "${exe}" in -+ usr/lib/hevea/*.exe) ;; -+ *.exe) mv "${binary}" "${binary%.exe}" ;; -+ esac -+ continue -+ fi -+ -+ # OCaml bytecode must not be stripped -+ # Magic number is at end of file: -+ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900#74 -+ # http://cygwin.com/ml/cygwin-apps/2010-10/msg00057.html -+ # -+ # Perl Archive (PAR) binaries must not be stripped -+ # https://rt.cpan.org/Public/Bug/Display.html?id=18536 -+ # http://cygwin.com/ml/cygwin-apps/2012-07/msg00088.html -+ case $(tail -c 12 "${binary}" | tr '\012\0' '%') in -+ %PAR\.pm%) continue ;; -+ Caml1999X0[0-9][0-9]) continue ;; -+ esac -+ -+ # Mono assemblies must not be stripped, but remove .mdb debug symbols, -+ # and make them non-executable so they're not launched by MS .NET -+ if LC_ALL=C file -b "${binary}" 2>&1 | grep -q "Mono/\.Net assembly" -+ then -+ chmod 0644 "${binary}" -+ rm -f "${binary}.mdb" -+ continue -+ fi -+ -+ # check for .exe from non-automake Makefile which install(1) didn't fix -+ # strip(1) used to take care of this, but not anymore -+ case ${CHOST} in -+ *-*-cygwin*|*-*-mingw*|*-*-msys*) -+ case "${binary##*/}" in -+ *.dll|*.exe|*.sfx|*.so|*.so.[0-9]*|*.oct|*.cmxs) ;; -+ # make sure this isn't some oddly named DLL -+ *) if LANG=en_US.UTF-8 LC_ALL=C objdump -f "${binary}" | grep -Eq '^start address 0x(0000000[01])?00401[0-9a-e][0-9a-e]0' -+ then -+ mv "${binary}" "${binary}.exe" -+ binary+=.exe -+ fi ;; -+ esac -+ ;; -+ esac -+ chmod 0755 "${binary}"; -+ -+ case "$(@FILECMD@ -bi "$binary")" in -+ *application/x-dosexec*) # Windows executables and dlls -+ strip_flags="$STRIP_SHARED";; -+ *application/x-sharedlib*) # Libraries (.so) - strip_flags="$STRIP_SHARED";; - *Type:*'DYN (Position-Independent Executable file)'*) # Relocatable binaries - strip_flags="$STRIP_SHARED";; -diff --git a/scripts/libmakepkg/utils_fixed_path.sh.in b/scripts/libmakepkg/utils_fixed_path.sh.in -new file mode 100644 -index 0000000..e3a06bc ---- /dev/null -+++ b/scripts/libmakepkg/utils_fixed_path.sh.in -@@ -0,0 +1,34 @@ -+if [[ -n "$MSYSTEM" ]]; then -+ readonly -a UTILS_NAME=('bsdtar' -+ 'bzip2' -+ 'bzr' -+ 'cat' -+ 'ccache' -+ 'distcc' -+ 'git' -+ 'gpg' -+ 'gzip' -+ 'hg' -+ 'lzip' -+ 'lzop' -+ 'openssl' -+ 'svn' -+ 'tput' -+ 'uncompress' -+ 'xargs' -+ 'xz' -+ 'zstd' -+ ) -+ -+ for wrapper in ${UTILS_NAME[@]}; do -+ eval " -+ ${wrapper}"'() { -+ local UTILS_PATH="/usr/bin/" -+ if ! type -p ${UTILS_PATH}${FUNCNAME[0]} >/dev/null; then -+ error "$(gettext "Cannot find the %s binary required for makepkg.")" "${UTILS_PATH}${FUNCNAME[0]}" -+ exit 1 -+ fi -+ ${UTILS_PATH}${FUNCNAME[0]} "$@" -+ }' -+ done -+fi -diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in -index e58edfa..6c8446b 100644 ---- a/scripts/makepkg.sh.in -+++ b/scripts/makepkg.sh.in -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/usr/bin/env bash - # - # makepkg - make packages compatible for use with pacman - # -@@ -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,6 @@ FORCE=0 - GENINTEG=0 - HOLDVER=0 - IGNOREARCH=0 --INFAKEROOT=0 - INSTALL=0 - LOGGING=0 - NEEDED=0 -@@ -105,10 +104,9 @@ done - trap_exit() { - local signal=$1; shift - -- if (( ! INFAKEROOT )); then -- echo -- error "$@" -- fi -+ echo -+ error "$@" -+ - [[ -n $srclinks ]] && rm -rf "$srclinks" - - # unset the trap for this signal, and then call the default handler -@@ -123,11 +121,6 @@ trap_exit() { - clean_up() { - local EXIT_CODE=$? - -- if (( INFAKEROOT )); then -- # Don't clean up when leaving fakeroot, we're not done yet. -- return 0 -- fi -- - if [[ -p $logpipe ]]; then - rm "$logpipe" - fi -@@ -137,7 +130,7 @@ clean_up() { - - # If it's a clean exit and -c/--clean has been passed... - msg "$(gettext "Cleaning up...")" -- rm -rf "$pkgdirbase" "$srcdir" -+ rm -rf "$pkgdirbase" "$srcdir" "$destdir" - if [[ -n $pkgbase ]]; then - local fullver=$(get_full_version) - # Can't do this unless the BUILDSCRIPT has been sourced. -@@ -179,11 +172,6 @@ clean_up() { - fi - } - --enter_fakeroot() { -- msg "$(gettext "Entering %s environment...")" "fakeroot" -- fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $? --} -- - # Automatically update pkgver variable if a pkgver() function is provided - # Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver - update_pkgver() { -@@ -237,10 +225,6 @@ run_pacman() { - else - cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}") - fi -- elif type -p sudo >/dev/null; then -- cmd=(sudo "${cmd[@]}") -- else -- cmd=(su root -c "$cmdescape") - fi - local lockfile="$(pacman-conf DBPath)/db.lck" - while [[ -f $lockfile ]]; do -@@ -440,7 +424,7 @@ run_function() { - - $pkgfunc &>"$logpipe" - -- wait -f $teepid -+ wait $teepid - rm "$logpipe" - else - "$pkgfunc" -@@ -468,7 +452,7 @@ find_libdepends() { - - sodepends=0 - for d in "${depends[@]}"; do -- if [[ $d = *.so ]]; then -+ if [[ $d = *.dll ]]; then - sodepends=1 - break - fi -@@ -479,28 +463,33 @@ find_libdepends() { - return 0 - fi - -- local libdeps filename soarch sofile soname soversion -+ local libdeps filename soarch sofile soname - declare -A libdeps - - while IFS= read -rd '' filename; do -- # get architecture of the file; if soarch is empty it's not an ELF binary -- soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') -+ # get architecture of the file; if soarch is empty it's not an binary -+ soarch=$(LANG=en_US.UTF-8 LC_ALL=C objdump -a "$filename" | sed -n 's/.*file format.*pei-\(i386\|x86-64\)/\1/p') - [[ -n "$soarch" ]] || continue -+ case "$soarch" in -+ i386) -+ soarch=i686 -+ ;; -+ x86-64) -+ soarch=x86_64 -+ ;; -+ esac - - # process all libraries needed by the binary -- for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') -+ for sofile in $(LC_ALL=C objdump -x "$filename" 2>/dev/null | sed -nr 's/.*DLL Name: (.*).*/\1/p') - do -- # extract the library name: libfoo.so -- soname="${sofile%.so?(+(.+([0-9])))}".so -- # extract the major version: 1 -- soversion="${sofile##*\.so\.}" -+ soname=${sofile} - - if [[ ${libdeps[$soname]} ]]; then -- if [[ ${libdeps[$soname]} != *${soversion}-${soarch}* ]]; then -- libdeps[$soname]+=" ${soversion}-${soarch}" -+ if [[ ${libdeps[$soname]} != *${soarch}* ]]; then -+ libdeps[$soname]+=" ${soarch}" - fi - else -- libdeps[$soname]="${soversion}-${soarch}" -+ libdeps[$soname]="${soarch}" - fi - done - done < <(find "$pkgdir" -type f -perm -u+x -print0) -@@ -508,7 +497,7 @@ find_libdepends() { - local libdepends v - for d in "${depends[@]}"; do - case "$d" in -- *.so) -+ *.dll) - if [[ ${libdeps[$d]} ]]; then - for v in ${libdeps[$d]}; do - libdepends+=("$d=$v") -@@ -534,30 +523,23 @@ find_libprovides() { - missing=0 - versioned_provides=() - case "$p" in -- *.so) -- mapfile -t filename < <(find "$pkgdir" -type f -name $p\* | LC_ALL=C sort) -+ *.dll) -+ mapfile -t filename < <(find "$pkgdir" -type f -name $p) - if [[ $filename ]]; then - # packages may provide multiple versions of the same library - for fn in "${filename[@]}"; do -- # check if we really have a shared object -- if LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then -- # get the string binaries link to (e.g. libfoo.so.1.2 -> libfoo.so.1) -- local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p') -- if [[ -z "$sofile" ]]; then -- warning "$(gettext "Library listed in %s is not versioned: %s")" "'provides'" "$p" -- continue -- fi -- -- # get the library architecture (32 or 64 bit) -- local soarch=$(LC_ALL=C readelf -h "$fn" | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') -- -- # extract the library major version -- local soversion="${sofile##*\.so\.}" -- -- versioned_provides+=("${p}=${soversion}-${soarch}") -- else -- warning "$(gettext "Library listed in %s is not a shared object: %s")" "'provides'" "$p" -- fi -+ # get the library architecture (32 or 64 bit) -+ local soarch=$(LC_ALL=C objdump -a "$fn" | sed -n 's/.*file format.*pei-\(i386\|x86-64\)/\1/p') -+ case "$soarch" in -+ i386) -+ soarch=i686 -+ ;; -+ x86-64) -+ soarch=x86_64 -+ ;; -+ esac -+ -+ versioned_provides+=("${p}=${soarch}") - done - else - missing=1 -@@ -597,7 +579,6 @@ write_pkginfo() { - merge_arch_attrs - - printf "# Generated by makepkg %s\n" "$makepkg_version" -- printf "# using %s\n" "$(fakeroot -v)" - - write_kv_pair "pkgname" "$pkgname" - write_kv_pair "pkgbase" "$pkgbase" -@@ -750,7 +731,7 @@ create_debug_package() { - local pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@" - - # check if we have any debug symbols to package -- if dir_is_empty "$pkgdir/usr/lib/debug"; then -+ if dir_is_empty "$pkgdir"; then - return 0 - fi - -@@ -939,6 +920,11 @@ restore_package_variables() { - - run_single_packaging() { - local pkgdir="$pkgdirbase/$pkgname" -+ # clean existing pkg directory -+ if [[ -d "$pkgdir" ]]; then -+ msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/" -+ rm -rf "$pkgdir" -+ fi - mkdir "$pkgdir" - if [[ -n $1 ]] || (( PKGFUNC )); then - run_package $1 -@@ -1032,12 +1018,16 @@ if ! type -p gettext >/dev/null; then - gettext() { - printf "%s\n" "$@" - } -+else -+ gettext() { -+ /usr/bin/gettext "$@" -+ } - fi - - ARGLIST=("$@") - - # Parse Command Line Options. --OPT_SHORT="AcCdefFghiLmop:rRsSV" -+OPT_SHORT="AcCdefghiLmop:rRsSV" - OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' - 'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild' - 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist' -@@ -1071,7 +1061,6 @@ while true; do - -d|--nodeps) NODEPS=1 ;; - -e|--noextract) NOEXTRACT=1 ;; - -f|--force) FORCE=1 ;; -- -F) INFAKEROOT=1 ;; - # generating integrity checks does not depend on architecture - -g|--geninteg) BUILDPKG=0 GENINTEG=1 IGNOREARCH=1;; - --holdver) HOLDVER=1 ;; -@@ -1186,19 +1175,6 @@ if (( LOGGING )) && ! ensure_writable_dir "LOGDEST" "$LOGDEST"; then - 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\ --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 --fi -- - unset pkgname "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}" - unset "${known_hash_algos[@]/%/sums}" - unset -f pkgver prepare build check package "${!package_@}" -@@ -1319,29 +1295,6 @@ if (( ! PKGVERFUNC )); then - check_build_status - fi - --# Run the bare minimum in fakeroot --if (( INFAKEROOT )); then -- if (( SOURCEONLY )); then -- create_srcpackage -- msg "$(gettext "Leaving %s environment.")" "fakeroot" -- exit $E_OK -- fi -- -- prepare_buildenv -- -- chmod 755 "$pkgdirbase" -- if (( ! SPLITPKG )); then -- run_single_packaging -- else -- run_split_packaging -- fi -- -- create_debug_package -- -- msg "$(gettext "Leaving %s environment.")" "fakeroot" -- exit $E_OK --fi -- - msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))" - - # if we are creating a source-only package, go no further -@@ -1365,7 +1318,7 @@ if (( SOURCEONLY )); then - check_source_integrity all - cd_safe "$startdir" - -- enter_fakeroot -+ create_srcpackage - - if [[ $SIGNPKG = 'y' ]]; then - msg "$(gettext "Signing package...")" -@@ -1415,6 +1368,9 @@ mkdir -p "$srcdir" - chmod a-s "$srcdir" - cd_safe "$srcdir" - -+export MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX -+export DXSDK_DIR ACLOCAL_PATH PKG_CONFIG_PATH -+ - if (( !REPKG )); then - if (( NOEXTRACT && ! VERIFYSOURCE )); then - warning "$(gettext "Using existing %s tree")" "\$srcdir/" -@@ -1467,15 +1423,23 @@ else - cd_safe "$startdir" - fi - -- enter_fakeroot -+ # if inhibiting archive creation, go no further -+ if (( NOARCHIVE )); then -+ msg "$(gettext "Package directory is ready.")" -+ exit $E_OK -+ fi -+ mkdir -p "$pkgdirbase" -+ chmod a-srwx "$pkgdirbase" -+ chmod 755 "$pkgdirbase" -+ if (( ! SPLITPKG )); then -+ run_single_packaging -+ else -+ run_split_packaging -+ fi - -- create_package_signatures || exit $E_PRETTY_BAD_PRIVACY --fi -+ create_debug_package - --# if inhibiting archive creation, go no further --if (( NOARCHIVE )); then -- msg "$(gettext "Package directory is ready.")" -- exit $E_OK -+ create_package_signatures || exit $E_PRETTY_BAD_PRIVACY - fi - - msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date +%c))" -diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in -index 550d9f9..c1cb200 100644 ---- a/scripts/pacman-db-upgrade.sh.in -+++ b/scripts/pacman-db-upgrade.sh.in -@@ -1,4 +1,4 @@ --#!/bin/bash -e -+#!/usr/bin/env bash - # - # pacman-db-upgrade - upgrade the local pacman db to a newer format - # -@@ -78,9 +78,13 @@ resolve_dir() { - # PROGRAM START - - # determine whether we have gettext; make it a no-op if we do not --if ! type gettext &>/dev/null; then -+if ! type -p gettext >/dev/null; then - gettext() { -- echo "$@" -+ printf "%s\n" "$@" -+ } -+else -+ gettext() { -+ /usr/bin/gettext "$@" - } - fi - -@@ -137,7 +141,7 @@ lockfile="${dbroot}/db.lck" - - # make sure pacman isn't running - if [[ -f $lockfile ]]; then -- die "$(gettext "Pacman lock file was found. Cannot run while pacman is running.")" -+ die "$(/bin/gettext "Pacman lock file was found. Cannot run while pacman is running.")" - fi - # do not let pacman run while we do this - touch "$lockfile" -diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in -index f7f1dd6..591dcec 100644 ---- a/scripts/pacman-key.sh.in -+++ b/scripts/pacman-key.sh.in -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/usr/bin/env bash - # - # pacman-key - manages pacman's keyring - # Based on apt-key, from Debian -@@ -30,6 +30,7 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'} - # Import libmakepkg - source "$LIBRARY"/util/message.sh - source "$LIBRARY"/util/parseopts.sh -+source "$LIBRARY"/utils_fixed_path.sh - - # Options - ADD=0 -@@ -265,7 +266,7 @@ check_keyring() { - exit 1 - fi - -- if (( (EXPORT || FINGER || LIST || VERIFY) && EUID != 0 )); then -+ if (( EXPORT || FINGER || LIST || VERIFY )); then - if ! grep -q "^[[:space:]]*lock-never[[:space:]]*$" ${PACMAN_KEYRING_DIR}/gpg.conf &>/dev/null; then - error "$(gettext "You do not have sufficient permissions to run this command.")" - msg "$(gettext "Use '%s' to correct the keyring permissions.")" "pacman-key --init" -@@ -433,7 +434,7 @@ import_trustdb() { - local ret=0 - for importdir in "$@"; do - if [[ -f "${importdir}/trustdb.gpg" ]]; then -- gpg --homedir "${importdir}" --export-ownertrust | \ -+ /bin/gpg --homedir "${importdir}" --export-ownertrust | \ - "${GPG_PACMAN[@]}" --import-ownertrust - - if (( PIPESTATUS )); then - error "$(gettext "%s could not be imported.")" "${importdir}/trustdb.gpg" -@@ -605,10 +606,14 @@ updatedb() { - fi - } - --# PROGRAM START --if ! type gettext &>/dev/null; then -+# determine whether we have gettext; make it a no-op if we do not -+if ! type -p gettext >/dev/null; then - gettext() { -- echo "$@" -+ printf "%s\n" "$@" -+ } -+else -+ gettext() { -+ /usr/bin/gettext "$@" - } - fi - -@@ -672,11 +677,6 @@ if ! type -p gpg >/dev/null; then - exit 1 - fi - --if (( (ADD || DELETE || EDITKEY || IMPORT || IMPORT_TRUSTDB || INIT || LSIGNKEY || POPULATE || RECEIVE || REFRESH || UPDATEDB) && EUID != 0 )); then -- error "$(gettext "%s needs to be run as root for this operation.")" "pacman-key" -- exit 1 --fi -- - CONFIG=${CONFIG:-@sysconfdir@/pacman.conf} - if [[ ! -r "${CONFIG}" ]]; then - error "$(gettext "%s configuration file '%s' not found.")" "pacman" "$CONFIG" -diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in -index d393839..a231699 100644 ---- a/scripts/repo-add.sh.in -+++ b/scripts/repo-add.sh.in -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/usr/bin/env bash - # - # repo-add - add a package to a given repo database file - # repo-remove - remove a package entry from a given repo database file -@@ -46,6 +46,7 @@ PREVENT_DOWNGRADE=0 - # Import libmakepkg - source "$LIBRARY"/util/compress.sh - source "$LIBRARY"/util/message.sh -+source "$LIBRARY"/utils_fixed_path.sh - - # ensure we have a sane umask set - umask 0022 -@@ -562,9 +563,13 @@ clean_up() { - # PROGRAM START - - # determine whether we have gettext; make it a no-op if we do not --if ! type gettext &>/dev/null; then -+if ! type -p gettext &>/dev/null; then - gettext() { -- echo "$@" -+ printf "%s\n" "$@" -+ } -+else -+ gettext() { -+ /usr/bin/gettext "$@" - } - fi - -diff --git a/scripts/wrapper.sh.in b/scripts/wrapper.sh.in -index 1b28b84..504db36 100644 ---- a/scripts/wrapper.sh.in -+++ b/scripts/wrapper.sh.in -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/usr/bin/env bash - # - # @PROGNAME@ - a wrapper for running the real @PROGNAME@ in the source tree - # -diff --git a/src/pacman/callback.c b/src/pacman/callback.c -index 75c74f8..2f07512 100644 ---- a/src/pacman/callback.c -+++ b/src/pacman/callback.c -@@ -153,8 +153,11 @@ static int64_t get_update_timediff(int first_call) - static void fill_progress(const int bar_percent, const int disp_percent, - const int proglen) - { -- /* 8 = 1 space + 1 [ + 1 ] + 5 for percent */ -- const int hashlen = proglen > 8 ? proglen - 8 : 0; -+ /* 9 = 1 space + 1 [ + 1 ] + 5 for percent + 1 blank */ -+ /* Without the single blank at the end, carriage return wouldn't -+ * work properly on most windows terminals. -+ */ -+ const int hashlen = proglen > 9 ? proglen - 9 : 0; - const int hash = bar_percent * hashlen / 100; - static int lasthash = 0, mouth = 0; - int i; -diff --git a/src/pacman/check.c b/src/pacman/check.c -index 091055f..188f515 100644 ---- a/src/pacman/check.c -+++ b/src/pacman/check.c -@@ -75,6 +75,7 @@ static int check_file_permissions(const char *pkgname, const char *filepath, - int errors = 0; - mode_t fsmode; - -+#ifndef __MSYS__ - /* uid */ - if(st->st_uid != archive_entry_uid(entry)) { - errors++; -@@ -92,6 +93,7 @@ static int check_file_permissions(const char *pkgname, const char *filepath, - pkgname, filepath); - } - } -+#endif - - /* mode */ - fsmode = st->st_mode & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO); -diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c -index e398855..36c3b5e 100644 ---- a/src/pacman/pacman.c -+++ b/src/pacman/pacman.c -@@ -1086,7 +1086,9 @@ static void cl_to_log(int argc, char *argv[]) - int main(int argc, char *argv[]) - { - int ret = 0; -+#ifndef __MSYS__ - uid_t myuid = getuid(); -+#endif - - console_cursor_hide(); - install_segv_handler(); -@@ -1130,11 +1132,13 @@ int main(int argc, char *argv[]) - cleanup(ret); - } - -+#ifndef __MSYS__ - /* check if we have sufficient permission for the requested operation */ - if(myuid > 0 && needs_root()) { - pm_printf(ALPM_LOG_ERROR, _("you cannot perform this operation unless you are root.\n")); - cleanup(EXIT_FAILURE); - } -+#endif - - /* we support reading targets from stdin if a cmdline parameter is '-' */ - if(alpm_list_find_str(pm_targets, "-")) { -diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py -index 94b0930..f008f22 100644 ---- a/test/pacman/pmtest.py -+++ b/test/pacman/pmtest.py -@@ -239,19 +239,6 @@ class pmtest(object): - vprint("\tpacman %s" % self.args) - - cmd = [] -- if os.geteuid() != 0: -- fakeroot = util.which("fakeroot") -- if not fakeroot: -- tap.diag("WARNING: fakeroot not found!") -- else: -- cmd.append("fakeroot") -- -- fakechroot = util.which("fakechroot") -- if not fakechroot: -- tap.diag("WARNING: fakechroot not found!") -- else: -- cmd.append("fakechroot") -- - if pacman["gdb"]: - cmd.extend(["libtool", "execute", "gdb", "--args"]) - if pacman["valgrind"]: -@@ -294,8 +281,10 @@ class pmtest(object): - # Change to the tmp dir before running pacman, so that local package - # archives are made available more easily. - time_start = time.time() -- self.retcode = subprocess.call(cmd, stdout=output, stderr=output, -- cwd=os.path.join(self.root, util.TMPDIR), env={'LC_ALL': 'C'}) -+ self.retcode = subprocess.call(cmd, -+ cwd=os.path.join(self.root, util.TMPDIR), -+ env={'LC_ALL': 'C', 'PATH': os.environ['PATH']}, -+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - time_end = time.time() - vprint("\ttime elapsed: %.2fs" % (time_end - time_start)) - diff --git a/pacman/0001-makepkg-clean-up-more-things.patch b/pacman/0001-makepkg-clean-up-more-things.patch new file mode 100644 index 00000000..f1ea4eda --- /dev/null +++ b/pacman/0001-makepkg-clean-up-more-things.patch @@ -0,0 +1,34 @@ +From bf8bd9828cf3e4efedbaa9a367e94de0e3361d30 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:24:16 +0100 +Subject: [PATCH 01/N] makepkg: clean up more things + +--- + scripts/makepkg.sh.in | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index f799c8f..fca9b2c 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -137,7 +137,7 @@ clean_up() { + + # If it's a clean exit and -c/--clean has been passed... + msg "$(gettext "Cleaning up...")" +- rm -rf "$pkgdirbase" "$srcdir" ++ rm -rf "$pkgdirbase" "$srcdir" "$destdir" + if [[ -n $pkgbase ]]; then + local fullver=$(get_full_version) + # Can't do this unless the BUILDSCRIPT has been sourced. +@@ -939,6 +939,11 @@ restore_package_variables() { + + run_single_packaging() { + local pkgdir="$pkgdirbase/$pkgname" ++ # clean existing pkg directory ++ if [[ -d "$pkgdir" ]]; then ++ msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/" ++ rm -rf "$pkgdir" ++ fi + mkdir "$pkgdir" + if [[ -n $1 ]] || (( PKGFUNC )); then + run_package $1 diff --git a/pacman/0002-makepkg-bash-v4-compat.patch b/pacman/0002-makepkg-bash-v4-compat.patch new file mode 100644 index 00000000..c051257f --- /dev/null +++ b/pacman/0002-makepkg-bash-v4-compat.patch @@ -0,0 +1,24 @@ +From 1fbb46db545fad72daab79d769f19a4ae4cea6e3 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:24:42 +0100 +Subject: [PATCH 02/N] makepkg: bash v4 compat + +I think this is from a time when we only had bash v4 which didn't support "-f" +and can be dropped +--- + scripts/makepkg.sh.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index fca9b2c..5549f07 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -440,7 +440,7 @@ run_function() { + + $pkgfunc &>"$logpipe" + +- wait -f $teepid ++ wait $teepid + rm "$logpipe" + else + "$pkgfunc" diff --git a/pacman/0003-makepkg-find_libdepends-port-to-Windows.patch b/pacman/0003-makepkg-find_libdepends-port-to-Windows.patch new file mode 100644 index 00000000..848fd8d0 --- /dev/null +++ b/pacman/0003-makepkg-find_libdepends-port-to-Windows.patch @@ -0,0 +1,76 @@ +From 261911e634510c2b5390cf67d5067fca8f18a2a3 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:29:47 +0100 +Subject: [PATCH 03/N] makepkg: find_libdepends: port to Windows + +--- + scripts/makepkg.sh.in | 31 ++++++++++++++++++------------- + 1 file changed, 18 insertions(+), 13 deletions(-) + +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index 5549f07..048d90d 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -468,7 +468,7 @@ find_libdepends() { + + sodepends=0 + for d in "${depends[@]}"; do +- if [[ $d = *.so ]]; then ++ if [[ $d = *.dll ]]; then + sodepends=1 + break + fi +@@ -479,28 +479,33 @@ find_libdepends() { + return 0 + fi + +- local libdeps filename soarch sofile soname soversion ++ local libdeps filename soarch sofile soname + declare -A libdeps + + while IFS= read -rd '' filename; do +- # get architecture of the file; if soarch is empty it's not an ELF binary +- soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') ++ # get architecture of the file; if soarch is empty it's not an binary ++ soarch=$(LANG=en_US.UTF-8 LC_ALL=C objdump -a "$filename" | sed -n 's/.*file format.*pei-\(i386\|x86-64\)/\1/p') + [[ -n "$soarch" ]] || continue ++ case "$soarch" in ++ i386) ++ soarch=i686 ++ ;; ++ x86-64) ++ soarch=x86_64 ++ ;; ++ esac + + # process all libraries needed by the binary +- for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') ++ for sofile in $(LC_ALL=C objdump -x "$filename" 2>/dev/null | sed -nr 's/.*DLL Name: (.*).*/\1/p') + do +- # extract the library name: libfoo.so +- soname="${sofile%.so?(+(.+([0-9])))}".so +- # extract the major version: 1 +- soversion="${sofile##*\.so\.}" ++ soname=${sofile} + + if [[ ${libdeps[$soname]} ]]; then +- if [[ ${libdeps[$soname]} != *${soversion}-${soarch}* ]]; then +- libdeps[$soname]+=" ${soversion}-${soarch}" ++ if [[ ${libdeps[$soname]} != *${soarch}* ]]; then ++ libdeps[$soname]+=" ${soarch}" + fi + else +- libdeps[$soname]="${soversion}-${soarch}" ++ libdeps[$soname]="${soarch}" + fi + done + done < <(find "$pkgdir" -type f -perm -u+x -print0) +@@ -508,7 +513,7 @@ find_libdepends() { + local libdepends v + for d in "${depends[@]}"; do + case "$d" in +- *.so) ++ *.dll) + if [[ ${libdeps[$d]} ]]; then + for v in ${libdeps[$d]}; do + libdepends+=("$d=$v") diff --git a/pacman/0004-makepkg-build-env-export.patch b/pacman/0004-makepkg-build-env-export.patch new file mode 100644 index 00000000..26e3c477 --- /dev/null +++ b/pacman/0004-makepkg-build-env-export.patch @@ -0,0 +1,24 @@ +From c8025392f733b5b28687a8b468191354cd037415 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:30:09 +0100 +Subject: [PATCH 04/N] makepkg: build env export + +this should be moved to the other exports really.. +--- + scripts/makepkg.sh.in | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index 048d90d..2a85702 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -1425,6 +1425,9 @@ mkdir -p "$srcdir" + chmod a-s "$srcdir" + cd_safe "$srcdir" + ++export MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX ++export DXSDK_DIR ACLOCAL_PATH PKG_CONFIG_PATH ++ + if (( !REPKG )); then + if (( NOEXTRACT && ! VERIFYSOURCE )); then + warning "$(gettext "Using existing %s tree")" "\$srcdir/" diff --git a/pacman/0005-makepkg-find_libprovides-port-to-Windows.patch b/pacman/0005-makepkg-find_libprovides-port-to-Windows.patch new file mode 100644 index 00000000..0e72bdaa --- /dev/null +++ b/pacman/0005-makepkg-find_libprovides-port-to-Windows.patch @@ -0,0 +1,58 @@ +From e17f32548b02f143ec175dedd3130fdeee101787 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:30:23 +0100 +Subject: [PATCH 05/N] makepkg: find_libprovides: port to Windows + +--- + scripts/makepkg.sh.in | 35 ++++++++++++++--------------------- + 1 file changed, 14 insertions(+), 21 deletions(-) + +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index 2a85702..6384c35 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -539,30 +539,23 @@ find_libprovides() { + missing=0 + versioned_provides=() + case "$p" in +- *.so) +- mapfile -t filename < <(find "$pkgdir" -type f -name $p\* | LC_ALL=C sort) ++ *.dll) ++ mapfile -t filename < <(find "$pkgdir" -type f -name $p) + if [[ $filename ]]; then + # packages may provide multiple versions of the same library + for fn in "${filename[@]}"; do +- # check if we really have a shared object +- if LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then +- # get the string binaries link to (e.g. libfoo.so.1.2 -> libfoo.so.1) +- local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p') +- if [[ -z "$sofile" ]]; then +- warning "$(gettext "Library listed in %s is not versioned: %s")" "'provides'" "$p" +- continue +- fi +- +- # get the library architecture (32 or 64 bit) +- local soarch=$(LC_ALL=C readelf -h "$fn" | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') +- +- # extract the library major version +- local soversion="${sofile##*\.so\.}" +- +- versioned_provides+=("${p}=${soversion}-${soarch}") +- else +- warning "$(gettext "Library listed in %s is not a shared object: %s")" "'provides'" "$p" +- fi ++ # get the library architecture (32 or 64 bit) ++ local soarch=$(LC_ALL=C objdump -a "$fn" | sed -n 's/.*file format.*pei-\(i386\|x86-64\)/\1/p') ++ case "$soarch" in ++ i386) ++ soarch=i686 ++ ;; ++ x86-64) ++ soarch=x86_64 ++ ;; ++ esac ++ ++ versioned_provides+=("${p}=${soarch}") + done + else + missing=1 diff --git a/pacman/0006-fill_progress.patch b/pacman/0006-fill_progress.patch new file mode 100644 index 00000000..a266d6c2 --- /dev/null +++ b/pacman/0006-fill_progress.patch @@ -0,0 +1,27 @@ +From 6a848dc26eb97a74ce01694d066dcb6eab335aa3 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:30:40 +0100 +Subject: [PATCH 06/N] fill_progress + +--- + src/pacman/callback.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/pacman/callback.c b/src/pacman/callback.c +index 75c74f8..2f07512 100644 +--- a/src/pacman/callback.c ++++ b/src/pacman/callback.c +@@ -153,8 +153,11 @@ static int64_t get_update_timediff(int first_call) + static void fill_progress(const int bar_percent, const int disp_percent, + const int proglen) + { +- /* 8 = 1 space + 1 [ + 1 ] + 5 for percent */ +- const int hashlen = proglen > 8 ? proglen - 8 : 0; ++ /* 9 = 1 space + 1 [ + 1 ] + 5 for percent + 1 blank */ ++ /* Without the single blank at the end, carriage return wouldn't ++ * work properly on most windows terminals. ++ */ ++ const int hashlen = proglen > 9 ? proglen - 9 : 0; + const int hash = bar_percent * hashlen / 100; + static int lasthash = 0, mouth = 0; + int i; diff --git a/pacman/0007-test-fixes.patch b/pacman/0007-test-fixes.patch new file mode 100644 index 00000000..63da6529 --- /dev/null +++ b/pacman/0007-test-fixes.patch @@ -0,0 +1,26 @@ +From 4c61f9081840055b4c0ca1840e6a45d287b9a21d Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:30:50 +0100 +Subject: [PATCH 07/N] test fixes + +--- + test/pacman/pmtest.py | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py +index 94b0930..bc4f2e3 100644 +--- a/test/pacman/pmtest.py ++++ b/test/pacman/pmtest.py +@@ -294,8 +294,10 @@ class pmtest(object): + # Change to the tmp dir before running pacman, so that local package + # archives are made available more easily. + time_start = time.time() +- self.retcode = subprocess.call(cmd, stdout=output, stderr=output, +- cwd=os.path.join(self.root, util.TMPDIR), env={'LC_ALL': 'C'}) ++ self.retcode = subprocess.call(cmd, ++ cwd=os.path.join(self.root, util.TMPDIR), ++ env={'LC_ALL': 'C', 'PATH': os.environ['PATH']}, ++ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + time_end = time.time() + vprint("\ttime elapsed: %.2fs" % (time_end - time_start)) + diff --git a/pacman/0008-Remove-everything-related-to-sudo-fakeroot-file-perm.patch b/pacman/0008-Remove-everything-related-to-sudo-fakeroot-file-perm.patch new file mode 100644 index 00000000..948b7efd --- /dev/null +++ b/pacman/0008-Remove-everything-related-to-sudo-fakeroot-file-perm.patch @@ -0,0 +1,348 @@ +From 5bff0d9224c0b8d1151f7a695d164fb1a1a5258a Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 08:41:42 +0100 +Subject: [PATCH 08/N] Remove everything related to sudo/fakeroot/file + permissions + +We don't have sudo or fakeroot in MSYS2 and file permissions +don't work the same. +--- + lib/libalpm/add.c | 2 + + scripts/libmakepkg/executable/meson.build | 2 - + scripts/makepkg.sh.in | 92 ++++++----------------- + scripts/pacman-key.sh.in | 7 +- + src/pacman/check.c | 2 + + src/pacman/pacman.c | 4 + + test/pacman/pmtest.py | 13 ---- + 7 files changed, 34 insertions(+), 88 deletions(-) + +diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c +index f806e5b..f0af886 100644 +--- a/lib/libalpm/add.c ++++ b/lib/libalpm/add.c +@@ -266,6 +266,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, + "filesystem: %o package: %o\n", filename, lsbuf.st_mode & mask, + entrymode & mask); + } ++#ifndef __MSYS__ + + #if 0 + /* Disable this warning until our user management in packages has improved. +@@ -283,6 +284,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, + } + #endif + ++#endif + _alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n", + filename); + archive_read_data_skip(archive); +diff --git a/scripts/libmakepkg/executable/meson.build b/scripts/libmakepkg/executable/meson.build +index 8536a54..535da57 100644 +--- a/scripts/libmakepkg/executable/meson.build ++++ b/scripts/libmakepkg/executable/meson.build +@@ -4,12 +4,10 @@ sources = [ + 'ccache.sh.in', + 'checksum.sh.in', + 'distcc.sh.in', +- 'fakeroot.sh.in', + 'gpg.sh.in', + 'gzip.sh.in', + 'pacman.sh.in', + 'strip.sh.in', +- 'sudo.sh.in', + 'vcs.sh.in', + ] + +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index 6384c35..a4a8cc1 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -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,6 @@ FORCE=0 + GENINTEG=0 + HOLDVER=0 + IGNOREARCH=0 +-INFAKEROOT=0 + INSTALL=0 + LOGGING=0 + NEEDED=0 +@@ -105,10 +104,9 @@ done + trap_exit() { + local signal=$1; shift + +- if (( ! INFAKEROOT )); then +- echo +- error "$@" +- fi ++ echo ++ error "$@" ++ + [[ -n $srclinks ]] && rm -rf "$srclinks" + + # unset the trap for this signal, and then call the default handler +@@ -123,11 +121,6 @@ trap_exit() { + clean_up() { + local EXIT_CODE=$? + +- if (( INFAKEROOT )); then +- # Don't clean up when leaving fakeroot, we're not done yet. +- return 0 +- fi +- + if [[ -p $logpipe ]]; then + rm "$logpipe" + fi +@@ -179,11 +172,6 @@ clean_up() { + fi + } + +-enter_fakeroot() { +- msg "$(gettext "Entering %s environment...")" "fakeroot" +- fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $? +-} +- + # Automatically update pkgver variable if a pkgver() function is provided + # Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver + update_pkgver() { +@@ -237,10 +225,6 @@ run_pacman() { + else + cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}") + fi +- elif type -p sudo >/dev/null; then +- cmd=(sudo "${cmd[@]}") +- else +- cmd=(su root -c "$cmdescape") + fi + local lockfile="$(pacman-conf DBPath)/db.lck" + while [[ -f $lockfile ]]; do +@@ -595,7 +579,6 @@ write_pkginfo() { + merge_arch_attrs + + printf "# Generated by makepkg %s\n" "$makepkg_version" +- printf "# using %s\n" "$(fakeroot -v)" + + write_kv_pair "pkgname" "$pkgname" + write_kv_pair "pkgbase" "$pkgbase" +@@ -1035,12 +1018,16 @@ if ! type -p gettext >/dev/null; then + gettext() { + printf "%s\n" "$@" + } ++else ++ gettext() { ++ /usr/bin/gettext "$@" ++ } + fi + + ARGLIST=("$@") + + # Parse Command Line Options. +-OPT_SHORT="AcCdefFghiLmop:rRsSV" ++OPT_SHORT="AcCdefghiLmop:rRsSV" + OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' + 'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild' + 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist' +@@ -1074,7 +1061,6 @@ while true; do + -d|--nodeps) NODEPS=1 ;; + -e|--noextract) NOEXTRACT=1 ;; + -f|--force) FORCE=1 ;; +- -F) INFAKEROOT=1 ;; + # generating integrity checks does not depend on architecture + -g|--geninteg) BUILDPKG=0 GENINTEG=1 IGNOREARCH=1;; + --holdver) HOLDVER=1 ;; +@@ -1189,19 +1175,6 @@ if (( LOGGING )) && ! ensure_writable_dir "LOGDEST" "$LOGDEST"; then + 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\ +-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 +-fi +- + unset pkgname "${pkgbuild_schema_strings[@]}" "${pkgbuild_schema_arrays[@]}" + unset "${known_hash_algos[@]/%/sums}" + unset -f pkgver prepare build check package "${!package_@}" +@@ -1322,29 +1295,6 @@ if (( ! PKGVERFUNC )); then + check_build_status + fi + +-# Run the bare minimum in fakeroot +-if (( INFAKEROOT )); then +- if (( SOURCEONLY )); then +- create_srcpackage +- msg "$(gettext "Leaving %s environment.")" "fakeroot" +- exit $E_OK +- fi +- +- prepare_buildenv +- +- chmod 755 "$pkgdirbase" +- if (( ! SPLITPKG )); then +- run_single_packaging +- else +- run_split_packaging +- fi +- +- create_debug_package +- +- msg "$(gettext "Leaving %s environment.")" "fakeroot" +- exit $E_OK +-fi +- + msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))" + + # if we are creating a source-only package, go no further +@@ -1368,7 +1318,7 @@ if (( SOURCEONLY )); then + check_source_integrity all + cd_safe "$startdir" + +- enter_fakeroot ++ create_srcpackage + + if [[ $SIGNPKG = 'y' ]]; then + msg "$(gettext "Signing package...")" +@@ -1473,17 +1423,25 @@ else + cd_safe "$startdir" + fi + +- enter_fakeroot ++ # if inhibiting archive creation, go no further ++ if (( NOARCHIVE )); then ++ msg "$(gettext "Package directory is ready.")" ++ exit $E_OK ++ fi ++ mkdir -p "$pkgdirbase" ++ chmod a-srwx "$pkgdirbase" ++ chmod 755 "$pkgdirbase" ++ if (( ! SPLITPKG )); then ++ run_single_packaging ++ else ++ run_split_packaging ++ fi ++ ++ create_debug_package + + create_package_signatures || exit $E_PRETTY_BAD_PRIVACY + fi + +-# if inhibiting archive creation, go no further +-if (( NOARCHIVE )); then +- msg "$(gettext "Package directory is ready.")" +- exit $E_OK +-fi +- + msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date +%c))" + + install_package && exit $E_OK || exit $E_INSTALL_FAILED +diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in +index 913f2c3..0894514 100644 +--- a/scripts/pacman-key.sh.in ++++ b/scripts/pacman-key.sh.in +@@ -265,7 +265,7 @@ check_keyring() { + exit 1 + fi + +- if (( (EXPORT || FINGER || LIST || VERIFY) && EUID != 0 )); then ++ if (( EXPORT || FINGER || LIST || VERIFY )); then + if ! grep -q "^[[:space:]]*lock-never[[:space:]]*$" ${PACMAN_KEYRING_DIR}/gpg.conf &>/dev/null; then + error "$(gettext "You do not have sufficient permissions to run this command.")" + msg "$(gettext "Use '%s' to correct the keyring permissions.")" "pacman-key --init" +@@ -672,11 +672,6 @@ if ! type -p gpg >/dev/null; then + exit 1 + fi + +-if (( (ADD || DELETE || EDITKEY || IMPORT || IMPORT_TRUSTDB || INIT || LSIGNKEY || POPULATE || RECEIVE || REFRESH || UPDATEDB) && EUID != 0 )); then +- error "$(gettext "%s needs to be run as root for this operation.")" "pacman-key" +- exit 1 +-fi +- + CONFIG=${CONFIG:-@sysconfdir@/pacman.conf} + if [[ ! -r "${CONFIG}" ]]; then + error "$(gettext "%s configuration file '%s' not found.")" "pacman" "$CONFIG" +diff --git a/src/pacman/check.c b/src/pacman/check.c +index 091055f..188f515 100644 +--- a/src/pacman/check.c ++++ b/src/pacman/check.c +@@ -75,6 +75,7 @@ static int check_file_permissions(const char *pkgname, const char *filepath, + int errors = 0; + mode_t fsmode; + ++#ifndef __MSYS__ + /* uid */ + if(st->st_uid != archive_entry_uid(entry)) { + errors++; +@@ -92,6 +93,7 @@ static int check_file_permissions(const char *pkgname, const char *filepath, + pkgname, filepath); + } + } ++#endif + + /* mode */ + fsmode = st->st_mode & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO); +diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c +index e398855..36c3b5e 100644 +--- a/src/pacman/pacman.c ++++ b/src/pacman/pacman.c +@@ -1086,7 +1086,9 @@ static void cl_to_log(int argc, char *argv[]) + int main(int argc, char *argv[]) + { + int ret = 0; ++#ifndef __MSYS__ + uid_t myuid = getuid(); ++#endif + + console_cursor_hide(); + install_segv_handler(); +@@ -1130,11 +1132,13 @@ int main(int argc, char *argv[]) + cleanup(ret); + } + ++#ifndef __MSYS__ + /* check if we have sufficient permission for the requested operation */ + if(myuid > 0 && needs_root()) { + pm_printf(ALPM_LOG_ERROR, _("you cannot perform this operation unless you are root.\n")); + cleanup(EXIT_FAILURE); + } ++#endif + + /* we support reading targets from stdin if a cmdline parameter is '-' */ + if(alpm_list_find_str(pm_targets, "-")) { +diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py +index bc4f2e3..f008f22 100644 +--- a/test/pacman/pmtest.py ++++ b/test/pacman/pmtest.py +@@ -239,19 +239,6 @@ class pmtest(object): + vprint("\tpacman %s" % self.args) + + cmd = [] +- if os.geteuid() != 0: +- fakeroot = util.which("fakeroot") +- if not fakeroot: +- tap.diag("WARNING: fakeroot not found!") +- else: +- cmd.append("fakeroot") +- +- fakechroot = util.which("fakechroot") +- if not fakechroot: +- tap.diag("WARNING: fakechroot not found!") +- else: +- cmd.append("fakechroot") +- + if pacman["gdb"]: + cmd.extend(["libtool", "execute", "gdb", "--args"]) + if pacman["valgrind"]: diff --git a/pacman/0009-change-shebang.patch b/pacman/0009-change-shebang.patch new file mode 100644 index 00000000..fc44dd3c --- /dev/null +++ b/pacman/0009-change-shebang.patch @@ -0,0 +1,64 @@ +From 6b51761d44cca57f66d8adfa18fa03496474b514 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:38:51 +0100 +Subject: [PATCH 09/N] change shebang + +(looks like this dropped a "set -e" which should be fixed) +--- + scripts/makepkg.sh.in | 2 +- + scripts/pacman-db-upgrade.sh.in | 2 +- + scripts/pacman-key.sh.in | 2 +- + scripts/repo-add.sh.in | 2 +- + scripts/wrapper.sh.in | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index a4a8cc1..da24e5f 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/usr/bin/env bash + # + # makepkg - make packages compatible for use with pacman + # +diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in +index 550d9f9..eec54cb 100644 +--- a/scripts/pacman-db-upgrade.sh.in ++++ b/scripts/pacman-db-upgrade.sh.in +@@ -1,4 +1,4 @@ +-#!/bin/bash -e ++#!/usr/bin/env bash + # + # pacman-db-upgrade - upgrade the local pacman db to a newer format + # +diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in +index 0894514..d5144f9 100644 +--- a/scripts/pacman-key.sh.in ++++ b/scripts/pacman-key.sh.in +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/usr/bin/env bash + # + # pacman-key - manages pacman's keyring + # Based on apt-key, from Debian +diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in +index d393839..2f69488 100644 +--- a/scripts/repo-add.sh.in ++++ b/scripts/repo-add.sh.in +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/usr/bin/env bash + # + # repo-add - add a package to a given repo database file + # repo-remove - remove a package entry from a given repo database file +diff --git a/scripts/wrapper.sh.in b/scripts/wrapper.sh.in +index 1b28b84..504db36 100644 +--- a/scripts/wrapper.sh.in ++++ b/scripts/wrapper.sh.in +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/usr/bin/env bash + # + # @PROGNAME@ - a wrapper for running the real @PROGNAME@ in the source tree + # diff --git a/pacman/0010-Set-fixed-paths-for-various-tools.patch b/pacman/0010-Set-fixed-paths-for-various-tools.patch new file mode 100644 index 00000000..c04b9639 --- /dev/null +++ b/pacman/0010-Set-fixed-paths-for-various-tools.patch @@ -0,0 +1,163 @@ +From 43fb1e0846ebe66de66984f2b4a0457e1a861b5e Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Tue, 28 Feb 2023 20:39:11 +0100 +Subject: [PATCH 10/N] Set fixed paths for various tools + +So that we call the right tools even if mingw variants are in PATH +--- + scripts/libmakepkg/meson.build | 1 + + scripts/libmakepkg/utils_fixed_path.sh.in | 34 +++++++++++++++++++++++ + scripts/pacman-db-upgrade.sh.in | 10 +++++-- + scripts/pacman-key.sh.in | 13 ++++++--- + scripts/repo-add.sh.in | 9 ++++-- + 5 files changed, 58 insertions(+), 9 deletions(-) + create mode 100644 scripts/libmakepkg/utils_fixed_path.sh.in + +diff --git a/scripts/libmakepkg/meson.build b/scripts/libmakepkg/meson.build +index 50eb905..9396923 100644 +--- a/scripts/libmakepkg/meson.build ++++ b/scripts/libmakepkg/meson.build +@@ -8,6 +8,7 @@ libmakepkg_modules = [ + { 'name' : 'reproducible', 'has_subdir' : true }, + { 'name' : 'source', 'has_subdir' : true }, + { 'name' : 'srcinfo', }, ++ { 'name' : 'utils_fixed_path', }, + { 'name' : 'tidy', 'has_subdir' : true }, + { 'name' : 'util', 'has_subdir' : true }, + ] +diff --git a/scripts/libmakepkg/utils_fixed_path.sh.in b/scripts/libmakepkg/utils_fixed_path.sh.in +new file mode 100644 +index 0000000..e3a06bc +--- /dev/null ++++ b/scripts/libmakepkg/utils_fixed_path.sh.in +@@ -0,0 +1,34 @@ ++if [[ -n "$MSYSTEM" ]]; then ++ readonly -a UTILS_NAME=('bsdtar' ++ 'bzip2' ++ 'bzr' ++ 'cat' ++ 'ccache' ++ 'distcc' ++ 'git' ++ 'gpg' ++ 'gzip' ++ 'hg' ++ 'lzip' ++ 'lzop' ++ 'openssl' ++ 'svn' ++ 'tput' ++ 'uncompress' ++ 'xargs' ++ 'xz' ++ 'zstd' ++ ) ++ ++ for wrapper in ${UTILS_NAME[@]}; do ++ eval " ++ ${wrapper}"'() { ++ local UTILS_PATH="/usr/bin/" ++ if ! type -p ${UTILS_PATH}${FUNCNAME[0]} >/dev/null; then ++ error "$(gettext "Cannot find the %s binary required for makepkg.")" "${UTILS_PATH}${FUNCNAME[0]}" ++ exit 1 ++ fi ++ ${UTILS_PATH}${FUNCNAME[0]} "$@" ++ }' ++ done ++fi +diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in +index eec54cb..c1cb200 100644 +--- a/scripts/pacman-db-upgrade.sh.in ++++ b/scripts/pacman-db-upgrade.sh.in +@@ -78,9 +78,13 @@ resolve_dir() { + # PROGRAM START + + # determine whether we have gettext; make it a no-op if we do not +-if ! type gettext &>/dev/null; then ++if ! type -p gettext >/dev/null; then + gettext() { +- echo "$@" ++ printf "%s\n" "$@" ++ } ++else ++ gettext() { ++ /usr/bin/gettext "$@" + } + fi + +@@ -137,7 +141,7 @@ lockfile="${dbroot}/db.lck" + + # make sure pacman isn't running + if [[ -f $lockfile ]]; then +- die "$(gettext "Pacman lock file was found. Cannot run while pacman is running.")" ++ die "$(/bin/gettext "Pacman lock file was found. Cannot run while pacman is running.")" + fi + # do not let pacman run while we do this + touch "$lockfile" +diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in +index d5144f9..c667006 100644 +--- a/scripts/pacman-key.sh.in ++++ b/scripts/pacman-key.sh.in +@@ -30,6 +30,7 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'} + # Import libmakepkg + source "$LIBRARY"/util/message.sh + source "$LIBRARY"/util/parseopts.sh ++source "$LIBRARY"/utils_fixed_path.sh + + # Options + ADD=0 +@@ -433,7 +434,7 @@ import_trustdb() { + local ret=0 + for importdir in "$@"; do + if [[ -f "${importdir}/trustdb.gpg" ]]; then +- gpg --homedir "${importdir}" --export-ownertrust | \ ++ /bin/gpg --homedir "${importdir}" --export-ownertrust | \ + "${GPG_PACMAN[@]}" --import-ownertrust - + if (( PIPESTATUS )); then + error "$(gettext "%s could not be imported.")" "${importdir}/trustdb.gpg" +@@ -605,10 +606,14 @@ updatedb() { + fi + } + +-# PROGRAM START +-if ! type gettext &>/dev/null; then ++# determine whether we have gettext; make it a no-op if we do not ++if ! type -p gettext >/dev/null; then + gettext() { +- echo "$@" ++ printf "%s\n" "$@" ++ } ++else ++ gettext() { ++ /usr/bin/gettext "$@" + } + fi + +diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in +index 2f69488..a231699 100644 +--- a/scripts/repo-add.sh.in ++++ b/scripts/repo-add.sh.in +@@ -46,6 +46,7 @@ PREVENT_DOWNGRADE=0 + # Import libmakepkg + source "$LIBRARY"/util/compress.sh + source "$LIBRARY"/util/message.sh ++source "$LIBRARY"/utils_fixed_path.sh + + # ensure we have a sane umask set + umask 0022 +@@ -562,9 +563,13 @@ clean_up() { + # PROGRAM START + + # determine whether we have gettext; make it a no-op if we do not +-if ! type gettext &>/dev/null; then ++if ! type -p gettext &>/dev/null; then + gettext() { +- echo "$@" ++ printf "%s\n" "$@" ++ } ++else ++ gettext() { ++ /usr/bin/gettext "$@" + } + fi + diff --git a/pacman/0011-makepkg-port-staticlibs-to-Windows.patch b/pacman/0011-makepkg-port-staticlibs-to-Windows.patch new file mode 100644 index 00000000..f781d8e9 --- /dev/null +++ b/pacman/0011-makepkg-port-staticlibs-to-Windows.patch @@ -0,0 +1,25 @@ +From 438e238310f2f4d008a60c9e56f91973104c9df0 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Mon, 27 Feb 2023 18:51:05 +0100 +Subject: [PATCH 11/N] makepkg: port staticlibs to Windows + +--- + scripts/libmakepkg/tidy/staticlibs.sh.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scripts/libmakepkg/tidy/staticlibs.sh.in b/scripts/libmakepkg/tidy/staticlibs.sh.in +index 498518c..e9d514a 100644 +--- a/scripts/libmakepkg/tidy/staticlibs.sh.in ++++ b/scripts/libmakepkg/tidy/staticlibs.sh.in +@@ -35,9 +35,9 @@ tidy_staticlibs() { + msg2 "$(gettext "Removing static library files...")" + local l + while IFS= read -rd '' l; do +- if [[ -f "${l%.a}.so" || -h "${l%.a}.so" ]]; then ++ if [[ -f "${l%.a}.dll.a" || -h "${l%.a}.dll.a" ]]; then + rm "$l" + fi +- done < <(find . ! -type d -name "*.a" -print0) ++ done < <(find . ! -type d \( -name "*.a" ! -name "*.dll.a" \) -print0) + fi + } diff --git a/pacman/0012-makepkg-port-strip-debug-to-Windows.patch b/pacman/0012-makepkg-port-strip-debug-to-Windows.patch new file mode 100644 index 00000000..978f37b6 --- /dev/null +++ b/pacman/0012-makepkg-port-strip-debug-to-Windows.patch @@ -0,0 +1,252 @@ +From 3077636f7466dfce19894666ae3a3284a8889279 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Mon, 27 Feb 2023 18:28:50 +0100 +Subject: [PATCH 12/N] makepkg: port strip/debug to Windows + +--- + scripts/libmakepkg/tidy/strip.sh.in | 196 +++++++++++++++++----------- + scripts/makepkg.sh.in | 2 +- + 2 files changed, 120 insertions(+), 78 deletions(-) + +diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in +index e7aecd3..f88a189 100644 +--- a/scripts/libmakepkg/tidy/strip.sh.in ++++ b/scripts/libmakepkg/tidy/strip.sh.in +@@ -31,87 +31,55 @@ packaging_options+=('strip' 'debug') + tidy_modify+=('tidy_strip') + + +-build_id() { +- LANG=C readelf -n "$1" | sed -n '/Build ID/ { s/.*: //p; q; }' +-} +- +-source_files() { +- # This function does two things: +- # +- # 1) rewrites source file locations for packages not respecting prefix- +- # map switches. This ensures all source file references in debug +- # info point to $dbgsrcdir. +- # +- # 2) outputs a list of files from the package source files to stdout +- # while stripping the $dbgsrcdir prefix +- +- LANG=C debugedit --no-recompute-build-id \ +- --base-dir "${srcdir}" \ +- --dest-dir "${dbgsrcdir}/${pkgbase}" \ +- --list-file /dev/stdout "$1" \ +- | sort -zu | tr '\0' '\n' +-} +- + strip_file() { + local binary=$1; shift + +- if check_option "debug" "y"; then +- local bid=$(build_id "$binary") +- +- # has this file already been stripped +- if [[ -n "$bid" ]]; then +- if [[ -f "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" ]]; then ++ case "$(file -bi "$binary")" in ++ *application/x-dosexec* | *application/vnd.microsoft.portable-executable*) ++ if check_option "debug" "y"; then ++ if [[ -f "$dbgdir/$binary.debug" ]]; then + return + fi +- elif [[ -f "$dbgdir/$binary.debug" ]]; then +- return +- fi +- +- # copy source files to debug directory +- local file dest t +- while IFS= read -r t; do +- file="${srcdir}/${t}" +- dest="${dbgsrc}/${t}" +- if [[ -f "$file" ]] && ! [[ -f $dest ]]; then +- mkdir -p "${dest%/*}" +- cp -- "$file" "$dest" +- fi +- done < <(source_files "$binary") +- +- # copy debug symbols to debug directory +- mkdir -p "$dbgdir/${binary%/*}" +- +- # abandon processing files that are not a recognised format +- if ! objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" 2>/dev/null; then +- return +- fi +- +- local tempfile=$(mktemp "$binary.XXXXXX") +- objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile" +- cat "$tempfile" > "$binary" +- rm "$tempfile" +- +- # create any needed hardlinks +- while IFS= read -rd '' file ; do +- if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then +- mkdir -p "$dbgdir/${file%/*}" +- ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug" +- fi +- done < <(find . -type f -perm -u+w -print0 2>/dev/null) + +- if [[ -n "$bid" ]]; then +- local target +- mkdir -p "$dbgdir/.build-id/${bid:0:2}" ++ # copy debug symbols to debug directory ++ mkdir -p "$dbgdir/${binary%/*}" ++ msg2 "Separating debug info from $binary into $dbgdir/$binary.debug" ++ # create a dbg file with proper debug info: ++ objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" ++ ++ msg2 "Creating a debuginfo link to $dbgdir/$binary.debug in $binary" ++ local tempfile=$(mktemp "$binary.XXXXXX") ++ objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile" ++ cat "$tempfile" > "$binary" ++ rm "$tempfile" ++ ++ msg2 "Separating (again) debug info from $binary into $dbgdir/$binary.debug" ++ objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug" ++ ++ msg2 "Removing old .gnu_debuglink section from $binary" ++ objcopy --remove-section=.gnu_debuglink "$binary" ++ ++ # strip debug-info from the original file ++ objcopy --strip-debug "$binary" ++ msg2 "Creating (again) a debuginfo link to $dbgdir/$binary.debug in $binary" ++ tempfile=$(mktemp "$binary.XXXXXX") ++ objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile" ++ cat "$tempfile" > "$binary" ++ rm "$tempfile" ++ # This way dbg file gets a .gnu_debuglink section (doesn't matter where ++ # it's pointing), and its contents pass the CRC32 check ++ ++ # create any needed hardlinks ++ while IFS= read -rd '' file ; do ++ if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then ++ mkdir -p "$dbgdir/${file%/*}" ++ ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug" ++ fi ++ done < <(find . -type f -perm -u+w -print0 2>/dev/null) + +- target="../../../../../${binary#./}" +- target="${target/..\/..\/usr\/lib\/}" +- target="${target/..\/usr\/}" +- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}" +- +- target="../../${binary#./}.debug" +- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" + fi +- fi ++ ;; ++ esac + + local tempfile=$(mktemp "$binary.XXXXXX") + if strip "$@" "$binary" -o "$tempfile"; then +@@ -140,17 +108,91 @@ tidy_strip() { + + if check_option "debug" "y"; then + +- dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug" ++ dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@" + dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}" + dbgsrc="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@$dbgsrcdir" + mkdir -p "$dbgdir" "$dbgsrc" + fi + + local binary strip_flags +- find . -type f -perm -u+w -print0 2>/dev/null | while IFS= read -rd '' binary ; do ++ # *.so: Apache2 modules, OCaml stublibs, Ruby modules ++ # *.oct: Octave modules ++ # *.cmxs: OCaml natdynlink modules: http://gallium.inria.fr/~frisch/ndl.txt ++ find * -type f ! -name '*.dll.a' ! -name '*.lib' \ ++ -a \( -name '*.a' -o -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.oct' -o -name '*.cmxs' \) -print0 \ ++ -o -type f -executable ! -name '*.dll' ! -name '*.exe' ! -name '*.so' ! -name '*.so.[0-9]*' ! -name '*.oct' ! -name '*.cmxs' ! -name '*.a' ! -name '*.la' ! -name '*.lib' ! -name '*.exe.manifest' ! -name '*.exe.config' ! -name '*.dll.config' ! -name '*.mdb' ! -name '*-config' ! -name '*.csh' ! -name '*.sh' ! -name '*.pl' ! -name '*.pm' ! -name '*.py' ! -name '*.rb' ! -name '*.tcl' -print0 | \ ++ while IFS= read -d $'\0' binary ++ do + local STRIPLTO=0 +- case "$(LC_ALL=C readelf -h "$binary" 2>/dev/null)" in +- *Type:*'DYN (Shared object file)'*) # Libraries (.so) or Relocatable binaries ++ # Skip thin archives from stripping ++ case "${binary##*/}" in ++ *.a) ++ if [ "$(head -c 7 "${binary}")" = '!' ] ++ then ++ continue ++ fi ++ ;; ++ esac ++ ++ # assure this is actually a binary object ++ if [ "$(head -c 2 "${binary}")" = '#!' ] ++ then ++ # sometimes .exe will be appended where it does not belong ++ case "${exe}" in ++ usr/lib/hevea/*.exe) ;; ++ *.exe) mv "${binary}" "${binary%.exe}" ;; ++ esac ++ continue ++ fi ++ ++ # OCaml bytecode must not be stripped ++ # Magic number is at end of file: ++ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900#74 ++ # http://cygwin.com/ml/cygwin-apps/2010-10/msg00057.html ++ # ++ # Perl Archive (PAR) binaries must not be stripped ++ # https://rt.cpan.org/Public/Bug/Display.html?id=18536 ++ # http://cygwin.com/ml/cygwin-apps/2012-07/msg00088.html ++ case $(tail -c 12 "${binary}" | tr '\012\0' '%') in ++ %PAR\.pm%) continue ;; ++ Caml1999X0[0-9][0-9]) continue ;; ++ esac ++ ++ # Mono assemblies must not be stripped, but remove .mdb debug symbols, ++ # and make them non-executable so they're not launched by MS .NET ++ if LC_ALL=C file -b "${binary}" 2>&1 | grep -q "Mono/\.Net assembly" ++ then ++ chmod 0644 "${binary}" ++ rm -f "${binary}.mdb" ++ continue ++ fi ++ ++ # check for .exe from non-automake Makefile which install(1) didn't fix ++ # strip(1) used to take care of this, but not anymore ++ case ${CHOST} in ++ *-*-cygwin*|*-*-mingw*|*-*-msys*) ++ case "${binary##*/}" in ++ *.dll|*.exe|*.sfx|*.so|*.so.[0-9]*|*.oct|*.cmxs) ;; ++ # make sure this isn't some oddly named DLL ++ *) if LANG=en_US.UTF-8 LC_ALL=C objdump -f "${binary}" | grep -Eq '^start address 0x(0000000[01])?00401[0-9a-e][0-9a-e]0' ++ then ++ mv "${binary}" "${binary}.exe" ++ binary+=.exe ++ fi ;; ++ esac ++ ;; ++ esac ++ chmod 0755 "${binary}"; ++ ++ case "$(@FILECMD@ -bi "$binary")" in ++ *application/x-dosexec*) # Windows executables and dlls (file <=5.43) ++ strip_flags="$STRIP_SHARED";; ++ *application/vnd.microsoft.portable-executable*) # Windows executables and dlls (file >=5.44) ++ strip_flags="$STRIP_SHARED";; ++ *application/x-archive*) # Static and Import Libraries (*.a and *.dll.a) ++ strip_flags="$STRIP_STATIC" ++ STRIPLTO=1;; ++ *application/x-sharedlib*) # Libraries (.so) + strip_flags="$STRIP_SHARED";; + *Type:*'DYN (Position-Independent Executable file)'*) # Relocatable binaries + strip_flags="$STRIP_SHARED";; +diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in +index da24e5f..6c24f2c 100644 +--- a/scripts/makepkg.sh.in ++++ b/scripts/makepkg.sh.in +@@ -731,7 +731,7 @@ create_debug_package() { + local pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@" + + # check if we have any debug symbols to package +- if dir_is_empty "$pkgdir/usr/lib/debug"; then ++ if dir_is_empty "$pkgdir"; then + return 0 + fi + diff --git a/pacman/0013-makepkg-lint_package-Warn-on-package-files-referenci.patch b/pacman/0013-makepkg-lint_package-Warn-on-package-files-referenci.patch new file mode 100644 index 00000000..223bed77 --- /dev/null +++ b/pacman/0013-makepkg-lint_package-Warn-on-package-files-referenci.patch @@ -0,0 +1,28 @@ +From 29014bdc04140941ecb5f17aeb065fcb56dbc5b5 Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Mon, 27 Feb 2023 18:36:48 +0100 +Subject: [PATCH 13/N] makepkg: lint_package: Warn on package files + referencing absolute Windows paths + +--- + scripts/libmakepkg/lint_package/build_references.sh.in | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/scripts/libmakepkg/lint_package/build_references.sh.in b/scripts/libmakepkg/lint_package/build_references.sh.in +index 9b7ffab..a5fc455 100644 +--- a/scripts/libmakepkg/lint_package/build_references.sh.in ++++ b/scripts/libmakepkg/lint_package/build_references.sh.in +@@ -37,5 +37,13 @@ warn_build_references() { + printf '%s\n' "${refs[@]#"$pkgdir/"}" >&2 + fi + done ++ ++ # Check for Windows-style MSYS2 root path ++ if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -m /)" ; then ++ warning "$(gettext "Package contains reference to %s")" "\$(cygpath -m /)" ++ fi ++ if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -w /)" ; then ++ warning "$(gettext "Package contains reference to %s")" "\$(cygpath -w /)" ++ fi + return 0 + } diff --git a/pacman/0002-More-debugging-info.patch b/pacman/0014-More-debugging-info.patch similarity index 94% rename from pacman/0002-More-debugging-info.patch rename to pacman/0014-More-debugging-info.patch index 0477ef39..b87aad99 100644 --- a/pacman/0002-More-debugging-info.patch +++ b/pacman/0014-More-debugging-info.patch @@ -1,7 +1,7 @@ -From ea1b4c6bb509a8543cb0aa3aa671b883581b0bd8 Mon Sep 17 00:00:00 2001 +From 235ea43e9a0d3d4a373a37970a62be8dfd32282b Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:47:49 +0200 -Subject: [PATCH 02/N] More debugging info +Subject: [PATCH 14/N] More debugging info --- lib/libalpm/util.c | 21 +++++++++++++++++++-- diff --git a/pacman/0014-Remove-fakeroot.patch b/pacman/0014-Remove-fakeroot.patch deleted file mode 100644 index 6bf063f1..00000000 --- a/pacman/0014-Remove-fakeroot.patch +++ /dev/null @@ -1,25 +0,0 @@ -From bd4961e6882df9c4f087cb99de0284eb22a4ae55 Mon Sep 17 00:00:00 2001 -From: Christoph Reiter -Date: Fri, 21 May 2021 23:02:23 +0200 -Subject: [PATCH 14/N] Remove fakeroot - -Currently we don't have fakeroot, so let's allow building without it. Most of -the patching is currently done in 0000-pacman-msysize.patch, these are just some -new occurrences. Ideally this removal will be a completely separate patch in -the future. ---- - scripts/libmakepkg/executable/meson.build | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/scripts/libmakepkg/executable/meson.build b/scripts/libmakepkg/executable/meson.build -index 8536a54..d5b6dcc 100644 ---- a/scripts/libmakepkg/executable/meson.build -+++ b/scripts/libmakepkg/executable/meson.build -@@ -4,7 +4,6 @@ sources = [ - 'ccache.sh.in', - 'checksum.sh.in', - 'distcc.sh.in', -- 'fakeroot.sh.in', - 'gpg.sh.in', - 'gzip.sh.in', - 'pacman.sh.in', diff --git a/pacman/0003-Core-update.patch b/pacman/0015-Core-update.patch similarity index 98% rename from pacman/0003-Core-update.patch rename to pacman/0015-Core-update.patch index 80233edd..8fafa123 100644 --- a/pacman/0003-Core-update.patch +++ b/pacman/0015-Core-update.patch @@ -1,7 +1,7 @@ -From 845b0d7a577420ef71272ba541679c7aef047f9b Mon Sep 17 00:00:00 2001 +From 3efdc22f606d8e6cba0226cfeaa385903db4ae6a Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:52:38 +0200 -Subject: [PATCH 03/N] Core update +Subject: [PATCH 15/N] Core update --- lib/libalpm/alpm.h | 9 +++ @@ -56,7 +56,7 @@ index f837f84..8f592ad 100644 +} +#endif diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c -index 36ad624..88f1fc6 100644 +index acca375..d10b14c 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -197,7 +197,13 @@ static alpm_list_t *check_replacers(alpm_handle_t *handle, alpm_pkg_t *lpkg, diff --git a/pacman/0015-Remove-sudo.patch b/pacman/0015-Remove-sudo.patch deleted file mode 100644 index 5e2944c2..00000000 --- a/pacman/0015-Remove-sudo.patch +++ /dev/null @@ -1,26 +0,0 @@ -From f15f48914eef35fc21c896231b5a1d83fb716ff6 Mon Sep 17 00:00:00 2001 -From: Christoph Reiter -Date: Fri, 21 May 2021 23:02:56 +0200 -Subject: [PATCH 15/N] Remove sudo - -Currently we don't have sudo and most people have their MSYS2 roots -user-writable anyway, so let's completely remove the usage of sudo. Most of the -patching is currently done in 0000-pacman-msysize.patch, these are just some new -occurrences. Ideally this removal will be a completely separate patch in the -future. ---- - scripts/libmakepkg/executable/meson.build | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/scripts/libmakepkg/executable/meson.build b/scripts/libmakepkg/executable/meson.build -index d5b6dcc..535da57 100644 ---- a/scripts/libmakepkg/executable/meson.build -+++ b/scripts/libmakepkg/executable/meson.build -@@ -8,7 +8,6 @@ sources = [ - 'gzip.sh.in', - 'pacman.sh.in', - 'strip.sh.in', -- 'sudo.sh.in', - 'vcs.sh.in', - ] - diff --git a/pacman/0004-Remove-ldconfig.patch b/pacman/0016-Remove-ldconfig.patch similarity index 98% rename from pacman/0004-Remove-ldconfig.patch rename to pacman/0016-Remove-ldconfig.patch index 6b4242fc..f8d795d6 100644 --- a/pacman/0004-Remove-ldconfig.patch +++ b/pacman/0016-Remove-ldconfig.patch @@ -1,7 +1,7 @@ -From c32c180cb82c9c585280c4d52c7c8ee14bb7c8f1 Mon Sep 17 00:00:00 2001 +From 0855e7f71a761f8e5bbc39110f9c21414aa628c5 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:53:34 +0200 -Subject: [PATCH 04/N] Remove ldconfig +Subject: [PATCH 16/N] Remove ldconfig --- lib/libalpm/add.c | 9 ++++++++- @@ -61,7 +61,7 @@ index f0af886..174e051 100644 return ret; } diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c -index de39724..e7d9cc2 100644 +index 958374a..2f01304 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -765,18 +765,22 @@ int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig) diff --git a/pacman/0016-Use-msys-tools.patch b/pacman/0016-Use-msys-tools.patch deleted file mode 100644 index f210149e..00000000 --- a/pacman/0016-Use-msys-tools.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ace69722a5e67a453471d90482e3f4407390f842 Mon Sep 17 00:00:00 2001 -From: Christoph Reiter -Date: Fri, 21 May 2021 23:03:54 +0200 -Subject: [PATCH 16/N] Use msys tools - -Some of the external tools pacman uses might unfortunately have incompatible -versions in PATH, e.g. when using makepkg-mingw. Let's always invoke them using -absolute paths. Most of the patching is currently done in -0000-pacman-msysize.patch, these are just some new occurrences. Ideally these -PATH guards will be a completely separate patch in the future. ---- - scripts/libmakepkg/meson.build | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/scripts/libmakepkg/meson.build b/scripts/libmakepkg/meson.build -index 50eb905..9396923 100644 ---- a/scripts/libmakepkg/meson.build -+++ b/scripts/libmakepkg/meson.build -@@ -8,6 +8,7 @@ libmakepkg_modules = [ - { 'name' : 'reproducible', 'has_subdir' : true }, - { 'name' : 'source', 'has_subdir' : true }, - { 'name' : 'srcinfo', }, -+ { 'name' : 'utils_fixed_path', }, - { 'name' : 'tidy', 'has_subdir' : true }, - { 'name' : 'util', 'has_subdir' : true }, - ] diff --git a/pacman/0005-Change-the-epoch-separator.patch b/pacman/0017-Change-the-epoch-separator.patch similarity index 93% rename from pacman/0005-Change-the-epoch-separator.patch rename to pacman/0017-Change-the-epoch-separator.patch index 490f2bdf..d5e5f4b2 100644 --- a/pacman/0005-Change-the-epoch-separator.patch +++ b/pacman/0017-Change-the-epoch-separator.patch @@ -1,7 +1,7 @@ -From aa2196e3a9bd764c9a4e2d268f7bf69da3afc2b8 Mon Sep 17 00:00:00 2001 +From fd1fffafe833e8c13b742c19c74cad7e93362916 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:54:23 +0200 -Subject: [PATCH 05/N] Change the epoch separator +Subject: [PATCH 17/N] Change the epoch separator --- lib/libalpm/version.c | 6 +++++- diff --git a/pacman/0017-Export-CC-and-CXX-variables-explicitly.patch b/pacman/0017-Export-CC-and-CXX-variables-explicitly.patch deleted file mode 100644 index 832ceadd..00000000 --- a/pacman/0017-Export-CC-and-CXX-variables-explicitly.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 87d6d92836be00bbf65686df9a4911768bf76461 Mon Sep 17 00:00:00 2001 -From: Christoph Reiter -Date: Sun, 23 May 2021 17:36:14 +0200 -Subject: [PATCH 17/N] Export CC and CXX variables explicitly - -See https://github.com/msys2/MSYS2-packages/pull/2501 ---- - scripts/libmakepkg/buildenv.sh.in | 2 +- - scripts/libmakepkg/buildenv/buildflags.sh.in | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/scripts/libmakepkg/buildenv.sh.in b/scripts/libmakepkg/buildenv.sh.in -index 6605788..85d5ec2 100644 ---- a/scripts/libmakepkg/buildenv.sh.in -+++ b/scripts/libmakepkg/buildenv.sh.in -@@ -38,5 +38,5 @@ prepare_buildenv() { - done - - # ensure all necessary build variables are exported -- export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST -+ export CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST - } -diff --git a/scripts/libmakepkg/buildenv/buildflags.sh.in b/scripts/libmakepkg/buildenv/buildflags.sh.in -index 873dd82..4ba1dbc 100644 ---- a/scripts/libmakepkg/buildenv/buildflags.sh.in -+++ b/scripts/libmakepkg/buildenv/buildflags.sh.in -@@ -30,6 +30,6 @@ buildenv_functions+=('buildenv_buildflags') - - buildenv_buildflags() { - if check_option "buildflags" "n"; then -- unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS RUSTFLAGS DEBUG_RUSTFLAGS -+ unset CC CXX CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS RUSTFLAGS DEBUG_RUSTFLAGS - fi - } diff --git a/pacman/0006-makepkg-avoid-creating-.tar-files-with-extended-attr.patch b/pacman/0018-makepkg-avoid-creating-.tar-files-with-extended-attr.patch similarity index 76% rename from pacman/0006-makepkg-avoid-creating-.tar-files-with-extended-attr.patch rename to pacman/0018-makepkg-avoid-creating-.tar-files-with-extended-attr.patch index e7e5fa89..a833ec17 100644 --- a/pacman/0006-makepkg-avoid-creating-.tar-files-with-extended-attr.patch +++ b/pacman/0018-makepkg-avoid-creating-.tar-files-with-extended-attr.patch @@ -1,7 +1,7 @@ -From 829d458b09a81fed5edfb5aec82bcb2de11c9882 Mon Sep 17 00:00:00 2001 +From 0839de121eeac48b11e6027437bbdc056c9c56df Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 29 Jun 2017 11:54:48 +0200 -Subject: [PATCH 06/N] makepkg: avoid creating .tar files with extended +Subject: [PATCH 18/N] makepkg: avoid creating .tar files with extended attributes Extended attributes are not necessary for pacman to work. Extended @@ -23,15 +23,15 @@ Signed-off-by: Johannes Schindelin 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in -index 6c8446b..7ad3a0e 100644 +index 6c24f2c..d2b5d26 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -711,7 +711,7 @@ create_package() { msg2 "$(gettext "Compressing package...")" # TODO: Maybe this can be set globally for robustness shopt -s -o pipefail -- list_package_files | LANG=C bsdtar --no-fflags -cnf - --null --files-from - | -+ list_package_files | LANG=C bsdtar --no-fflags --no-xattrs -cnf - --null --files-from - | +- list_package_files | LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ -cnf - --null --files-from - | ++ list_package_files | LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ --no-xattrs -cnf - --null --files-from - | compress_as "$PKGEXT" > "${pkg_file}" || ret=$? shopt -u -o pipefail diff --git a/pacman/0007-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch b/pacman/0019-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch similarity index 93% rename from pacman/0007-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch rename to pacman/0019-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch index 352447f0..3cbab89d 100644 --- a/pacman/0007-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch +++ b/pacman/0019-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch @@ -1,7 +1,7 @@ -From 62febd801bfec2fd732ee0272e85904092cf6822 Mon Sep 17 00:00:00 2001 +From d694a347ac4647bc27d2bae25b112c2f24792314 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:55:24 +0200 -Subject: [PATCH 07/N] pacman/libalpm: ignore file conflicts for foo.exe -> +Subject: [PATCH 19/N] pacman/libalpm: ignore file conflicts for foo.exe -> foo renames In case a file "foo.exe" gets renamed to "foo" the msys2 .exe diff --git a/pacman/0008-Change-default-answer-of-all-queries-to-yes.patch b/pacman/0020-Change-default-answer-of-all-queries-to-yes.patch similarity index 93% rename from pacman/0008-Change-default-answer-of-all-queries-to-yes.patch rename to pacman/0020-Change-default-answer-of-all-queries-to-yes.patch index 6b328daf..989bb4f8 100644 --- a/pacman/0008-Change-default-answer-of-all-queries-to-yes.patch +++ b/pacman/0020-Change-default-answer-of-all-queries-to-yes.patch @@ -1,12 +1,12 @@ -From 8dc1d34544ac2652b1f6a7b6a96bd308a6f787b7 Mon Sep 17 00:00:00 2001 +From 864894b80495284ff47977686eccbfe0a856bf73 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 10 Feb 2018 22:39:35 +0100 -Subject: [PATCH 08/N] Change default answer of all queries to yes +Subject: [PATCH 20/N] Change default answer of all queries to yes This allows to use pacman completely unattended using the --noconfirm switch which automatically accepts the default answer. -See https://github.com/Alexpux/MSYS2-packages/issues/1141 +See https://github.com/msys2/MSYS2-packages/issues/1141 --- src/pacman/callback.c | 6 +++--- src/pacman/remove.c | 2 +- diff --git a/pacman/0020-Strip-static-libraries-as-well.patch b/pacman/0020-Strip-static-libraries-as-well.patch deleted file mode 100644 index cd121365..00000000 --- a/pacman/0020-Strip-static-libraries-as-well.patch +++ /dev/null @@ -1,24 +0,0 @@ -From c24fb101df85a0b8a2bee220602fe88c4051ec87 Mon Sep 17 00:00:00 2001 -From: Mehdi Chinoune -Date: Sat, 13 Nov 2021 08:08:40 +0100 -Subject: [PATCH 20/N] Strip static libraries as well - -Fixes #7 ---- - scripts/libmakepkg/tidy/strip.sh.in | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in -index c376a39..7324fc3 100644 ---- a/scripts/libmakepkg/tidy/strip.sh.in -+++ b/scripts/libmakepkg/tidy/strip.sh.in -@@ -203,6 +203,9 @@ tidy_strip() { - case "$(@FILECMD@ -bi "$binary")" in - *application/x-dosexec*) # Windows executables and dlls - strip_flags="$STRIP_SHARED";; -+ *application/x-archive*) # Static and Import Libraries (*.a and *.dll.a) -+ strip_flags="$STRIP_STATIC" -+ STRIPLTO=1;; - *application/x-sharedlib*) # Libraries (.so) - strip_flags="$STRIP_SHARED";; - *Type:*'DYN (Position-Independent Executable file)'*) # Relocatable binaries diff --git a/pacman/0009-Use-pipe-instead-of-socket.patch b/pacman/0021-Use-pipe-instead-of-socket.patch similarity index 94% rename from pacman/0009-Use-pipe-instead-of-socket.patch rename to pacman/0021-Use-pipe-instead-of-socket.patch index c744f3b3..83c8cea2 100644 --- a/pacman/0009-Use-pipe-instead-of-socket.patch +++ b/pacman/0021-Use-pipe-instead-of-socket.patch @@ -1,7 +1,7 @@ -From 2f6e643b87ad3d9d34436b8c5ac999e78d0a31bb Mon Sep 17 00:00:00 2001 +From f973a61a290a1c5f85b9f3d5541b75d0f887c993 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:56:23 +0200 -Subject: [PATCH 09/N] Use pipe instead of socket +Subject: [PATCH 21/N] Use pipe instead of socket --- lib/libalpm/util.c | 26 ++++++++++++++++++++++++++ diff --git a/pacman/0022-fixup-Export-CC-and-CXX-variables-explicitly.patch b/pacman/0022-fixup-Export-CC-and-CXX-variables-explicitly.patch deleted file mode 100644 index 7c139922..00000000 --- a/pacman/0022-fixup-Export-CC-and-CXX-variables-explicitly.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 61a06846a149e3843758b9a3a8efaf896d66cc50 Mon Sep 17 00:00:00 2001 -From: Christoph Reiter -Date: Mon, 7 Feb 2022 19:55:55 +0100 -Subject: [PATCH 22/N] fixup! Export CC and CXX variables explicitly - ---- - scripts/libmakepkg/buildenv/buildflags.sh.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/libmakepkg/buildenv/buildflags.sh.in b/scripts/libmakepkg/buildenv/buildflags.sh.in -index 4ba1dbc..873dd82 100644 ---- a/scripts/libmakepkg/buildenv/buildflags.sh.in -+++ b/scripts/libmakepkg/buildenv/buildflags.sh.in -@@ -30,6 +30,6 @@ buildenv_functions+=('buildenv_buildflags') - - buildenv_buildflags() { - if check_option "buildflags" "n"; then -- unset CC CXX CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS RUSTFLAGS DEBUG_RUSTFLAGS -+ unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS RUSTFLAGS DEBUG_RUSTFLAGS - fi - } diff --git a/pacman/0010-pacman-make-file-list-comparisons-between-packages-c.patch b/pacman/0022-pacman-make-file-list-comparisons-between-packages-c.patch similarity index 96% rename from pacman/0010-pacman-make-file-list-comparisons-between-packages-c.patch rename to pacman/0022-pacman-make-file-list-comparisons-between-packages-c.patch index c9f435ed..144e46be 100644 --- a/pacman/0010-pacman-make-file-list-comparisons-between-packages-c.patch +++ b/pacman/0022-pacman-make-file-list-comparisons-between-packages-c.patch @@ -1,7 +1,7 @@ -From 6242036e9f809cc7e6d21783db4ce22f39c6d944 Mon Sep 17 00:00:00 2001 +From ae18ca4f394458a4316d20a784142477ca9db7c0 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:57:25 +0200 -Subject: [PATCH 10/N] pacman: make file list comparisons between packages +Subject: [PATCH 22/N] pacman: make file list comparisons between packages case insensitive In case a package gets upgrade and a filename has changed case this allows diff --git a/pacman/0011-Translate-MSYS2-specific-messages-into-Japanese.patch b/pacman/0023-Translate-MSYS2-specific-messages-into-Japanese.patch similarity index 89% rename from pacman/0011-Translate-MSYS2-specific-messages-into-Japanese.patch rename to pacman/0023-Translate-MSYS2-specific-messages-into-Japanese.patch index 2c5c4fdb..32c1a196 100644 --- a/pacman/0011-Translate-MSYS2-specific-messages-into-Japanese.patch +++ b/pacman/0023-Translate-MSYS2-specific-messages-into-Japanese.patch @@ -1,14 +1,14 @@ -From d2183ca4914b79bf7657a34fc5769e44f17f0ab9 Mon Sep 17 00:00:00 2001 +From 6866c7d8834453492ae291ad1a92ee127c1c9286 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:58:41 +0200 -Subject: [PATCH 11/N] Translate MSYS2 specific messages into Japanese +Subject: [PATCH 23/N] Translate MSYS2 specific messages into Japanese --- src/pacman/po/ja.po | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/pacman/po/ja.po b/src/pacman/po/ja.po -index bc1e923..99b4e77 100644 +index c35a96f..028b1f9 100644 --- a/src/pacman/po/ja.po +++ b/src/pacman/po/ja.po @@ -1493,6 +1493,30 @@ msgid "'%s' is a file, did you mean %s instead of %s?\n" diff --git a/pacman/0012-Workaround-compressing-packages-with-bsdtar-under-Ac.patch b/pacman/0024-Workaround-compressing-packages-with-bsdtar-under-Ac.patch similarity index 64% rename from pacman/0012-Workaround-compressing-packages-with-bsdtar-under-Ac.patch rename to pacman/0024-Workaround-compressing-packages-with-bsdtar-under-Ac.patch index 412e72d9..daa16a2d 100644 --- a/pacman/0012-Workaround-compressing-packages-with-bsdtar-under-Ac.patch +++ b/pacman/0024-Workaround-compressing-packages-with-bsdtar-under-Ac.patch @@ -1,7 +1,7 @@ -From 90656790f41703008eeb92139a7c3513eac0d3d9 Mon Sep 17 00:00:00 2001 +From 1237e5c381760d8f3f9c847d61dfd22b6d02bfbc Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 22:59:28 +0200 -Subject: [PATCH 12/N] Workaround compressing packages with bsdtar under +Subject: [PATCH 24/N] Workaround compressing packages with bsdtar under Active Directory account --- @@ -10,15 +10,15 @@ Subject: [PATCH 12/N] Workaround compressing packages with bsdtar under 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in -index 7ad3a0e..1a6acc1 100644 +index d2b5d26..8f27f93 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -711,7 +711,7 @@ create_package() { msg2 "$(gettext "Compressing package...")" # TODO: Maybe this can be set globally for robustness shopt -s -o pipefail -- list_package_files | LANG=C bsdtar --no-fflags --no-xattrs -cnf - --null --files-from - | -+ list_package_files | LANG=C bsdtar --no-fflags --no-xattrs --uid 1 --uname root --gid 1 --gname root -cnf - --null --files-from - | +- list_package_files | LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ --no-xattrs -cnf - --null --files-from - | ++ list_package_files | LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ --no-xattrs --uid 1 --uname root --gid 1 --gname root -cnf - --null --files-from - | compress_as "$PKGEXT" > "${pkg_file}" || ret=$? shopt -u -o pipefail @@ -26,8 +26,8 @@ index 7ad3a0e..1a6acc1 100644 # TODO: Maybe this can be set globally for robustness shopt -s -o pipefail -- LANG=C bsdtar --no-fflags -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$? -+ LANG=C bsdtar --no-fflags --uid 1 --uname root --gid 1 --gname root -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$? +- LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$? ++ LANG=C bsdtar --no-fflags @BSDTAR_NO_READ_SPARSE@ --uid 1 --uname root --gid 1 --gname root -cLf - ${pkgbase} | compress_as "$SRCEXT" > "${pkg_file}" || ret=$? shopt -u -o pipefail diff --git a/pacman/0024-libmakepkg-fix-compatibility-with-bash-5.2-globskipd.patch b/pacman/0024-libmakepkg-fix-compatibility-with-bash-5.2-globskipd.patch deleted file mode 100644 index a3642096..00000000 --- a/pacman/0024-libmakepkg-fix-compatibility-with-bash-5.2-globskipd.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 80f01df7fbc2c3424e191119915849d18b63523c Mon Sep 17 00:00:00 2001 -From: Allan McRae -Date: Sun, 2 Oct 2022 11:40:52 +1000 -Subject: [PATCH 24/N] libmakepkg: fix compatibility with bash-5.2 - globskipdots - -Bash 5.2 has a new globskipdots option, which is enabled by default. The -check_dotfiles lint fails with globskipdots due to the assumption that -at least the "." and ".." paths will match. Disabling globskipdots would -be the usual solution, but that fails on bash<5.2. Instead, enable -nullglob for this check. - -Signed-off-by: Allan McRae ---- - scripts/libmakepkg/lint_package/dotfiles.sh.in | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/scripts/libmakepkg/lint_package/dotfiles.sh.in b/scripts/libmakepkg/lint_package/dotfiles.sh.in -index bf6c754..ac86b02 100644 ---- a/scripts/libmakepkg/lint_package/dotfiles.sh.in -+++ b/scripts/libmakepkg/lint_package/dotfiles.sh.in -@@ -29,10 +29,17 @@ lint_package_functions+=('check_dotfiles') - - check_dotfiles() { - local ret=0 -+ -+ local shellopts=$(shopt -p nullglob) -+ shopt -s nullglob -+ - for f in "$pkgdir"/.*; do - [[ ${f##*/} == . || ${f##*/} == .. ]] && continue - error "$(gettext "Dotfile found in package root '%s'")" "$f" - ret=1 - done -+ -+ eval "$shellopts" -+ - return $ret - } diff --git a/pacman/0013-Fix-asciidoc-argparse.patch b/pacman/0025-Fix-asciidoc-argparse.patch similarity index 88% rename from pacman/0013-Fix-asciidoc-argparse.patch rename to pacman/0025-Fix-asciidoc-argparse.patch index d6ee90f0..f064c34f 100644 --- a/pacman/0013-Fix-asciidoc-argparse.patch +++ b/pacman/0025-Fix-asciidoc-argparse.patch @@ -1,7 +1,7 @@ -From 4bc3c8076fab15616f00b69564c24fef83d922b3 Mon Sep 17 00:00:00 2001 +From d3e36393d2522590735a28e2d7024a72c6b85454 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Fri, 21 May 2021 23:00:14 +0200 -Subject: [PATCH 13/N] Fix asciidoc argparse +Subject: [PATCH 25/N] Fix asciidoc argparse a2x seems to fail when a value to an argument looks like an argument itself. The best fix seems to be to attach the value to the argument using an equal diff --git a/pacman/0025-Fix-strip-with-file-5.44.patch b/pacman/0025-Fix-strip-with-file-5.44.patch deleted file mode 100644 index 6b2c0261..00000000 --- a/pacman/0025-Fix-strip-with-file-5.44.patch +++ /dev/null @@ -1,41 +0,0 @@ -From e782c7968f1eb004204c22cc6e602e01f146745f Mon Sep 17 00:00:00 2001 -From: Christoph Reiter -Date: Mon, 16 Jan 2023 18:08:32 +0100 -Subject: [PATCH 25/N] Fix strip with file >= 5.44 - -file 5.44 no longer reports .exe and .dll as "application/x-dosexec", -but as "application/vnd.microsoft.portable-executable". -Likely related to https://github.com/file/file/commit/d22701be6a71b946eacb - -This leads to pacman no longer stripping binaries resulting in very larger -packages. - -When looking for files to strip check for both strings instead. ---- - scripts/libmakepkg/tidy/strip.sh.in | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in -index 7324fc3..cd9cd9a 100644 ---- a/scripts/libmakepkg/tidy/strip.sh.in -+++ b/scripts/libmakepkg/tidy/strip.sh.in -@@ -40,7 +40,7 @@ strip_file() { - local binary=$1; shift - - case "$(file -bi "$binary")" in -- *application/x-dosexec*) -+ *application/x-dosexec* | *application/vnd.microsoft.portable-executable*) - if check_option "debug" "y"; then - if [[ -f "$dbgdir/$binary.debug" ]]; then - return -@@ -201,7 +201,9 @@ tidy_strip() { - chmod 0755 "${binary}"; - - case "$(@FILECMD@ -bi "$binary")" in -- *application/x-dosexec*) # Windows executables and dlls -+ *application/x-dosexec*) # Windows executables and dlls (file <=5.43) -+ strip_flags="$STRIP_SHARED";; -+ *application/vnd.microsoft.portable-executable*) # Windows executables and dlls (file >=5.44) - strip_flags="$STRIP_SHARED";; - *application/x-archive*) # Static and Import Libraries (*.a and *.dll.a) - strip_flags="$STRIP_STATIC" diff --git a/pacman/0026-Export-CC-and-CXX-variables-explicitly.patch b/pacman/0026-Export-CC-and-CXX-variables-explicitly.patch new file mode 100644 index 00000000..10441430 --- /dev/null +++ b/pacman/0026-Export-CC-and-CXX-variables-explicitly.patch @@ -0,0 +1,21 @@ +From 10cd1c5dd359ef584edecbc543a58452d814393b Mon Sep 17 00:00:00 2001 +From: Christoph Reiter +Date: Sun, 23 May 2021 17:36:14 +0200 +Subject: [PATCH 26/N] Export CC and CXX variables explicitly + +See https://github.com/msys2/MSYS2-packages/pull/2501 +--- + scripts/libmakepkg/buildenv.sh.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/libmakepkg/buildenv.sh.in b/scripts/libmakepkg/buildenv.sh.in +index 6605788..85d5ec2 100644 +--- a/scripts/libmakepkg/buildenv.sh.in ++++ b/scripts/libmakepkg/buildenv.sh.in +@@ -38,5 +38,5 @@ prepare_buildenv() { + done + + # ensure all necessary build variables are exported +- export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST ++ export CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST + } diff --git a/pacman/0018-pacman.c-handle-cr-on-stdin-as-well.patch b/pacman/0027-pacman.c-handle-cr-on-stdin-as-well.patch similarity index 90% rename from pacman/0018-pacman.c-handle-cr-on-stdin-as-well.patch rename to pacman/0027-pacman.c-handle-cr-on-stdin-as-well.patch index f449b54d..3c0a615e 100644 --- a/pacman/0018-pacman.c-handle-cr-on-stdin-as-well.patch +++ b/pacman/0027-pacman.c-handle-cr-on-stdin-as-well.patch @@ -1,7 +1,7 @@ -From 0eb29125b56f6fb947cb22516daaabc7f9447a46 Mon Sep 17 00:00:00 2001 +From 4fecac861dc310e0f219d24fb2243fc9f363aec8 Mon Sep 17 00:00:00 2001 From: Christopher Degawa Date: Wed, 18 Aug 2021 10:00:26 -0500 -Subject: [PATCH 18/N] pacman.c: handle cr on stdin as well +Subject: [PATCH 27/N] pacman.c: handle cr on stdin as well Improves compatibility with Windows targets, specifically when using powershell for string transforming package names and piping into diff --git a/pacman/0019-Add-a-CI-job.patch b/pacman/0028-Add-a-CI-job.patch similarity index 94% rename from pacman/0019-Add-a-CI-job.patch rename to pacman/0028-Add-a-CI-job.patch index f1fb9f51..3c5dec14 100644 --- a/pacman/0019-Add-a-CI-job.patch +++ b/pacman/0028-Add-a-CI-job.patch @@ -1,7 +1,7 @@ -From fd4c8f1f9fd7add827bceb512ac68dee97e81577 Mon Sep 17 00:00:00 2001 +From 63de6f62df29b526f619b9b552cacc9ffd777620 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 3 Jun 2021 16:49:35 +0200 -Subject: [PATCH 19/N] Add a CI job +Subject: [PATCH 28/N] Add a CI job --- .github/workflows/build.yaml | 55 ++++++++++++++++++++++++++++++++++++ diff --git a/pacman/0021-Fix-building-staticlibs-with-LTO.patch b/pacman/0029-Fix-building-staticlibs-with-LTO.patch similarity index 62% rename from pacman/0021-Fix-building-staticlibs-with-LTO.patch rename to pacman/0029-Fix-building-staticlibs-with-LTO.patch index 3a1b49e9..b00e7920 100644 --- a/pacman/0021-Fix-building-staticlibs-with-LTO.patch +++ b/pacman/0029-Fix-building-staticlibs-with-LTO.patch @@ -1,7 +1,7 @@ -From f578b472aa42851f8a142de20cd8c70664c60248 Mon Sep 17 00:00:00 2001 +From 322b34becb4fc751b07f7e5412b8974f8699864a Mon Sep 17 00:00:00 2001 From: Mehdi Chinoune Date: Sat, 13 Nov 2021 08:27:49 +0100 -Subject: [PATCH 21/N] Fix building staticlibs with LTO +Subject: [PATCH 29/N] Fix building staticlibs with LTO Unless `-ffat-lto-objects` get passed to the compiler, It will only generate LTO bytecode. @@ -9,18 +9,17 @@ see: https://wiki.ubuntu.com/ToolChain/LTO : Implementation https://fedoraproject.org/wiki/Changes/LTOBuildImprovements --- - scripts/libmakepkg/buildenv/lto.sh.in | 5 +++++ - 1 file changed, 5 insertions(+) + scripts/libmakepkg/buildenv/lto.sh.in | 4 ++++ + 1 file changed, 4 insertions(+) diff --git a/scripts/libmakepkg/buildenv/lto.sh.in b/scripts/libmakepkg/buildenv/lto.sh.in -index 8e7be66..c216a24 100644 +index 334aa91..5593eac 100644 --- a/scripts/libmakepkg/buildenv/lto.sh.in +++ b/scripts/libmakepkg/buildenv/lto.sh.in -@@ -33,5 +33,10 @@ buildenv_lto() { - if check_option "lto" "y"; then - CFLAGS+=" -flto" - CXXFLAGS+=" -flto" -+ LDFLAGS+=" -flto" +@@ -34,5 +34,9 @@ buildenv_lto() { + CFLAGS+=" ${LTOFLAGS:--flto}" + CXXFLAGS+=" ${LTOFLAGS:--flto}" + LDFLAGS+=" ${LTOFLAGS:--flto}" + if check_option "staticlibs" "y"; then + CFLAGS+=" -ffat-lto-objects" + CXXFLAGS+=" -ffat-lto-objects" diff --git a/pacman/0023-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch b/pacman/0030-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch similarity index 89% rename from pacman/0023-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch rename to pacman/0030-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch index 7458d21f..e5672069 100644 --- a/pacman/0023-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch +++ b/pacman/0030-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch @@ -1,7 +1,7 @@ -From fa096f8f6ef3f8a8201c56738f7a7636fb67c738 Mon Sep 17 00:00:00 2001 +From ab633a20cdb481e6c8a2ccfaf689f0e00b510a7d Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Sat, 10 Sep 2022 11:39:35 +0200 -Subject: [PATCH 23/N] Make lint_pkgbuild opt-in via MAKEPKG_LINT_PKGBUILD=1 +Subject: [PATCH 30/N] Make lint_pkgbuild opt-in via MAKEPKG_LINT_PKGBUILD=1 Cygwin bash is struggling with the thousands of commands that get invoked when lint_pkgbuild is run. This especially is annoying for split packages @@ -25,7 +25,7 @@ We can for example enable this in CI. 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in -index 1a6acc1..6ab2701 100644 +index 8f27f93..a5728fa 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1207,8 +1207,11 @@ fi diff --git a/pacman/PKGBUILD b/pacman/PKGBUILD index 98cdbd14..79adbd28 100644 --- a/pacman/PKGBUILD +++ b/pacman/PKGBUILD @@ -3,12 +3,12 @@ # Contributor: Ray Donnelly pkgname=pacman -pkgver=6.0.1 -pkgrel=32 +pkgver=6.0.2 +pkgrel=1 pkgdesc="A library-based package manager with dependency support (MSYS2 port)" arch=('i686' 'x86_64') url="https://www.archlinux.org/pacman/" -license=('GPL') +license=('spdx:GPL-2.0-or-later') depends=('bash>=4.2.045' 'gettext' 'gnupg' @@ -36,37 +36,42 @@ makedepends=('asciidoc' backup=("etc/pacman.conf" "etc/makepkg.conf" "etc/makepkg_mingw.conf") -_commit="0a6fecd07271a54d9009ea7204c0e6288a44212b" +_commit="c2d4568d35173f92c17b6b93222bc101a63c9928" source=(pacman-${pkgver}::git+https://gitlab.archlinux.org/pacman/pacman.git#commit=${_commit} "pacman.conf" "makepkg.conf" "makepkg_mingw.conf" "makepkg-mingw" - 0001-Msysize.patch - 0002-More-debugging-info.patch - 0003-Core-update.patch - 0004-Remove-ldconfig.patch - 0005-Change-the-epoch-separator.patch - 0006-makepkg-avoid-creating-.tar-files-with-extended-attr.patch - 0007-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch - 0008-Change-default-answer-of-all-queries-to-yes.patch - 0009-Use-pipe-instead-of-socket.patch - 0010-pacman-make-file-list-comparisons-between-packages-c.patch - 0011-Translate-MSYS2-specific-messages-into-Japanese.patch - 0012-Workaround-compressing-packages-with-bsdtar-under-Ac.patch - 0013-Fix-asciidoc-argparse.patch - 0014-Remove-fakeroot.patch - 0015-Remove-sudo.patch - 0016-Use-msys-tools.patch - 0017-Export-CC-and-CXX-variables-explicitly.patch - 0018-pacman.c-handle-cr-on-stdin-as-well.patch - 0019-Add-a-CI-job.patch - 0020-Strip-static-libraries-as-well.patch - 0021-Fix-building-staticlibs-with-LTO.patch - 0022-fixup-Export-CC-and-CXX-variables-explicitly.patch - 0023-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch - 0024-libmakepkg-fix-compatibility-with-bash-5.2-globskipd.patch - 0025-Fix-strip-with-file-5.44.patch) + 0001-makepkg-clean-up-more-things.patch + 0002-makepkg-bash-v4-compat.patch + 0003-makepkg-find_libdepends-port-to-Windows.patch + 0004-makepkg-build-env-export.patch + 0005-makepkg-find_libprovides-port-to-Windows.patch + 0006-fill_progress.patch + 0007-test-fixes.patch + 0008-Remove-everything-related-to-sudo-fakeroot-file-perm.patch + 0009-change-shebang.patch + 0010-Set-fixed-paths-for-various-tools.patch + 0011-makepkg-port-staticlibs-to-Windows.patch + 0012-makepkg-port-strip-debug-to-Windows.patch + 0013-makepkg-lint_package-Warn-on-package-files-referenci.patch + 0014-More-debugging-info.patch + 0015-Core-update.patch + 0016-Remove-ldconfig.patch + 0017-Change-the-epoch-separator.patch + 0018-makepkg-avoid-creating-.tar-files-with-extended-attr.patch + 0019-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch + 0020-Change-default-answer-of-all-queries-to-yes.patch + 0021-Use-pipe-instead-of-socket.patch + 0022-pacman-make-file-list-comparisons-between-packages-c.patch + 0023-Translate-MSYS2-specific-messages-into-Japanese.patch + 0024-Workaround-compressing-packages-with-bsdtar-under-Ac.patch + 0025-Fix-asciidoc-argparse.patch + 0026-Export-CC-and-CXX-variables-explicitly.patch + 0027-pacman.c-handle-cr-on-stdin-as-well.patch + 0028-Add-a-CI-job.patch + 0029-Fix-building-staticlibs-with-LTO.patch + 0030-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch) validpgpkeys=('6645B0A8C7005E78DB1D7864F99FFE0FEAE999BD' # Allan McRae 'B8151B117037781095514CA7BBDFFC92306B1121') # Andrew Gregory (pacman) sha256sums=('SKIP' @@ -74,31 +79,36 @@ sha256sums=('SKIP' 'c12da01ede663a4924d0817a0d1bd6082b1380383cfb74cc1cea08f9d73e4902' '8cb6b244d39107afc6cff74d919708ffc58b903c42f82d050d1d49bbf31208ab' '98198e1f0f252eae0560d271bee4b9149e127399dd0d3fd5d8d24579d9e0550f' - '5951434296d1ea551941db408bac367e4b014add1b77ab5eb5d249deb81f777b' - '1975fb6d1a0d4cc3c54caefb80b719b471b8cf797d4850a082a8d03aa2ba6278' - '0cfc5332c3033321ff840b2399d80087416201a3100ea4ff868d3fdb29e35420' - '97818a36b5a687626c70b782beda024761511c9c95b3ab829acecae1835107eb' - '4b35438da5967cb4556e08509f35f1fc30b4b63d808b583f28ce2ac6caf15c57' - '4dc0d8fee098933e92ae0b1fa4ea79cf755665929d4491ca6aa19b8d72475d8e' - '725a128e9182253b886323ab4cf4557e09a22a3b7e7df6864709c2684b576990' - '3c3bd339c540e5a56bb5109c7ebadfe95f59f8d2c81082655ca929788db62320' - '160d132fa9f1b92f0e47bc5b0144b53c7a4c8b3a95b0d72906ec37e2dd638272' - 'c0daf020a2cfbaeedf1a97ebfc65a8ee6299fb44867b3ee42fd60fe66199ec57' - 'd0921fba5290fa1a7ffeff541b5c24a231c343a8b52c7bf10010598527265d47' - '4a6efe93984db6148a47d7d4a2256a2ce2bd64822c9f3e6a6d29a8c035107ef8' - '95d53e8f91060676b5b2aaae3e20ec0da76412997de6b8cda60e2cdbf4118757' - '67ba3c03714bece0b1a5df395c29e8dfe7a1b8dee96c3e3272b08dabd7b362f5' - '9073851459696a62a494f91a2421fa87f8e6554a953962db16cb87de9204c66e' - 'a9b4897445e94e30ca6a1f3e47b061983e14505d1e8fe8d85944310e3f316731' - '7b86f89d9619258f4dfbdcf2b431dbc96a2a84628dc8ebbbe0356dec31b8f67f' - '4caa52fa3f806ca3ad0b0f3b3f497a3fd3910b2c1224ea0a39b8a21df8740f95' - '2480fcee75268d2f952c05e3fb46c0b7e9e9f533e7bc5a5bb53ec7536293e924' - '534c0a48e18e6fb935b19bbea64e44f531d9fa49e9634c3717810b76061ba498' - '4f8db01c932f592479dc0019eeb494bee8afc4a46e068de372df43de6e63e65c' - '2debaf890678f07503dca1368869ef975ab53099b682232661e202b66d55ccd1' - '335f3d23cdac35a203044e594053a84f9fbad3fb6ae3c6977aab9b06cf34a3e3' - '0da1d2c6670ce1475af6ac81005285d7854f48b03c0a01e1ee6c96ad76f12b93' - '525e4248cef9d70c8973c5c1aa39fa011ffe05cb7b9aae54ac5b9f8e7af85b4b') + 'd272176dea508bf0972dde6396ca655e900d509099d0a496bd6a138f98bb48df' + '7e2a2fc6799ed8a9dbc8b0712b162be963ed22351e4cb29b3a4d4a4d3f28d7ed' + '953b66200dbe4f5b3a9caac2ce25f1ded7918232dce2e61b4bf64f5d87892d07' + 'ca1ec64e74ed557ccf3db8d0ff5e22a52b0b52b6451454f76fd02d1eac082484' + 'cdcdcdbc4496caa852131c72f65ac770d68fec09e259509b1398a99e6e9dc5d6' + '4b3e3cd1ba7d0f513b75a83b27550f308a4a6731427ed27fc7fedf5aa57d57b2' + '305c98e5b9f26787eeaa48ac541dcaf69eb988221b2e1a60e0c097b5b64824aa' + '8e0ff83f6183e94026e2c7fc603e3dfc06702a002d59c7a3c42795e3ccd0df1e' + '11cfe55af4ebe46427f55ef4e02fd5862b9936dcc0cae46a2b9693dcd676a17e' + '27d65613f58f3c114eda732a5683bfe10c48f36a576e5fa913492f55e8152a92' + 'c554b9fdccb3815e9db3594533fe2a9c890049d02eb884b19ac3c892e09910b6' + 'a188897adfcee5744a2932cfdbb906660b21c93f9b1318037d0d4267b4b574b6' + '3061622244395175c7330d369f464c4a65c7e75b97dcc13437e8561fa29150fc' + '9508ddbc126e97bcfb9e0c9c8de6573f3abbf8b2d18814ce2c8576b285eca502' + '90aab35cf01950423638b7af3c3931d4a342b3671086814b99d53e3f847f3736' + 'b5945ecf365acee5fb4caca51caf1d6fe2da050eb33127e0b4b00b74202aa616' + '6c5e124d483b64e7b0ad7aa001c943550d5be76965f2272708083b0995c99af2' + '5d27de39618780371a627ed020624bdce05b3e11784b23941e9f5248e7087f3f' + '7285a21f2c1082ca51befe90daaea19784c22a839e94da882d0d80f23a9f03e3' + '01443d77fb152d631d921b09b9fb50283bee39c6929fcd7ffd3736fc814661d9' + '609101251745f901ec7adcbd9e4e518360d75a8a41c5748f38a475630b79f739' + '016b85da0d455604daac43a03af8aaf7240392ad628c1dd3ac3897f4723fe35b' + '8ffe18df93d77caced48357e31995887f06f5685181a5a6e11f0a7d2740f2ca8' + 'ca60e60bfb4b35f04fec8c73aa551cf532c860c44c26b5b66c9c66a095c46491' + '75035088a9030316977b7f953ba75489bac629d500827daa481f1ddd0dc2c0b1' + '04a40d840df9c834c273849224ab462ec5eaa55850f4b9c71e7479484114e856' + '06b0abe321240d19127e0578ee2b7607d3ce38c62c696e48f71b58f181134c56' + '347222818ffbbc2b72bfe7cdb9e00247cae240372ac629aa5fd1e9386813d9ca' + '80796220c074856f55a63d4ef576f5b5d45cfa4fdc5701b5c7f384e5d92d72bd' + '7b8588bb8ac9c2c74bc5b537e3e17ea90c81d8cf70ea2bd8ff48e3583c24d67f') apply_git_with_msg() { for _patch in "$@" @@ -115,31 +125,36 @@ prepare() { git config core.symlinks true git reset HEAD --hard - apply_git_with_msg 0001-Msysize.patch \ - 0002-More-debugging-info.patch \ - 0003-Core-update.patch \ - 0004-Remove-ldconfig.patch \ - 0005-Change-the-epoch-separator.patch \ - 0006-makepkg-avoid-creating-.tar-files-with-extended-attr.patch \ - 0007-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch \ - 0008-Change-default-answer-of-all-queries-to-yes.patch \ - 0009-Use-pipe-instead-of-socket.patch \ - 0010-pacman-make-file-list-comparisons-between-packages-c.patch \ - 0011-Translate-MSYS2-specific-messages-into-Japanese.patch \ - 0012-Workaround-compressing-packages-with-bsdtar-under-Ac.patch \ - 0013-Fix-asciidoc-argparse.patch \ - 0014-Remove-fakeroot.patch \ - 0015-Remove-sudo.patch \ - 0016-Use-msys-tools.patch \ - 0017-Export-CC-and-CXX-variables-explicitly.patch \ - 0018-pacman.c-handle-cr-on-stdin-as-well.patch \ - 0019-Add-a-CI-job.patch \ - 0020-Strip-static-libraries-as-well.patch \ - 0021-Fix-building-staticlibs-with-LTO.patch \ - 0022-fixup-Export-CC-and-CXX-variables-explicitly.patch \ - 0023-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch \ - 0024-libmakepkg-fix-compatibility-with-bash-5.2-globskipd.patch \ - 0025-Fix-strip-with-file-5.44.patch + apply_git_with_msg 0001-makepkg-clean-up-more-things.patch \ + 0002-makepkg-bash-v4-compat.patch \ + 0003-makepkg-find_libdepends-port-to-Windows.patch \ + 0004-makepkg-build-env-export.patch \ + 0005-makepkg-find_libprovides-port-to-Windows.patch \ + 0006-fill_progress.patch \ + 0007-test-fixes.patch \ + 0008-Remove-everything-related-to-sudo-fakeroot-file-perm.patch \ + 0009-change-shebang.patch \ + 0010-Set-fixed-paths-for-various-tools.patch \ + 0011-makepkg-port-staticlibs-to-Windows.patch \ + 0012-makepkg-port-strip-debug-to-Windows.patch \ + 0013-makepkg-lint_package-Warn-on-package-files-referenci.patch \ + 0014-More-debugging-info.patch \ + 0015-Core-update.patch \ + 0016-Remove-ldconfig.patch \ + 0017-Change-the-epoch-separator.patch \ + 0018-makepkg-avoid-creating-.tar-files-with-extended-attr.patch \ + 0019-pacman-libalpm-ignore-file-conflicts-for-foo.exe-foo.patch \ + 0020-Change-default-answer-of-all-queries-to-yes.patch \ + 0021-Use-pipe-instead-of-socket.patch \ + 0022-pacman-make-file-list-comparisons-between-packages-c.patch \ + 0023-Translate-MSYS2-specific-messages-into-Japanese.patch \ + 0024-Workaround-compressing-packages-with-bsdtar-under-Ac.patch \ + 0025-Fix-asciidoc-argparse.patch \ + 0026-Export-CC-and-CXX-variables-explicitly.patch \ + 0027-pacman.c-handle-cr-on-stdin-as-well.patch \ + 0028-Add-a-CI-job.patch \ + 0029-Fix-building-staticlibs-with-LTO.patch \ + 0030-Make-lint_pkgbuild-opt-in-via-MAKEPKG_LINT_PKGBUILD-.patch } build() {