Merge pull request #2116 from felixhandte/pkg-config-again-again
Fix pkg-config File Generation Again Again
This commit is contained in:
commit
3b39ce6b52
@ -184,6 +184,7 @@ matrix:
|
||||
os: osx
|
||||
script:
|
||||
- make test
|
||||
- make -C lib all
|
||||
|
||||
- name: zbuff test
|
||||
if: branch = master
|
||||
|
4
Makefile
4
Makefile
@ -45,7 +45,7 @@ allmost: allzstd zlibwrapper
|
||||
|
||||
# skip zwrapper, can't build that on alternate architectures without the proper zlib installed
|
||||
.PHONY: allzstd
|
||||
allzstd: lib
|
||||
allzstd: lib-all
|
||||
$(MAKE) -C $(PRGDIR) all
|
||||
$(MAKE) -C $(TESTDIR) all
|
||||
|
||||
@ -55,7 +55,7 @@ all32:
|
||||
$(MAKE) -C $(TESTDIR) all32
|
||||
|
||||
.PHONY: lib lib-release libzstd.a
|
||||
lib lib-release :
|
||||
lib lib-release lib-all :
|
||||
@$(MAKE) -C $(ZSTDDIR) $@
|
||||
|
||||
.PHONY: zstd zstd-release
|
||||
|
@ -137,11 +137,12 @@ endif ()
|
||||
if (UNIX)
|
||||
# pkg-config
|
||||
set(PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||
set(LIBDIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
set(INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(VERSION "${zstd_VERSION}")
|
||||
add_custom_target(libzstd.pc ALL
|
||||
${CMAKE_COMMAND} -DIN="${LIBRARY_DIR}/libzstd.pc.in" -DOUT="libzstd.pc"
|
||||
-DPREFIX="${PREFIX}" -DVERSION="${VERSION}"
|
||||
-DPREFIX="${PREFIX}" -DLIBDIR="${LIBDIR}" -DINCLUDEDIR="${INCLUDEDIR}" -DVERSION="${VERSION}"
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig.cmake"
|
||||
COMMENT "Creating pkg-config file")
|
||||
|
||||
|
37
lib/Makefile
37
lib/Makefile
@ -180,10 +180,13 @@ else
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: default all clean install uninstall
|
||||
.PHONY: default lib-all all clean install uninstall
|
||||
|
||||
default: lib-release
|
||||
|
||||
# alias
|
||||
lib-all: all
|
||||
|
||||
all: lib
|
||||
|
||||
libzstd.a: ARFLAGS = rcs
|
||||
@ -250,6 +253,8 @@ clean:
|
||||
#-----------------------------------------------------------------------------
|
||||
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku))
|
||||
|
||||
all: libzstd.pc
|
||||
|
||||
DESTDIR ?=
|
||||
# directory variables : GNU conventions prefer lowercase
|
||||
# see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
|
||||
@ -257,11 +262,31 @@ DESTDIR ?=
|
||||
prefix ?= /usr/local
|
||||
PREFIX ?= $(prefix)
|
||||
exec_prefix ?= $(PREFIX)
|
||||
libdir ?= $(exec_prefix)/lib
|
||||
EXEC_PREFIX ?= $(exec_prefix)
|
||||
libdir ?= $(EXEC_PREFIX)/lib
|
||||
LIBDIR ?= $(libdir)
|
||||
includedir ?= $(PREFIX)/include
|
||||
INCLUDEDIR ?= $(includedir)
|
||||
|
||||
PCLIBDIR ?= $(shell echo "$(LIBDIR)" | sed -n -E -e "s@^$(EXEC_PREFIX)(/|$$)@@p")
|
||||
PCINCDIR ?= $(shell echo "$(INCLUDEDIR)" | sed -n -E -e "s@^$(PREFIX)(/|$$)@@p")
|
||||
|
||||
ifeq (,$(PCLIBDIR))
|
||||
# Additional prefix check is required, since the empty string is technically a
|
||||
# valid PCLIBDIR
|
||||
ifeq (,$(shell echo "$(LIBDIR)" | sed -n -E -e "\\@^$(EXEC_PREFIX)(/|$$)@ p"))
|
||||
$(error configured libdir ($(LIBDIR)) is outside of prefix ($(PREFIX)), can't generate pkg-config file)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (,$(PCINCDIR))
|
||||
# Additional prefix check is required, since the empty string is technically a
|
||||
# valid PCINCDIR
|
||||
ifeq (,$(shell echo "$(INCLUDEDIR)" | sed -n -E -e "\\@^$(PREFIX)(/|$$)@ p"))
|
||||
$(error configured includedir ($(INCLUDEDIR)) is outside of exec_prefix ($(EXEC_PREFIX)), can't generate pkg-config file)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly))
|
||||
PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig
|
||||
else
|
||||
@ -281,9 +306,11 @@ INSTALL_DATA ?= $(INSTALL) -m 644
|
||||
libzstd.pc:
|
||||
libzstd.pc: libzstd.pc.in
|
||||
@echo creating pkgconfig
|
||||
$(Q)sed -e 's|@PREFIX@|$(PREFIX)|' \
|
||||
-e 's|@VERSION@|$(VERSION)|' \
|
||||
$< >$@
|
||||
$(Q)@sed -E -e 's|@PREFIX@|$(PREFIX)|' \
|
||||
-e 's|@LIBDIR@|$(PCLIBDIR)|' \
|
||||
-e 's|@INCLUDEDIR@|$(PCINCDIR)|' \
|
||||
-e 's|@VERSION@|$(VERSION)|' \
|
||||
$< >$@
|
||||
|
||||
install: install-pc install-static install-shared install-includes
|
||||
@echo zstd static and shared library installed
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
prefix=@PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
includedir=${prefix}/@INCLUDEDIR@
|
||||
libdir=${exec_prefix}/@LIBDIR@
|
||||
|
||||
Name: zstd
|
||||
Description: fast lossless compression algorithm library
|
||||
|
Loading…
Reference in New Issue
Block a user