void-packages/srcpkgs/tmines/patches/cmake.patch
Đoàn Trần Công Danh 4f75cf25fd srcpkgs/t*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

41 lines
1.1 KiB
Diff

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,6 +58,28 @@ add_library(iodevice_simulation src/iodevice_simulation.cpp)
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIRS})
+include (CheckCSourceCompiles)
+
+check_c_source_compiles (
+ "#include <argp.h>
+ int main () {
+ int argc=1;
+ char *argv[]={\"test\"};
+ argp_parse(0,argc,argv,0,0,0);
+ return 0;
+ }" LIBC_HAS_ARGP
+)
+
+if (NOT LIBC_HAS_ARGP)
+ message(STATUS "libc does not have argp")
+ find_library (ARGP_LIB argp REQUIRED)
+ if (ARGP_LIB)
+ message(STATUS "Found libargp")
+ else(ARGP_LIB)
+ message(FATAL_ERROR "libargp required but not found")
+ endif(ARGP_LIB)
+endif(NOT LIBC_HAS_ARGP)
+
add_executable(tmines src/tmines.cpp)
add_subdirectory(doc)
@@ -68,6 +90,9 @@ target_link_libraries(tmines minefield)
target_link_libraries(tmines iodevice_curses)
target_link_libraries(tmines iodevice_simulation)
target_link_libraries(tmines ${CURSES_LIBRARIES})
+if (ARGP_LIB)
+ target_link_libraries (tmines ${ARGP_LIB})
+endif(ARGP_LIB)
install(TARGETS tmines DESTINATION bin)
# add manpage