Skip to content

Commit

Permalink
Fix Rogue Company patch and change injection method (#18)
Browse files Browse the repository at this point in the history
* Fix syntax in rogue_company_reverts.patch

* Add shebang and remove leading space

* Change method of injecting fixes
Make variables easier to change
Add status messages

* Change build options

* unattended - build only, no user input
* build   - build only, after user input
* default - build and install, after user input
  • Loading branch information
xiota authored Sep 9, 2024
1 parent 1dc68d1 commit de5df72
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 174 deletions.
48 changes: 0 additions & 48 deletions disable_tests.patch

This file was deleted.

87 changes: 62 additions & 25 deletions glibc_eac.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,71 @@
# Enable/disable each fix we offer
_reenable_dt_hash="true"
_rogue_company_fix="false"
_disable_tests="true" # They are very playful and seem to fail randomly in different ways depending on the machine, so let's disable them by default - https://github.com/Frogging-Family/glibc-eac/issues/2
_upstream_commit="" # 2.39-4 commit was 31da30f23cddd36db29d5b6a1c7619361b271fb4
#!/usr/bin/env bash

rm -rf ./glibc && git clone --depth=1 --single-branch -b main https://gitlab.archlinux.org/archlinux/packaging/packages/glibc.git
cd ./glibc
# Enable/disable each fix we offer
: ${_reenable_dt_hash=true}
: ${_rogue_company_fix=false}
: ${_disable_tests=true} # random fails on different machines
: ${_upstream_commit=} # 2.40+r16+gaa533d58ff = aa533d58ff12e27771d9c960a727d74992a3f2a3

if [ "$_reenable_dt_hash" = "true" ]; then
patch -Np1 -i ../inject_reenable_DT_HASH.patch && cp ../reenable_DT_HASH.patch ./
fi
rm -rf ./glibc && git clone --depth=1 --single-branch -b main https://gitlab.archlinux.org/archlinux/packaging/packages/glibc.git
cd ./glibc

if [ "$_rogue_company_fix" = "true" ]; then
patch -Np1 -i ../inject_rogue_company_reverts.patch && cp ../rogue_company_reverts.patch ./
fi
if [[ "${_reenable_dt_hash::1}" =~ t|y|1 ]]; then
echo "::: Fixing DT_HASH..."
cat >> PKGBUILD << 'END'
export LDFLAGS+=" -Wl,--hash-style=both"
END
fi

if [ "$_disable_tests" = "true" ]; then
patch -Np1 -i ../disable_tests.patch
fi
if [[ "${_rogue_company_fix::1}" =~ t|y|1 ]]; then
echo "::: Fixing Rogue Company..."
cp ../rogue_company_reverts.patch ./
cat >> PKGBUILD << 'END'
source+=('rogue_company_reverts.patch')
b2sums+=('SKIP')
if [ -n "$_upstream_commit" ]; then
sed -i "s/_commit=.*/_commit=$_upstream_commit/g" PKGBUILD
fi
eval _orig_"$(declare -f prepare)"
prepare() {
(_orig_prepare)
if [ "$1" = "build" ]; then
cd glibc
# Reverts for Rogue Company to work again
# 7a5db2e82fbb6c3a6e3fdae02b7166c5d0e8c7a8
# 8208be389bce84be0e1c35a3daa0c3467418f921
# 6bf789d69e6be48419094ca98f064e00297a27d5
# b89d5de2508215ef3131db7bed76ac50b3f4c205
# 86f0179bc003ffc34ffaa8d528a7a90153ac06c6
patch -Np1 -F100 -i "../rogue_company_reverts.patch"
}
END
fi

# https://github.com/Frogging-Family/glibc-eac/issues/2
if [[ "${_disable_tests::1}" =~ t|y|1 ]]; then
echo "::: Disabling unit tests..."
cat >> PKGBUILD << 'END'
unset checkdepends
unset -f check
END
fi

if [ -n "$_upstream_commit" ]; then
echo -n "::: Using commit: $_upstream_commit"
sed -i "s/_commit=.*/_commit=$_upstream_commit/g" PKGBUILD
fi

case "$1" in
unattended)
echo "::: Building in unattended mode..."
makepkg --noconfirm --skipinteg -sc
;;
build)
echo "::: Build only. If you want to build and install, re-run without options."
read -rp "Press enter to continue or hit ctrl+c to leave"
makepkg --noconfirm --skipinteg -sc
else
echo "############################################################################################"
echo "! Defaulting to building then installing ! If you only want to build, run './glibc_eac.sh build'"
echo "############################################################################################"
;;
*)
echo "::: Build and install. If you want to build only, run: './glibc_eac.sh build'"
read -rp "Press enter to continue or hit ctrl+c to leave"
makepkg --noconfirm --skipinteg -sic
fi
;;
esac
34 changes: 0 additions & 34 deletions inject_reenable_DT_HASH.patch

This file was deleted.

37 changes: 0 additions & 37 deletions inject_rogue_company_reverts.patch

This file was deleted.

29 changes: 0 additions & 29 deletions reenable_DT_HASH.patch

This file was deleted.

2 changes: 1 addition & 1 deletion rogue_company_reverts.patch
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ index a50a988e7362cf3b20ea1c05e1f8eb9f6df2b996..6c8a9e80ba5f91f88e21478084e981f8
tst-tls1-static \
tst-tls1-static-non-pie \
tst-tunables \
+ tst-libc_dlvsym-static
+ tst-libc_dlvsym-static \
# tests-static-internal

CRT-tst-tls1-static-non-pie := $(csu-objpfx)crt1.o
Expand Down

0 comments on commit de5df72

Please sign in to comment.