Skip to content

Commit

Permalink
build.sh: Check output with file
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Apr 16, 2024
1 parent 22debcf commit b095623
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ jobs:
if: always()
run: ./build.sh build-log

- name: Check binaries
run: ./build.sh check-binaries

- name: Dist
run: if [ ! "$SKIP_DISC" ]; then ./build.sh dist; else echo "meson dist skipped"; fi

Expand Down
39 changes: 38 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ PREFIX="${PREFIX:-$HOME/iputils-install}"
BUILD_OPTS="-Dprefix=$PREFIX $EXTRA_BUILD_OPTS"
[ -f "meson.cross" ] && BUILD_OPTS="--cross-file $PWD/meson.cross $BUILD_OPTS"

BINARIES='arping clockdiff ping/ping tracepath'

# NOTE: meson iself checkes for minimal version
# see meson_version in meson.build, it fails if not required
# Meson version is 0.37.1 but project requires >=0.40.
Expand Down Expand Up @@ -91,6 +93,37 @@ build()
make -j$(getconf _NPROCESSORS_ONLN)
}

check_binaries()
{

echo "=== check_binaries ==="

local arch i
local bits="64"

case "${ARCH:-}" in
'') arch='x86-64';;
arm64) arch='aarch64';;
ppc64el) arch='PowerPC';;
s390x) arch='S/390';;
esac

if [ "${BUILD_32:-}" ]; then
bits=32
arch='80386'
fi

echo "arch: '$arch'" # FIXME: debug
find $BUILD_DIR # FIXME: debug

for i in $BINARIES; do
[ -x "$BUILD_DIR/$i" ]

file "$BUILD_DIR/$i" # FIXME: debug
file "$BUILD_DIR/$i" | grep -E "$i.*${bits}-bit .*(executable|shared object).*$arch.*dynamically linked"
done
}

install()
{
echo "=== install ==="
Expand Down Expand Up @@ -147,7 +180,7 @@ cd `dirname $0`

cmd=
case "${1:-}" in
build|build-log|configure|dependencies|dist|info|install|install-log|test|test-log|"") cmd="${1:-}";;
build|build-log|check-binaries|configure|dependencies|dist|info|install|install-log|test|test-log|"") cmd="${1:-}";;
*) echo "ERROR: wrong command '$1'" >&2; exit 1;;
esac

Expand All @@ -167,6 +200,10 @@ if [ -z "$cmd" -o "$cmd" = "build" ]; then
build
fi

if [ -z "$cmd" -o "$cmd" = "check-binaries" ]; then
check_binaries
fi

if [ "$cmd" = "build-log" ]; then
print_log meson-log.txt
fi
Expand Down

0 comments on commit b095623

Please sign in to comment.