-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
209 additions
and
69 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
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/bash | ||
# | ||
set -e | ||
|
||
# Determine the version and build timestamp | ||
VERSION=$(grep -Po '(?<=set\(log4cxx_VER ")(.*)(?="\))' src/cmake/projectVersionDetails.cmake) | ||
if ! echo "$VERSION" | grep -Pq '^\d+\.\d+\.\d+$'; then | ||
echo Invalid version number: "$VERSION" >& 2 | ||
exit 1 | ||
fi | ||
|
||
OUTPUT_TIMESTAMP=$(grep -Po '(?<=set\(log4cxx_OUTPUT_TIMESTAMP ")(.*)(?="\))' src/cmake/projectVersionDetails.cmake) | ||
if ! echo "$OUTPUT_TIMESTAMP" | grep -Pq '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$'; then | ||
echo Invalid build timestamp: "$OUTPUT_TIMESTAMP" >& 2 | ||
echo Run '`'date -u +%Y-%m-%dT%H:%M:%SZ'`' to generate it | ||
exit 1 | ||
fi | ||
|
||
# Build directory | ||
build=CMakeFiles | ||
|
||
# Create source directory | ||
mkdir -p "$build" | ||
OUTPUT_DIR="$build/apache-log4cxx-$VERSION" | ||
if [ -f "$OUTPUT_DIR" ]; then | ||
if [ ! -d "$OUTPUT_DIR" ]; then | ||
echo File "$OUTPUT_DIR" is not a directory >& 2 | ||
exit 1 | ||
fi | ||
if [ ! -z "$(ls -A "$OUTPUT_DIR")" ]; then | ||
echo Directory "$OUTPUT_DIR" is not empty >& 2 | ||
exit 1 | ||
fi | ||
fi | ||
mkdir -p "$OUTPUT_DIR" | ||
|
||
# Copy files to directory | ||
cp -r \ | ||
CMakeLists.txt \ | ||
KEYS \ | ||
INSTALL \ | ||
LICENSE \ | ||
NOTICE \ | ||
README.md \ | ||
src \ | ||
liblog4cxx.pc.in \ | ||
liblog4cxx-qt.pc.in \ | ||
"$OUTPUT_DIR" | ||
rm -r "$OUTPUT_DIR"/src/main/abi-symbols | ||
|
||
# Create TAR file | ||
# | ||
# See https://reproducible-builds.org/docs/archives/ for reproducibility tips | ||
TAR_ARCHIVE="$build/apache-log4cxx-$VERSION.tar.gz" | ||
echo 'Tar version:' | ||
tar --version | sed -e 's/^/\t/' | ||
echo 'Gzip version:' | ||
gzip --version | sed -e 's/^/\t/' | ||
if [ -f "$TAR_ARCHIVE" ]; then | ||
echo Archive "$TAR_ARCHIVE" already exists >& 2 | ||
exit 1 | ||
fi | ||
|
||
tar --transform="s!^$OUTPUT_DIR!apache-log4cxx-$VERSION!" \ | ||
--mtime="$OUTPUT_TIMESTAMP" \ | ||
--owner=0 --group=0 --numeric-owner \ | ||
--sort=name \ | ||
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \ | ||
--create --gzip --file "$TAR_ARCHIVE" "$OUTPUT_DIR" | ||
|
||
echo -e Tar archive: "$TAR_ARCHIVE" | ||
|
||
# Create ZIP file | ||
# | ||
# See https://reproducible-builds.org/docs/archives/ for reproducibility tips | ||
# Change the mtime of all files | ||
ZIP_ARCHIVE="$build/apache-log4cxx-$VERSION.zip" | ||
echo 'Zip version:' | ||
zip --version | sed 's/^/\t/' | ||
if [ -f "$ZIP_ARCHIVE" ]; then | ||
echo Archive "$ZIP_ARCHIVE" already exists >& 2 | ||
exit 1 | ||
fi | ||
|
||
find "$OUTPUT_DIR" -exec touch --date="$OUTPUT_TIMESTAMP" -m {} + | ||
# Sort files and zip. | ||
( | ||
cd "$build" | ||
find apache-log4cxx-$VERSION -print0 | | ||
LC_ALL=C sort -z | | ||
xargs -0 zip -q -X apache-log4cxx-$VERSION.zip | ||
) | ||
|
||
echo -e ZIP archive: "$ZIP_ARCHIVE" | ||
|
||
# Generate hashes | ||
( | ||
cd "$build" | ||
for format in tar.gz zip; do | ||
sha256sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha256 | ||
sha512sum apache-log4cxx-$VERSION.$format > apache-log4cxx-$VERSION.$format.sha512 | ||
done | ||
) |
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,27 @@ | ||
# This file should contain nothing but the following line | ||
# setting the project version. The variable name must not | ||
# clash with the log4cxx_VERSION* variables automatically | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
## | ||
# This file should contain only the current version and the build timestamp | ||
|
||
# The variable name must not clash with the log4cxx_VERSION* variables automatically | ||
# defined by the project() command. | ||
set(log4cxx_VER 1.3.0.0) | ||
set(log4cxx_VER "1.3.0") | ||
|
||
# Timestamp used for the source archive to guarantee reproducible builds in ISO 8601 format. | ||
# | ||
# To generate use: date -u +%Y-%m-%dT%H:%M:%SZ | ||
set(log4cxx_OUTPUT_TIMESTAMP "2024-10-11T14:35:14Z") |