-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
2 changed files
with
55 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
/target | ||
.pnpm-store | ||
.env | ||
vendor | ||
.vendor | ||
*.tar.xz | ||
|
||
.cargo |
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,24 +1,63 @@ | ||
VERSION=$(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version') | ||
PKG_NAME=globalprotect-openconnect-$(VERSION) | ||
OFFLINE ?= 0 | ||
CARGO ?= cargo | ||
VERSION = $(shell $(CARGO) metadata --no-deps --format-version 1 | jq -r '.packages[0].version') | ||
PKG_NAME = globalprotect-openconnect-$(VERSION) | ||
|
||
build: build-fe build-rs gpgui-helper | ||
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: | ||
cd apps/gpgui-helper && pnpm install && pnpm build | ||
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 --release --frozen -p gpclient -p gpauth -p gpservice | ||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpauth -p gpservice | ||
|
||
gpgui-helper: | ||
cargo build --release --frozen -p gpgui-helper --features "tauri/custom-protocol" | ||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpgui-helper --features "tauri/custom-protocol" | ||
|
||
tarball: build-fe | ||
clean: | ||
$(CARGO) clean | ||
rm -rf .vendor | ||
rm -rf apps/gpgui-helper/node_modules | ||
|
||
mkdir -p .cargo | ||
cargo vendor > .cargo/config.toml | ||
|
||
tar --transform 's,^,${PKG_NAME}/,' -cJf ../${PKG_NAME}.tar.xz * .cargo | ||
clean-tarball: | ||
rm -rf vendor.tar.xz | ||
rm -rf ../$(PKG_NAME).tar.gz | ||
|
||
install: | ||
install -Dm755 target/release/gpclient $(DESTDIR)/usr/bin/gpclient | ||
|
@@ -45,3 +84,6 @@ uninstall: | |
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 "[email protected]" -f "Kevin Yue" |