mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-30 14:46:27 -04:00
Improve the build script
This commit is contained in:
parent
de0885a7b8
commit
2dde9cff42
128
.github/workflows/build.yaml
vendored
128
.github/workflows/build.yaml
vendored
@ -55,7 +55,7 @@ jobs:
|
|||||||
path: |
|
path: |
|
||||||
source/gp/.build/tarball/*.tar.gz
|
source/gp/.build/tarball/*.tar.gz
|
||||||
|
|
||||||
build-deb:
|
build-gp:
|
||||||
needs:
|
needs:
|
||||||
- setup-matrix
|
- setup-matrix
|
||||||
- tarball
|
- tarball
|
||||||
@ -65,130 +65,17 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Prepare workspace
|
- name: Prepare workspace
|
||||||
run: rm -rf build-deb && mkdir build-deb
|
run: rm -rf build-gp && mkdir build-gp
|
||||||
- name: Download tarball
|
- name: Download tarball
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: artifact-source
|
name: artifact-source
|
||||||
path: build-deb
|
path: build-gp
|
||||||
- name: Docker Login
|
- name: Docker Login
|
||||||
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
||||||
- name: Build DEB package in Docker
|
- name: Build gp in Docker
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -v $(pwd)/build-deb:/deb yuezk/gpdev:deb-builder
|
docker run --rm -v $(pwd)/build-gp:/gp yuezk/gpdev:gp-builder
|
||||||
- name: Install DEB package in Docker
|
|
||||||
run: |
|
|
||||||
docker run --rm -v $(pwd)/build-deb:/deb yuezk/gpdev:deb-builder \
|
|
||||||
bash -c "sudo dpkg -i /deb/*.deb; gpclient --version; gpservice --version; gpauth --version; gpgui-helper --version;"
|
|
||||||
- name: Upload DEB package
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-deb-${{ matrix.os }}
|
|
||||||
if-no-files-found: error
|
|
||||||
path: |
|
|
||||||
build-deb/*.deb
|
|
||||||
|
|
||||||
build-rpm:
|
|
||||||
needs:
|
|
||||||
- setup-matrix
|
|
||||||
- tarball
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Prepare workspace
|
|
||||||
run: rm -rf build-rpm && mkdir build-rpm
|
|
||||||
- name: Download tarball
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-source
|
|
||||||
path: build-rpm
|
|
||||||
- name: Docker Login
|
|
||||||
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
|
||||||
- name: Build RPM package in Docker
|
|
||||||
run: |
|
|
||||||
docker run --rm -v $(pwd)/build-rpm:/rpm yuezk/gpdev:rpm-builder
|
|
||||||
- name: Install RPM package in Docker
|
|
||||||
run: |
|
|
||||||
docker run --rm -v $(pwd)/build-rpm:/rpm yuezk/gpdev:rpm-builder \
|
|
||||||
bash -c "sudo rpm -i /rpm/*.$(uname -m).rpm; gpclient --version; gpservice --version; gpauth --version; gpgui-helper --version;"
|
|
||||||
- name: Upload RPM package
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-rpm-${{ matrix.os }}
|
|
||||||
if-no-files-found: error
|
|
||||||
path: |
|
|
||||||
build-rpm/*.rpm
|
|
||||||
|
|
||||||
build-pkgbuild:
|
|
||||||
needs:
|
|
||||||
- setup-matrix
|
|
||||||
- tarball
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Prepare workspace
|
|
||||||
run: rm -rf build-pkgbuild && mkdir build-pkgbuild
|
|
||||||
- name: Download tarball
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-source
|
|
||||||
path: build-pkgbuild
|
|
||||||
- name: Docker Login
|
|
||||||
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
|
||||||
- name: Build PKGBUILD package in Docker
|
|
||||||
run: |
|
|
||||||
docker run --rm -v $(pwd)/build-pkgbuild:/pkgbuild yuezk/gpdev:pkgbuild
|
|
||||||
- name: Install PKGBUILD package in Docker
|
|
||||||
run: |
|
|
||||||
docker run --rm -v $(pwd)/build-pkgbuild:/pkgbuild yuezk/gpdev:pkgbuild \
|
|
||||||
bash -c "sudo pacman -U --noconfirm /pkgbuild/*.pkg.tar.zst; gpclient --version; gpservice --version; gpauth --version; gpgui-helper --version;"
|
|
||||||
- name: Upload PKGBUILD package
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-pkgbuild-${{ matrix.os }}
|
|
||||||
if-no-files-found: error
|
|
||||||
path: |
|
|
||||||
build-pkgbuild/*.pkg.tar.zst
|
|
||||||
|
|
||||||
build-binary:
|
|
||||||
needs:
|
|
||||||
- setup-matrix
|
|
||||||
- tarball
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: ${{fromJson(needs.setup-matrix.outputs.matrix)}}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Prepare workspace
|
|
||||||
run: rm -rf build-binary && mkdir build-binary
|
|
||||||
- name: Download tarball
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-source
|
|
||||||
path: build-binary
|
|
||||||
- name: Docker Login
|
|
||||||
run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
|
||||||
- name: Build binary in Docker
|
|
||||||
run: |
|
|
||||||
docker run --rm -v $(pwd)/build-binary:/binary yuezk/gpdev:binary-builder
|
|
||||||
- name: Install binary in Docker
|
|
||||||
run: |
|
|
||||||
cd build-binary
|
|
||||||
tar -xJf ./*.bin.tar.xz
|
|
||||||
docker run --rm -v $(pwd):/binary yuezk/gpdev:binary-builder \
|
|
||||||
bash -c "cd /binary/globalprotect-openconnect*/ && sudo make install && gpclient --version && gpservice --version && gpauth --version && gpgui-helper --version;"
|
|
||||||
- name: Upload binary
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-binary-${{ matrix.os }}
|
|
||||||
if-no-files-found: error
|
|
||||||
path: |
|
|
||||||
build-binary/*.bin.tar.xz
|
|
||||||
build-binary/*.bin.tar.xz.sha256
|
|
||||||
|
|
||||||
build-gpgui:
|
build-gpgui:
|
||||||
needs:
|
needs:
|
||||||
@ -243,10 +130,7 @@ jobs:
|
|||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- build-deb
|
- build-gp
|
||||||
- build-rpm
|
|
||||||
- build-pkgbuild
|
|
||||||
- build-binary
|
|
||||||
- build-gpgui
|
- build-gpgui
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
23
Makefile
23
Makefile
@ -1,5 +1,6 @@
|
|||||||
OFFLINE ?= 0
|
OFFLINE ?= 0
|
||||||
BUILD_FE ?= 1
|
BUILD_FE ?= 1
|
||||||
|
INCLUDE_GUI ?= 0
|
||||||
CARGO ?= cargo
|
CARGO ?= cargo
|
||||||
|
|
||||||
VERSION = $(shell $(CARGO) metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
|
VERSION = $(shell $(CARGO) metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
|
||||||
@ -50,7 +51,19 @@ tarball: clean-tarball
|
|||||||
|
|
||||||
tar --exclude .vendor --exclude target --transform 's,^,${PKG}/,' -czf .build/tarball/${PKG}.tar.gz * .cargo
|
tar --exclude .vendor --exclude target --transform 's,^,${PKG}/,' -czf .build/tarball/${PKG}.tar.gz * .cargo
|
||||||
|
|
||||||
build: build-fe build-rs
|
download-gui:
|
||||||
|
rm -rf .build/gpgui
|
||||||
|
|
||||||
|
if [ $(INCLUDE_GUI) -eq 1 ]; then \
|
||||||
|
echo "Downloading GlobalProtect GUI..."; \
|
||||||
|
mkdir -p .build/gpgui; \
|
||||||
|
curl -sSL https://github.com/yuezk/GlobalProtect-openconnect/releases/download/v$(VERSION)/gpgui_$(VERSION)_$(shell uname -m).bin.tar.xz -o .build/gpgui/gpgui_$(VERSION)_x$(shell uname -m).bin.tar.xz; \
|
||||||
|
tar -xJf .build/gpgui/*.tar.xz -C .build/gpgui; \
|
||||||
|
else \
|
||||||
|
echo "Skipping GlobalProtect GUI download (INCLUDE_GUI=0)"; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
build: download-gui build-fe build-rs
|
||||||
|
|
||||||
# Install and build the frontend
|
# Install and build the frontend
|
||||||
# If OFFLINE is set to 1, skip it
|
# If OFFLINE is set to 1, skip it
|
||||||
@ -88,6 +101,10 @@ install:
|
|||||||
install -Dm755 target/release/gpservice $(DESTDIR)/usr/bin/gpservice
|
install -Dm755 target/release/gpservice $(DESTDIR)/usr/bin/gpservice
|
||||||
install -Dm755 target/release/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
|
install -Dm755 target/release/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
|
||||||
|
|
||||||
|
if [ -f .build/gpgui/gpgui_*/gpgui ]; then \
|
||||||
|
install -Dm755 .build/gpgui/gpgui_*/gpgui $(DESTDIR)/usr/bin/gpgui; \
|
||||||
|
fi
|
||||||
|
|
||||||
install -Dm644 packaging/files/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop
|
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/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/32x32/apps/gpgui.png $(DESTDIR)/usr/share/icons/hicolor/32x32/apps/gpgui.png
|
||||||
@ -95,6 +112,8 @@ install:
|
|||||||
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/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
|
install -Dm644 packaging/files/usr/share/polkit-1/actions/com.yuezk.gpgui.policy $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||||
|
|
||||||
|
update-desktop-database $(DESTDIR)/usr/share/applications
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
@echo "Uninstalling $(PKG_NAME)..."
|
@echo "Uninstalling $(PKG_NAME)..."
|
||||||
|
|
||||||
@ -111,6 +130,8 @@ uninstall:
|
|||||||
rm -f $(DESTDIR)/usr/share/icons/hicolor/256x256@2/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
|
rm -f $(DESTDIR)/usr/share/polkit-1/actions/com.yuezk.gpgui.policy
|
||||||
|
|
||||||
|
update-desktop-database $(DESTDIR)/usr/share/applications
|
||||||
|
|
||||||
clean-debian:
|
clean-debian:
|
||||||
rm -rf .build/deb
|
rm -rf .build/deb
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ install:
|
|||||||
install -Dm755 artifacts/usr/bin/gpservice $(DESTDIR)/usr/bin/gpservice
|
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/gpauth $(DESTDIR)/usr/bin/gpauth
|
||||||
install -Dm755 artifacts/usr/bin/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
|
install -Dm755 artifacts/usr/bin/gpgui-helper $(DESTDIR)/usr/bin/gpgui-helper
|
||||||
|
install -Dm755 artifacts/usr/bin/gpgui $(DESTDIR)/usr/bin/gpgui
|
||||||
|
|
||||||
install -Dm644 artifacts/usr/share/applications/gpgui.desktop $(DESTDIR)/usr/share/applications/gpgui.desktop
|
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/scalable/apps/gpgui.svg $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/gpgui.svg
|
||||||
|
@ -44,10 +44,7 @@ make build OFFLINE=@OFFLINE@ BUILD_FE=0
|
|||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{_bindir}/gpclient
|
%{_bindir}/*
|
||||||
%{_bindir}/gpservice
|
|
||||||
%{_bindir}/gpauth
|
|
||||||
%{_bindir}/gpgui-helper
|
|
||||||
%{_datadir}/applications/gpgui.desktop
|
%{_datadir}/applications/gpgui.desktop
|
||||||
%{_datadir}/icons/hicolor/32x32/apps/gpgui.png
|
%{_datadir}/icons/hicolor/32x32/apps/gpgui.png
|
||||||
%{_datadir}/icons/hicolor/128x128/apps/gpgui.png
|
%{_datadir}/icons/hicolor/128x128/apps/gpgui.png
|
||||||
|
Loading…
x
Reference in New Issue
Block a user