mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
build: Added snap package (#2348)
This commit is contained in:
53
.github/workflows/build.yml
vendored
53
.github/workflows/build.yml
vendored
@@ -1076,6 +1076,59 @@ jobs:
|
||||
path: |
|
||||
imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm
|
||||
|
||||
snap-build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- architecture: "x86_64"
|
||||
image: ubuntu-24.04
|
||||
- architecture: "arm64"
|
||||
image: ubuntu-24.04-arm
|
||||
name: 🐧 Snap ${{ matrix.architecture }}
|
||||
runs-on: ${{ matrix.image }}
|
||||
|
||||
permissions:
|
||||
id-token: write
|
||||
attestations: write
|
||||
|
||||
steps:
|
||||
- name: ⬇️ Install setup dependencies
|
||||
run: |
|
||||
sudo apt update && sudo apt install -y git curl
|
||||
|
||||
- name: 🧰 Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: 📜 Set version variable
|
||||
run: |
|
||||
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
|
||||
|
||||
- name: 📜 Move snap directory to root
|
||||
run: |
|
||||
mkdir -p ./snap
|
||||
envsubst '${IMHEX_VERSION}' < ./dist/snap/snapcraft.yaml > ./snap/snapcraft.yaml
|
||||
|
||||
- name: 🛠️ Build
|
||||
uses: snapcore/action-build@v1
|
||||
id: snapcraft
|
||||
|
||||
- name: 🗝️ Generate build provenance attestations
|
||||
uses: actions/attest-build-provenance@v2
|
||||
if: ${{ github.event.repository.fork == false && github.event_name != 'pull_request' }}
|
||||
with:
|
||||
subject-path: |
|
||||
${{ steps.snapcraft.outputs.snap }}
|
||||
|
||||
- name: ⬆️ Upload Snap
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: Snap ${{ matrix.architecture }}
|
||||
path: ${{ steps.snapcraft.outputs.snap }}
|
||||
|
||||
webassembly-build:
|
||||
runs-on: ubuntu-24.04
|
||||
name: 🌍 Web
|
||||
|
||||
22
.gitignore
vendored
22
.gitignore
vendored
@@ -1,14 +1,15 @@
|
||||
.vscode/
|
||||
.idea/
|
||||
.kdev4/
|
||||
/.vscode/
|
||||
/.idea/
|
||||
/.kdev4/
|
||||
/.vs/
|
||||
|
||||
cmake-build-*/
|
||||
build*/
|
||||
local/
|
||||
venv/
|
||||
.cache/
|
||||
install/
|
||||
out/
|
||||
/cmake-build-*/
|
||||
/build*/
|
||||
/local/
|
||||
/venv/
|
||||
/.cache/
|
||||
/install/
|
||||
/out/
|
||||
|
||||
*.mgc
|
||||
*.kdev4
|
||||
@@ -17,5 +18,4 @@ imgui.ini
|
||||
CMakeUserPresets.json
|
||||
Brewfile.lock.json
|
||||
|
||||
.vs/
|
||||
vcpkg.json
|
||||
|
||||
@@ -347,8 +347,7 @@ macro(createPackage)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.imhex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
|
||||
|
||||
# install symlink for the old standard name
|
||||
file(CREATE_LINK net.werwolv.imhex.metainfo.xml ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml SYMBOLIC)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/net.werwolv.imhex.appdata.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dist/net.werwolv.imhex.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo RENAME net.werwolv.imhex.appdata.xml)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
87
dist/snap/snapcraft.yaml
vendored
Normal file
87
dist/snap/snapcraft.yaml
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
name: imhex
|
||||
base: core24
|
||||
version: ${IMHEX_VERSION}
|
||||
summary: Hex editor for reverse engineering
|
||||
description: |
|
||||
ImHex is a hex editor for reverse engineering, reverse engineering, and
|
||||
analyzing binary files. It provides a powerful and flexible interface for
|
||||
working with binary data, including features like pattern matching, scripting,
|
||||
and a customizable user interface.
|
||||
grade: stable
|
||||
confinement: classic
|
||||
contact: https://github.com/WerWolv/ImHex/discussions
|
||||
issues: https://github.com/WerWolv/ImHex/issues
|
||||
website: https://imhex.werwolv.net
|
||||
license: GPL-2.0-only
|
||||
icon: resources/icon.svg
|
||||
adopt-info: imhex
|
||||
|
||||
platforms:
|
||||
amd64:
|
||||
arm64:
|
||||
|
||||
apps:
|
||||
imhex:
|
||||
command: usr/local/bin/imhex
|
||||
desktop: usr/local/share/applications/imhex.desktop
|
||||
environment:
|
||||
LD_LIBRARY_PATH: '$SNAP/usr/local/lib:$SNAP/usr/local/lib/imhex:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH'
|
||||
XDG_DATA_DIRS: '$XDG_DATA_DIRS:$SNAP/usr/local/share:$SNAP/usr/local/lib:$SNAP/usr/local/share'
|
||||
XDG_CONFIG_DIRS: '$XDG_CONFIG_DIRS:$SNAP/usr/local/share'
|
||||
XDG_DATA_HOME: '$XDG_DATA_HOME:$SNAP_DATA'
|
||||
|
||||
parts:
|
||||
imhex:
|
||||
plugin: cmake
|
||||
source: .
|
||||
build-environment:
|
||||
- CC: /usr/bin/gcc-14
|
||||
- CXX: /usr/bin/g++-14
|
||||
cmake-parameters:
|
||||
- -DCMAKE_BUILD_TYPE=Release
|
||||
cmake-generator: Ninja
|
||||
build-packages:
|
||||
- cmake
|
||||
- ninja-build
|
||||
- gcc-14
|
||||
- g++-14
|
||||
- git
|
||||
- pkg-config
|
||||
- libglfw3-dev
|
||||
- libmagic-dev
|
||||
- libmbedtls-dev
|
||||
- libfontconfig-dev
|
||||
- libfreetype-dev
|
||||
- libdbus-1-dev
|
||||
- libcurl4-gnutls-dev
|
||||
- libgtk-3-dev
|
||||
- zlib1g-dev
|
||||
- libbz2-dev
|
||||
- liblzma-dev
|
||||
- libzstd-dev
|
||||
- liblz4-dev
|
||||
- libssh2-1-dev
|
||||
stage-packages:
|
||||
- libglfw3
|
||||
- libmagic1
|
||||
- libmbedtls14
|
||||
- libfontconfig1
|
||||
- libfreetype6
|
||||
- libdbus-1-3
|
||||
- libcurl4-gnutls-dev
|
||||
- libgtk-3-0
|
||||
- zlib1g
|
||||
- libbz2-1.0
|
||||
- liblzma5
|
||||
- libzstd1
|
||||
- liblz4-1
|
||||
- libssh2-1
|
||||
prime:
|
||||
- -usr/include/*
|
||||
- -usr/local/include/*
|
||||
- -usr/lib/**/*.a
|
||||
- -usr/local/lib/**/*.a
|
||||
- -usr/lib/**/*.la
|
||||
- -usr/local/lib/**/*.la
|
||||
- -usr/share/doc/*
|
||||
- -usr/share/man/*
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <time.h>
|
||||
#include "imgui_internal.h"
|
||||
#include <cmath>
|
||||
|
||||
#ifndef IMPLOT_VERSION
|
||||
#error Must include implot.h before implot_internal.h
|
||||
@@ -120,7 +121,7 @@ static inline T ImRemap01(T x, T x0, T x1) { return (x - x0) / (x1 - x0); }
|
||||
// Returns always positive modulo (assumes r != 0)
|
||||
static inline int ImPosMod(int l, int r) { return (l % r + r) % r; }
|
||||
// Returns true if val is NAN
|
||||
static inline bool ImNan(double val) { return isnan(val); }
|
||||
static inline bool ImNan(double val) { return std::isnan(val); }
|
||||
// Returns true if val is NAN or INFINITY
|
||||
static inline bool ImNanOrInf(double val) { return !(val >= -DBL_MAX && val <= DBL_MAX) || ImNan(val); }
|
||||
// Turns NANs to 0s
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#ifndef IMPLOT3D_VERSION
|
||||
#include "implot3d.h"
|
||||
#endif
|
||||
@@ -58,7 +60,7 @@ template <typename TSet, typename TFlag> static inline bool ImHasFlag(TSet set,
|
||||
template <typename TSet, typename TFlag> static inline void ImFlipFlag(TSet& set, TFlag flag) { ImHasFlag(set, flag) ? set &= ~flag : set |= flag; }
|
||||
template <typename T> static inline T ImRemap01(T x, T x0, T x1) { return (x1 - x0) ? ((x - x0) / (x1 - x0)) : 0; }
|
||||
// Returns true if val is NAN
|
||||
static inline bool ImNan(float val) { return isnan(val); }
|
||||
static inline bool ImNan(float val) { return std::isnan(val); }
|
||||
// Returns true if val is NAN or INFINITY
|
||||
static inline bool ImNanOrInf(float val) { return !(val >= -FLT_MAX && val <= FLT_MAX) || ImNan(val); }
|
||||
// Turns NANs to 0s
|
||||
|
||||
Reference in New Issue
Block a user