@@ -18,17 +18,13 @@ if ! echo "$OUTPUT_TIMESTAMP" | grep -Eq "^$d{4}-$d{2}-$d{2}T$d{2}:$d{2}:$d{2}Z$
1818 exit 1
1919fi
2020
21- # Build directory containing temporary files
21+ # Build directory containing temporary files, all the paths are relative to it.
2222#
2323build=CMakeFiles
2424
25- # Directory containing the distribution archives
26- #
27- dist=" $build /dist"
28-
2925# Create source directory
30- mkdir -p " $dist "
31- OUTPUT_DIR=" $build / apache-log4cxx-$VERSION "
26+ mkdir -p " $build / dist"
27+ OUTPUT_DIR=" apache-log4cxx-$VERSION "
3228if [ -f " $OUTPUT_DIR " ]; then
3329 if [ ! -d " $OUTPUT_DIR " ]; then
3430 echo File " $OUTPUT_DIR " is not a directory >& 2
@@ -39,7 +35,7 @@ if [ -f "$OUTPUT_DIR" ]; then
3935 exit 1
4036 fi
4137fi
42- mkdir -p " $OUTPUT_DIR "
38+ mkdir -p " $build / $ OUTPUT_DIR"
4339
4440# Copy files to directory
4541cp -r \
@@ -52,13 +48,13 @@ cp -r \
5248 src \
5349 liblog4cxx.pc.in \
5450 liblog4cxx-qt.pc.in \
55- " $OUTPUT_DIR "
56- rm -r " $OUTPUT_DIR " /src/main/abi-symbols
51+ " $build / $ OUTPUT_DIR"
52+ rm -r " $build / $ OUTPUT_DIR" /src/main/abi-symbols
5753
5854# Create TAR file
5955#
6056# See https://reproducible-builds.org/docs/archives/ for reproducibility tips
61- TAR_ARCHIVE=" $ dist /apache-log4cxx-$VERSION .tar.gz"
57+ TAR_ARCHIVE=" dist/apache-log4cxx-$VERSION .tar.gz"
6258echo ' Tar version:'
6359tar --version | sed -e ' s/^/\t/'
6460echo ' Gzip version:'
@@ -68,43 +64,44 @@ if [ -f "$TAR_ARCHIVE" ]; then
6864 exit 1
6965fi
7066
71- tar --transform=" s!^$OUTPUT_DIR !apache-log4cxx-$VERSION !" \
72- --mtime=" $OUTPUT_TIMESTAMP " \
73- --owner=0 --group=0 --numeric-owner \
74- --sort=name \
75- --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
76- --create --gzip --file " $TAR_ARCHIVE " " $OUTPUT_DIR "
77-
78- echo -e Tar archive: " $TAR_ARCHIVE "
67+ (
68+ cd " $build "
69+ tar --mtime=" $OUTPUT_TIMESTAMP " \
70+ --owner=0 --group=0 --numeric-owner \
71+ --sort=name \
72+ --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
73+ --create --gzip --file " $TAR_ARCHIVE " " $OUTPUT_DIR "
74+ )
75+ echo -e Tar archive: " $build /$TAR_ARCHIVE "
7976
8077# Create ZIP file
8178#
8279# See https://reproducible-builds.org/docs/archives/ for reproducibility tips
8380# Change the mtime of all files
84- ZIP_ARCHIVE=" $ dist /apache-log4cxx-$VERSION .zip"
81+ ZIP_ARCHIVE=" dist/apache-log4cxx-$VERSION .zip"
8582echo ' Zip version:'
8683zip --version | sed ' s/^/\t/'
8784if [ -f " $ZIP_ARCHIVE " ]; then
8885 echo Archive " $ZIP_ARCHIVE " already exists >& 2
8986 exit 1
9087fi
9188
92- find " $OUTPUT_DIR " -exec touch --date=" $OUTPUT_TIMESTAMP " -m {} +
89+ find " $build / $ OUTPUT_DIR" -exec touch --date=" $OUTPUT_TIMESTAMP " -m {} +
9390# Sort files and zip.
9491(
9592 cd " $build "
96- find apache-log4cxx- $VERSION -print0 |
93+ find " $OUTPUT_DIR " -print0 |
9794 LC_ALL=C sort -z |
98- xargs -0 zip -q -X dist/apache-log4cxx- $VERSION .zip
95+ xargs -0 zip -q -X " $ZIP_ARCHIVE "
9996)
10097
101- echo -e ZIP archive: " $ZIP_ARCHIVE "
98+ echo -e ZIP archive: " $build / $ ZIP_ARCHIVE"
10299
103100# Generate hashes
104101(
105- cd " $dist "
106- for format in tar.gz zip ; do
107- sha256sum apache-log4cxx- $VERSION . $format > apache-log4cxx- $VERSION . $format . sha256
108- sha512sum apache-log4cxx- $VERSION . $format > apache-log4cxx- $VERSION . $format . sha512
102+ cd " $build / dist"
103+ for file in * ; do
104+ sha256sum " $file " > " $file . sha256"
105+ sha512sum " $file " > " $file . sha512"
109106 done
110107)
0 commit comments