mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-29 22:26:26 -04:00
Update build
This commit is contained in:
parent
3daad748ae
commit
e8a64539aa
11
.github/workflows/build.yaml
vendored
11
.github/workflows/build.yaml
vendored
@ -34,7 +34,8 @@ jobs:
|
||||
with:
|
||||
name: artifact-tarball
|
||||
path: |
|
||||
globalprotect-openconnect-*.tar.gz
|
||||
gp/.build/tarball/*.tar.gz
|
||||
|
||||
deb:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [tarball]
|
||||
@ -50,12 +51,13 @@ jobs:
|
||||
name: artifact-tarball
|
||||
- name: Build DEB package
|
||||
run: |
|
||||
tar -xzf globalprotect-openconnect-*.tar.gz
|
||||
tar -xzf *.tar.gz
|
||||
cd globalprotect-openconnect-*
|
||||
make deb
|
||||
- name: Install DEB package
|
||||
run: |
|
||||
sudo dpkg -i globalprotect-openconnect_*.deb
|
||||
cd globalprotect-openconnect-*/
|
||||
sudo dpkg -i .build/deb/*.deb
|
||||
|
||||
gpclient --version
|
||||
gpservice --version
|
||||
@ -66,7 +68,7 @@ jobs:
|
||||
with:
|
||||
name: artifact-deb
|
||||
path: |
|
||||
globalprotect-openconnect_*.deb
|
||||
globalprotect-openconnect-*/.build/deb/*.deb
|
||||
|
||||
rpm:
|
||||
runs-on: ubuntu-latest
|
||||
@ -104,6 +106,7 @@ jobs:
|
||||
path: |
|
||||
globalprotect-openconnect-*/.build/rpm/*.rpm
|
||||
|
||||
|
||||
# Include arm64 if ref is a tag
|
||||
# setup-matrix:
|
||||
# runs-on: ubuntu-latest
|
||||
|
137
Makefile
137
Makefile
@ -7,6 +7,7 @@ PPA_REVISION ?= 1
|
||||
PKG_NAME = globalprotect-openconnect
|
||||
PKG = $(PKG_NAME)-$(VERSION)
|
||||
SERIES ?= $(shell lsb_release -cs)
|
||||
PUBLISH ?= 0
|
||||
|
||||
export DEBEMAIL = k3vinyue@gmail.com
|
||||
export DEBFULLNAME = Kevin Yue
|
||||
@ -22,21 +23,27 @@ default: build
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
|
||||
# Generate a vendor tarball and a .cargo/config.toml file
|
||||
cargo-vendor:
|
||||
mkdir -p .cargo
|
||||
clean-tarball:
|
||||
rm -rf .build/tarball
|
||||
rm -rf .vendor
|
||||
rm -rf vendor.tar.xz
|
||||
rm -rf .cargo
|
||||
|
||||
$(CARGO) vendor .vendor > .cargo/config.toml
|
||||
tar -cJf vendor.tar.xz .vendor
|
||||
|
||||
tarball: clean clean-tarball build-fe cargo-vendor
|
||||
# Create a tarball, include the cargo dependencies if OFFLINE is set to 1
|
||||
tarball: clean-tarball build-fe
|
||||
# Remove node_modules to reduce the tarball size
|
||||
rm -rf apps/gpgui-helper/node_modules
|
||||
|
||||
tar --transform 's,^,${PKG}/,' -czf ../${PKG}.tar.gz * .cargo
|
||||
mkdir -p .cargo
|
||||
mkdir -p .build/tarball
|
||||
|
||||
# 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
|
||||
# If OFFLINE is set to 1, vendor all cargo dependencies
|
||||
if [ $(OFFLINE) -eq 1 ]; then \
|
||||
$(CARGO) vendor .vendor > .cargo/config.toml; \
|
||||
tar -cJf vendor.tar.xz .vendor; \
|
||||
fi
|
||||
|
||||
tar --exclude .vendor --exclude target --transform 's,^,${PKG}/,' -czf .build/tarball/${PKG}.tar.gz * .cargo
|
||||
|
||||
build: build-fe build-rs
|
||||
|
||||
@ -52,9 +59,13 @@ build-fe:
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
build-rs: extract-vendor
|
||||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpauth
|
||||
# $(CARGO) build $(CARGO_BUILD_ARGS) -p gpgui-helper --features "tauri/custom-protocol"
|
||||
build-rs:
|
||||
if [ $(OFFLINE) -eq 1 ]; then \
|
||||
tar -xJf vendor.tar.xz; \
|
||||
fi
|
||||
|
||||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpclient -p gpservice -p gpauth
|
||||
$(CARGO) build $(CARGO_BUILD_ARGS) -p gpgui-helper --features "tauri/custom-protocol"
|
||||
|
||||
clean:
|
||||
$(CARGO) clean
|
||||
@ -62,11 +73,9 @@ clean:
|
||||
rm -rf .vendor
|
||||
rm -rf apps/gpgui-helper/node_modules
|
||||
|
||||
clean-tarball:
|
||||
rm -rf vendor.tar.xz
|
||||
rm -rf ../$(PKG).tar.gz
|
||||
|
||||
install:
|
||||
@echo "Installing $(PKG_NAME) $(VERSION)"
|
||||
|
||||
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
|
||||
@ -80,10 +89,13 @@ install:
|
||||
install -Dm644 packaging/files/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
uninstall:
|
||||
@echo "Uninstalling $(PKG_NAME) $(VERSION)"
|
||||
|
||||
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/bin/gpgui
|
||||
|
||||
rm -f $(DESTDIR)/usr/share/applications/gpgui.desktop
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
|
||||
@ -92,25 +104,45 @@ uninstall:
|
||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
init-debian:
|
||||
rm -rf .vendor
|
||||
rm -rf debian
|
||||
clean-debian:
|
||||
rm -rf .build/deb
|
||||
|
||||
# Generate the debian package structure, without the changelog
|
||||
init-debian: clean-debian tarball
|
||||
mkdir -p .build/deb
|
||||
cp .build/tarball/${PKG}.tar.gz .build/deb
|
||||
|
||||
tar -xzf .build/deb/${PKG}.tar.gz
|
||||
cd .build/deb/${PKG}
|
||||
|
||||
debmake
|
||||
|
||||
cp -f packaging/deb/control.in debian/control
|
||||
cp -f packaging/deb/rules debian/rules
|
||||
|
||||
sed -i "s/@OFFLINE@/$(OFFLINE)/g" debian/rules
|
||||
|
||||
rm -f debian/changelog
|
||||
|
||||
deb: init-debian
|
||||
cd .build/deb/${PKG}
|
||||
|
||||
# Remove the rust build depdency from the control file
|
||||
sed -i "s/@RUST@//g" debian/control
|
||||
|
||||
dch --create --distribution unstable --package $(PKG_NAME) --newversion $(VERSION)-$(REVISION) "Bugfix and improvements."
|
||||
|
||||
debuild --preserve-env -e PATH -us -uc -b
|
||||
|
||||
# Usage: make ppa SERIES=focal
|
||||
ppa: init-debian
|
||||
check-ppa:
|
||||
if [ $(OFFLINE) -eq 0 ]; then \
|
||||
@echo "Error: ppa build requires offline mode (OFFLINE=1)"; \
|
||||
fi
|
||||
|
||||
# Usage: make ppa SERIES=focal OFFLINE=1 PUBLISH=1
|
||||
ppa: check-ppa init-debian
|
||||
cd .build/deb/${PKG}
|
||||
|
||||
sed -i "s/@RUST@/rust-all(>=1.70)/g" debian/control
|
||||
|
||||
$(eval SERIES_VER = $(shell distro-info --series $(SERIES) -r | cut -d' ' -f1))
|
||||
@ -120,12 +152,17 @@ ppa: init-debian
|
||||
|
||||
echo "y" | debuild -e PATH -S -sa -k"$(GPG_KEY_ID)" -p"gpg --batch --passphrase $(GPG_KEY_PASS) --pinentry-mode loopback"
|
||||
|
||||
publish-ppa: ppa
|
||||
dput ppa:yuezk/globalprotect-openconnect ../*.changes
|
||||
if [ $(PUBLISH) -eq 1 ]; then \
|
||||
dput ppa:yuezk/globalprotect-openconnect ../*.changes; \
|
||||
else
|
||||
@echo "Skipping ppa publish (PUBLISH=0)"
|
||||
fi
|
||||
|
||||
clean-rpm:
|
||||
rm -rf .build/rpm
|
||||
|
||||
# Generate RPM sepc file
|
||||
init-rpm:
|
||||
rm -rf .build/rpm
|
||||
init-rpm: clean-rpm
|
||||
mkdir -p .build/rpm
|
||||
|
||||
cp packaging/rpm/globalprotect-openconnect.spec.in .build/rpm/globalprotect-openconnect.spec
|
||||
@ -133,26 +170,20 @@ init-rpm:
|
||||
|
||||
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/@OFFLINE@/$(OFFLINE)/g" .build/rpm/globalprotect-openconnect.spec
|
||||
sed -i "s/@DATE@/$(shell 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/@DATE@/$(shell LC_ALL=en.US date -u "+%a %b %e %T %Z %Y")/g" .build/rpm/globalprotect-openconnect.changes
|
||||
|
||||
# Ensure ../globalprotect-openconnect-*.tar.gz exists.
|
||||
rpm: init-rpm
|
||||
if [ ! -f ../$(PKG).tar.gz ]; then \
|
||||
echo "Missing ../$(PKG).tar.gz"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
rpm: init-rpm tarball
|
||||
rm -rf $(HOME)/rpmbuild
|
||||
rpmdev-setuptree
|
||||
|
||||
cp ../$(PKG).tar.gz $(HOME)/rpmbuild/SOURCES/$(PKG_NAME).tar.gz
|
||||
|
||||
cp .build/tarball/${PKG}.tar.gz $(HOME)/rpmbuild/SOURCES
|
||||
rpmbuild -ba .build/rpm/globalprotect-openconnect.spec
|
||||
|
||||
# Copy RPM package
|
||||
# Copy RPM package from build directory
|
||||
cp $(HOME)/rpmbuild/RPMS/$(shell uname -m)/$(PKG_NAME)*.rpm .build/rpm
|
||||
|
||||
# Copy the SRPM only for x86_64.
|
||||
@ -160,20 +191,38 @@ rpm: init-rpm
|
||||
cp $(HOME)/rpmbuild/SRPMS/$(PKG_NAME)*.rpm .build/rpm; \
|
||||
fi
|
||||
|
||||
init-pkgbuild:
|
||||
clean-pkgbuild:
|
||||
rm -rf .build/pkgbuild
|
||||
|
||||
init-pkgbuild: clean-pkgbuild tarball
|
||||
mkdir -p .build/pkgbuild
|
||||
|
||||
if [ ! -f ../$(PKG).tar.gz ]; then \
|
||||
echo "Missing ../$(PKG).tar.gz"; \
|
||||
exit 1; \
|
||||
fi
|
||||
cp ../$(PKG).tar.gz .build/pkgbuild
|
||||
|
||||
cp .build/tarball/${PKG}.tar.gz .build/pkgbuild
|
||||
cp packaging/pkgbuild/PKGBUILD.in .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/@REVISION@/$(REVISION)/g" .build/pkgbuild/PKGBUILD
|
||||
sed -i "s/@OFFLINE@/$(OFFLINE)/g" .build/pkgbuild/PKGBUILD
|
||||
|
||||
pkgbuild: init-pkgbuild
|
||||
cd .build/pkgbuild && makepkg -s --noconfirm
|
||||
|
||||
clean-binary:
|
||||
rm -rf .build/binary
|
||||
|
||||
binary: clean-binary tarball
|
||||
mkdir -p .build/binary
|
||||
|
||||
cp .build/tarball/${PKG}.tar.gz .build/binary
|
||||
tar -xzf .build/binary/${PKG}.tar.gz -C .build/binary
|
||||
|
||||
mkdir -p .build/binary/$(PKG_NAME)_$(VERSION)_$(shell uname -m)/artifacts
|
||||
|
||||
make -C .build/binary/${PKG} build OFFLINE=$(OFFLINE)
|
||||
make -C .build/binary/${PKG} install DESTDIR=$(PWD)/.build/binary/$(PKG_NAME)_$(VERSION)_$(shell uname -m)/artifacts
|
||||
|
||||
cp packaging/binary/Makefile.in .build/binary/$(PKG_NAME)_$(VERSION)_$(shell uname -m)/Makefile
|
||||
|
||||
# Create a tarball for the binary package
|
||||
tar -czf .build/binary/$(PKG_NAME)_$(VERSION)_$(shell uname -m).bin.tar.gz -C .build/binary $(PKG_NAME)_$(VERSION)_$(shell uname -m)
|
||||
|
30
packaging/binary/Makefile.in
Normal file
30
packaging/binary/Makefile.in
Normal file
@ -0,0 +1,30 @@
|
||||
install:
|
||||
@echo "===> Installing..."
|
||||
|
||||
install -Dm755 artifacts/usr/bin/gpclient $(DESTDIR)/usr/bin/gpclient
|
||||
install -Dm755 artifacts/usr/bin/gpservice $(DESTDIR)/usr/bin/gpservice
|
||||
install -Dm755 artifacts/usr/bin/gpauth $(DESTDIR)/usr/bin/gpauth
|
||||
install -Dm755 artifacts/usr/bin/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
|
||||
|
||||
install -Dm644 artifacts/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/128x128/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/128x128/apps/gpgui.png
|
||||
install -Dm644 artifacts/usr/share/icons/hicolor/256x256@2/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/256x256@2/apps/gpgui.png
|
||||
install -Dm644 artifacts/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||
|
||||
uninstall:
|
||||
@echo "===> Uninstalling from $(DESTDIR)..."
|
||||
|
||||
rm -f $(DESTDIR)/usr/bin/gpclient
|
||||
rm -f $(DESTDIR)/usr/bin/gpservice
|
||||
rm -f $(DESTDIR)/usr/bin/gpauth
|
||||
rm -f $(DESTDIR)/usr/bin/gpgui-helper
|
||||
rm -f $(DESTDIR)/usr/bin/gpgui
|
||||
|
||||
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
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export OFFLINE = 1
|
||||
export OFFLINE = @OFFLINE@
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
@ -21,10 +21,15 @@ options=('!strip')
|
||||
|
||||
build() {
|
||||
cd "$pkgname-$pkgver"
|
||||
make build OFFLINE=1
|
||||
|
||||
# Must unset the CFLAGS, otherwise the build fails
|
||||
unset CFLAGS
|
||||
|
||||
make build OFFLINE=@OFFLINE@
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "$pkgname-$pkgver"
|
||||
|
||||
make install DESTDIR="$pkgdir"
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ A GUI for GlobalProtect VPN, based on OpenConnect, supports the SSO authenticati
|
||||
%setup
|
||||
|
||||
%build
|
||||
make build OFFLINE=1
|
||||
make build OFFLINE=@OFFLINE@
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
Loading…
x
Reference in New Issue
Block a user