mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 22:46:14 -05:00
refactor: replace BUILD_GUI with BUILD_GUI_HELPER and simplify build options
This commit is contained in:
6 files changed
+24
-48
No files matched your search
@@ -74,8 +74,7 @@ jobs:
|
|||||||
cp -v packaging/deb/compat .build/debian/compat
|
cp -v packaging/deb/compat .build/debian/compat
|
||||||
cp -v packaging/deb/postrm .build/debian/postrm
|
cp -v packaging/deb/postrm .build/debian/postrm
|
||||||
|
|
||||||
sed -i "s/@OFFLINE@/1/g" .build/debian/rules
|
sed -i "s/@BUILD_GUI_HELPER@/1/g" .build/debian/rules
|
||||||
sed -i "s/@BUILD_GUI@/1/g" .build/debian/rules
|
|
||||||
|
|
||||||
# Update the control file with the correct Rust version
|
# Update the control file with the correct Rust version
|
||||||
# sed -i "s/rust-[0-9.]\+-all/rust-${{ inputs.rust }}-all/g" .build/debian/control
|
# sed -i "s/rust-[0-9.]\+-all/rust-${{ inputs.rust }}-all/g" .build/debian/control
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
.SHELLFLAGS += -e
|
.SHELLFLAGS += -e
|
||||||
|
|
||||||
OFFLINE ?= 0
|
|
||||||
BUILD_FE ?= 1
|
|
||||||
INCLUDE_GUI ?= 0
|
INCLUDE_GUI ?= 0
|
||||||
CARGO ?= cargo
|
CARGO ?= cargo
|
||||||
DISABLE_RUST_TOOLCHAIN ?= 0
|
DISABLE_RUST_TOOLCHAIN ?= 0
|
||||||
@@ -17,11 +15,16 @@ SERIES ?= $(shell lsb_release -cs)
|
|||||||
PUBLISH ?= 0
|
PUBLISH ?= 0
|
||||||
|
|
||||||
# Indicates whether to build the GUI components
|
# Indicates whether to build the GUI components
|
||||||
BUILD_GUI ?= 1
|
BUILD_GUI_HELPER ?= 1
|
||||||
|
|
||||||
export DEBEMAIL = [email protected]
|
export DEBEMAIL = [email protected]
|
||||||
export DEBFULLNAME = Kevin Yue
|
export DEBFULLNAME = Kevin Yue
|
||||||
export SNAPSHOT = $(shell test -f SNAPSHOT && echo "true" || echo "false")
|
export SNAPSHOT = $(shell test -f SNAPSHOT && echo "true" || echo "false")
|
||||||
|
export OFFLINE_BUILD = $(shell test -f OFFLINE_BUILD && echo "1" || echo "0")
|
||||||
|
# If OFFLINE is not set, use OFFLINE_BUILD
|
||||||
|
ifndef OFFLINE
|
||||||
|
OFFLINE = $(OFFLINE_BUILD)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(SNAPSHOT), true)
|
ifeq ($(SNAPSHOT), true)
|
||||||
RELEASE_TAG = snapshot
|
RELEASE_TAG = snapshot
|
||||||
@@ -48,21 +51,15 @@ clean-tarball:
|
|||||||
|
|
||||||
# Create a tarball, include the cargo dependencies if OFFLINE is set to 1
|
# Create a tarball, include the cargo dependencies if OFFLINE is set to 1
|
||||||
tarball: clean-tarball
|
tarball: clean-tarball
|
||||||
if [ $(BUILD_GUI) -eq 1 ] && [ $(BUILD_FE) -eq 1 ]; then \
|
|
||||||
echo "Building frontend..."; \
|
|
||||||
cd apps/gpgui-helper && pnpm install && pnpm build; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove node_modules to reduce the tarball size
|
|
||||||
rm -rf apps/gpgui-helper/node_modules
|
|
||||||
|
|
||||||
mkdir -p .cargo
|
mkdir -p .cargo
|
||||||
mkdir -p .build/tarball
|
mkdir -p .build/tarball
|
||||||
|
|
||||||
# If OFFLINE is set to 1, vendor all cargo dependencies
|
# If OFFLINE is set to 1, vendor all cargo dependencies
|
||||||
|
# Generate a OFFLINE_BUILD file to indicate offline build
|
||||||
if [ $(OFFLINE) -eq 1 ]; then \
|
if [ $(OFFLINE) -eq 1 ]; then \
|
||||||
$(CARGO) vendor .vendor > .cargo/config.toml; \
|
$(CARGO) vendor .vendor > .cargo/config.toml; \
|
||||||
tar -cJf vendor.tar.xz .vendor; \
|
tar -cJf vendor.tar.xz .vendor; \
|
||||||
|
touch OFFLINE_BUILD; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@echo "Creating tarball..."
|
@echo "Creating tarball..."
|
||||||
@@ -81,21 +78,7 @@ download-gui:
|
|||||||
echo "Skipping GlobalProtect GUI download (INCLUDE_GUI=0)"; \
|
echo "Skipping GlobalProtect GUI download (INCLUDE_GUI=0)"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build: download-gui build-fe build-rs
|
build: download-gui build-rs
|
||||||
|
|
||||||
# Install and build the frontend
|
|
||||||
# If OFFLINE is set to 1, skip it
|
|
||||||
build-fe:
|
|
||||||
if [ $(BUILD_GUI) -eq 0 ] || [ $(OFFLINE) -eq 1 ] || [ $(BUILD_FE) -eq 0 ]; then \
|
|
||||||
echo "Skipping frontend build (BUILD_GUI=0 or OFFLINE=1 or BUILD_FE=0)"; \
|
|
||||||
else \
|
|
||||||
cd apps/gpgui-helper && pnpm install && pnpm build; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $(BUILD_GUI) -eq 1 ] && [ ! -d apps/gpgui-helper/dist ]; then \
|
|
||||||
echo "Error: frontend build failed"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
build-rs:
|
build-rs:
|
||||||
if [ $(OFFLINE) -eq 1 ]; then \
|
if [ $(OFFLINE) -eq 1 ]; then \
|
||||||
@@ -107,8 +90,8 @@ build-rs:
|
|||||||
rm -vf rust-toolchain.toml; \
|
rm -vf rust-toolchain.toml; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only build the GUI components if BUILD_GUI is set to 1
|
# Only build the GUI components if BUILD_GUI_HELPER is set to 1
|
||||||
if [ $(BUILD_GUI) -eq 1 ]; then \
|
if [ $(BUILD_GUI_HELPER) -eq 1 ]; then \
|
||||||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth -p gpgui-helper; \
|
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth -p gpgui-helper; \
|
||||||
else \
|
else \
|
||||||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth; \
|
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth; \
|
||||||
@@ -127,8 +110,8 @@ install:
|
|||||||
install -Dm755 target/release/gpauth $(DESTDIR)/usr/bin/gpauth
|
install -Dm755 target/release/gpauth $(DESTDIR)/usr/bin/gpauth
|
||||||
install -Dm755 target/release/gpservice $(DESTDIR)/usr/bin/gpservice
|
install -Dm755 target/release/gpservice $(DESTDIR)/usr/bin/gpservice
|
||||||
|
|
||||||
# Install the GUI components if BUILD_GUI is set to 1
|
# Install the GUI components if BUILD_GUI_HELPER is set to 1
|
||||||
if [ $(BUILD_GUI) -eq 1 ]; then \
|
if [ $(BUILD_GUI_HELPER) -eq 1 ]; then \
|
||||||
install -Dm755 target/release/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper; \
|
install -Dm755 target/release/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -187,11 +170,10 @@ init-debian: clean-debian tarball
|
|||||||
cp -f packaging/deb/postrm .build/deb/$(PKG)/debian/postrm
|
cp -f packaging/deb/postrm .build/deb/$(PKG)/debian/postrm
|
||||||
cp -f packaging/deb/compat .build/deb/$(PKG)/debian/compat
|
cp -f packaging/deb/compat .build/deb/$(PKG)/debian/compat
|
||||||
|
|
||||||
sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/deb/$(PKG)/debian/rules
|
sed -i "s/@BUILD_GUI_HELPER@/$(BUILD_GUI_HELPER)/g" .build/deb/$(PKG)/debian/rules
|
||||||
sed -i "s/@BUILD_GUI@/$(BUILD_GUI)/g" .build/deb/$(PKG)/debian/rules
|
|
||||||
|
|
||||||
# Remove the GUI dependencies if BUILD_GUI is set to 0
|
# Remove the GUI dependencies if BUILD_GUI_HELPER is set to 0
|
||||||
if [ $(BUILD_GUI) -eq 0 ]; then \
|
if [ $(BUILD_GUI_HELPER) -eq 0 ]; then \
|
||||||
sed -i "/libsecret-1-0/d" .build/deb/$(PKG)/debian/control; \
|
sed -i "/libsecret-1-0/d" .build/deb/$(PKG)/debian/control; \
|
||||||
sed -i "/libayatana-appindicator3-1/d" .build/deb/$(PKG)/debian/control; \
|
sed -i "/libayatana-appindicator3-1/d" .build/deb/$(PKG)/debian/control; \
|
||||||
sed -i "/gnome-keyring/d" .build/deb/$(PKG)/debian/control; \
|
sed -i "/gnome-keyring/d" .build/deb/$(PKG)/debian/control; \
|
||||||
@@ -242,7 +224,6 @@ init-rpm: clean-rpm
|
|||||||
sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.spec
|
sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.spec
|
||||||
sed -i "s/@REVISION@/$(REVISION)/g" .build/rpm/globalprotect-openconnect.spec
|
sed -i "s/@REVISION@/$(REVISION)/g" .build/rpm/globalprotect-openconnect.spec
|
||||||
sed -i "s|@SOURCE@|$(RPM_SOURCE)|g" .build/rpm/globalprotect-openconnect.spec
|
sed -i "s|@SOURCE@|$(RPM_SOURCE)|g" .build/rpm/globalprotect-openconnect.spec
|
||||||
sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/rpm/globalprotect-openconnect.spec
|
|
||||||
sed -i "s/@DATE@/$(shell LC_ALL=en.US date "+%a %b %d %Y")/g" .build/rpm/globalprotect-openconnect.spec
|
sed -i "s/@DATE@/$(shell LC_ALL=en.US date "+%a %b %d %Y")/g" .build/rpm/globalprotect-openconnect.spec
|
||||||
|
|
||||||
sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.changes
|
sed -i "s/@VERSION@/$(VERSION)/g" .build/rpm/globalprotect-openconnect.changes
|
||||||
@@ -275,7 +256,6 @@ init-pkgbuild: clean-pkgbuild tarball
|
|||||||
sed -i "s/@PKG_NAME@/$(PKG_NAME)/g" .build/pkgbuild/PKGBUILD
|
sed -i "s/@PKG_NAME@/$(PKG_NAME)/g" .build/pkgbuild/PKGBUILD
|
||||||
sed -i "s/@VERSION@/$(VERSION)/g" .build/pkgbuild/PKGBUILD
|
sed -i "s/@VERSION@/$(VERSION)/g" .build/pkgbuild/PKGBUILD
|
||||||
sed -i "s/@REVISION@/$(REVISION)/g" .build/pkgbuild/PKGBUILD
|
sed -i "s/@REVISION@/$(REVISION)/g" .build/pkgbuild/PKGBUILD
|
||||||
sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/pkgbuild/PKGBUILD
|
|
||||||
|
|
||||||
pkgbuild: init-pkgbuild
|
pkgbuild: init-pkgbuild
|
||||||
cd .build/pkgbuild && makepkg -s --noconfirm
|
cd .build/pkgbuild && makepkg -s --noconfirm
|
||||||
@@ -291,7 +271,7 @@ binary: clean-binary tarball
|
|||||||
|
|
||||||
mkdir -p .build/binary/$(PKG_NAME)_$(VERSION)/artifacts
|
mkdir -p .build/binary/$(PKG_NAME)_$(VERSION)/artifacts
|
||||||
|
|
||||||
make -C .build/binary/${PKG} build OFFLINE=$(OFFLINE) BUILD_FE=0 INCLUDE_GUI=$(INCLUDE_GUI)
|
make -C .build/binary/${PKG} build INCLUDE_GUI=$(INCLUDE_GUI)
|
||||||
make -C .build/binary/${PKG} install DESTDIR=$(PWD)/.build/binary/$(PKG_NAME)_$(VERSION)/artifacts
|
make -C .build/binary/${PKG} install DESTDIR=$(PWD)/.build/binary/$(PKG_NAME)_$(VERSION)/artifacts
|
||||||
|
|
||||||
cp packaging/binary/Makefile.in .build/binary/$(PKG_NAME)_$(VERSION)/Makefile
|
cp packaging/binary/Makefile.in .build/binary/$(PKG_NAME)_$(VERSION)/Makefile
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ This project includes a DevContainer configuration that provides a consistent, r
|
|||||||
- [Tauri dependencies](https://tauri.app/start/prerequisites/)
|
- [Tauri dependencies](https://tauri.app/start/prerequisites/)
|
||||||
- `libopenconnect-dev` (or `openconnect-devel` on RPM-based systems)
|
- `libopenconnect-dev` (or `openconnect-devel` on RPM-based systems)
|
||||||
- `pkexec` and `gnome-keyring` (or `pam_kwallet` on KDE)
|
- `pkexec` and `gnome-keyring` (or `pam_kwallet` on KDE)
|
||||||
- `nodejs` and `pnpm` (optional if using pre-built release tarballs with `BUILD_FE=0`)
|
- `nodejs` and `pnpm` (optional)
|
||||||
|
|
||||||
#### Build Steps
|
#### Build Steps
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ This project includes a DevContainer configuration that provides a consistent, r
|
|||||||
```bash
|
```bash
|
||||||
tar -xzf globalprotect-openconnect-${version}.tar.gz
|
tar -xzf globalprotect-openconnect-${version}.tar.gz
|
||||||
cd globalprotect-openconnect-${version}
|
cd globalprotect-openconnect-${version}
|
||||||
make build BUILD_FE=0
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Install:**
|
3. **Install:**
|
||||||
@@ -351,8 +351,7 @@ Verify the CLI client is working correctly:
|
|||||||
|
|
||||||
### Build Options
|
### Build Options
|
||||||
|
|
||||||
- `BUILD_GUI=0` – Build CLI components only (excludes GUI)
|
- `BUILD_GUI_HELPER=0` – Build CLI components only (excludes GUI)
|
||||||
- `BUILD_FE=0` – Skip frontend build (uses pre-built assets)
|
|
||||||
- `OFFLINE=1` – Build in offline mode using vendored dependencies
|
- `OFFLINE=1` – Build in offline mode using vendored dependencies
|
||||||
|
|
||||||
## Frequently Asked Questions
|
## Frequently Asked Questions
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
export OFFLINE = @OFFLINE@
|
export BUILD_GUI_HELPER = @BUILD_GUI_HELPER@
|
||||||
export BUILD_FE = 0
|
|
||||||
export BUILD_GUI = @BUILD_GUI@
|
|
||||||
export DISABLE_RUST_TOOLCHAIN = 0
|
export DISABLE_RUST_TOOLCHAIN = 0
|
||||||
|
|
||||||
export PATH := /usr/lib/rust-1.85/bin:$(PATH)
|
export PATH := /usr/lib/rust-1.85/bin:$(PATH)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ build() {
|
|||||||
# Must unset the CFLAGS, otherwise the build fails
|
# Must unset the CFLAGS, otherwise the build fails
|
||||||
unset CFLAGS
|
unset CFLAGS
|
||||||
|
|
||||||
make build OFFLINE=@OFFLINE@ BUILD_FE=0
|
make build
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ rm -f %{_bindir}/gpgui
|
|||||||
%build
|
%build
|
||||||
# The injected RUSTFLAGS could fail the build
|
# The injected RUSTFLAGS could fail the build
|
||||||
unset RUSTFLAGS
|
unset RUSTFLAGS
|
||||||
make build OFFLINE=@OFFLINE@ BUILD_FE=0
|
make build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install
|
%make_install
|
||||||
|
|||||||
Reference in new issue
Block a user