Commit Graph

10 Commits (dc983e7d68aa2a78ceace5a73f3f29ba86b1383b)

Author SHA1 Message Date
Érico Nogueira 4d09952701 [lib] Fix libzstd.pc for lib-mt builds
Add the libzstd.pc target to the lib target in lib/Makefile, which makes
it inherit LDFLAGS_DYNLIB from the lib-mt target. This allows us to add
a Libs.private field to libzstd.pc which gets conditionally populated
with '-pthread'.

The 1.5.0 release notes mention that the static library isn't
multi-threaded by default, due to concern for people building static
binaries with libzstd:

   Now the dynamic library supports multi-threaded compression by
   default.  Note that this property is not extended to the static
   library because doing so would have impacted the build script of
   existing client applications (requiring them to add -pthread to their
   recipe), thus potentially breaking their build.

To get closer to being able to enable multi-threading for all library
builds by default, this commit makes it so that any libzstd consumer
using pkg-config gets the correct flags.

We also fix the indentation of the rule for libzstd.pc and move it
outside the if/endif block for install rules (which uses a list of OSs
where the rules were validated), so the rule is available for all users
of the 'lib*' targets.
2021-06-19 17:42:24 -03:00
W. Felix Handte b521183c74 Avoid Use of Regexes in Building Package-Config File 2020-12-08 20:10:05 -05:00
W. Felix Handte 15561bcf74 Fix pkg-config File Generation Again Again
Resubmission of #2001. This switches the `sed` invocations to use `-E`,
extended regex syntax, which is better standardized across platforms.
I guess.

Same test plan:

```
make -C lib clean libzstd.pc
cat lib/libzstd.pc

echo # should fail
make -C lib clean libzstd.pc     LIBDIR=/foo
make -C lib clean libzstd.pc INCLUDEDIR=/foo
make -C lib clean libzstd.pc     LIBDIR=/usr/localfoo
make -C lib clean libzstd.pc INCLUDEDIR=/usr/localfoo
make -C lib clean libzstd.pc     LIBDIR=/usr/local/lib     prefix=/foo
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/include prefix=/foo

echo # should succeed
make -C lib clean libzstd.pc     LIBDIR=/usr/local/foo
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/foo
make -C lib clean libzstd.pc     LIBDIR=/usr/local/
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/
make -C lib clean libzstd.pc     LIBDIR=/usr/local
make -C lib clean libzstd.pc INCLUDEDIR=/usr/local
make -C lib clean libzstd.pc     LIBDIR=/tmp/foo prefix=/tmp
make -C lib clean libzstd.pc INCLUDEDIR=/tmp/foo prefix=/tmp
make -C lib clean libzstd.pc     LIBDIR=/tmp/foo prefix=/tmp/foo
make -C lib clean libzstd.pc INCLUDEDIR=/tmp/foo prefix=/tmp/foo

echo # should also succeed
make -C lib clean libzstd.pc prefix=/foo LIBDIR=/foo/bar INCLUDEDIR=/foo/
cat lib/libzstd.pc

mkdir out
cd out
cmake ../build/cmake
make
cat lib/libzstd.pc
```
2020-05-08 16:11:32 -04:00
Felix Handte b669c5347a
Revert "Fix pkg-config File Generation Again" (#2016) 2020-02-26 10:52:49 -08:00
W. Felix Handte e668c9b528 Fix pkg-config File Generation Again
Revises #1851. Fixes #1900. Replaces #1930.

Thanks to @orbea, @neheb, @Polynomial-C, and particularly @eli-schwartz for
pointing out the problem and suggesting solutions.

Tested with

  ```
  make -C lib clean libzstd.pc
  cat lib/libzstd.pc

  # should fail
  make -C lib clean libzstd.pc     LIBDIR=/foo
  make -C lib clean libzstd.pc INCLUDEDIR=/foo
  make -C lib clean libzstd.pc     LIBDIR=/usr/localfoo
  make -C lib clean libzstd.pc INCLUDEDIR=/usr/localfoo
  make -C lib clean libzstd.pc     LIBDIR=/usr/local/lib     prefix=/foo
  make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/include prefix=/foo

  # should succeed
  make -C lib clean libzstd.pc     LIBDIR=/usr/local/foo
  make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/foo
  make -C lib clean libzstd.pc     LIBDIR=/usr/local/
  make -C lib clean libzstd.pc INCLUDEDIR=/usr/local/
  make -C lib clean libzstd.pc     LIBDIR=/usr/local
  make -C lib clean libzstd.pc INCLUDEDIR=/usr/local
  make -C lib clean libzstd.pc     LIBDIR=/tmp/foo prefix=/tmp
  make -C lib clean libzstd.pc INCLUDEDIR=/tmp/foo prefix=/tmp
  make -C lib clean libzstd.pc     LIBDIR=/tmp/foo prefix=/tmp/foo
  make -C lib clean libzstd.pc INCLUDEDIR=/tmp/foo prefix=/tmp/foo

  # should also succeed
  make -C lib clean libzstd.pc prefix=/foo LIBDIR=/foo/bar INCLUDEDIR=/foo/
  cat lib/libzstd.pc

  mkdir out
  cd out
  cmake ../build/cmake
  make
  cat lib/libzstd.pc
  ```
2020-02-18 12:23:50 -05:00
W. Felix Handte 74bd76c3ff In pkg-config File, Derive Lib and Include Dir from Prefix at Use-Time
Addresses #1794. Instead of deriving the lib dir and include dir at
build-time, let's do it like everyone else does at pkg-config run-time.

This has the disadvantage that we can no longer override LIBDIR and
INCLUDEDIR in the Makefile and have that reflected in the .pc file.
2019-10-25 15:07:31 -04:00
Yann Collet 95eb43be09 updated pkg config file 2016-11-30 11:06:58 -08:00
OBATA Akio c53eea7c1a libzstd.pc.in: Change to use variables for libdir and includedir 2016-11-29 16:47:53 +09:00
Yann Collet 33a0465a51 fixed a few links 2016-09-02 22:11:49 -07:00
Yann Collet 4856a00164 Initial release 2015-01-24 01:58:16 +01:00