~alpine/aports

[alpine-aports] [PATCH] community/upx: upgrade to 3.95

alpine-mips-patches <info@mobile-stream.com>
Details
Message ID
<20181220144423.9E6B1604E4@mx12.valuehost.ru>
Sender timestamp
1545314818
DKIM signature
missing
Download raw message
Patch: +47 -11
UPX 3.94 seems completely broken even on x86_64 due to toolchain
upgrade.

 - use cleaner method to force CXXFLAGS precedence over "-O2";
 - add basic check() -- passes on x86_64 and mipseln8hf, may need
   tweak for other architectures;

Just for the record: out-of-tree hard-float mips* is still broken
for any application that uses FPU because UPX does not copy the
attribute section to the compressed binary so the usual "FR=1 code
in FR=0 context" problem arises. In-tree soft-float mips* should
not be affected.
---
 community/upx/APKBUILD | 58 ++++++++++++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 11 deletions(-)

diff --git a/community/upx/APKBUILD b/community/upx/APKBUILD
index 901ef64692..d52c91f5bb 100644
--- a/community/upx/APKBUILD
+++ b/community/upx/APKBUILD
@@ -1,8 +1,8 @@
# Maintainer: Mitch Tishmack <mitch.tishmack@gmail.com>
# TODO: unbundle lzma-sdk
pkgname=upx
pkgver=3.94
pkgrel=1
pkgver=3.95
pkgrel=0
pkgdesc="The Ultimate Packer for eXecutables"
url="https://upx.github.io"
arch="all"
@@ -12,21 +12,57 @@ makedepends="bash perl-dev ucl-dev zlib-dev"
subpackages="$pkgname-doc"
source="https://github.com/upx/$pkgname/releases/download/v$pkgver/$pkgname-$pkgver-src.tar.xz
	0001-rm-broken-whitespace-check.patch"
options="!check" # no test suite
builddir="$srcdir/$pkgname-$pkgver-src"

prepare() {
	default_prepare

build() {
	cd "$builddir"
	sed -i 's/ -O2/ /' src/Makefile

	make CXXFLAGS_OPTIMIZE= UPX_LZMADIR="$srcdir" all
}

build() {
check() {
	cd "$builddir"

	CXXFLAGS_WERROR="-Werror -Wno-error=class-memaccess" \
	make UPX_LZMADIR="$srcdir" all
	# upx -q is not quiet enough by design or broken

	local upx=src/upx.out
	local out

	# first check some big dynamically-linked binary
	echo "checking -pie..."

	cp -f /bin/busybox ./sh
	for i in "-1" "-d"; do
		$upx $i -qf sh &>/dev/null
		out="$(./sh -c 'echo works')"
		test "x$out" = "xworks"
	done
	rm -f sh

	# then check less common statically-linked binaries (PIE and non-PIE)
	for v in "-static" "-static -no-pie"; do
		echo "checking $v..."

		# must be compressible (i.e. big enough) so pull printf etc
		$CC -o upxtest -pipe -std=c11 -pedantic -Wall $CFLAGS $LDFLAGS $v -x c - -latomic <<-EOF
		#include <stdatomic.h>
		#include <stdio.h>
		static const atomic_llong b = ATOMIC_VAR_INIT(0x1000200030004000LL);
		int main(int argc, char *argv[const]) {
			atomic_llong a = ATOMIC_VAR_INIT(argc);
			atomic_fetch_add(&a, b);
			printf("%d,%#llx\n", argc, a);
			return 0;
		}
		EOF

		for i in "-1" "-d"; do
			$upx $i -qf upxtest &>/dev/null
			out=$(./upxtest "")
			test "x$out" = "x2,0x1000200030004002"
		done
	done
	rm -f upxtest
}

package() {
@@ -36,5 +72,5 @@ package() {
	install -D -m 0644 doc/upx.1 "$pkgdir"/usr/share/man/man1/upx.1
}

sha512sums="b9e8e6e13b2a267a30a9c4e572243c4ebeff9600044193de38c84e8943e3cd30c9cdd7b270cc0bdf14c1078ac15250906238f8272cd97a7eb40f2588965c6151  upx-3.94-src.tar.xz
sha512sums="0e1d3e26462057f16587197e73301957e870107808fdbcd24d9976094dfa0e5efbe8da0f9b6732a99f05990dcd4be242a87ea19a7110dc052c6dc982cd596416  upx-3.95-src.tar.xz
a41dd8b8e9e884c78c410a49b4486963f6dd90759ba49eb05123e81b8e4fbe3d23af2ba5c2acf64218b7edeec7df0793b4030d1375c167a183a4d70d21addf50  0001-rm-broken-whitespace-check.patch"
-- 
2.20.1




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)