OFFLINE ?= 0 CARGO ?= cargo VERSION = $(shell $(CARGO) metadata --no-deps --format-version 1 | jq -r '.packages[0].version') PKG_NAME = globalprotect-openconnect-$(VERSION) CARGO_BUILD_ARGS = --release ifeq ($(OFFLINE), 1) CARGO_BUILD_ARGS += --frozen endif default: build version: @echo $(VERSION) # Generate a vendor tarball and a .cargo/config.toml file cargo-vendor: mkdir -p .cargo $(CARGO) vendor .vendor > .cargo/config.toml tar -cJf vendor.tar.xz .vendor tarball: clean clean-tarball build-fe cargo-vendor rm -rf apps/gpgui-helper/node_modules tar --transform 's,^,${PKG_NAME}/,' -czf ../${PKG_NAME}.tar.gz * .cargo # Extract the vendor tarball to the .vendor directory if it exists extract-vendor: if [ -f vendor.tar.xz ]; then tar -xJf vendor.tar.xz; fi build: extract-vendor build-fe build-rs gpgui-helper # Install and build the frontend # If OFFLINE is set to 1, skip it build-fe: if [ $(OFFLINE) -eq 0 ]; then \ cd apps/gpgui-helper && pnpm install && pnpm build; \ fi if [ ! -d apps/gpgui-helper/dist ]; then \ echo "Error: frontend build failed"; \ exit 1; \ fi build-rs: $(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpauth -p gpservice gpgui-helper: $(CARGO) build $(CARGO_BUILD_ARGS) -p gpgui-helper --features "tauri/custom-protocol" clean: $(CARGO) clean rm -rf .vendor rm -rf apps/gpgui-helper/node_modules clean-tarball: rm -rf vendor.tar.xz rm -rf ../$(PKG_NAME).tar.gz install: install -Dm755 target/release/gpclient $(DESTDIR)/usr/bin/gpclient install -Dm755 target/release/gpauth $(DESTDIR)/usr/bin/gpauth install -Dm755 target/release/gpservice $(DESTDIR)/usr/bin/gpservice install -Dm755 target/release/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper install -Dm644 packaging/files/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop install -Dm644 packaging/files/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg install -Dm644 packaging/files/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png install -Dm644 packaging/files/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png install -Dm644 packaging/files/usr/share/icons/hicolor/256x256@2/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png install -Dm644 packaging/files/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy uninstall: rm -f $(DESTDIR)/usr/bin/gpclient rm -f $(DESTDIR)/usr/bin/gpauth rm -f $(DESTDIR)/usr/bin/gpservice rm -f $(DESTDIR)/usr/bin/gpgui-helper rm -f $(DESTDIR)/usr/share/applications/gpgui.desktop rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg rm -f $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png rm -f $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy deb: debmake -e "k3vinyue@gmail.com" -f "Kevin Yue"