From a4c432f435dd715892a8f8c7148c3203e4e769f1 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Mon, 27 Jun 2022 21:11:35 +0200 Subject: [PATCH] git: Moved build instructions from the readme to individual files --- README.md | 91 ++------------------------------------- dist/compiling/linux.md | 41 ++++++++++++++++++ dist/compiling/macOS.md | 41 ++++++++++++++++++ dist/compiling/windows.md | 23 ++++++++++ 4 files changed, 108 insertions(+), 88 deletions(-) create mode 100644 dist/compiling/linux.md create mode 100644 dist/compiling/macOS.md create mode 100644 dist/compiling/windows.md diff --git a/README.md b/README.md index b044a72ad..088f9a41a 100644 --- a/README.md +++ b/README.md @@ -127,103 +127,16 @@ Nightlies are available via GitHub Actions [here](https://github.com/WerWolv/ImH - MacOS • __x86_64__ - [DMG](https://nightly.link/WerWolv/ImHex/workflows/build/master/macOS%20DMG.zip) - Linux • __x86_64__ - - [ELF](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20ELF.zip) - [DEB](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20DEB.zip) - - [Flatpak](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20Flatpak.zip) - [AppImage](https://nightly.link/WerWolv/ImHex/workflows/build/master/Linux%20AppImage.zip) ## Compiling -You need a C++20 compatible compiler such as GCC 10.2.0 to compile ImHex. +To compile ImHex, a C++20 compiler is required. Releases are all mainly built using GCC, however on macOS, clang is also required to compile some ObjC code. Many dependencies are bundled into the repository using submodules so make sure to clone it using the `--recurse-submodules` option. All dependencies that aren't bundled, can be installed using the dependency installer scripts found in the `/dist` folder. -For working examples - -### Windows - -On Windows, ImHex is built through msys2 / mingw. To install all dependencies, open a mys2 window and run the PKGCONFIG script in the [dist/msys2](dist/msys2) folder. -After all the dependencies are installed, run the following commands to build ImHex: - -```sh -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -make -j -``` - ---- - -To create a standalone zipfile on Windows, get the Python standard library (e.g. from https://github.com/python/cpython/tree/master/Lib) and place the files and folders in `lib/python3.8` next to your built executable. Don't forget to also copy the `libpython3.8.dll` and `libwinpthread-1.dll` from your mingw setup next to the executable. - -- Copy the files inside the `/resources/lib/python` folder into the `lib` folder next to your built executable. -- Place your magic databases in the `magic` folder next to your built executable -- Place your patterns in the `pattern` folder next to your built executable -- Place your include pattern files in the `include` folder next to your built executable - -### macOS - -To build ImHex on macOS, run the following commands: - -```sh -brew bundle --no-lock --file dist/Brewfile -mkdir build -cd build -CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++ PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" cmake -DCMAKE_BUILD_TYPE=Release .. -make -j -``` - -Install the ImHex executable as well as libimhex.dylib to wherever ImHex should be installed. - -All other files belong in `~/Library/Application Support/imhex`: -``` -Patterns: ~/Library/Application Support/imhex/patterns -Pattern Includes: ~/Library/Application Support/imhex/includes -Magic files: ~/Library/Application Support/imhex/magic -Python: ~/Library/Application Support/imhex/lib/pythonX.X -Plugins: ~/Library/Application Support/imhex/plugins -Configuration: ~/Library/Application Support/imhex/config -Resources: ~/Library/Application Support/imhex/resources -``` - -If the build fails while trying to find the macOS libraries, make sure you have -XCode installed with `xcode-select --install`. Homebrew will also help get the -most recent SDK installed and configured with `brew doctor`. - -### Linux - -Dependency installation scripts are available for many common Linux distributions in the [/dist](dist) folder. -After all the dependencies are installed, run the following commands to build ImHex: - -```sh -mkdir build -cd build -cmake -DCMAKE_BUILD_TYPE=Release .. -make -j -``` - ---- - -Put the ImHex executable into the `/usr/bin` folder. -Put libimhex.so into the `/usr/lib` folder. -Configuration files go to `/etc/xdg/imhex` or `~/.config/imhex`. -All other files belong in `/usr/share/imhex` or `~/.local/share/imhex`: - -``` -Patterns: /usr/share/imhex/patterns -Pattern Includes: /usr/share/imhex/includes -Magic files: /usr/share/imhex/magic -Python: /usr/share/imhex/lib/pythonX.X -Plugins: /usr/share/imhex/plugins -Configuration: /etc/xdg/imhex/config -Resources: /usr/share/imhex/resources -``` - -All paths follow the XDG Base Directories standard, and can thus be modified -with the environment variables `XDG_CONFIG_HOME`, `XDG_CONFIG_DIRS`, -`XDG_DATA_HOME` and `XDG_DATA_DIRS`. - ## Credits ### Contributors @@ -231,6 +144,8 @@ with the environment variables `XDG_CONFIG_HOME`, `XDG_CONFIG_DIRS`, - [Mary](https://github.com/Thog) for her immense help porting ImHex to MacOS and help during development - [Roblabla](https://github.com/Roblabla) for adding MSI Installer support to ImHex - [jam1garner](https://github.com/jam1garner) and [raytwo](https://github.com/raytwo) for their help with adding Rust support to plugins +- [Mailaender](https://github.com/Mailaender) for getting ImHex onto Flathub +- [iTrooz](https://github.com/iTrooz) for many improvements related to release packaging and the GitHub Action runners. - Everybody else who has reported issues on Discord or GitHub that I had great conversations with :) ### Libraries diff --git a/dist/compiling/linux.md b/dist/compiling/linux.md new file mode 100644 index 000000000..a2cb8122a --- /dev/null +++ b/dist/compiling/linux.md @@ -0,0 +1,41 @@ +### Compiling ImHex on Linux + +Dependency installation scripts are available for many common Linux distributions in the [/dist](dist) folder. +After all the dependencies are installed, run the following commands to build ImHex: + +```sh +mkdir -p build +cd build +CC=gcc-12 CXX=g++-12 cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ + -DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \ + -DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \ + -DRUST_PATH="$HOME/.cargo/bin/" \ + .. +make -j 4 install +``` + +--- + +Put the ImHex executable into the `/usr/bin` folder. +Put libimhex.so into the `/usr/lib` folder. +Configuration files go to `/usr/etc/imhex` or `~/.config/imhex`. +All other files belong in `/usr/share/imhex` or `~/.local/share/imhex`: + +``` +Patterns: /usr/share/imhex/patterns +Pattern Includes: /usr/share/imhex/includes +Magic files: /usr/share/imhex/magic +Python: /usr/share/imhex/lib/pythonX.X +Plugins: /usr/share/imhex/plugins +Configuration: /etc/xdg/imhex/config +``` + +All paths follow the XDG Base Directories standard, and can thus be modified +with the environment variables `XDG_CONFIG_HOME`, `XDG_CONFIG_DIRS`, +`XDG_DATA_HOME` and `XDG_DATA_DIRS`. \ No newline at end of file diff --git a/dist/compiling/macOS.md b/dist/compiling/macOS.md new file mode 100644 index 000000000..b375c22a6 --- /dev/null +++ b/dist/compiling/macOS.md @@ -0,0 +1,41 @@ +### Compiling ImHex on macOS + +To build ImHex on macOS, run the following commands: + +```sh +brew bundle --no-lock --file dist/Brewfile +mkdir -p build +cd build +CC=$(brew --prefix gcc@12)/bin/gcc-12 \ +CXX=$(brew --prefix gcc@12)/bin/g++-12 \ +OBJC=$(brew --prefix llvm)/bin/clang \ +OBJCXX=$(brew --prefix llvm)/bin/clang++ \ +PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \ +MACOSX_DEPLOYMENT_TARGET="10.15" \ +cmake \ + -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCREATE_BUNDLE=ON \ + -DCREATE_PACKAGE=ON \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \ + -DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \ + .. +make -j4 package +``` + +Open the generated .dmg file and drag-n-drop the ImHex executable to the Applications folder + +All other files belong in `~/Library/Application Support/imhex`: +``` +Patterns: ~/Library/Application Support/imhex/patterns +Pattern Includes: ~/Library/Application Support/imhex/includes +Magic files: ~/Library/Application Support/imhex/magic +Python: ~/Library/Application Support/imhex/lib/pythonX.X +Plugins: ~/Library/Application Support/imhex/plugins +Configuration: ~/Library/Application Support/imhex/config +``` + +If the build fails while trying to find the macOS libraries, make sure you have +XCode installed with `xcode-select --install`. Homebrew will also help get the +most recent SDK installed and configured with `brew doctor`. \ No newline at end of file diff --git a/dist/compiling/windows.md b/dist/compiling/windows.md new file mode 100644 index 000000000..206c70dc0 --- /dev/null +++ b/dist/compiling/windows.md @@ -0,0 +1,23 @@ +### Compiling ImHex on Windows + +On Windows, ImHex is built through msys2 / mingw. To install all dependencies, open a mys2 window and run the PKGCONFIG script in the [dist/msys2](dist/msys2) folder. +After all the dependencies are installed, run the following commands to build ImHex: + +```sh +mkdir build +cd build +cmake -G "MinGW Makefiles" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$PWD/install" \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_C_FLAGS="-fuse-ld=lld" \ + -DCMAKE_CXX_FLAGS="-fuse-ld=lld" \ + -DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \ + -DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \ + -DRUST_PATH="$USERPROFILE/.cargo/bin/" \ + .. +mingw32-make -j install +``` + +ImHex will look for any extra resources either in various folders directly next to the executable or in `%localappdata%/imhex` \ No newline at end of file