From 855c04d8f66c0a74b31f9808fc1221fa21ab84d4 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 8 Apr 2026 21:12:51 +0300 Subject: [PATCH] Uodate build environment --- .github/workflows/build-rpm-arm64.yml | 71 +++++++++++++++++++++++++ .github/workflows/build-rpm-armhf.yml | 72 ++++++++++++++++++++++++++ .github/workflows/build-rpm-x86-64.yml | 51 ++++++++++++++++++ .github/workflows/c-cpp-Linux.yml | 4 +- .github/workflows/c-cpp-MacOS.yml | 4 +- .github/workflows/c-cpp-Windows.yml | 4 +- .github/workflows/c-cpp-cmake.yml | 4 +- Makefile.Linux | 1 - scripts/rh/3proxy.spec | 40 ++++---------- src/plugins/PamAuth/Makefile.inc | 4 +- 10 files changed, 215 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/build-rpm-arm64.yml create mode 100644 .github/workflows/build-rpm-armhf.yml create mode 100644 .github/workflows/build-rpm-x86-64.yml diff --git a/.github/workflows/build-rpm-arm64.yml b/.github/workflows/build-rpm-arm64.yml new file mode 100644 index 0000000..2487dcf --- /dev/null +++ b/.github/workflows/build-rpm-arm64.yml @@ -0,0 +1,71 @@ +name: RPM build arm + +on: + push: + branches: [ "master" ] + paths: [ 'RELEASE', '.github/workflows/build-rpm-arm64.yml' ] + +jobs: + ci: + name: "${{ matrix.target }}" + strategy: + matrix: + target: + - ubuntu-latest + runs-on: ${{ matrix.target }} + steps: + - uses: actions/checkout@v4 + - name: env + run: | + pwd + echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV + echo "VERSION=$(date +%y%m%d%H%M%S)" >> $GITHUB_ENV + echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV + echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV + echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV + - name: Linux libraries + run: | + sudo apt update + sudo dpkg --add-architecture arm64 + echo "Types: deb" > ~/ubuntu.sources + echo "URIs: http://archive.ubuntu.com/ubuntu/" >> ~/ubuntu.sources + echo "Suites: noble noble-updates noble-backports" >> ~/ubuntu.sources + echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources + echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources + echo "Architectures: amd64" >> ~/ubuntu.sources + echo "" >> ~/ubuntu.sources + echo "Types: deb" >> ~/ubuntu.sources + echo "URIs: http://security.ubuntu.com/ubuntu/" >> ~/ubuntu.sources + echo "Suites: noble-security" >> ~/ubuntu.sources + echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources + echo "Architectures: amd64" >> ~/ubuntu.sources + echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources + echo "" >> ~/ubuntu.sources + echo "Types: deb" >>~/ubuntu.sources + echo "URIs: http://ports.ubuntu.com/ubuntu-ports/" >>~/ubuntu.sources + echo "Suites: noble noble-updates" >>~/ubuntu.sources + echo "Components: main restricted universe multiverse" >>~/ubuntu.sources + echo "Architectures: arm64" >>~/ubuntu.sources + echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >>~/ubuntu.sources + sudo cp ~/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources + sudo apt update + sudo apt install libssl-dev:arm64 libpam0g:arm64 libpam0g-dev:arm64 libpcre2-dev:arm64 rpm crossbuild-essential-arm64 + - name: make rpmbuild dir + run: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + - name: configure rpm env + run: | + tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . + ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz + cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec + - name: rpmbuild + run: | + ret=`pwd` + cd ~/rpmbuild/SPECS + rpmbuild -ba --define "PAMLIB pam0g" --define "_arch aarch64" --define "cross yes" --target=aarch64-linux-gnueabi 3proxy-$RELEASE.spec + cd $ret + mv ~/rpmbuild/RPMS/aarch64/3proxy-$RELEASE-1.aarch64.rpm 3proxy-$RELEASE.arm64.rpm + - name: Get artifact + uses: actions/upload-artifact@v4 + with: + name: "3proxy-${{ env.RELEASE }}-arm64.rpm" + path: "*.rpm" diff --git a/.github/workflows/build-rpm-armhf.yml b/.github/workflows/build-rpm-armhf.yml new file mode 100644 index 0000000..86b6198 --- /dev/null +++ b/.github/workflows/build-rpm-armhf.yml @@ -0,0 +1,72 @@ +name: RPM build arm + +on: + push: + branches: [ "master" ] + paths: [ 'RELEASE', '.github/workflows/build-rpm-armhf.yml' ] + +jobs: + ci: + name: "${{ matrix.target }}" + strategy: + matrix: + target: + - ubuntu-latest + runs-on: ${{ matrix.target }} + steps: + - uses: actions/checkout@v4 + - name: env + run: | + pwd + echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV + echo "VERSION=$(date +%y%m%d%H%M%S)" >> $GITHUB_ENV + echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV + echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV + echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV + - name: Linux libraries + run: | + sudo apt update + sudo dpkg --add-architecture armhf + echo "Types: deb" > ~/ubuntu.sources + echo "URIs: http://archive.ubuntu.com/ubuntu/" >> ~/ubuntu.sources + echo "Suites: noble noble-updates noble-backports" >> ~/ubuntu.sources + echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources + echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources + echo "Architectures: amd64" >> ~/ubuntu.sources + echo "" >> ~/ubuntu.sources + echo "Types: deb" >> ~/ubuntu.sources + echo "URIs: http://security.ubuntu.com/ubuntu/" >> ~/ubuntu.sources + echo "Suites: noble-security" >> ~/ubuntu.sources + echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources + echo "Architectures: amd64" >> ~/ubuntu.sources + echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources + echo "" >> ~/ubuntu.sources + echo "Types: deb" >>~/ubuntu.sources + echo "URIs: http://ports.ubuntu.com/ubuntu-ports/" >>~/ubuntu.sources + echo "Suites: noble noble-updates" >>~/ubuntu.sources + echo "Components: main restricted universe multiverse" >>~/ubuntu.sources + echo "Architectures: armhf" >>~/ubuntu.sources + echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >>~/ubuntu.sources + sudo cp ~/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources + sudo apt update + sudo apt install libssl-dev:armhf libpam0g:armhf libpam0g-dev:armhf libpcre2-dev:armhf rpm crossbuild-essential-armhf + - name: make rpmbuild dir + run: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + - name: configure rpm env + run: | + tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . + ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz + cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec + - name: rpmbuild + run: | + ret=`pwd` + cd ~/rpmbuild/SPECS + rpmbuild -ba --define "PAMLIB pam0g" --define "_arch arm" --define "cross yes" --target=arm-linux-gnueabi 3proxy-$RELEASE.spec + cd $ret + mv ~/rpmbuild/RPMS/arm/3proxy-$RELEASE-1.arm.rpm 3proxy-$RELEASE.arm.rpm + - name: Get artifact + uses: actions/upload-artifact@v4 + with: + name: "3proxy-${{ env.RELEASE }}-arm.rpm" + path: "*.rpm" + diff --git a/.github/workflows/build-rpm-x86-64.yml b/.github/workflows/build-rpm-x86-64.yml new file mode 100644 index 0000000..ce3570c --- /dev/null +++ b/.github/workflows/build-rpm-x86-64.yml @@ -0,0 +1,51 @@ +name: RPM build x86-64 + +on: + push: + branches: [ "master" ] + paths: [ 'RELEASE', '.github/workflows/build-rpm-x86-64.yml' ] + +jobs: + ci: + name: "${{ matrix.target }}" + strategy: + matrix: + target: + - ubuntu-latest + runs-on: ${{ matrix.target }} + steps: + - uses: actions/checkout@v4 + - name: env + run: | + pwd + echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV + echo "VERSION=$(date +%y%m%d%H%M%S)" >> $GITHUB_ENV + echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV + echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV + echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV + - name: echo env + run: echo "release $RELEASE version $VERSION major $MAJOR submajor $SUBMAJOR minor $MINOR" + - name: Linux libraries + run: | + sudo apt update + sudo apt install libssl-dev libpam-dev libpcre2-dev rpm + - name: make rpmbuild dir + run: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} + - name: configure rpm env + run: | + tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . + ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz + cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec + - name: rpmbuild + run: | + ret=`pwd` + cd ~/rpmbuild/SPECS + rpmbuild -ba 3proxy-$RELEASE.spec + cd $ret + mv ~/rpmbuild/RPMS/x86_64/3proxy-$RELEASE-1.x86_64.rpm 3proxy-$RELEASE.x86_64.rpm + - name: Get artifact + uses: actions/upload-artifact@v4 + with: + name: "3proxy-${{ env.RELEASE }}-x86_64.rpm" + path: "*.rpm" + diff --git a/.github/workflows/c-cpp-Linux.yml b/.github/workflows/c-cpp-Linux.yml index a950e81..868d6ba 100644 --- a/.github/workflows/c-cpp-Linux.yml +++ b/.github/workflows/c-cpp-Linux.yml @@ -3,10 +3,10 @@ name: C/C++ CI Linux on: push: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-Linux.yml' ] + paths: [ '**.c', '**.h', 'Makefile.Linux', '.github/configs', '.github/workflows/c-cpp-Linux.yml' ] pull_request: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-Linux.yml' ] + paths: [ '**.c', '**.h', 'Makefile.Linux', '.github/configs', '.github/workflows/c-cpp-Linux.yml' ] jobs: ci: diff --git a/.github/workflows/c-cpp-MacOS.yml b/.github/workflows/c-cpp-MacOS.yml index b7f026b..4741e41 100644 --- a/.github/workflows/c-cpp-MacOS.yml +++ b/.github/workflows/c-cpp-MacOS.yml @@ -3,10 +3,10 @@ name: C/C++ CI MacOS on: push: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-MacOS.yml' ] + paths: [ '**.c', '**.h', 'Makefile.FreeBSD', '.github/configs', '.github/workflows/c-cpp-MacOS.yml' ] pull_request: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-MacOS.yml' ] + paths: [ '**.c', '**.h', 'Makefile.FreeBSD', '.github/configs', '.github/workflows/c-cpp-MacOS.yml' ] jobs: ci: diff --git a/.github/workflows/c-cpp-Windows.yml b/.github/workflows/c-cpp-Windows.yml index 0cc183a..2c1c6cb 100644 --- a/.github/workflows/c-cpp-Windows.yml +++ b/.github/workflows/c-cpp-Windows.yml @@ -3,10 +3,10 @@ name: C/C++ CI Windows on: push: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-Windows.yml' ] + paths: [ '**.c', '**.h', 'Makefile.msvc', '.github/configs', '.github/workflows/c-cpp-Windows.yml' ] pull_request: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-Windows.yml' ] + paths: [ '**.c', '**.h', 'Makefile.msvc', '.github/configs', '.github/workflows/c-cpp-Windows.yml' ] jobs: ci: diff --git a/.github/workflows/c-cpp-cmake.yml b/.github/workflows/c-cpp-cmake.yml index b3dcd7b..820ddf5 100644 --- a/.github/workflows/c-cpp-cmake.yml +++ b/.github/workflows/c-cpp-cmake.yml @@ -3,10 +3,10 @@ name: C/C++ CI cmake on: push: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-cmake.yml' ] + paths: [ '**.c', '**.h', '**.cmake', 'CMakeLists.txt', '.github/configs', '.github/workflows/c-cpp-cmake.yml' ] pull_request: branches: [ "master" ] - paths: [ '**.c', '**.h', 'Makefile.**', '.github/configs', '.github/workflows/c-cpp-cmake.yml' ] + paths: [ '**.c', '**.h', '**.cmake', 'CMakeLists.txt', '.github/configs', '.github/workflows/c-cpp-cmake.yml' ] jobs: ci: diff --git a/Makefile.Linux b/Makefile.Linux index 4ae9ff0..794715f 100644 --- a/Makefile.Linux +++ b/Makefile.Linux @@ -99,7 +99,6 @@ install-bin: $(INSTALL_BIN) -d $(BINDIR) $(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR) $(INSTALL_BIN) -s bin/*.ld.so $(CHROOTDIR)/libexec - chmod -R a-w $(CHROOTDIR)/libexec install-etc-dir: $(INSTALL_BIN) -d $(ETCDIR) diff --git a/scripts/rh/3proxy.spec b/scripts/rh/3proxy.spec index 1d1b159..d187e38 100644 --- a/scripts/rh/3proxy.spec +++ b/scripts/rh/3proxy.spec @@ -1,6 +1,6 @@ Name: 3proxy Version: 0.9.5 -Release: 1 +Release: 1%{?dist} Summary: 3proxy tiny proxy server License: GPL/LGPL/Apache/BSD URL: https://3proxy.org/ @@ -13,11 +13,15 @@ Source: https://github.com/%{packager}/%{name}/archive/%{version}.tar.gz 3proxy is lightweight yet powerful proxy server %prep -%setup -q -n %{name}-%{version} +%setup -q ln -s Makefile.Linux Makefile %build -make +%if "%{?PAMLIB}" != "" + make PAMLIB=%{?PAMLIB} +%else + make +%endif %install make DESTDIR=%buildroot install @@ -44,33 +48,9 @@ make clean %config(noreplace) /usr/local/3proxy/conf/add3proxyuser.sh %config(noreplace) /usr/local/3proxy/conf/bandlimiters %config(noreplace) /usr/local/3proxy/conf/counters -/usr/local/3proxy/libexec/PCREPlugin.ld.so -/usr/local/3proxy/libexec/StringsPlugin.ld.so -/usr/local/3proxy/libexec/TrafficPlugin.ld.so -/usr/local/3proxy/libexec/TransparentPlugin.ld.so -%if "%{_arch}" == "arm" -/usr/share/man/man3/3proxy.cfg.3 -/usr/share/man/man8/3proxy.8 -/usr/share/man/man8/ftppr.8 -/usr/share/man/man8/pop3p.8 -/usr/share/man/man8/proxy.8 -/usr/share/man/man8/smtpp.8 -/usr/share/man/man8/socks.8 -/usr/share/man/man8/tcppm.8 -/usr/share/man/man8/udppm.8 -/usr/share/man/man8/tlspr.8 -%else -/usr/share/man/man3/3proxy.cfg.3.gz -/usr/share/man/man8/3proxy.8.gz -/usr/share/man/man8/ftppr.8.gz -/usr/share/man/man8/pop3p.8.gz -/usr/share/man/man8/proxy.8.gz -/usr/share/man/man8/smtpp.8.gz -/usr/share/man/man8/socks.8.gz -/usr/share/man/man8/tcppm.8.gz -/usr/share/man/man8/udppm.8.gz -/usr/share/man/man8/tlspr.8.gz -%endif +/usr/local/3proxy/libexec/*.ld.so +/usr/share/man/man3/* +/usr/share/man/man8/* /var/log/3proxy %doc doc/* diff --git a/src/plugins/PamAuth/Makefile.inc b/src/plugins/PamAuth/Makefile.inc index 661c2ed..a15c991 100644 --- a/src/plugins/PamAuth/Makefile.inc +++ b/src/plugins/PamAuth/Makefile.inc @@ -1,8 +1,10 @@ +PAMLIB ?= pam + all: $(BUILDDIR)pamauth$(DLSUFFICS) pamauth$(OBJSUFFICS): pamauth.c $(CC) $(DCFLAGS) $(CFLAGS) pamauth.c $(BUILDDIR)pamauth$(DLSUFFICS): pamauth$(OBJSUFFICS) - $(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)pam$(LIBSSUFFIX) pamauth$(OBJSUFFICS) + $(LN) $(LNOUT)../../$(BUILDDIR)pamauth$(DLSUFFICS) $(LDFLAGS) $(DLFLAGS) $(LIBSPREFIX)$(PAMLIB)$(LIBSSUFFIX) pamauth$(OBJSUFFICS)