Skip to content

Commit 8b026d5

Browse files
authored
Merge pull request #611 from NixOS/misc-cleanups
Misc cleanups
2 parents ae17b27 + aed52ef commit 8b026d5

File tree

5 files changed

+57
-18
lines changed

5 files changed

+57
-18
lines changed

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# EditorConfig configuration for PatchELF
2+
# http://EditorConfig.org
3+
4+
# Top-most EditorConfig file
5+
root = true
6+
7+
# Unix-style newlines with a newline ending every file, UTF-8 charset
8+
[*]
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
charset = utf-8
13+
14+
# Match Nix files, set indent to spaces with width of two
15+
[*.nix]
16+
indent_style = space
17+
indent_size = 2
18+
19+
# Match C++/C/shell, set indent to spaces with width of four
20+
[*.{hpp,cc,hh,c,h,sh}]
21+
indent_style = space
22+
indent_size = 4
23+
24+
# Match diffs, avoid to trim trailing whitespace
25+
[*.{diff,patch}]
26+
trim_trailing_whitespace = false

CMakeLists.txt

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,12 @@ cmake_minimum_required(VERSION 3.5)
22

33
project(patchelf)
44

5-
include(GNUInstallDirs)
6-
7-
set(CMAKE_CXX_STANDARD 17)
8-
set(CMAKE_CXX_EXTENSIONS OFF)
9-
10-
set(PAGESIZE 4096)
11-
12-
set(ADDITIONAL_HEADERS src/elf.h)
13-
14-
set(SOURCES src/patchelf.cc)
15-
165
file(READ version VERSION)
176

18-
add_executable(${PROJECT_NAME} ${SOURCES} ${ADDITIONAL_HEADERS})
19-
20-
target_compile_definitions(
21-
patchelf PRIVATE PAGESIZE=${PAGESIZE}
22-
PACKAGE_STRING="patchelf ${VERSION_STRING}")
7+
include(GNUInstallDirs)
238

24-
install(TARGETS patchelf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
9+
add_subdirectory(src)
10+
# add_subdirectory(tests) # TODO
2511

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

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ make check
8181
sudo make install
8282
```
8383

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

8686
```console
8787
mkdir build
@@ -91,6 +91,16 @@ ninja all
9191
sudo ninja install
9292
```
9393

94+
### Via [Meson](https://mesonbuild.com/) (and [Ninja](https://ninja-build.org/))
95+
96+
```console
97+
mkdir build
98+
meson configure build
99+
cd build
100+
ninja all
101+
sudo ninja install
102+
```
103+
94104
### Via Nix
95105

96106
You can build with Nix in several ways.

flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@
3939
(lib.fileset.difference ./src (
4040
lib.fileset.unions [
4141
./src/Makefile.am
42+
./src/CMakeLists.txt
4243
./src/meson.build
4344
]
4445
))
4546
(lib.fileset.difference ./tests (
4647
lib.fileset.unions [
4748
./tests/Makefile.am
49+
#./tests/CMakeLists.txt
4850
#./tests/meson.build
4951
]
5052
))
@@ -61,12 +63,15 @@
6163

6264
cmakeSrcFiles = [
6365
./CMakeLists.txt
66+
./src/CMakeLists.txt
67+
#./tests/CMakeLists.txt
6468
];
6569

6670
mesonSrcFiles = [
6771
./meson.build
6872
./meson.options
6973
./src/meson.build
74+
#./tests/meson.build
7075
];
7176

7277
autotoolsSrc = lib.fileset.toSource {

src/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
set(CMAKE_CXX_STANDARD 17)
2+
set(CMAKE_CXX_EXTENSIONS OFF)
3+
4+
set(PAGESIZE 4096)
5+
6+
add_executable(${PROJECT_NAME} patchelf.cc elf.h patchelf.h)
7+
8+
target_compile_definitions(
9+
patchelf PRIVATE PAGESIZE=${PAGESIZE}
10+
PACKAGE_STRING="patchelf ${VERSION_STRING}")
11+
12+
install(TARGETS patchelf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

0 commit comments

Comments
 (0)