From adbbf9673309166a287bce0435c3bd0f86bde54a Mon Sep 17 00:00:00 2001 From: Cyano Hao Date: Tue, 24 Oct 2023 12:20:32 +0800 Subject: [PATCH] add RPM package (#150) --- .github/workflows/build.yml | 42 +++++++++++++++++++ BUILD.md | 48 ++++++++++++++++++++++ BUILD_cn.md | 48 ++++++++++++++++++++++ packages/fedora/01-in-docker.sh | 15 +++++++ packages/fedora/buildrpm.sh | 13 ++++++ packages/fedora/redpanda-cpp-git.spec.in | 44 ++++++++++++++++++++ packages/opensuse/01-in-docker.sh | 21 ++++++++++ packages/opensuse/buildrpm.sh | 13 ++++++ packages/opensuse/redpanda-cpp-git.spec.in | 44 ++++++++++++++++++++ 9 files changed, 288 insertions(+) create mode 100755 packages/fedora/01-in-docker.sh create mode 100755 packages/fedora/buildrpm.sh create mode 100644 packages/fedora/redpanda-cpp-git.spec.in create mode 100755 packages/opensuse/01-in-docker.sh create mode 100755 packages/opensuse/buildrpm.sh create mode 100644 packages/opensuse/redpanda-cpp-git.spec.in diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ff289dac..052522e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,6 +197,48 @@ jobs: name: Arch Linux path: dist/*.pkg.tar.zst + rpm_fedora: + name: RPM on latest Fedora + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Fetch container image + run: | + podman pull --platform linux/amd64 docker.io/amd64/fedora:latest + + - name: Build + run: | + podman run --rm -e SOURCE_DIR=/src -v $GITHUB_WORKSPACE:/src --platform linux/amd64 docker.io/amd64/fedora:latest /src/packages/fedora/01-in-docker.sh + + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: RPM on latest Fedora + path: dist/*.rpm + + rpm_opensuse: + name: RPM on openSUSE Tumbleweed + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Fetch container image + run: | + podman pull --platform linux/amd64 docker.io/opensuse/tumbleweed:latest + + - name: Build + run: | + podman run --rm -e SOURCE_DIR=/src -v $GITHUB_WORKSPACE:/src --platform linux/amd64 docker.io/opensuse/tumbleweed:latest /src/packages/opensuse/01-in-docker.sh + + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: RPM on openSUSE Tumbleweed + path: dist/*.rpm + macos_x86_64: name: macOS x86_64 runs-on: macos-latest diff --git a/BUILD.md b/BUILD.md index b64767c2..1ae1e858 100644 --- a/BUILD.md +++ b/BUILD.md @@ -335,6 +335,54 @@ Enter `RedPandaIDE` to launch RedPanda C++. Note that makepkg checks out HEAD of the repo, so any change should be committed before building. +## Fedora + +1. Install dependency: + ```bash + sudo dnf install \ + gcc gcc-c++ rpm-build rpmdevtools git \ + glibc-static libstdc++-static libasan \ + qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel + + rpmdev-setuptree # first time only + ``` +2. Build the package: + ```bash + ./packages/fedora/buildrpm.sh + ``` +3. Install the package: + ```bash + sudo dnf install ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm + ``` +4. Run Red Panda C++: + ```bash + RedPandaIDE + ``` + +## openSUSE + +1. Install dependency: + ```bash + sudo zypper in \ + gcc gcc-c++ rpm-build rpmdevtools git \ + glibc-devel-static \ + libqt5svg5-dev qtbase5-dev qtbase5-dev-tools qttools5-dev-tools + + rpmdev-setuptree # first time only + ``` +2. Build the package: + ```bash + ./packages/opensuse/buildrpm.sh + ``` +3. Install the package: + ```bash + sudo zypper --no-gpg-checks in ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm + ``` +4. Run Red Panda C++: + ```bash + RedPandaIDE + ``` + ## Linux AppImage 1. Install dependency: Docker or Podman. diff --git a/BUILD_cn.md b/BUILD_cn.md index 1dc2f851..3cb27216 100644 --- a/BUILD_cn.md +++ b/BUILD_cn.md @@ -335,6 +335,54 @@ Windows 宿主的额外要求: 注意:makepkg 签出此存储库的 HEAD,因此构建之前务必提交所有变更。 +## Fedora + +1. 安装依赖包: + ```bash + sudo dnf install \ + gcc gcc-c++ rpm-build rpmdevtools git \ + glibc-static libstdc++-static libasan \ + qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel + + rpmdev-setuptree # 仅第一次 + ``` +2. 构建 rpm 包: + ```bash + ./packages/fedora/buildrpm.sh + ``` +3. 安装 rpm 包: + ```bash + sudo dnf install ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm + ``` +4. 运行小熊猫 C++: + ```bash + RedPandaIDE + ``` + +## openSUSE + +1. 安装依赖包: + ```bash + sudo zypper in \ + gcc gcc-c++ rpm-build rpmdevtools git \ + glibc-devel-static \ + libqt5svg5-dev qtbase5-dev qtbase5-dev-tools qttools5-dev-tools + + rpmdev-setuptree # 仅第一次 + ``` +2. 构建 rpm 包: + ```bash + ./packages/opensuse/buildrpm.sh + ``` +3. 安装 rpm 包: + ```bash + sudo zypper --no-gpg-checks in ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm + ``` +4. 运行小熊猫 C++: + ```bash + RedPandaIDE + ``` + ## Linux AppImage 1. 安装依赖包:Docker 或 Podman。 diff --git a/packages/fedora/01-in-docker.sh b/packages/fedora/01-in-docker.sh new file mode 100755 index 00000000..8f9ca1c4 --- /dev/null +++ b/packages/fedora/01-in-docker.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -xeuo pipefail + +dnf install -y \ + gcc gcc-c++ rpm-build rpmdevtools git \ + glibc-static libstdc++-static libasan \ + qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel +rpmdev-setuptree + +cd $SOURCE_DIR +./packages/fedora/buildrpm.sh + +mkdir -p $SOURCE_DIR/dist +cp ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm $SOURCE_DIR/dist/ diff --git a/packages/fedora/buildrpm.sh b/packages/fedora/buildrpm.sh new file mode 100755 index 00000000..d6a6b12d --- /dev/null +++ b/packages/fedora/buildrpm.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -xeuo pipefail + +SPECDIR=$(rpm --eval %{_specdir}) +BUILDDIR=$(rpm --eval %{_builddir})/redpanda-cpp-git +VERSION=$(git describe --long --tags --always | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g') + +sed -s "s/__VERSION__/$VERSION/g" packages/fedora/redpanda-cpp-git.spec.in >$SPECDIR/redpanda-cpp-git.spec + +[[ -d $BUILDDIR ]] && rm -rf $BUILDDIR + +rpmbuild --define "_sourcedir $(pwd)" -bb $SPECDIR/redpanda-cpp-git.spec diff --git a/packages/fedora/redpanda-cpp-git.spec.in b/packages/fedora/redpanda-cpp-git.spec.in new file mode 100644 index 00000000..7886accf --- /dev/null +++ b/packages/fedora/redpanda-cpp-git.spec.in @@ -0,0 +1,44 @@ +Name: redpanda-cpp-git +Version: __VERSION__ +Release: 1%{?dist} +Summary: A fast, lightweight, open source, and cross platform C++ IDE +License: GPLv3+ +URL: https://github.com/royqh1979/RedPanda-CPP + +BuildRequires: gcc gcc-c++ +BuildRequires: qt5-qtbase-devel qt5-qtsvg-devel qt5-qttools-devel +Requires: gcc gcc-c++ +Requires: glibc-static libstdc++-static libasan +Requires: qt5-qtbase qt5-qtsvg + +%description +A lightweight but powerful C/C++ IDE + +Red Panda C++ (Old name Red Panda Dev-C++ 7) is a full featured C/C++ IDE. +It's the succesor of Red Panda Dev-C++ 6, which is developed by Delphi 7 and +can only running under Windows. + +%prep + +%build +mkdir -p %{name} +cd %{name} +qmake-qt5 \ + PREFIX=/usr \ + XDG_ADAPTIVE_ICON=ON \ + "%{_sourcedir}/Red_Panda_CPP.pro" +make %{_smp_mflags} + +%install +cd %{name} +make INSTALL_ROOT="%{buildroot}" install + +%files +/usr/bin/RedPandaIDE +/usr/libexec/RedPandaCPP/* +/usr/share/RedPandaCPP/* +/usr/share/doc/RedPandaCPP/* +/usr/share/applications/redpandaide.desktop +/usr/share/icons/hicolor/scalable/apps/redpandaide.svg + +%changelog diff --git a/packages/opensuse/01-in-docker.sh b/packages/opensuse/01-in-docker.sh new file mode 100755 index 00000000..7f5e8eeb --- /dev/null +++ b/packages/opensuse/01-in-docker.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -xeuo pipefail + +DISTRO_ID=$(grep ^ID= /etc/os-release | cut -d= -f2- | tr -d '"') +VERSION_ID=$(grep ^VERSION_ID= /etc/os-release | cut -d= -f2- | tr -d '"') + +zypper in -y \ + gcc gcc-c++ rpm-build rpmdevtools git \ + glibc-devel-static \ + libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qttools-devel +rpmdev-setuptree + +cd $SOURCE_DIR +./packages/opensuse/buildrpm.sh + +file=$(ls ~/rpmbuild/RPMS/$(uname -m)/redpanda-cpp-git-*.rpm) +basename=$(basename $file) + +mkdir -p $SOURCE_DIR/dist +cp $file $SOURCE_DIR/dist/${basename/.rpm/.$DISTRO_ID$VERSION_ID.rpm} diff --git a/packages/opensuse/buildrpm.sh b/packages/opensuse/buildrpm.sh new file mode 100755 index 00000000..9c4c339d --- /dev/null +++ b/packages/opensuse/buildrpm.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -xeuo pipefail + +SPECDIR=$(rpm --eval %{_specdir}) +BUILDDIR=$(rpm --eval %{_builddir})/redpanda-cpp-git +VERSION=$(git describe --long --tags --always | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g') + +sed -s "s/__VERSION__/$VERSION/g" packages/opensuse/redpanda-cpp-git.spec.in >$SPECDIR/redpanda-cpp-git.spec + +[[ -d $BUILDDIR ]] && rm -rf $BUILDDIR + +rpmbuild --define "_sourcedir $(pwd)" -bb $SPECDIR/redpanda-cpp-git.spec diff --git a/packages/opensuse/redpanda-cpp-git.spec.in b/packages/opensuse/redpanda-cpp-git.spec.in new file mode 100644 index 00000000..5d8662c9 --- /dev/null +++ b/packages/opensuse/redpanda-cpp-git.spec.in @@ -0,0 +1,44 @@ +Name: redpanda-cpp-git +Version: __VERSION__ +Release: 1%{?dist} +Summary: A fast, lightweight, open source, and cross platform C++ IDE +License: GPLv3+ +URL: https://github.com/royqh1979/RedPanda-CPP + +BuildRequires: gcc gcc-c++ +BuildRequires: libqt5-qtbase-devel libqt5-qtsvg-devel libqt5-qttools-devel +Requires: gcc gcc-c++ +Requires: glibc-devel-static +Requires: libQt5Core5 libQt5Gui5 libQt5Svg5 + +%description +A lightweight but powerful C/C++ IDE + +Red Panda C++ (Old name Red Panda Dev-C++ 7) is a full featured C/C++ IDE. +It's the succesor of Red Panda Dev-C++ 6, which is developed by Delphi 7 and +can only running under Windows. + +%prep + +%build +mkdir -p %{name} +cd %{name} +qmake-qt5 \ + PREFIX=/usr \ + XDG_ADAPTIVE_ICON=ON \ + "%{_sourcedir}/Red_Panda_CPP.pro" +make %{_smp_mflags} + +%install +cd %{name} +make INSTALL_ROOT="%{buildroot}" install + +%files +/usr/bin/RedPandaIDE +/usr/libexec/RedPandaCPP/* +/usr/share/RedPandaCPP/* +/usr/share/doc/RedPandaCPP/* +/usr/share/applications/redpandaide.desktop +/usr/share/icons/hicolor/scalable/apps/redpandaide.svg + +%changelog