diff options
| -rw-r--r-- | CMakeLists.txt | 6 | ||||
| -rw-r--r-- | Makefile | 9 | ||||
| -rw-r--r-- | dynstr.pc | 11 |
3 files changed, 25 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b21447..91609ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,3 +17,9 @@ add_library(${PROJECT_NAME} STATIC "dynstr.c") target_include_directories(${PROJECT_NAME} PUBLIC "include") install(TARGETS ${PROJECT_NAME}) install(DIRECTORY include/ TYPE INCLUDE) +file(READ ${CMAKE_CURRENT_LIST_DIR}/dynstr.pc dynstr_pc) +string(REPLACE /usr/local ${CMAKE_INSTALL_PREFIX} dynstr_repl_pc ${dynstr_pc}) +file(WRITE ${CMAKE_BINARY_DIR}/dynstr.pc ${dynstr_repl_pc}) +include(GNUInstallDirs) +install(FILES ${CMAKE_BINARY_DIR}/dynstr.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) @@ -15,6 +15,8 @@ .POSIX: PREFIX = /usr/local +DST = $(PREFIX)/lib +PC_DST = $(DST)/pkgconfig PROJECT = libdynstr.a CFLAGS = -Iinclude DEPS = \ @@ -22,7 +24,7 @@ DEPS = \ all: $(PROJECT) -install: $(PROJECT) +install: $(PROJECT) $(PC_DST)/dynstr.pc mkdir -p $(PREFIX)/include cp include/dynstr.h $(PREFIX)/include chmod 0644 $(PREFIX)/include/dynstr.h @@ -35,3 +37,8 @@ clean: $(PROJECT): $(DEPS) $(AR) $(ARFLAGS) $@ $(DEPS) + +$(PC_DST)/dynstr.pc: dynstr.pc + mkdir -p $(PC_DST) + sed -e 's,/usr/local,$(PREFIX),' $< > $@ + chmod 0644 $@ diff --git a/dynstr.pc b/dynstr.pc new file mode 100644 index 0000000..0f6f48a --- /dev/null +++ b/dynstr.pc @@ -0,0 +1,11 @@ +prefix=/usr/local +exec_prefix=${prefix} +includedir=${prefix}/include +libdir=${exec_prefix}/lib + +Name: dynstr +Url: https://gitea.privatedns.org/xavi/dynstr +Description: Minimal library that provides dynamic strings using plain C99. +Version: 0.1.0 +Cflags: -I${includedir} +Libs: -L${libdir} -ldynstr |
