From 25f9ceba55c2c7e38fdd0427e5233e1dd6d6d453 Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Fri, 19 Jun 2026 22:36:46 -0500 Subject: [PATCH] Use my new toolchain, fix a bug on mac/freebsd --- .gitea/workflows/tag.yaml | 53 ++++++++--- CMakeLists.txt | 9 +- Packaging/Linux/PKGBUILD | 48 ---------- Packaging/Linux/build-arch.sh | 17 ---- build-for-nfpm.sh | 40 ++++++++ build-for-ppc.sh | 20 ++++ changelog.md | 3 + cmake/options.cmake | 1 + cmake/version.cmake | 2 +- nfpm.yaml.in | 172 ++++++++++++++++++++++++++++++++++ ppc-pkgbuild.in | 21 +++++ 11 files changed, 308 insertions(+), 78 deletions(-) delete mode 100644 Packaging/Linux/PKGBUILD delete mode 100644 Packaging/Linux/build-arch.sh create mode 100644 build-for-nfpm.sh create mode 100644 build-for-ppc.sh create mode 100644 nfpm.yaml.in create mode 100644 ppc-pkgbuild.in diff --git a/.gitea/workflows/tag.yaml b/.gitea/workflows/tag.yaml index 1ae09ce..b7f42b2 100644 --- a/.gitea/workflows/tag.yaml +++ b/.gitea/workflows/tag.yaml @@ -9,19 +9,50 @@ env: VERSION: ${{ gitea.ref_name }} jobs: - build-arch: - name: "🔨 Build for Arch Linux/Static Builds" - runs-on: arch-builder + build-ppc: + name: "🔨 Build for PowerPC" + runs-on: ubuntu-latest + container: + image: git.tesses.org/tesses50/linux-ppc:latest steps: - uses: actions/checkout@v4 - - run: pacman --noconfirm -Sy mbedtls zip zig ninja - - run: pacman --config /opt/cross/ppc/pacman.conf --noconfirm -Sy mbedtls - - run: cp Packaging/Linux/PKGBUILD /home/build/PKGBUILD - - run: cp Packaging/Linux/build-arch.sh /home/build/build-arch.sh - - run: chmod 755 /home/build/build-arch.sh - - run: chown build:build /home/build/PKGBUILD - - run: chown build:build /home/build/build-arch.sh - - run: su build -c /home/build/build-arch.sh + - run: bash build-for-ppc.sh + - uses: akkuman/gitea-release-action@v1 + env: + NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18 + with: + prerelease: true + files: |- + artifacts/** + + build-packages: + name: "🔨 Build for everything else" + runs-on: fw13-ubuntu-latest + strategy: + fail-fast: true + matrix: + include: + - container: "git.tesses.org/tesses50/linux-x64:latest" + nfpmName: "amd64" + debianName: "x86_64-linux-gnu" + - container: "git.tesses.org/tesses50/linux-x86:latest" + nfpmName: "386" + debianName: "i386-linux-gnu" + - container: "git.tesses.org/tesses50/linux-arm:latest" + nfpmName: "arm7" + debianName: "arm-linux-gnueabihf" + - container: "git.tesses.org/tesses50/linux-arm64:latest" + nfpmName: "arm64" + debianName: "aarch64-linux-gnu" + - container: "git.tesses.org/tesses50/linux-riscv64:latest" + nfpmName: "riscv64" + debianName: "riscv64-linux-gnu" + + container: + image: ${{ matrix.container }} + steps: + - uses: actions/checkout@v4 + - run: bash build-for-nfpm.sh ${{ matrix.nfpmName }} ${{ matrix.debianName }} - uses: akkuman/gitea-release-action@v1 env: NODE_OPTIONS: '--experimental-fetch' # if nodejs < 18 diff --git a/CMakeLists.txt b/CMakeLists.txt index f7dbb7e..da0c7e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,4 +63,11 @@ include(cmake/apps.cmake) if(TESSESFRAMEWORK_INSTALL_DEVELOPMENT) add_subdirectory(pkgconfig) -endif() \ No newline at end of file +endif() + +if(NOT TESSESFRAMEWORK_NFPM_ARCH STREQUAL "") +configure_file(nfpm.yaml.in nfpm.yaml @ONLY) + +endif() + +configure_file(ppc-pkgbuild.in ppc-pkgbuild @ONLY) \ No newline at end of file diff --git a/Packaging/Linux/PKGBUILD b/Packaging/Linux/PKGBUILD deleted file mode 100644 index d90a4c7..0000000 --- a/Packaging/Linux/PKGBUILD +++ /dev/null @@ -1,48 +0,0 @@ -# Maintainer: Mike Nolan -pkgname=tessesframework # '-bzr', '-git', '-hg' or '-svn' -pkgver=0.0.5 -pkgrel=1 -pkgdesc="" -arch=('x86_64' 'powerpc') -url="https://git.tesses.org/tesses50/tessesframework" -license=('MIT') -groups=() -depends=('mbedtls') -makedepends=('git' 'cmake' 'make' 'base-devel' 'wget') # 'bzr', 'git', 'mercurial' or 'subversion' -install= -source=('tessesframework::git+https://git.tesses.org/tesses50/tessesframework#tag=v0.0.5') -noextract=() -sha256sums=('SKIP') -if [[ -z "$CMAKE_TOOLCHAIN" ]]; then -options=(!strip) -else -options=(!buildflags !strip) -fi - - -prepare() { - cd "$srcdir/${pkgname}" -} - -build() { - cd "$srcdir/${pkgname}" - mkdir build - - if [[ -z "$CMAKE_TOOLCHAIN" ]]; then - cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr -DTESSESFRAMEWORK_VENDERCERTCHAIN=OFF -DTESSESFRAMEWORK_FETCHCONTENT=OFF -DCMAKE_BUILD_TYPE=Release - else - cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr -DTESSESFRAMEWORK_VENDERCERTCHAIN=OFF -DTESSESFRAMEWORK_FETCHCONTENT=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$CMAKE_TOOLCHAIN" - fi - - cd build - make -j`nproc` - -} - - - - -package() { - cd "$srcdir/${pkgname}/build" - make install DESTDIR="$pkgdir/" -} diff --git a/Packaging/Linux/build-arch.sh b/Packaging/Linux/build-arch.sh deleted file mode 100644 index 74ffcd9..0000000 --- a/Packaging/Linux/build-arch.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -cd /home/build -mkdir x86_64 -cd x86_64 -cp ../PKGBUILD . -makepkg -curl --user tesses50:$PACKAGE_AND_BREW \ - --upload-file *.pkg.tar.zst \ - https://git.tesses.org/api/packages/tesses50/arch/core -cd .. -mkdir powerpc -cd powerpc -cp ../PKGBUILD . -CARCH=powerpc CMAKE_TOOLCHAIN=/opt/cross/ppc/toolchain.cmake makepkg -curl --user tesses50:$PACKAGE_AND_BREW \ - --upload-file *.pkg.tar.zst \ - https://git.tesses.org/api/packages/tesses50/arch/core diff --git a/build-for-nfpm.sh b/build-for-nfpm.sh new file mode 100644 index 0000000..09412e2 --- /dev/null +++ b/build-for-nfpm.sh @@ -0,0 +1,40 @@ +if [ $# -lt 2 ] +then + echo "Not enough args, pass nfpm arch and debian tripple as argument" + echo "This script requires our docker container: git.tesses.org/tesses50/linux-*:latest" +else + mkdir -p build + cd build + cmake-cross -S .. -B . -DTESSESFRAMEWORK_NFPM_ARCH=$1 -DCMAKE_INSTALL_LIBDIR=lib/$2 -DCMAKE_BUILD_TYPE=Release + make -j`nproc` + make install DESTDIR=debian + cd debian + nfpm package -f ../nfpm.yaml -p deb + curl --user tesses50:$PACKAGE_AND_BREW \ + --upload-file *.deb \ + https://git.tesses.org/api/packages/tesses50/debian/pool/universal/main/upload + #debian/pool/bionic + cd .. + if [ "$1" = "386" ] || [ "$1" = "arm7" ] + then + cmake-cross -S .. -B . -DTESSESFRAMEWORK_NFPM_ARCH=$1 -DCMAKE_INSTALL_LIBDIR=lib32 + else + cmake-cross -S .. -B . -DTESSESFRAMEWORK_NFPM_ARCH=$1 -DCMAKE_INSTALL_LIBDIR=lib64 + fi + make install DESTDIR=fedora + cd fedora + nfpm package -f ../nfpm.yaml -p rpm + curl --user tesses50:$PACKAGE_AND_BREW \ + --upload-file *.rpm \ + https://git.tesses.org/api/packages/tesses50/rpm/upload + cd .. + cmake-cross -S .. -B . -DTESSESFRAMEWORK_NFPM_ARCH=$1 -DCMAKE_INSTALL_LIBDIR=lib + make install DESTDIR=arch + cd arch + nfpm package -f ../nfpm.yaml -p archlinux + curl --user tesses50:$PACKAGE_AND_BREW \ + --upload-file *.pkg.tar.zst \ + https://git.tesses.org/api/packages/tesses50/arch/core + mkdir -p ../../artifacts + tar czf ../../artifacts/tessesframework-$VERSION\-$1\.tar.gz -C usr/ . +fi \ No newline at end of file diff --git a/build-for-ppc.sh b/build-for-ppc.sh new file mode 100644 index 0000000..4c4123e --- /dev/null +++ b/build-for-ppc.sh @@ -0,0 +1,20 @@ + +mkdir -p build +pushd build +cmake-cross -S .. -B . -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release +make -j`nproc` +mkdir -p /home/build/tf +chown build:build -R /home/build +make install DESTDIR=/home/build/tf/src +cp ppc-pkgbuild /home/build/tf/PKGBUILD +chmod 644 /home/build/tf/PKGBUILD +chown build:build -R /home/build/tf +pushd /home/build/tf +su build -c 'CARCH=powerpc makepkg -d' +curl --user tesses50:$PACKAGE_AND_BREW \ + --upload-file *.pkg.tar.zst \ + https://git.tesses.org/api/packages/tesses50/arch/core +popd +popd +mkdir -p artifacts +tar czf artifacts/tessesframework-$VERSION\-powerpc.tar.gz -C /home/build/tf/src/usr . \ No newline at end of file diff --git a/changelog.md b/changelog.md index 5c84e8b..c035b35 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Changelog +## 0.0.6 +Use my new toolchain, fix a bug on mac/freebsd + ## 0.0.5 Fix win32 printing, fix my stupid json vulnerability diff --git a/cmake/options.cmake b/cmake/options.cmake index ce33247..97ccf1a 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -14,3 +14,4 @@ option(TESSESFRAMEWORK_ENABLE_SETDATE "Enable setting date to file" ON) option(TESSESFRAMEWORK_LOGTOFILE "TessesFramework Log to file" OFF) option(TESSESFRAMEWORK_FETCHCONTENT "TessesFramework fetchcontent" ON) option(TESSESFRAMEWORK_VENDERCERTCHAIN "Use the ca-certificates.crt in project rather than system" ON) +option(TESSESFRAMEWORK_NFPM_ARCH "Architecture for NFPM" "") \ No newline at end of file diff --git a/cmake/version.cmake b/cmake/version.cmake index c5abe5a..ebcc856 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -1,3 +1,3 @@ set(TESSESFRAMEWORK_MAJOR_VERSION 0) set(TESSESFRAMEWORK_MINOR_VERSION 0) -set(TESSESFRAMEWORK_PATCH_VERSION 5) \ No newline at end of file +set(TESSESFRAMEWORK_PATCH_VERSION 6) \ No newline at end of file diff --git a/nfpm.yaml.in b/nfpm.yaml.in new file mode 100644 index 0000000..d948c3e --- /dev/null +++ b/nfpm.yaml.in @@ -0,0 +1,172 @@ +# Name. (required) +name: tessesframework + +# Architecture. (required) +# This will expand any env var you set in the field, e.g. arch: ${GOARCH} +# The architecture is specified using Go nomenclature (GOARCH) and translated +# to the platform specific equivalent. In order to manually set the architecture +# to a platform specific value, set `{format}.arch`. +# Examples: `all`, `amd64`, `386`, `arm5`, `arm6`, `arm7`, `arm64`, `mips`, +# `mipsle`, `mips64le`, `ppc64le`, `s390`, `riscv64` +arch: @TESSESFRAMEWORK_NFPM_ARCH@ + +# Platform. +# This will expand any env var you set in the field, e.g. platform: ${GOOS} +# This is only used by the rpm and deb packagers. +# Examples: `linux` (default), `darwin` +platform: linux + +# Version. (required) +# This will expand any env var you set in the field, e.g. version: ${SEMVER} +# Some package managers, like deb, require the version to start with a digit. +# Hence, you should not prefix the version with 'v'. +version: @TESSESFRAMEWORK_MAJOR_VERSION@.@TESSESFRAMEWORK_MINOR_VERSION@.@TESSESFRAMEWORK_PATCH_VERSION@ + +# Version Schema allows you to specify how to parse the version string. +# Default is `semver` +# `semver` attempt to parse the version string as a valid semver version. +# The parser is lenient; it will strip a `v` prefix and will accept +# versions with fewer than 3 components, like `v1.2`. +# If parsing succeeds, then the version will be molded into a format +# compatible with the specific packager used. +# If parsing fails, then the version is used as-is. +# `none` skip trying to parse the version string and just use what is passed in +version_schema: semver + +# Version Epoch. +# A package with a higher version epoch will always be considered newer. +# See: https://www.debian.org/doc/debian-policy/ch-controlfields.html#epochs-should-be-used-sparingly +epoch: 1 + +# Version Prerelease. +# Default is extracted from `version` if it is semver compatible. +# This is appended to the `version`, e.g. `1.2.3+beta1`. If the `version` is +# semver compatible, then this replaces the prerelease component of the semver. +prerelease: alpha + +# Version Metadata (previously deb.metadata). +# Default is extracted from `version` if it is semver compatible. +# Setting metadata might interfere with version comparisons depending on the +# packager. If the `version` is semver compatible, then this replaces the +# version metadata component of the semver. +# version_metadata: git + +# Version Release, aka revision. +# This will expand any env var you set in the field, e.g. release: ${VERSION_RELEASE} +# This is appended to the `version` after `prerelease`. This should be +# incremented if you release an updated package of the same upstream version, +# and it should reset to 1 when bumping the version. +release: 1 + +# Section. +# This is only used by the deb packager. +# See: https://www.debian.org/doc/debian-policy/ch-archive.html#sections +section: default + +# Priority. +# Defaults to `optional` on deb +# Defaults to empty on rpm and apk +# See: https://www.debian.org/doc/debian-policy/ch-archive.html#priorities +priority: extra + +# Maintainer. (required) +# This will expand any env var you set in the field, e.g. maintainer: ${GIT_COMMITTER_NAME} <${GIT_COMMITTER_EMAIL}> +# Defaults to empty on rpm and apk +# Leaving the 'maintainer' field unset will not be allowed in a future version +maintainer: Mike Nolan + +# Description. +# This will expand any env var you set in the field, e.g. description: ${DESCRIPTION} +# Defaults to `no description given`. +# Most packagers call for a one-line synopsis of the package. Some (like deb) +# also call for a multi-line description starting on the second line. +description: TessesFramework a library to make C++ easier for me, used in CrossLang + +# Vendor. +# This will expand any env var you set in the field, e.g. vendor: ${VENDOR} +# This is only used by the rpm packager. +vendor: Tesses + +# Package's homepage. +# This will expand any env var you set in the field, e.g. homepage: ${CI_PROJECT_URL} +homepage: https://git.tesses.org/tesses50/tessesframework + +# License. +license: GPLv3 + +# Date to be used as mtime on internal files. +# +# Default is the value of $SOURCE_DATE_EPOCH (which should be an Unix time), +# or the current time. +# Read more about SOURCE_DATE_EPOCH at https://reproducible-builds.org/docs/source-date-epoch/ +#mtime: "2009-11-10T23:00:00Z" + +# Changelog YAML file, see: https://github.com/goreleaser/chglog +# changelog: "changelog.yaml" + +# Disables globbing for files, config_files, etc. +# disable_globbing: false + +# Packages it replaces. (overridable) +# This will expand any env var you set in the field, e.g. ${REPLACE_BLA} +# the env var approach can be used to account for differences in platforms +#replaces: +# - foobar +# - ${REPLACE_BLA} + +# Packages it provides. (overridable) +# This will expand any env var you set in the field, e.g. ${PROVIDES_BLA} +# the env var approach can be used to account for differences in platforms +#provides: +# - bar +# - ${PROVIDES_BLA} + +# Dependencies. (overridable) +# This will expand any env var you set in the field, e.g. ${DEPENDS_NGINX} +# the env var approach can be used to account for differences in platforms +# e.g. rhel needs nginx >= 1:1.18 and deb needs nginx (>= 1.18.0) +#depends: +# - git +# - ${DEPENDS_NGINX} + +# Recommended packages. (overridable) +# This will expand any env var you set in the field, e.g. ${RECOMMENDS_BLA} +# the env var approach can be used to account for differences in platforms +#recommends: +# - golang +# - ${RECOMMENDS_BLA} + +# Suggested packages. (overridable) +# This will expand any env var you set in the field, e.g. ${SUGGESTS_BLA} +# the env var approach can be used to account for differences in platforms +#suggests: +# - bzr + +# Packages it conflicts with. (overridable) +# This will expand any env var you set in the field, e.g. ${CONFLICTS_BLA} +# the env var approach can be used to account for differences in platforms +#conflicts: +# - mercurial +# - ${CONFLICTS_BLA} + +# Contents to add to the package +# This can be binaries or any other files. +contents: + - src: usr/ + dst: /usr/ + type: tree + +# Umask to be used on files without explicit mode set. +# +# By default, nFPM will inherit the mode of the original file that's being +# added. +# This may lead to issues if these files are checkout out in Git, for example, +# as it won't keep all the permissions on fresh checkouts, or if the local +# system has a problematic umask setting. +# +# This setting allows to set the umask for all files that are added to the +# package without a specific file_info.mode set. +# +# Default: 0o002 (will remove world-writable permissions) +umask: 0o002 + diff --git a/ppc-pkgbuild.in b/ppc-pkgbuild.in new file mode 100644 index 0000000..79e9eef --- /dev/null +++ b/ppc-pkgbuild.in @@ -0,0 +1,21 @@ +# Maintainer: Mike Nolan +pkgname=tessesframework # '-bzr', '-git', '-hg' or '-svn' +pkgver=@TESSESFRAMEWORK_MAJOR_VERSION@.@TESSESFRAMEWORK_MINOR_VERSION@.@TESSESFRAMEWORK_PATCH_VERSION@ +pkgrel=1 +pkgdesc="TessesFramework a library to make C++ easier for me, used in CrossLang" +arch=('powerpc') +url="https://git.tesses.org/tesses50/tessesframework" +license=('GPLv3') +groups=() +depends=() +makedepends=('git' 'cmake' 'make' 'base-devel' 'wget') # 'bzr', 'git', 'mercurial' or 'subversion' +install= +source=() +noextract=() +sha256sums=() +options=(!buildflags !strip) + + +package() { + cp -r "${srcdir}/"* "${pkgdir}/" +}