make gpg relocatable without hacks

This commit is contained in:
Max Howell 2023-11-25 08:05:20 -05:00
parent 75071188a5
commit 18aec11b11
4 changed files with 21 additions and 31 deletions

View file

@ -1,18 +0,0 @@
#!/bin/sh
d="$(dirname "$0")"
etc="$d/../etc/gnupg"
export GNUPGHOME="${GNUPGHOME:-"$etc"}"
if [ ! -f "$etc/gpg.conf" ]; then
mkdir -p "$etc"
chmod 700 "$etc"
cat << EOF > "$etc"/gpg.conf
use-agent
pinentry-mode loopback
agent-program $d/gpg-agent
EOF
fi
exec "$d"/gpg-exec "$@"

View file

@ -0,0 +1,2 @@
use-agent
pinentry-mode loopback

View file

@ -0,0 +1 @@
rootdir = $GNUPG_BUILD_ROOT/

View file

@ -9,8 +9,16 @@ versions:
- /gnupg-/ - /gnupg-/
- /.tar.bz2/ - /.tar.bz2/
runtime:
env:
# allows us to be relocatable provided `gpgconf.ctl` exists alongside
# the `gpgconf` binary. NOTE causes warning messages on Darwin:
# error reading symlink '/proc/curproc/file': No such file or directory
# which seemingly cannot be avoided without a patch
GNUPG_BUILD_ROOT: '{{prefix}}'
dependencies: dependencies:
zlib.net: '*' zlib.net: ^1.1
sourceware.org/bzip2: '*' sourceware.org/bzip2: '*'
gnupg.org/npth: '*' gnupg.org/npth: '*'
gnupg.org/libgpg-error: '*' gnupg.org/libgpg-error: '*'
@ -22,13 +30,8 @@ dependencies:
openldap.org: ^2 openldap.org: ^2
gnu.org/readline: ^8 gnu.org/readline: ^8
sqlite.org: ^3 sqlite.org: ^3
thrysoee.dk/editline: ^3 #NOTE added by jacob to try and fix a bug darwin: # nobody added a comment to say why this is Darwin only
darwin: gnu.org/gettext: ^0.21
gnu.org/gettext: ^0.22.4
runtime:
env:
GNUPGHOME: '{{prefix}}/etc/gnupg'
build: build:
freedesktop.org/pkg-config: '*' freedesktop.org/pkg-config: '*'
@ -38,6 +41,10 @@ build:
- ./configure $ARGS - ./configure $ARGS
- make --jobs {{ hw.concurrency }} - make --jobs {{ hw.concurrency }}
- make --jobs {{ hw.concurrency }} install - make --jobs {{ hw.concurrency }} install
# this makes the lookup machinery relocatable, see above
- cp props/gpgconf.ctl {{prefix}}/bin
- run: | - run: |
sed -i.bak "s|{{prefix}}|\$(dirname \$0)/..|g" gpg-wks-client sed -i.bak "s|{{prefix}}|\$(dirname \$0)/..|g" gpg-wks-client
rm gpg-wks-client.bak rm gpg-wks-client.bak
@ -46,11 +53,9 @@ build:
mkdir -p var/run etc/gnupg mkdir -p var/run etc/gnupg
chmod 700 etc/gnupg chmod 700 etc/gnupg
working-directory: '{{prefix}}' working-directory: '{{prefix}}'
- run: |
mv ./gpg ./gpg-exec # nobody added a comment explaining why this conf is required
working-directory: '{{prefix}}/bin' - run: cp props/gpg.conf {{prefix}}/etc/gnupg/gpg.conf
- run: install gpg {{prefix}}/bin/
working-directory: props
env: env:
ARGS: ARGS:
- --prefix={{prefix}} - --prefix={{prefix}}