chore: add make install-gpclient target (#672)

This is useful in build environments where gpclient is a separate
artifact from other binaries (this is the case in nixpkgs).
This commit is contained in:
Ihar Hrachyshka authored and GitHub committed 2026-10-12 10:53:37 +08:00
1 parent be111a671a
commit d73b712dd3
2 files changed
+34 -8

No files matched your search

+17 -8
View File
@@ -150,26 +150,35 @@ clean:
ifeq ($(shell uname -s),Darwin) ifeq ($(shell uname -s),Darwin)
install: install-macos install: install-macos
install-gpclient: install-gpclient-macos
else ifneq ($(filter FreeBSD OpenBSD,$(shell uname -s)),) else ifneq ($(filter FreeBSD OpenBSD,$(shell uname -s)),)
install: install-bsd install: install-bsd
install-gpclient: install-gpclient-unix
else else
install: install-linux install: install-linux
install-gpclient: install-gpclient-unix
endif endif
install-macos: install-gpclient-unix:
@echo "Installing $(PKG_NAME) for macOS under $(PREFIX)..." install -d "$(DESTDIR)$(PREFIX)/bin" "$(DESTDIR)$(PREFIX)/libexec/gpclient"
install -m 755 "$(CARGO_RELEASE_DIR)/gpclient" "$(DESTDIR)$(PREFIX)/bin/"
install -m 755 packaging/files/usr/libexec/gpclient/vpnc-script "$(DESTDIR)$(PREFIX)/libexec/gpclient/"
install-gpclient-macos:
install -d "$(DESTDIR)$(PREFIX)/bin" "$(DESTDIR)$(PREFIX)/lib/gpclient" "$(DESTDIR)$(PREFIX)/libexec/gpclient" install -d "$(DESTDIR)$(PREFIX)/bin" "$(DESTDIR)$(PREFIX)/lib/gpclient" "$(DESTDIR)$(PREFIX)/libexec/gpclient"
install -m 755 "$(CARGO_RELEASE_DIR)/gpclient" "$(CARGO_RELEASE_DIR)/gpauth" "$(DESTDIR)$(PREFIX)/bin/" install -m 755 "$(CARGO_RELEASE_DIR)/gpclient" "$(DESTDIR)$(PREFIX)/bin/"
set -e; library=$$(sh scripts/macos-openconnect-library.sh "$(CARGO_RELEASE_DIR)/gpclient"); \ set -e; library=$$(sh scripts/macos-openconnect-library.sh "$(CARGO_RELEASE_DIR)/gpclient"); \
install -m 755 "$$library" "$(DESTDIR)$(PREFIX)/lib/gpclient/"; \ install -m 755 "$$library" "$(DESTDIR)$(PREFIX)/lib/gpclient/"; \
install_name_tool -delete_rpath "$$(dirname "$$library")" "$(DESTDIR)$(PREFIX)/bin/gpclient"; \ install_name_tool -delete_rpath "$$(dirname "$$library")" "$(DESTDIR)$(PREFIX)/bin/gpclient"; \
codesign --force --sign - "$(DESTDIR)$(PREFIX)/bin/gpclient" codesign --force --sign - "$(DESTDIR)$(PREFIX)/bin/gpclient"
install -m 755 packaging/files/usr/libexec/gpclient/vpnc-script "$(DESTDIR)$(PREFIX)/libexec/gpclient/" install -m 755 packaging/files/usr/libexec/gpclient/vpnc-script "$(DESTDIR)$(PREFIX)/libexec/gpclient/"
install-macos: install-gpclient-macos
install -m 755 "$(CARGO_RELEASE_DIR)/gpauth" "$(DESTDIR)$(PREFIX)/bin/"
# Common executable and icon installation uses portable install options on Linux/BSD. # Common executable and icon installation uses portable install options on Linux/BSD.
install-unix: install-unix: install-gpclient-unix
install -d "$(DESTDIR)$(PREFIX)/bin" "$(DESTDIR)$(PREFIX)/libexec/gpclient" set -e; for binary in gpauth gpservice; do \
set -e; for binary in gpclient gpauth gpservice; do \
install -m 755 "$(CARGO_RELEASE_DIR)/$$binary" "$(DESTDIR)$(PREFIX)/bin/"; \ install -m 755 "$(CARGO_RELEASE_DIR)/$$binary" "$(DESTDIR)$(PREFIX)/bin/"; \
done done
set -e; for binary in gp-hip-script-installer gp-vpnc-script-installer; do \ set -e; for binary in gp-hip-script-installer gp-vpnc-script-installer; do \
@@ -181,7 +190,6 @@ install-unix:
set -e; if [ -f "$(GPGUI_BINARY)" ]; then \ set -e; if [ -f "$(GPGUI_BINARY)" ]; then \
install -m 755 "$(GPGUI_BINARY)" "$(DESTDIR)$(PREFIX)/bin/gpgui"; \ install -m 755 "$(GPGUI_BINARY)" "$(DESTDIR)$(PREFIX)/bin/gpgui"; \
fi fi
install -m 755 packaging/files/usr/libexec/gpclient/vpnc-script "$(DESTDIR)$(PREFIX)/libexec/gpclient/"
set -e; for file in packaging/files/usr/share/icons/hicolor/*/apps/gpgui.* \ set -e; for file in packaging/files/usr/share/icons/hicolor/*/apps/gpgui.* \
packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-*.svg; do \ packaging/files/usr/share/icons/hicolor/scalable/status/gpgui-*.svg; do \
destination="$(DESTDIR)$(PREFIX)/$${file#packaging/files/usr/}"; \ destination="$(DESTDIR)$(PREFIX)/$${file#packaging/files/usr/}"; \
@@ -287,7 +295,8 @@ else
uninstall: uninstall-linux uninstall: uninstall-linux
endif endif
.PHONY: install install-macos install-unix install-linux install-bsd \ .PHONY: install install-gpclient install-macos install-unix install-linux install-bsd \
install-gpclient-macos install-gpclient-unix \
uninstall uninstall-macos uninstall-unix uninstall-linux uninstall-bsd uninstall uninstall-macos uninstall-unix uninstall-linux uninstall-bsd
uninstall-macos: uninstall-macos:
+17
View File
@@ -9,6 +9,14 @@ for binary in gpclient gpauth gpservice gpgui gpgui-helper gp-vpnc-script-instal
printf '#!/bin/sh\nexit 0\n' > "$temp/release/$binary" printf '#!/bin/sh\nexit 0\n' > "$temp/release/$binary"
chmod 755 "$temp/release/$binary" chmod 755 "$temp/release/$binary"
done done
mkdir -p "$temp/client-release"
cp "$temp/release/gpclient" "$temp/client-release/"
make install-gpclient-unix PREFIX='/custom/gp install' DESTDIR="$temp/client-stage" \
CARGO_RELEASE_DIR="$temp/client-release" > "$temp/client.log"
installed="$temp/client-stage/custom/gp install"
test -x "$installed/bin/gpclient"
test -x "$installed/libexec/gpclient/vpnc-script"
test "$(find "$installed" -type f | wc -l | tr -d ' ')" = 2
for platform in linux bsd; do for platform in linux bsd; do
stage="$temp/$platform-stage" stage="$temp/$platform-stage"
make "install-$platform" PREFIX=/custom/gp DESTDIR="$stage" \ make "install-$platform" PREFIX=/custom/gp DESTDIR="$stage" \
@@ -121,6 +129,14 @@ if [ "$(uname -s)" = Darwin ]; then
-Wl,-rpath,"$temp/build-library" -o "$temp/release/gpclient" -Wl,-rpath,"$temp/build-library" -o "$temp/release/gpclient"
printf 'stale library must never be selected\n' > "$temp/unreferenced-library/libopenconnect.5.dylib" printf 'stale library must never be selected\n' > "$temp/unreferenced-library/libopenconnect.5.dylib"
test "$(sh scripts/macos-openconnect-library.sh "$temp/release/gpclient")" = "$library" test "$(sh scripts/macos-openconnect-library.sh "$temp/release/gpclient")" = "$library"
cp "$temp/release/gpclient" "$temp/client-release/"
make install-gpclient PREFIX='/custom/gp install' DESTDIR="$temp/macos-client-stage" \
CARGO_RELEASE_DIR="$temp/client-release" > "$temp/macos-client.log"
installed="$temp/macos-client-stage/custom/gp install"
test -x "$installed/bin/gpclient"
test -x "$installed/libexec/gpclient/vpnc-script"
test -f "$installed/lib/gpclient/libopenconnect.5.dylib"
test "$(find "$installed" -type f | wc -l | tr -d ' ')" = 3
installed="$temp/macos-stage/custom/gp" installed="$temp/macos-stage/custom/gp"
mkdir -p "$installed/lib" "$temp/homebrew-cellar" mkdir -p "$installed/lib" "$temp/homebrew-cellar"
printf 'Homebrew-owned library\n' > "$temp/homebrew-cellar/libopenconnect.5.dylib" printf 'Homebrew-owned library\n' > "$temp/homebrew-cellar/libopenconnect.5.dylib"
@@ -140,6 +156,7 @@ if [ "$(uname -s)" = Darwin ]; then
codesign --force --sign - "$temp/App/Contents/Helpers/gpclient" codesign --force --sign - "$temp/App/Contents/Helpers/gpclient"
mv "$temp/build-library" "$temp/removed-build-library" mv "$temp/build-library" "$temp/removed-build-library"
"$temp/macos-stage/custom/gp/bin/gpclient" "$temp/macos-stage/custom/gp/bin/gpclient"
"$temp/macos-client-stage/custom/gp install/bin/gpclient"
"$temp/App/Contents/Helpers/gpclient" "$temp/App/Contents/Helpers/gpclient"
touch "$installed/lib/gpclient/unrelated" "$installed/libexec/gpclient/unrelated" touch "$installed/lib/gpclient/unrelated" "$installed/libexec/gpclient/unrelated"
for attempt in 1 2; do for attempt in 1 2; do