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 Run cmake first and configure/make second, see issue madler#499 (build breaks due to zconf.h missing) ci: add fedora, debian; use matrix and a template in .cirrus.yml
- Loading branch information
Showing
14 changed files
with
227 additions
and
43 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM debian:10 | ||
|
||
RUN apt-get update && \ | ||
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,5 @@ | ||
FROM debian:8 | ||
|
||
RUN apt-get update && \ | ||
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,5 @@ | ||
FROM debian:9 | ||
|
||
RUN apt-get update && \ | ||
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,12 @@ | ||
FROM fedora:31 | ||
|
||
RUN dnf -y update && dnf clean all | ||
|
||
RUN dnf makecache \ | ||
&& dnf -y install \ | ||
gcc \ | ||
cmake \ | ||
diffutils \ | ||
make \ | ||
ninja-build \ | ||
&& dnf clean all |
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,12 @@ | ||
FROM fedora:32 | ||
|
||
RUN dnf -y update && dnf clean all | ||
|
||
RUN dnf makecache \ | ||
&& dnf -y install \ | ||
gcc \ | ||
cmake \ | ||
diffutils \ | ||
make \ | ||
ninja-build \ | ||
&& dnf clean all |
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,5 @@ | ||
FROM ubuntu:14.04 | ||
|
||
RUN apt-get update && \ | ||
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,5 @@ | ||
FROM ubuntu:16.04 | ||
|
||
RUN apt-get update && \ | ||
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: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,5 @@ | ||
FROM ubuntu:20.10 | ||
|
||
RUN apt-get update && \ | ||
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,103 @@ | ||
#!/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|Linux) | ||
# 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 grep -i fedora /etc/os-release > /dev/null | ||
then | ||
# Note: Fedora patches cmake to use -O2 in release, which | ||
# does not match the -O3 configure sets :-( | ||
export CFLAGS="-O2 -DNDEBUG" | ||
fi | ||
if clang --version | ||
then | ||
export CC=clang | ||
../configure | ||
elif gcc --version | ||
then | ||
export CC=gcc | ||
../configure | ||
else | ||
../configure | ||
fi | ||
;; | ||
*) | ||
../configure | ||
;; | ||
esac | ||
make | ||
make install | ||
cd .. | ||
|
||
repack_ar() { | ||
if ! cmp --silent pkgtmp1/usr/local/lib/libz.a pkgtmp2/usr/local/lib/libz.a | ||
then | ||
echo "Warning: libz.a does not match. Assuming ar needs -D option. Unpacking..." | ||
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 .. | ||
fi | ||
} | ||
|
||
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|Linux) | ||
# The ar on newer systems defaults to -D (i.e. deterministic), | ||
# but FreeBSD 12.1, Debian 8, and Ubuntu 14.04 seem to not do that. | ||
# I had trouble passing -D safely to the ar inside CMakeLists.txt, | ||
# so punt and unpack the archive if needed before comparing. | ||
repack_ar | ||
;; | ||
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 .. |