Page MenuHome GnuPG

No OneTemporary

diff --git a/docker/docker-build.sh b/docker/docker-build.sh
index 9b80f074..04b77c52 100755
--- a/docker/docker-build.sh
+++ b/docker/docker-build.sh
@@ -1,262 +1,269 @@
#!/bin/bash
# Copyright (C) 2024 g10 Code GmbH
#
# Software engineering by Andre Heinecke <aheinecke@gnupg.org>
#
# This file is part of GPG4Win.
#
# GPG4Win is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GPG4Win is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-2.0+
# Packages the current HEAD of a git repository as tarball and generates
# a text block that can be copy and pasted into packages.current.
set -e
usage()
{
cat <<EOF
Usage: $PGM [OPTIONS]
Build Gpg4win in a docker containter.
Options:
--appimage Build the AppImage
--gpg-2.2 Use GnuPG 2.2 instead of the default
--dirty Include uncommited changes
--clean Remove a pre-existing build directory
--shell Start a shell instead of starting a buildscript
--root-shell Start a root shell
--clean-pkgs Do not use already downloaded packages
--inplace Build in the current directoy
--buildroot Directory where the build should take place
--update-image Update the docker image before build
+ --w64 Use 64 bit Windows as primary host arch
This builds either the Appimage the Windows installer.
By default the build is done in \$TMPDIR (${TMPDIR}) with
a subdirectory prefixed with gpg4win.
Use the option --inplace or --buildroot to change that behavior.
Note that the option --dirty uses rsync to copy the local
checkout without the delete option.
Examples:
./$0
Clone the current gpg4win directory to a temporary
directory and build an installer there.
./$0 --dirty --buildroot /home/$USER/build/
Make a copy with rsync of the current gpg4win checkout
and build in that directory. E.g. for development.
./$0 --inplace
Build in the current checkout directory. For
example to rebuild a source tarball.
EOF
exit $1
}
rsync_gpg4win()
{
rsync -a --exclude "playground" \
--exclude '*.tar.*' --exclude '*.zip' \
--exclude '*.exe' --exclude '*.wixlib' \
--exclude 'stamps' --exclude 'installers' \
--exclude 'config.status' --exclude 'config.log' \
"$@"
}
gpg22="no"
dirty="no"
shell="no"
root_shell="no"
clean_pkgs="no"
clean="no"
inplace="no"
branch="master"
srcdir=$(cd $(dirname $0)/..; pwd)
is_tmpbuild="no"
update_image="no"
+w64="no"
# Store the original comamnd line
commandline="$0 $@"
while [ $# -gt 0 ]; do
case $1 in
--appimage) appimage="yes";;
--gpg-2.2) gpg22="yes";;
--dirty) dirty="yes";;
--shell) shell="yes";;
--root-shell) root_shell="yes";;
--clean-pkgs) clean_pkgs="yes";;
--clean) clean="yes";;
--inplace) inplace="yes";;
--update-image) update_image="yes";;
+ --w64) w64="yes";;
--buildroot) buildroot="$2"; shift; ;;
*) usage 1 1>&2; exit 1;;
esac
shift
done
# Set default build directory if not specified
if [ -z "$buildroot" -a "$inplace" == "no" ]; then
buildroot=$(mktemp -d --tmpdir gpg4win.XXXXXXXXXX)
is_tmpbuild="yes"
fi
if [ "$appimage" == "yes" ]; then
cmd=/build/src/appimage/build-appimage.sh
docker_image=g10-build-appimage:sles15
dockerfile=${srcdir}/docker/appimage
else
- cmd=/build/src/build-gpg4win.sh
+ if [ "$w64" == "yes" ]; then
+ cmd="/build/src/build-gpg4win.sh --build-w64"
+ else
+ cmd="/build/src/build-gpg4win.sh"
+ fi
docker_image=g10-build-gpg4win:bookworm
dockerfile=${srcdir}/docker/gpg4win-bookworm
fi
drep=$(echo $docker_image | cut -d : -f 1)
dtag=$(echo $docker_image | cut -d : -f 2)
if [ -z "$(docker images | grep $drep | grep $dtag)" -o "$update_image" == "yes" ]; then
echo "Local image $docker_image not found"
echo "Building docker image"
docker build -t $docker_image $dockerfile 2>&1
fi
# make a local clone or export of gpg4win to keep the working copy clean
if [ "$inplace" == "yes" ]; then
echo "Building in $srcdir"
gpg4win_dir="$srcdir"
else
echo "Building in $buildroot"
mkdir -p "$buildroot"
buildroot=$(readlink -f ${buildroot})
gpg4win_dir="${buildroot}/gpg4win"
if [ "$clean" == "yes" ]; then
rm -rf ${gpg4win_dir}
fi
if test ! -d "${gpg4win_dir}"; then
if [ "$dirty" == "yes" -o ! -d "${srcdir}/.git" ]; then
mkdir -p "${gpg4win_dir}"
rsync_gpg4win "${srcdir}/" "${gpg4win_dir}/"
else
git clone "${srcdir}" "${gpg4win_dir}"
fi
else
echo "Directory ${gpg4win_dir} already exists."
if [ "$dirty" == "yes" ]; then
echo "Updating copy"
rsync_gpg4win "${srcdir}/" "${gpg4win_dir}/"
elif [ -d "${gpg4win_dir}/.git" ]; then
echo "Pulling local repo"
(cd "${gpg4win_dir}" && git pull)
else
echo "Continung without updating the buildscripts"
fi
fi
fi
if [ "$clean_pkgs" == "no" -a "$inplace" == "no" ]; then
echo "Copying packages from ${srcdir}/packages .."
files=$(find ${srcdir}/packages -maxdepth 1 \
-name \*.tar\* -o \
-name \*.zip -o \
-name \*.exe -o \
-name \*.wixlib \
-o -name '.#download.*')
[ -n "$files" ] && cp $files ${gpg4win_dir}/packages
fi
# Always call ./packages/download.sh to avoid accidentally
# using old tarballs. Local tarball switches can be done
# if the file and checksum is updated in the packages
# file.
cd ${gpg4win_dir}/packages
echo "Downloading packages"
if [ "$gpg22" == "yes" ]; then
./download.sh --quiet --v3
else
./download.sh --quiet
fi
userid=$(id -u)
grouid=$(id -g)
if [ "$root_shell" == "yes" ]; then
userid="0"
groupid="0"
cmd="bash"
fi
if [ "$shell" == "yes" ]; then
cmd="bash"
fi
start_time=$(date +"%s")
if [ "$appimage" == "yes" ]; then
log_file="${buildroot}/appimage-buildlog.txt"
else
log_file="${buildroot}/gpg4win-buildlog.txt"
fi
docker run -it --rm --user "$userid:$groupid" \
--volume ${gpg4win_dir}:/build \
$docker_image $cmd 2>&1 | tee ${buildroot}/build-log.txt
err="${PIPESTATUS[0]}"
end_time=$(date +"%s")
duration=$((end_time - start_time))
hours=$((duration / 3600))
minutes=$((duration % 3600 / 60))
seconds=$((duration % 60))
if [ "$err" == "1" -a "$appimage" == "yes" ]; then
echo "Return value is 1 on AppImage build. Treating it as success."
err=0
fi
if [ "$err" == "0" ]; then
mkdir -p "${srcdir}/artifacts"
if [ "$appimage" == "yes" ]; then
results=$(find "${gpg4win_dir}" -maxdepth 1 -iname \*.appimage -a -type f -printf '%p ')
else
results=$(find "${gpg4win_dir}/src/installers" -type f -printf '%p ')
fi
echo ""
echo "#################### Success 🥳 ####################"
echo "Created:"
for result in $results; do
cp -i "$result" ${srcdir}/artifacts/
echo "${srcdir}/artifacts/$(basename $result)"
done
else
echo "#################### Failure 😪 ####################"
echo "Command returned: $err"
fi
echo "Logfile:"
echo "${log_file}"
echo -n "Buildtime: $buildtime"
printf "%02d:%02d:%02d\n" "$hours" "$minutes" "$seconds"
echo "Build command:"
echo "${commandline}"
echo "###################################################"
if [ "$is_tmpbuild" == "yes" ]; then
echo "Do you want to remove ${buildroot}?"
rm -rI "${buildroot}";
fi
diff --git a/src/build-gpg4win.sh b/src/build-gpg4win.sh
index 0fc12230..35e3cc54 100755
--- a/src/build-gpg4win.sh
+++ b/src/build-gpg4win.sh
@@ -1,34 +1,38 @@
#!/bin/sh
# Build Windows installers of GnuPG (VS-)Desktop
# Copyright (C) 2022 g10 Code GmbH
#
# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
#
# This file is part of GnuPG.
#
# GnuPG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0+
set -e
gpg4win_root=$(cd $(dirname $0)/..; pwd)
cd ${gpg4win_root}/packages
./download.sh
cd ${gpg4win_root}
./autogen.sh
-./autogen.sh --build-w32
+if [ $# -gt 0 ]; then
+ ./autogen.sh "$@"
+else
+ ./autogen.sh --build-w32
+fi
make

File Metadata

Mime Type
text/x-diff
Expires
Mon, Dec 23, 1:30 PM (6 h, 4 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1d/50/3ee56eff91c952fc68ac1c030810

Event Timeline