mirror of
				https://github.com/yuezk/GlobalProtect-openconnect.git
				synced 2025-05-20 07:26:58 -04:00 
			
		
		
		
	Improve makefile
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -2,6 +2,7 @@ | ||||
| /target | ||||
| .pnpm-store | ||||
| .env | ||||
| vendor | ||||
| .vendor | ||||
| *.tar.xz | ||||
|  | ||||
| .cargo | ||||
|   | ||||
							
								
								
									
										68
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										68
									
								
								Makefile
									
									
									
									
									
								
							| @@ -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 | ||||
|  | ||||
| build-fe: | ||||
| 	cd apps/gpgui-helper && pnpm install && pnpm build | ||||
| ifeq ($(OFFLINE), 1) | ||||
| 	CARGO_BUILD_ARGS += --frozen | ||||
| endif | ||||
|  | ||||
| build-rs: | ||||
| 	cargo build --release --frozen -p gpclient -p gpauth -p gpservice | ||||
| default: build | ||||
|  | ||||
| gpgui-helper: | ||||
| 	cargo build --release --frozen -p gpgui-helper --features "tauri/custom-protocol" | ||||
| version: | ||||
| 	@echo $(VERSION) | ||||
|  | ||||
| tarball: build-fe | ||||
| # 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 | ||||
|  | ||||
| 	mkdir -p .cargo | ||||
| 	cargo vendor > .cargo/config.toml | ||||
| 	tar --transform 's,^,${PKG_NAME}/,' -czf ../${PKG_NAME}.tar.gz * .cargo | ||||
|  | ||||
| 	tar --transform 's,^,${PKG_NAME}/,' -cJf ../${PKG_NAME}.tar.xz * .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 | ||||
| @@ -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 "k3vinyue@gmail.com" -f "Kevin Yue" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user