forked from madler/zlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkgcheck.sh: verify make and cmake install same bits; tests madler#497 …
…and madler#499 Probably want to be careful about using same compiler for both builds in general, but for now, hide it behind the FreeBSD conditional, since that's where I hit the problem. Run cmake first and configure/make second, see issue madler#499 (build breaks due to zconf.h missing) Add to cirrus CI unixlike builds.
- Loading branch information
Showing
6 changed files
with
116 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y cmake gcc libc6-dev ninja-build && \ | ||
apt-get install --no-install-recommends -y cmake gcc libc6-dev ninja-build make && \ | ||
apt-get clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y cmake gcc libc6-dev ninja-build && \ | ||
apt-get install --no-install-recommends -y cmake gcc libc6-dev ninja-build make && \ | ||
apt-get clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/sh | ||
# Verify that the various build systems produce identical results on a Unixlike system | ||
set -ex | ||
|
||
# Tell GNU's ld etc. to use Jan 1 1970 when embedding timestamps | ||
export SOURCE_DATE_EPOCH=0 | ||
# Tell Apple's ar etc. to use zero timestamps | ||
export ZERO_AR_DATE=1 | ||
|
||
# New build system | ||
# Happens to delete top-level zconf.h | ||
# (which itself is a bug, https://github.com/madler/zlib/issues/162 ) | ||
# which triggers another bug later in configure, | ||
# https://github.com/madler/zlib/issues/499 | ||
rm -rf btmp2 pkgtmp2 | ||
mkdir btmp2 pkgtmp2 | ||
export DESTDIR=$(pwd)/pkgtmp2 | ||
cd btmp2 | ||
cmake -G Ninja .. | ||
ninja -v | ||
ninja install | ||
cd .. | ||
|
||
# Original build system | ||
rm -rf btmp1 pkgtmp1 | ||
mkdir btmp1 pkgtmp1 | ||
export DESTDIR=$(pwd)/pkgtmp1 | ||
cd btmp1 | ||
case $(uname) in | ||
Darwin) | ||
# Tell configure which compiler etc. to use to match cmake | ||
# Tell configure to pad the executable the same way cmake will | ||
CC="$(xcrun --find gcc || echo gcc)" \ | ||
CFLAGS="-DNDEBUG -O3 -isysroot $(xcrun --show-sdk-path)" \ | ||
LDFLAGS="-Wl,-headerpad_max_install_names" \ | ||
../configure | ||
;; | ||
FreeBSD) | ||
# 1) tell configure to tell ar to be deterministic (skipped, see below) | ||
# 2) configure fails with cc, so use clang or gcc | ||
# 3) Force same CC for configure and clang | ||
#export ARFLAGS="Drc" | ||
if clang --version | ||
then | ||
export CC=clang | ||
../configure | ||
elif gcc --version | ||
then | ||
export CC=gcc | ||
../configure | ||
else | ||
# will probably fail | ||
../configure | ||
fi | ||
;; | ||
*) | ||
../configure | ||
;; | ||
esac | ||
make | ||
make install | ||
cd .. | ||
|
||
case $(uname) in | ||
Darwin) | ||
# Alas, dylibs still have an embedded hash or something, | ||
# so nuke it. | ||
# FIXME: find a less fragile way to deal with this. | ||
dylib1=$(find pkgtmp1 -name '*.dylib*' -type f) | ||
dylib2=$(find pkgtmp2 -name '*.dylib*' -type f) | ||
dd conv=notrunc if=/dev/zero of=$dylib1 skip=1337 count=16 | ||
dd conv=notrunc if=/dev/zero of=$dylib2 skip=1337 count=16 | ||
;; | ||
FreeBSD) | ||
# I had trouble passing -D to the ar inside CMakeLists.txt, | ||
# so punt and unpack the archive before comparing. | ||
cd pkgtmp1; ar x usr/local/lib/libz.a; rm usr/local/lib/libz.a; cd .. | ||
cd pkgtmp2; ar x usr/local/lib/libz.a; rm usr/local/lib/libz.a; cd .. | ||
;; | ||
esac | ||
|
||
if diff -Nur pkgtmp1 pkgtmp2 | ||
then | ||
echo pkgcheck-cmake-bits-identical PASS | ||
else | ||
echo pkgcheck-cmake-bits-identical FAIL | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
# Build and test with CMake | ||
set -ex | ||
|
||
rm -rf btmp | ||
mkdir btmp | ||
cd btmp | ||
cmake -G Ninja .. | ||
ninja | ||
ctest -V | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
# Build and test with Make | ||
set -ex | ||
|
||
rm -rf btmp | ||
mkdir btmp | ||
cd btmp1 | ||
../configure | ||
make | ||
make test | ||
cd .. |