Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig configuration for PatchELF
# http://EditorConfig.org

# Top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file, UTF-8 charset
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

# Match Nix files, set indent to spaces with width of two
[*.nix]
indent_style = space
indent_size = 2

# Match C++/C/shell, set indent to spaces with width of four
[*.{hpp,cc,hh,c,h,sh}]
indent_style = space
indent_size = 4

# Match diffs, avoid to trim trailing whitespace
[*.{diff,patch}]
trim_trailing_whitespace = false
20 changes: 3 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,12 @@ cmake_minimum_required(VERSION 3.5)

project(patchelf)

include(GNUInstallDirs)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)

set(PAGESIZE 4096)

set(ADDITIONAL_HEADERS src/elf.h)

set(SOURCES src/patchelf.cc)

file(READ version VERSION)

add_executable(${PROJECT_NAME} ${SOURCES} ${ADDITIONAL_HEADERS})

target_compile_definitions(
patchelf PRIVATE PAGESIZE=${PAGESIZE}
PACKAGE_STRING="patchelf ${VERSION_STRING}")
include(GNUInstallDirs)

install(TARGETS patchelf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
add_subdirectory(src)
# add_subdirectory(tests) # TODO

install(FILES patchelf.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)

Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ make check
sudo make install
```

## Via [CMake](https://cmake.org/) (and [Ninja](https://ninja-build.org/))
### Via [CMake](https://cmake.org/) (and [Ninja](https://ninja-build.org/))

```console
mkdir build
Expand All @@ -91,6 +91,16 @@ ninja all
sudo ninja install
```

### Via [Meson](https://mesonbuild.com/) (and [Ninja](https://ninja-build.org/))

```console
mkdir build
meson configure build
cd build
ninja all
sudo ninja install
```

### Via Nix

You can build with Nix in several ways.
Expand Down
5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@
(lib.fileset.difference ./src (
lib.fileset.unions [
./src/Makefile.am
./src/CMakeLists.txt
./src/meson.build
]
))
(lib.fileset.difference ./tests (
lib.fileset.unions [
./tests/Makefile.am
#./tests/CMakeLists.txt
#./tests/meson.build
]
))
Expand All @@ -61,12 +63,15 @@

cmakeSrcFiles = [
./CMakeLists.txt
./src/CMakeLists.txt
#./tests/CMakeLists.txt
];

mesonSrcFiles = [
./meson.build
./meson.options
./src/meson.build
#./tests/meson.build
];

autotoolsSrc = lib.fileset.toSource {
Expand Down
12 changes: 12 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)

set(PAGESIZE 4096)

add_executable(${PROJECT_NAME} patchelf.cc elf.h patchelf.h)

target_compile_definitions(
patchelf PRIVATE PAGESIZE=${PAGESIZE}
PACKAGE_STRING="patchelf ${VERSION_STRING}")

install(TARGETS patchelf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Loading