summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Basin2018-03-27 16:46:44 +0300
committerIlya Basin2018-03-27 16:46:44 +0300
commit195c6acd48a51622ca143cb3a26bede47eef02ec (patch)
tree3740cbedcbf5fba69de6be965bf6361bcb24b1f0
parentb732498c534c8dd0321739e011698abd164b0537 (diff)
downloadaur-195c6acd48a51622ca143cb3a26bede47eef02ec.tar.gz
check output binaries arch
-rw-r--r--PKGBUILD26
1 files changed, 25 insertions, 1 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 84a7ef91518d..196e2f0431c0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -38,7 +38,7 @@ prepare() {
}
build() {
- unset CFLAGS
+ unset CFLAGS CXXLAGS
cd $_pkgname-$pkgver
if true; then
./configure \
@@ -56,6 +56,30 @@ fi
make
}
+check() {
+ local s readelfarch
+ readelfarch='AArch64'
+ cd $_pkgname-$pkgver
+
+ s=$(find . -type f "(" -name "*.so*" -o -name "*.a" ")" -print0 | \
+ 2>/dev/null LC_ALL=C xargs -0 readelf -h | \
+ sed -n -e '/File:/h;/Machine:/{/'"$readelfarch"'/!{H;x;p}}' | head -10)
+
+ if [ -n "$s" ]; then
+ >&2 echo "some binaries have wrong architecture:"
+ >&2 echo "$s"
+ return 1
+ fi
+}
+
+strip() {
+ ${_target}-strip "$@"
+}
+
+objcopy() {
+ ${_target}-objcopy "$@"
+}
+
package() {
cd $_pkgname-$pkgver
make DESTDIR="$pkgdir" install