Compare commits
9 Commits
v0.1.0-rc1
...
master
Author | SHA1 | Date | |
---|---|---|---|
7be16e6e5c | |||
e7b84e0bf6 | |||
67bc69c53e | |||
1a303c69cd | |||
b2ded0cd62 | |||
de0d0e9fab | |||
c4979825b7 | |||
cc9eae6d01 | |||
ef14ee964a |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
|||
*.o
|
||||
*.obj
|
||||
*.a
|
||||
*.so
|
||||
*.so.*
|
||||
|
|
|
@ -12,8 +12,14 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(dynstr C)
|
||||
add_library(${PROJECT_NAME} STATIC "dynstr.c")
|
||||
project(dynstr LANGUAGES C VERSION 0.1.0)
|
||||
add_library(${PROJECT_NAME} "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)
|
||||
|
|
49
Makefile
49
Makefile
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2020 Xavier Del Campo Romero
|
||||
# Copyright 2020-2023 Xavier Del Campo Romero
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -14,24 +14,47 @@
|
|||
|
||||
.POSIX:
|
||||
|
||||
PREFIX = /usr/local
|
||||
PROJECT = libdynstr.a
|
||||
CFLAGS = -Iinclude
|
||||
prefix = /usr/local
|
||||
exec_prefix = $(prefix)
|
||||
includedir = $(prefix)/include
|
||||
libdir = $(exec_prefix)/lib
|
||||
pkgcfgdir = $(libdir)/pkgconfig
|
||||
PROJECT = libdynstr
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 1
|
||||
PATCH_VERSION = 0
|
||||
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)
|
||||
PROJECT_A = $(PROJECT).a
|
||||
PROJECT_SO = $(PROJECT).so.$(VERSION)
|
||||
PROJECT_SO_FQ = $(PROJECT).so.$(MAJOR_VERSION)
|
||||
PROJECT_SO_NV = $(PROJECT).so
|
||||
CFLAGS = -Iinclude -fPIC -O1
|
||||
LDFLAGS = -shared
|
||||
DEPS = \
|
||||
dynstr.o
|
||||
|
||||
all: $(PROJECT)
|
||||
all: $(PROJECT_A) $(PROJECT_SO)
|
||||
|
||||
install: $(PROJECT)
|
||||
mkdir -p $(PREFIX)/include
|
||||
cp include/dynstr.h $(PREFIX)/include
|
||||
chmod 0644 $(PREFIX)/include/dynstr.h
|
||||
mkdir -p $(PREFIX)/bin
|
||||
cp $(PROJECT) $(PREFIX)/bin
|
||||
chmod 0755 $(PREFIX)/bin/$(PROJECT)
|
||||
install: all $(pkgcfgdir)/dynstr.pc
|
||||
mkdir -p $(DESTDIR)$(includedir)
|
||||
cp include/dynstr.h $(DESTDIR)$(includedir)
|
||||
chmod 0644 $(DESTDIR)$(includedir)/dynstr.h
|
||||
mkdir -p $(DESTDIR)$(libdir)
|
||||
cp $(PROJECT_A) $(PROJECT_SO) $(DESTDIR)$(libdir)
|
||||
chmod 0755 $(libdir)/$(PROJECT_A) $(DESTDIR)$(libdir)/$(PROJECT_SO)
|
||||
ln -fs $(DESTDIR)$(libdir)/$(PROJECT_SO) $(DESTDIR)$(libdir)/$(PROJECT_SO_FQ)
|
||||
ln -fs $(DESTDIR)$(libdir)/$(PROJECT_SO) $(DESTDIR)$(libdir)/$(PROJECT_SO_NV)
|
||||
|
||||
clean:
|
||||
rm -f $(DEPS)
|
||||
|
||||
$(PROJECT): $(DEPS)
|
||||
$(PROJECT_A): $(DEPS)
|
||||
$(AR) $(ARFLAGS) $@ $(DEPS)
|
||||
|
||||
$(PROJECT_SO): $(DEPS)
|
||||
$(CC) $(LDFLAGS) $(DEPS) -o $@
|
||||
|
||||
$(pkgcfgdir)/dynstr.pc: dynstr.pc
|
||||
mkdir -p $(DESTDIR)$(pkgcfgdir)
|
||||
sed -e 's,/usr/local,$(DESTDIR)$(prefix),' $< > $@
|
||||
chmod 0644 $@
|
||||
|
|
11
dynstr.pc
Normal file
11
dynstr.pc
Normal file
|
@ -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
|
Loading…
Reference in New Issue
Block a user