Compare commits

...

3 Commits

Author SHA1 Message Date
Jonathan Wright 04d0458ae7
build: Improve Fedora builds and add EL9 build. (#861) 2023-01-10 23:10:34 +01:00
WerWolv 3b5d54dd96 fix: Text Editor behaving a bit weirdly now 2023-01-10 19:27:27 +01:00
WerWolv 87571450f4 patterns: Updated pattern language 2023-01-10 16:20:54 +01:00
4 changed files with 173 additions and 74 deletions

View File

@ -446,71 +446,123 @@ jobs:
path: |
build/imhex-${{env.IMHEX_VERSION}}-ArchLinux.pkg.tar.zst
# Fedora build
fedora-build:
# RPM distro builds
rpm-build:
strategy:
matrix:
include:
- docker_image: fedora:latest
release: Latest
- docker_image: fedora:rawhide
release: Rawhide
# - name: Fedora
# mock_release: rawhide
# release_num: rawhide
# mock_config: fedora-rawhide
- name: Fedora
mock_release: f37
release_num: 37
mock_config: fedora-37
- name: Fedora
mock_release: f36
release_num: 36
mock_config: fedora-36
- name: RHEL-AlmaLinux
mock_release: epel9
release_num: 9
mock_config: "alma+epel-9"
name: 🐧 Fedora ${{ matrix.release }}
name: 🐧 ${{ matrix.name }} ${{ matrix.release_num }}
runs-on: ubuntu-latest
container:
image: "${{ matrix.docker_image }}"
image: "fedora:latest"
options: --privileged
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 \
rpm-build \
yara-devel
- name: ⬇️ Install git-core
run: dnf install --disablerepo="*" --enablerepo="fedora" git-core -y
- name: 🧰 Checkout
uses: actions/checkout@v3
with:
path: ImHex
submodules: recursive
- name: ⬇️ Install ImHex dependencies
- name: 📜 Setup DNF Cache
uses: actions/cache@v3
with:
path: /var/cache/dnf
key: ${{ matrix.mock_release }}-${{secrets.CACHE_VERSION }}-dnf-${{ github.run_id }}
restore-keys: |
${{ matrix.mock_release }}-${{secrets.CACHE_VERSION }}-dnf-
- name: ⬇️ Update all packages and install dependencies
run: |
dist/get_deps_fedora.sh
dnf upgrade --disablerepo="*" --enablerepo="fedora,updates" -y
dnf install --disablerepo="*" --enablerepo="fedora,updates" -y \
fedpkg \
ccache
- name: 📜 Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
uses: hendrikmuhs/ccache-action@v1.2.5
with:
key: fedora-${{ matrix.release }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
restore-keys: fedora-${{ matrix.release }}-${{ secrets.CACHE_VERSION }}-build
max-size: 50M
key: rpm-${{ matrix.mock_release }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
restore-keys: rpm-${{ matrix.mock_release }}-${{ secrets.CACHE_VERSION }}-build
max-size: 1G
- name: 📜 Set version variable
run: |
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
echo "IMHEX_VERSION=`cat ImHex/VERSION`" >> $GITHUB_ENV
- name: 🗜️ Create tarball from sources with dependencies
run: tar --exclude-vcs -czf $GITHUB_WORKSPACE/imhex-$IMHEX_VERSION.tar.gz ImHex
- name: "✒️ Modify spec file: set version, use latest pattern language, enable online build"
run: |
sed -i \
-e 's/Version: [0-9]*\.[0-9]*\.[0-9]*$/Version: ${{env.IMHEX_VERSION}}/g' \
-e 's/IMHEX_OFFLINE_BUILD=ON/IMHEX_OFFLINE_BUILD=OFF/g' \
-e '/IMHEX_OFFLINE_BUILD=OFF/a -D IMHEX_PATTERNS_PULL_MASTER=ON \\' \
-e '/BuildRequires: cmake/a BuildRequires: git-core' \
-e '/%files/a %{_datadir}/%{name}/' \
$GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec
- name: 📜 Fix ccache on EL9
if: matrix.mock_release == 'epel9'
run: sed -i '/\. \/opt\/rh\/gcc-toolset-12\/enable/a PATH=/usr/lib64/ccache:$PATH' $GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec
- name: 🟩 Copy spec file to build root
run: mv $GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec $GITHUB_WORKSPACE/imhex.spec
- name: 📜 Enable ccache for mock
run: |
cat <<EOT > $GITHUB_WORKSPACE/mock.cfg
include('${{ matrix.mock_config }}-x86_64.cfg')
config_opts['plugin_conf']['ccache_enable'] = True
config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '1G'
config_opts['plugin_conf']['ccache_opts']['compress'] = True
config_opts['plugin_conf']['ccache_opts']['dir'] = "$GITHUB_WORKSPACE/.ccache"
EOT
- name: 📜 Setup Mock Cache
uses: actions/cache@v3
with:
path: /var/cache/mock
key: ${{ matrix.mock_release }}-${{secrets.CACHE_VERSION }}-mock-${{ github.run_id }}
restore-keys: |
${{ matrix.mock_release }}-${{secrets.CACHE_VERSION }}-mock-
# Fedora cmake build (in imhex.spec)
- name: 📦 Build RPM
run: |
rpmbuild -ba --define "_version ${{env.IMHEX_VERSION}}" --define "_src_path $GITHUB_WORKSPACE" --define "_build_type $BUILD_TYPE" $GITHUB_WORKSPACE/dist/rpm/imhex.spec
mv ~/rpmbuild/RPMS/x86_64/*.rpm imhex-${{env.IMHEX_VERSION}}-Fedora-${{matrix.release}}.rpm
fedpkg --path $GITHUB_WORKSPACE --release ${{ matrix.mock_release }} mockbuild --enable-network -N --root $GITHUB_WORKSPACE/mock.cfg extra_args -- -v
# set fortify_source back to 2 - level 3 in rawhide breaks through GH actions for some reason
- name: 🟩 Move and rename finished RPM
run: |
mv $GITHUB_WORKSPACE/results_imhex/${{env.IMHEX_VERSION}}/*/imhex-${{env.IMHEX_VERSION}}-0.*.x86_64.rpm \
$GITHUB_WORKSPACE/imhex-${{env.IMHEX_VERSION}}-${{matrix.name}}-${{matrix.release_num}}-x86_64.rpm
- name: ⬆️ Upload RPM
uses: actions/upload-artifact@v3
with:
name: Fedora ${{ matrix.release }} RPM
name: ${{ matrix.name }} ${{ matrix.release_num }} RPM
path: |
imhex-${{env.IMHEX_VERSION}}-Fedora-${{matrix.release}}.rpm
imhex-${{env.IMHEX_VERSION}}-${{matrix.name}}-${{matrix.release_num}}-x86_64.rpm

101
dist/rpm/imhex.spec vendored
View File

@ -1,10 +1,14 @@
Name: imhex
Version: %{_version}
Version: 1.26.2
Release: 0%{?dist}
Summary: A hex editor for reverse engineers and programmers
License: GPL-2.0-only
License: GPL-2.0-only AND Zlib AND MIT AND Apache-2.0
# imhex is gplv2. capstone is custom. nativefiledialog is Zlib. intervaltree is MIT
# see license dir for full breakdown
URL: https://imhex.werwolv.net/
# We need the archive with deps bundled
Source0: https://github.com/WerWolv/%{name}/releases/download/v%{version}/Full.Sources.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: desktop-file-utils
@ -13,16 +17,36 @@ BuildRequires: file-devel
BuildRequires: freetype-devel
BuildRequires: fmt-devel
BuildRequires: gcc-c++
BuildRequires: mesa-libGL-devel
BuildRequires: libappstream-glib
BuildRequires: libglvnd-devel
BuildRequires: glfw-devel
BuildRequires: json-devel
BuildRequires: libcurl-devel
BuildRequires: llvm-devel
BuildRequires: mbedtls-devel
%if 0%{?fedora} >= 37
BuildRequires: yara-devel
BuildRequires: nativefiledialog-extended-devel
%if 0%{?rhel}
BuildRequires: gcc-toolset-12
%endif
Provides: bundled(gnulib)
Provides: bundled(capstone) = 5.0-rc2
Provides: bundled(imgui)
Provides: bundled(libromfs)
Provides: bundled(microtar)
Provides: bundled(libpl)
# ImHex modified upstream intervaltree so we have to package it
# https://github.com/ekg/intervaltree
Provides: bundled(intervaltree) = 0.1
Provides: bundled(xdgpp)
# ftbfs on these arches. armv7hl might compile when capstone 5.x
# is released upstream and we can build against it
# [7:02 PM] WerWolv: We're not supporting 32 bit anyways soooo
# [11:38 AM] WerWolv: Officially supported are x86_64 and aarch64
ExclusiveArch: x86_64 %{arm64} ppc64le
%description
ImHex is a Hex Editor, a tool to display, decode and analyze binary data to
@ -37,26 +61,26 @@ 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}/
%autosetup -n ImHex
# remove bundled libs we aren't using
rm -rf lib/external/{curl,fmt,llvm,nlohmann_json,yara}
%build
%if 0%{?rhel}
. /opt/rh/gcc-toolset-12/enable
%set_build_flags
CXXFLAGS+=" -std=gnu++2b"
%endif
%cmake \
-DCMAKE_BUILD_TYPE=%{_build_type} \
-D CMAKE_BUILD_TYPE=Release \
-D IMHEX_STRIP_RELEASE=OFF \
-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 \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D IMHEX_PATTERNS_PULL_MASTER=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
-D USE_SYSTEM_NFD=ON \
# when capstone >= 5.x is released we should be able to build against \
# system libs of it \
# -D USE_SYSTEM_CAPSTONE=ON
@ -64,23 +88,46 @@ cp -r %{_src_path}/* %{_builddir}/
%cmake_build
%check
%if 0%{?rhel}
. /opt/rh/gcc-toolset-12/enable
%set_build_flags
CXXFLAGS+=" -std=gnu++2b"
%endif
# build binaries required for tests
%cmake_build --target unit_tests
%ctest --exclude-regex '(Helpers/StoreAPI|Helpers/TipsAPI|Helpers/ContentAPI)'
# Helpers/*API exclude tests that require network access
%install
%cmake_install
desktop-file-validate %{buildroot}%{_datadir}/applications/imhex.desktop
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
# this is a symlink for the old appdata name that we don't need
rm -f %{buildroot}%{_metainfodir}/net.werwolv.%{name}.appdata.xml
# AppData
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/net.werwolv.%{name}.metainfo.xml
# install licenses
cp -a lib/external/nativefiledialog/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/nativefiledialog-LICENSE
cp -a lib/external/capstone/LICENSE.TXT %{buildroot}%{_datadir}/licenses/%{name}/capstone-LICENSE
cp -a lib/external/capstone/suite/regress/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/capstone-regress-LICENSE
cp -a lib/external/microtar/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/microtar-LICENSE
cp -a lib/external/pattern_language/external/intervaltree/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/pattern-language-intervaltree-LICENSE
cp -a lib/external/xdgpp/LICENSE %{buildroot}%{_datadir}/licenses/%{name}/xdgpp-LICENSE
%files
%dir %{_datadir}/licenses/imhex
%license %{_datadir}/licenses/imhex/LICENSE
%license %{_datadir}/licenses/%{name}/
%doc README.md
%{_bindir}/imhex
%dir %{_datadir}/imhex
%{_datadir}/imhex/*
%{_datadir}/pixmaps/imhex.png
%{_datadir}/applications/imhex.desktop
%{_prefix}/lib64/libimhex.so.%{_version}
%{_prefix}/lib64/imhex/plugins/*
%{_metainfodir}/net.werwolv.imhex.metainfo.xml
%{_metainfodir}/net.werwolv.imhex.appdata.xml
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%{_libdir}/libimhex.so*
%{_libdir}/%{name}/
%{_metainfodir}/net.werwolv.%{name}.metainfo.xml
%changelog

View File

@ -2123,7 +2123,7 @@ void TextEditor::EnsureCursorVisible() {
if (len + mTextStart < left + 4)
ImGui::SetScrollX(std::max(0.0f, len + mTextStart - 4));
if (len + mTextStart > right - 4)
ImGui::SetScrollX(std::max(0.0f, len + mTextStart + 4));
ImGui::SetScrollX(std::max(0.0f, len + mTextStart + 4 - width + mCharAdvance.x * 2));
}
int TextEditor::GetPageSize() const {

@ -1 +1 @@
Subproject commit f5ae1a5b85c6fd7ef07e133fae480a6cda08dd55
Subproject commit fa47ecad9885a0c53ac6eaa0e41e2f049444c284