Skip to content

Commit

Permalink
git: Added Fedora .rpm packaging to CI (WerWolv#608)
Browse files Browse the repository at this point in the history
* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update get_deps_fedora.sh

* Update build.yml

* Update get_deps_fedora.sh

* Update build.yml

* Update build.yml

* Update get_deps_fedora.sh

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Create imhex.spec

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Update imhex.spec

* Update build.yml

* Update README.md

* remove duplicate fedora build deps

* Fix license

* Use release tag 0

fedora official packaging starts at 1 so this will prevent conflicts and allow someone who manually installs the RPM to then later get updates from fedora repositories

* add RPMs to releases

* include rpms in releases

* fixed order of ops for fedora builds

* can't checkout without git...
  • Loading branch information
jonathanspw authored Jul 30, 2022
1 parent 1ed88f3 commit f12f10b
Show file tree
Hide file tree
Showing 5 changed files with 223 additions and 9 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,129 @@ jobs:
path: |
build/imhex-${{env.IMHEX_VERSION}}-ArchLinux.pkg.tar.zst
fedora-build-rawhide:
name: 🐧 Fedora Rawhide
runs-on: ubuntu-latest

container:
image: fedora:rawhide

steps:
- name: ⬇️ Update all packages
run: |
dnf upgrade -y
- name: ⬇️ Install setup dependencies
run: |
dnf install -y \
capstone-devel \
ccache \
desktop-file-utils \
fmt-devel \
git \
json-devel \
libcurl-devel \
llvm-devel \
mbedtls-devel \
mock \
python3-devel \
rpm-build \
yara-devel
- name: 🧰 Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: ⬇️ Install ImHex dependencies
run: |
dist/get_deps_fedora.sh
- name: 📜 Restore ccache
uses: actions/cache@v3
with:
path: |
~/.cache/ccache
key: fedora-rawhide-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
restore-keys: fedora-rawhide-${{ secrets.CACHE_VERSION }}-build

- name: 📜 Restore CMakeCache
uses: actions/cache@v3
with:
path: |
build/CMakeCache.txt
key: fedora-rawhide-${{ secrets.CACHE_VERSION }}-build-${{ hashFiles('**/CMakeLists.txt') }}

- name: 📜 Set version variable
run: |
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
- name: 📦 Build RPM
run: |
rpmbuild -ba --define "_version ${{env.IMHEX_VERSION}}" --define "_src_path $GITHUB_WORKSPACE" $GITHUB_WORKSPACE/dist/rpm/imhex.spec
- name: ⬆️ Upload RPM
uses: actions/upload-artifact@v3
with:
name: Fedora Rawhide RPM
path: |
~/rpmbuild/RPMS/*/*.rpm
fedora-build-stable:
name: 🐧 Fedora Stable
runs-on: ubuntu-latest

container:
image: fedora:latest

steps:
- name: ⬇️ Update all packages
run: |
dnf upgrade -y
- name: ⬇️ Install setup dependencies
run: |
dnf install -y \
ccache \
desktop-file-utils \
fmt-devel \
git \
json-devel \
libcurl-devel \
llvm-devel \
mbedtls-devel \
python3-devel \
rpm-build
- name: 🧰 Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: ⬇️ Install ImHex dependencies
run: |
dist/get_deps_fedora.sh
- name: 📜 Restore ccache
uses: actions/cache@v3
with:
path: |
~/.cache/ccache
key: fedora-stable-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
restore-keys: fedora-stable-${{ secrets.CACHE_VERSION }}-build

- name: 📜 Set version variable
run: |
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
- name: 📦 Build RPM
run: |
rpmbuild -ba --define "_version ${{env.IMHEX_VERSION}}" --define "_src_path $GITHUB_WORKSPACE" $GITHUB_WORKSPACE/dist/rpm/imhex.spec
- name: ⬆️ Upload RPM
uses: actions/upload-artifact@v3
with:
name: Fedora Stable RPM
path: |
~/rpmbuild/RPMS/*/*.rpm
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ jobs:
- name: ⬆️ Upload everything to release
uses: softprops/action-gh-release@v1
with:
files: '*'
files: |
'*'
'*/*.rpm'
- name: ✒️ Prepare PKGBUILD
run: |
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ Nightlies are available via GitHub Actions [here](https://github.com/WerWolv/ImH
- [DEB](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20DEB.zip)
- [AppImage](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20AppImage.zip)
- [Arch Package](https://nightly.link/WerWolv/ImHex/workflows/build/master/ArchLinux%20.pkg.tar.zst.zip)
- [Fedora Rawhide RPM](https://nightly.link/WerWolv/ImHex/workflows/build/master/Fedora%20Rawhide%20RPM.zip)
- [Fedora Stable RPM](https://nightly.link/WerWolv/ImHex/workflows/build/master/Fedora%20Stable%20RPM.zip)

## Compiling

Expand Down
16 changes: 8 additions & 8 deletions dist/get_deps_fedora.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env sh

dnf install \
dnf install -y \
cmake \
gcc-c++ \
lld \
dbus-devel \
file-devel \
glfw-devel \
freetype-devel \
gcc-c++ \
git \
mesa-libGL-devel \
glfw-devel \
lld \
mbedtls-devel \
python-devel \
freetype-devel \
dbus \
xdg-desktop-portal
python3-devel
84 changes: 84 additions & 0 deletions dist/rpm/imhex.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# ftbfs without this
%global _lto_cflags %{nil}

Name: ImHex
Version: %{_version}
Release: 0%{?dist}
Summary: A hex editor for reverse engineers and programmers

License: GPL-2.0-only
URL: https://imhex.werwolv.net/

BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: dbus-devel
BuildRequires: file-devel
BuildRequires: freetype-devel
BuildRequires: fmt-devel
BuildRequires: gcc-c++
BuildRequires: mesa-libGL-devel
BuildRequires: glfw-devel
BuildRequires: json-devel
BuildRequires: libcurl-devel
BuildRequires: llvm-devel
BuildRequires: mbedtls-devel
BuildRequires: python3-devel
%if 0%{?fedora} >= 37
BuildRequires: yara-devel
%endif


%description
ImHex is a Hex Editor, a tool to display, decode and analyze binary data to
reverse engineer their format, extract informations or patch values in them.

What makes ImHex special is that it has many advanced features that can often
only be found in paid applications. Such features are a completely custom binary
template and pattern language to decode and highlight structures in the data, a
graphical node-based data processor to pre-process values before they're
displayed, a disassembler, diffing support, bookmarks and much much more. At the
same time ImHex is completely free and open source under the GPLv2 language.


%prep
# don't use the setup macro since we're pulling from git
cp -r %{_src_path}/* %{_builddir}/


%build
%cmake \
-D IMHEX_OFFLINE_BUILD=ON \
-D USE_SYSTEM_NLOHMANN_JSON=ON \
-D USE_SYSTEM_FMT=ON \
-D USE_SYSTEM_CURL=ON \
-D USE_SYSTEM_LLVM=ON \
%if 0%{?fedora} >= 37
-D USE_SYSTEM_YARA=ON \
# if fedora <= 36 get updated to yara 4.2.x then they should \
# be able to build against system libs \
# https://bugzilla.redhat.com/show_bug.cgi?id=2112508 \
%endif
# when capstone >= 5.x is released we should be able to build against \
# system libs of it \
# -D USE_SYSTEM_CAPSTONE=ON

%cmake_build


%install
%cmake_install
desktop-file-validate %{buildroot}%{_datadir}/applications/imhex.desktop


%files
%dir %{_datadir}/licenses/imhex
%license %{_datadir}/licenses/imhex/LICENSE
%doc README.md
%{_bindir}/imhex
%{_datadir}/pixmaps/imhex.png
%dir %{_datadir}/imhex
%{_datadir}/imhex/*
%{_datadir}/applications/imhex.desktop
%{_prefix}/lib/libimhex.so

%changelog

0 comments on commit f12f10b

Please sign in to comment.