Compare commits
302 Commits
stable/1.8
...
master
Author | SHA1 | Date |
---|---|---|
Ariadne Conill | 444846dd2d | |
rentianyue-jk | 8c479a8355 | |
Ariadne Conill | 4697d636cc | |
Ariadne Conill | a88c0d962a | |
Ariadne Conill | 0dde98fa8b | |
Ariadne Conill | ba3c2bd47c | |
Ariadne Conill | 72082a4d17 | |
Ariadne Conill | 874d559e42 | |
Ariadne Conill | d2d01a10c5 | |
Ariadne Conill | 9aaff5148c | |
Ariadne Conill | eb7c2385d0 | |
Ariadne Conill | 0ca4e5d00c | |
Ariadne Conill | 2070c00d63 | |
Ariadne Conill | ef99b6c626 | |
Ariadne Conill | ca2a06898f | |
Ariadne Conill | c84223616a | |
Ariadne Conill | d8cd27e2d2 | |
Ariadne Conill | 22866eca45 | |
Ariadne Conill | b24f3dfd8f | |
Ariadne Conill | d5cd2a4f28 | |
Ariadne Conill | f635f63220 | |
Ariadne Conill | d76aa357e4 | |
Ariadne Conill | 174db1a17a | |
Ariadne Conill | a6179c7779 | |
Ariadne Conill | a276c0b4a8 | |
Ariadne Conill | 93ae120daf | |
Kai Pastor | 8b7e2c4eee | |
Kai Pastor | 64ff8b031f | |
Taylor R Campbell | 633433b29b | |
Petr Písař | 2d26db3a98 | |
Pierce | a8a492e2e4 | |
Ismael Luceno | c583d49a37 | |
Ariadne Conill | 06120a8769 | |
Ariadne Conill | 7a8532f849 | |
Ariadne Conill | a3d7ecb31b | |
Kai Pastor | e2a8080cbf | |
Kai Pastor | 883b57df47 | |
Kai Pastor | 194dde096b | |
Kai Pastor | 78d53ea012 | |
Kai Pastor | 4090ba3e0d | |
Kai Pastor | 5eb79f6651 | |
Kai Pastor | e7c9bdb317 | |
Kai Pastor | 4e01010d6f | |
Kai Pastor | 6219af9a0a | |
Kai Pastor | eaf1a2d804 | |
Kai Pastor | d6753888b8 | |
Kai Pastor | f95e8d4428 | |
Kai Pastor | db63c8ee0b | |
Kai Pastor | b6e04e2d47 | |
Ariadne Conill | 2edf954f3a | |
Ariadne Conill | d8924aced5 | |
Ariadne Conill | 80b5011e69 | |
Kai Pastor | 4a3adf3457 | |
Kai Pastor | 5825e2c6d6 | |
Kai Pastor | b2f8386c32 | |
Kai Pastor | 125af82dbe | |
Sam James | 08f4a9da15 | |
Stefan Weil | a4ecd42bf3 | |
Ariadne Conill | 61d39ad899 | |
Ariadne Conill | 5fb09af863 | |
Ariadne Conill | d0038689fd | |
Ariadne Conill | 31512b210b | |
Ariadne Conill | 5f6c5320e5 | |
Ariadne Conill | f3540de30d | |
Kai Pastor | be1ea7888b | |
Kai Pastor | 45073b7460 | |
Victor Westerhuis | 948297b5b8 | |
Sam James | d454f62c73 | |
Ariadne Conill | 752a9825dc | |
Ariadne Conill | 86c43b4e3d | |
Ariadne Conill | 4db8031402 | |
Kai Pastor | eb087a6c84 | |
Colin Gillespie | dd6a8e3fc7 | |
Ariadne Conill | 97d907ba93 | |
Peter Kokot | a4033ab9c6 | |
L. E. Segovia | a7c29fec18 | |
Xi Ruoyao | 962a5e96b7 | |
Colin Gillespie | 5aeb469b81 | |
Ariadne Conill | 652aff9790 | |
Ariadne Conill | a6fb59a0ed | |
Ariadne Conill | 3f07015d3a | |
Ariadne Conill | ee702658cd | |
Colin Gillespie | 66994f1533 | |
Colin Gillespie | 9cddd22bbc | |
Ariadne Conill | eaa4bb44a0 | |
Ariadne Conill | a265f8a42b | |
Ariadne Conill | f0f28fa690 | |
Ariadne Conill | 6a84d70439 | |
Ariadne Conill | f49029c681 | |
Ariadne Conill | 4fb0988a29 | |
Ariadne Conill | 5ef2ab8c7c | |
Ariadne Conill | 95086643fa | |
Ariadne Conill | fe69ccc6b9 | |
Ariadne Conill | de51b03cc1 | |
Ariadne Conill | f305901052 | |
Ariadne Conill | a97b75ab2c | |
Ariadne Conill | 384ade5f31 | |
Ariadne Conill | a4eb097b39 | |
Ariadne Conill | 5d0e2f5092 | |
Ariadne Conill | 437c2a3218 | |
Ariadne Conill | 094dc38468 | |
Ariadne Conill | 35b1a62314 | |
Ariadne Conill | 83f412a1fd | |
Ariadne Conill | 7bfc2289fd | |
Ariadne Conill | 1e179963d4 | |
Harmen Stoppels | f7bebba664 | |
Harmen Stoppels | 434cb2935e | |
Harmen Stoppels | 40638f2472 | |
h30032433 | b08733f45d | |
huyubiao | 6d1f160e89 | |
Taylor R Campbell | 212c85863a | |
Andrej Shadura | 78f3abc935 | |
Andrej Shadura | 9ab5ea2e83 | |
Andrej Shadura | cfda825f80 | |
Ariadne Conill | 873e51aaae | |
Ariadne Conill | f7305434eb | |
Ariadne Conill | 93edd215b4 | |
Ariadne Conill | 49ab0b2ab7 | |
Ariadne Conill | 98b33b48cd | |
Ariadne Conill | d9e507cc6e | |
Ariadne Conill | 90b65c866b | |
Ariadne Conill | 1ce000f397 | |
Ariadne Conill | 99bc93fbe5 | |
Ariadne Conill | e2a12fd4c2 | |
Ariadne Conill | 8f12d36b76 | |
Ariadne Conill | b106de0c7a | |
Ariadne Conill | 648a2249fc | |
Ariadne Conill | dd741e722f | |
Timo Röhling | 506ebab7d6 | |
Ariadne Conill | be0d811942 | |
Ariadne Conill | 6a5b55740d | |
Doug Freed | 131619ae4b | |
Doug Freed | 08db74c474 | |
Doug Freed | eb5c6b49d6 | |
Ziemowit Łąski | 1c3f246198 | |
wi24rd | 27287f323d | |
Eli Schwartz | 8f233383cd | |
Ariadne Conill | 2f51733e34 | |
Ariadne Conill | 628b2b2baf | |
Ariadne Conill | 3e481581ba | |
Ariadne Conill | 0226cdda6d | |
Dylan Baker | fa803c7ecd | |
Ariadne Conill | bddf1641f8 | |
Ariadne Conill | 8754bdfe09 | |
Ariadne Conill | 6a66b312b4 | |
Ariadne Conill | 4c38d3f60c | |
Ariadne Conill | b7593aea27 | |
Ariadne Conill | dbd78db67f | |
Ariadne Conill | 80bc5ac3b9 | |
Ariadne Conill | 5044491f43 | |
Ariadne Conill | c6d14e6fa1 | |
Ariadne Conill | ced9bee613 | |
Ariadne Conill | 2c89541101 | |
Ariadne Conill | 5500a15133 | |
Ariadne Conill | 74faf8d0e2 | |
Ariadne Conill | c918b6e225 | |
Ariadne Conill | 12f3a30980 | |
Ariadne Conill | 01c1d9f4cc | |
Ariadne Conill | 9e8052b699 | |
Ariadne Conill | 696124b608 | |
Ariadne Conill | 79327b8967 | |
Ariadne Conill | f3021a82c5 | |
Ariadne Conill | 194ad3e656 | |
Ariadne Conill | aa99ddf789 | |
Ariadne Conill | 68b5cab72d | |
Ariadne Conill | 78f00da130 | |
psykose | 746005582f | |
Ariadne Conill | 28b5d57b98 | |
Ariadne Conill | af9b26c15c | |
Ariadne Conill | c0d2d65347 | |
Ariadne Conill | 69a3d458ef | |
Ariadne Conill | 7e9aa7e1fc | |
Ariadne Conill | 4e449bd45f | |
Ariadne Conill | 69f630aadc | |
Ariadne Conill | 760d1eea10 | |
Ariadne Conill | 8764578719 | |
Ariadne Conill | 5b10a85a82 | |
Ariadne Conill | 884a88583b | |
Ariadne Conill | 4e8f376c5d | |
Ariadne Conill | 79d25f979d | |
Ariadne Conill | 03ba00d30b | |
Ariadne Conill | 1a66d963cf | |
Ariadne Conill | 8271ea1952 | |
Ariadne Conill | b29f9d8713 | |
Ariadne Conill | 94b3f118cc | |
Dylan Baker | 7976daab9a | |
Ariadne Conill | d8d669f637 | |
Ariadne Conill | 23556ff818 | |
Ariadne Conill | da9b2cfbc1 | |
Ariadne Conill | b2579a661b | |
Ariadne Conill | 666b520273 | |
Ariadne Conill | d5f9bdae57 | |
Ariadne Conill | 0e05308f9c | |
Ariadne Conill | 1389aa05ba | |
Ariadne Conill | dce34e9afd | |
Ariadne Conill | 9aa0006c27 | |
Ariadne Conill | 7edfdbff0b | |
Ariadne Conill | 662668d082 | |
Eli Schwartz | 59a56dfa64 | |
Ariadne Conill | 56881f64f0 | |
Ariadne Conill | b310728111 | |
Dylan Baker | 179a0560a6 | |
Dylan Baker | 1cfa2d1e20 | |
Dylan Baker | 301d8fa0c6 | |
Dylan Baker | 34b110200a | |
Dylan Baker | e71a5a3370 | |
Dylan Baker | 4934205737 | |
Dylan Baker | a46ce3672f | |
Dylan Baker | 4493a322f6 | |
Dylan Baker | a391f9b650 | |
Dylan Baker | 38103134a5 | |
Dylan Baker | 171738024e | |
Dylan Baker | e4d1c8ffa5 | |
Dylan Baker | 6609001114 | |
Dylan Baker | e275594ba6 | |
Dylan Baker | 4a1119aa2a | |
Dylan Baker | a4de6235c2 | |
Dylan Baker | ebe74fd253 | |
Ariadne Conill | d240afe7d9 | |
Dylan Baker | 125a13d3b9 | |
Dylan Baker | 96c61cbab0 | |
Ariadne Conill | a042827951 | |
Dylan Baker | dd779ad9f8 | |
Dylan Baker | c04097e491 | |
Dylan Baker | 06fe2e23b0 | |
Dylan Baker | 1f993bc095 | |
Dylan Baker | f947af057f | |
Dylan Baker | 5ba74dec93 | |
Dylan Baker | bf307c1d95 | |
Dylan Baker | 4a2c9c285f | |
Dylan Baker | 40ec08594e | |
Dylan Baker | 71974d8c54 | |
Ariadne Conill | 918b660992 | |
Ariadne Conill | f93870efd9 | |
Ariadne Conill | 18e2406002 | |
Ariadne Conill | 6c70781aad | |
Ariadne Conill | f8aefea7ec | |
Ariadne Conill | 297e18f2c8 | |
Ariadne Conill | d9ec3ee642 | |
Ariadne Conill | b0802cb3d1 | |
Ariadne Conill | b602e33141 | |
Ariadne Conill | 72e429ae70 | |
Ariadne Conill | 7fa632a658 | |
Ariadne Conill | 9950312fde | |
Ariadne Conill | 19b1befb5d | |
Ariadne Conill | a61193c723 | |
Ariadne Conill | d68a867dc0 | |
Ariadne Conill | bc272e4e9f | |
Ariadne Conill | 623b8f7851 | |
Ariadne Conill | fdd7d192e0 | |
Ariadne Conill | 11164376f7 | |
Ariadne Conill | ab352222a2 | |
Ariadne Conill | 04a6dda79f | |
Ariadne Conill | a1a415111f | |
Ariadne Conill | 9bc6d80e61 | |
Ariadne Conill | fe4db3aad9 | |
Ariadne Conill | 5a82a259ac | |
Ariadne Conill | a416dc1fd6 | |
Ariadne Conill | 197fcadd4c | |
Ariadne Conill | 5817e8848f | |
Ariadne Conill | 6ae17bd0ef | |
Ariadne Conill | ffa0805d58 | |
Ariadne Conill | c1579d381c | |
Ariadne Conill | 4c76f6bf01 | |
Ariadne Conill | 664f741f26 | |
Ariadne Conill | 464672404e | |
Dylan Baker | c0fa7879b2 | |
Dylan Baker | 2d201af326 | |
Ariadne Conill | 21ffd343e1 | |
Ariadne Conill | a441455bf4 | |
Ariadne Conill | cf48b61a59 | |
Ariadne Conill | 40131312ec | |
Ariadne Conill | cc4ccc1429 | |
Ariadne Conill | ac964d13f3 | |
Ariadne Conill | 0995e49977 | |
Ariadne Conill | 820af53a2d | |
Ariadne Conill | a45dbccc01 | |
Ariadne Conill | c6cfca6730 | |
Ariadne Conill | aaabc2cb15 | |
Dylan Baker | c581e24a67 | |
Dylan Baker | f5d6bb71f8 | |
data-man | b132ce8317 | |
olf | ae3a9c5440 | |
Andrea Pappacoda | 6109e06089 | |
Dylan Baker | 1044bb57ca | |
Dylan Baker | 72c59b89c6 | |
Mattias Hansson | 8d9d3de6eb | |
Mattias Hansson | 360a818f2f | |
Ariadne Conill | f3049d634d | |
Ariadne Conill | bf933903aa | |
Ariadne Conill | 2b82a4f63e | |
Ariadne Conill | 7d8cc1e4ce | |
Ariadne Conill | c547edd07f | |
Ariadne Conill | 4144d506bb | |
olf | d87114068f | |
Ariadne Conill | 8130dd159e | |
Ariadne Conill | 2b390ea9cf | |
Ariadne Conill | 4b87e256d3 | |
Ariadne Conill | df1b671c83 | |
Ariadne Conill | 41bff10998 | |
Ariadne Conill | f411e7e55b | |
Ariadne Conill | ce82e36c14 |
|
@ -35,13 +35,13 @@ jobs:
|
||||||
# the code assumes msvc style printf atm
|
# the code assumes msvc style printf atm
|
||||||
export CFLAGS=-D__USE_MINGW_ANSI_STDIO=0
|
export CFLAGS=-D__USE_MINGW_ANSI_STDIO=0
|
||||||
|
|
||||||
meson -Dtests=false _build
|
meson -Dtests=disabled _build
|
||||||
meson compile -C _build
|
meson compile -C _build
|
||||||
|
|
||||||
debian-meson:
|
debian-meson:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: debian:bullseye
|
image: debian:testing
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -53,17 +53,41 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
meson _build
|
meson _build -Dwerror=true
|
||||||
meson compile -C _build
|
meson compile -C _build
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
meson test -v -C _build
|
meson test -v -C _build
|
||||||
|
|
||||||
|
debian-meson-asan:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: debian:testing
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Update system and add dependencies
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y kyua atf-sh build-essential meson
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
meson _build -Db_sanitize=address
|
||||||
|
meson compile -C _build
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
meson test -v -C _build
|
||||||
|
env:
|
||||||
|
ASAN_OPTIONS: "exitcode=7"
|
||||||
|
|
||||||
debian-autotools:
|
debian-autotools:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: debian:bullseye
|
image: debian:testing
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -98,7 +122,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
meson _build
|
meson _build -Dwerror=true
|
||||||
meson compile -C _build
|
meson compile -C _build
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
.dirstamp
|
||||||
|
stamp-h*
|
||||||
*.h.in~
|
*.h.in~
|
||||||
*.o
|
*.o
|
||||||
*.og
|
*.og
|
||||||
*.op
|
*.op
|
||||||
|
*.lo
|
||||||
*.gcno
|
*.gcno
|
||||||
*.gcda
|
*.gcda
|
||||||
*.gcov
|
*.gcov
|
||||||
core
|
core
|
||||||
.gdb_history
|
.gdb_history
|
||||||
|
|
||||||
|
.libs
|
||||||
.deps
|
.deps
|
||||||
|
|
||||||
*.exe
|
*.exe
|
||||||
|
@ -16,8 +22,8 @@ core
|
||||||
*.orig
|
*.orig
|
||||||
*.patch
|
*.patch
|
||||||
*.rej
|
*.rej
|
||||||
/tests/run.sh
|
|
||||||
|
|
||||||
|
# autoconf stuff
|
||||||
/aclocal.m4
|
/aclocal.m4
|
||||||
/autom4te.cache/
|
/autom4te.cache/
|
||||||
/buildsys.mk
|
/buildsys.mk
|
||||||
|
@ -26,8 +32,47 @@ core
|
||||||
/config.log
|
/config.log
|
||||||
/config.status
|
/config.status
|
||||||
/configure
|
/configure
|
||||||
|
/compile
|
||||||
|
/config.guess
|
||||||
|
/config.sub
|
||||||
|
/depcomp
|
||||||
|
/install-sh
|
||||||
|
/missing
|
||||||
|
|
||||||
|
# programs
|
||||||
|
/bomtool
|
||||||
/pkgconf
|
/pkgconf
|
||||||
/pkgconf-gcov
|
/pkgconf-gcov
|
||||||
/pkgconf-profile
|
/pkgconf-profile
|
||||||
|
|
||||||
Makefile
|
# libtool
|
||||||
|
/libtool
|
||||||
|
/ltmain.sh
|
||||||
|
/libpkgconf.la
|
||||||
|
/m4/libtool.m4
|
||||||
|
/m4/lt~obsolete.m4
|
||||||
|
/m4/ltoptions.m4
|
||||||
|
/m4/ltsugar.m4
|
||||||
|
/m4/ltversion.m4
|
||||||
|
|
||||||
|
# pkgconfig file
|
||||||
|
/libpkgconf.pc
|
||||||
|
|
||||||
|
# autoheader
|
||||||
|
/libpkgconf/config.h
|
||||||
|
/libpkgconf/config.h.in
|
||||||
|
|
||||||
|
# tests
|
||||||
|
/Kyuafile
|
||||||
|
/tests/Kyuafile
|
||||||
|
/tests/basic
|
||||||
|
/tests/builtins
|
||||||
|
/tests/conflicts
|
||||||
|
/tests/framework
|
||||||
|
/tests/parser
|
||||||
|
/tests/provides
|
||||||
|
/tests/regress
|
||||||
|
/tests/requires
|
||||||
|
/tests/sysroot
|
||||||
|
/tests/test_env.sh
|
||||||
|
/tests/version
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
pipeline:
|
||||||
|
debian-meson:
|
||||||
|
image: debian:testing
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y kyua atf-sh build-essential meson
|
||||||
|
- meson _build -Dwerror=true
|
||||||
|
- meson compile -C _build
|
||||||
|
- meson test -v -C _build
|
||||||
|
when:
|
||||||
|
matrix:
|
||||||
|
IMAGE: debian
|
||||||
|
BUILD: meson
|
||||||
|
|
||||||
|
debian-meson-asan:
|
||||||
|
image: debian:testing
|
||||||
|
environment:
|
||||||
|
- ASAN_OPTIONS="exitcode=7"
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y kyua atf-sh build-essential meson
|
||||||
|
- meson _build -Db_sanitize=address
|
||||||
|
- meson compile -C _build
|
||||||
|
- meson test -v -C _build
|
||||||
|
when:
|
||||||
|
matrix:
|
||||||
|
IMAGE: debian
|
||||||
|
BUILD: meson
|
||||||
|
|
||||||
|
debian-autotools:
|
||||||
|
image: debian:testing
|
||||||
|
commands:
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install -y kyua atf-sh build-essential autoconf libtool
|
||||||
|
- ./autogen.sh
|
||||||
|
- ./configure
|
||||||
|
- make -j
|
||||||
|
- make distcheck
|
||||||
|
when:
|
||||||
|
matrix:
|
||||||
|
IMAGE: debian
|
||||||
|
BUILD: autotools
|
||||||
|
|
||||||
|
alpine-meson:
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- apk add -U --no-cache kyua atf build-base meson
|
||||||
|
- meson _build -Dwerror=true
|
||||||
|
- meson compile -C _build
|
||||||
|
- meson test -v -C _build
|
||||||
|
when:
|
||||||
|
matrix:
|
||||||
|
IMAGE: alpine
|
||||||
|
BUILD: meson
|
||||||
|
|
||||||
|
alpine-autotools:
|
||||||
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- apk add -U --no-cache kyua atf build-base autoconf automake libtool xz gzip
|
||||||
|
- ./autogen.sh
|
||||||
|
- ./configure
|
||||||
|
- make -j
|
||||||
|
- make distcheck
|
||||||
|
when:
|
||||||
|
matrix:
|
||||||
|
IMAGE: alpine
|
||||||
|
BUILD: autotools
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
IMAGE:
|
||||||
|
- debian
|
||||||
|
- alpine
|
||||||
|
BUILD:
|
||||||
|
- meson
|
||||||
|
- autotools
|
28
Makefile.am
28
Makefile.am
|
@ -9,9 +9,10 @@ personality_dir = @PERSONALITY_PATH@
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
nodist_pkgconfig_DATA = libpkgconf.pc
|
nodist_pkgconfig_DATA = libpkgconf.pc
|
||||||
|
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
AM_CFLAGS = -DPERSONALITY_PATH=\"$(personality_dir)\" -DPKG_DEFAULT_PATH=\"$(pkg_default_dir)\" -DSYSTEM_INCLUDEDIR=\"$(system_includedir)\" -DSYSTEM_LIBDIR=\"$(system_libdir)\"
|
AM_CFLAGS = -DPERSONALITY_PATH=\"$(personality_dir)\" -DPKG_DEFAULT_PATH=\"$(pkg_default_dir)\" -DSYSTEM_INCLUDEDIR=\"$(system_includedir)\" -DSYSTEM_LIBDIR=\"$(system_libdir)\"
|
||||||
|
|
||||||
bin_PROGRAMS = pkgconf
|
bin_PROGRAMS = pkgconf bomtool
|
||||||
lib_LTLIBRARIES = libpkgconf.la
|
lib_LTLIBRARIES = libpkgconf.la
|
||||||
|
|
||||||
EXTRA_DIST = pkg.m4 \
|
EXTRA_DIST = pkg.m4 \
|
||||||
|
@ -27,6 +28,8 @@ EXTRA_DIST = pkg.m4 \
|
||||||
tests/lib1/paren-quoting.pc \
|
tests/lib1/paren-quoting.pc \
|
||||||
tests/lib1/argv-parse-3.pc \
|
tests/lib1/argv-parse-3.pc \
|
||||||
tests/lib1/foo.pc \
|
tests/lib1/foo.pc \
|
||||||
|
tests/lib1/foobar.pc \
|
||||||
|
tests/lib1/unavailable-provider.pc \
|
||||||
tests/lib1/prefix-foo1.pc \
|
tests/lib1/prefix-foo1.pc \
|
||||||
tests/lib1/argv-parse.pc \
|
tests/lib1/argv-parse.pc \
|
||||||
tests/lib1/framework-1.pc \
|
tests/lib1/framework-1.pc \
|
||||||
|
@ -62,6 +65,7 @@ EXTRA_DIST = pkg.m4 \
|
||||||
tests/lib3/bar.pc \
|
tests/lib3/bar.pc \
|
||||||
tests/lib1/conflicts.pc \
|
tests/lib1/conflicts.pc \
|
||||||
tests/lib1/omg-uninstalled.pc \
|
tests/lib1/omg-uninstalled.pc \
|
||||||
|
tests/lib1/omg-sysroot-uninstalled.pc \
|
||||||
tests/lib1/isystem.pc \
|
tests/lib1/isystem.pc \
|
||||||
tests/lib1/idirafter.pc \
|
tests/lib1/idirafter.pc \
|
||||||
tests/lib1/idirafter-ordering.pc \
|
tests/lib1/idirafter-ordering.pc \
|
||||||
|
@ -89,6 +93,10 @@ EXTRA_DIST = pkg.m4 \
|
||||||
tests/lib1/malformed-1.pc \
|
tests/lib1/malformed-1.pc \
|
||||||
tests/lib1/malformed-quoting.pc \
|
tests/lib1/malformed-quoting.pc \
|
||||||
tests/lib1/malformed-version.pc \
|
tests/lib1/malformed-version.pc \
|
||||||
|
tests/lib1/metapackage.pc \
|
||||||
|
tests/lib1/metapackage-1.pc \
|
||||||
|
tests/lib1/metapackage-2.pc \
|
||||||
|
tests/lib1/metapackage-3.pc \
|
||||||
tests/lib1/explicit-sysroot.pc \
|
tests/lib1/explicit-sysroot.pc \
|
||||||
tests/lib1/escaped-backslash.pc \
|
tests/lib1/escaped-backslash.pc \
|
||||||
tests/lib1/cflags-internal.pc \
|
tests/lib1/cflags-internal.pc \
|
||||||
|
@ -99,6 +107,11 @@ EXTRA_DIST = pkg.m4 \
|
||||||
tests/lib1/tuple-quoting.pc \
|
tests/lib1/tuple-quoting.pc \
|
||||||
tests/lib1/empty-tuple.pc \
|
tests/lib1/empty-tuple.pc \
|
||||||
tests/lib1/orphaned-requires-private.pc \
|
tests/lib1/orphaned-requires-private.pc \
|
||||||
|
tests/lib1/sysroot-dir-2.pc \
|
||||||
|
tests/lib1/sysroot-dir-3.pc \
|
||||||
|
tests/lib1/sysroot-dir-4.pc \
|
||||||
|
tests/lib1/sysroot-dir-5.pc \
|
||||||
|
tests/lib1/child-prefix/pkgconfig/child-prefix-1.pc \
|
||||||
$(test_scripts) \
|
$(test_scripts) \
|
||||||
doc/conf.py \
|
doc/conf.py \
|
||||||
doc/extract.py \
|
doc/extract.py \
|
||||||
|
@ -127,7 +140,8 @@ test_scripts= tests/meson.build \
|
||||||
tests/sysroot.sh \
|
tests/sysroot.sh \
|
||||||
tests/version.sh
|
tests/version.sh
|
||||||
|
|
||||||
check_SCRIPTS= $(test_scripts:.sh=)
|
test_sh = $(filter-out tests/meson.build, $(test_scripts))
|
||||||
|
check_SCRIPTS = $(test_sh:.sh=)
|
||||||
|
|
||||||
SUFFIXES= .sh
|
SUFFIXES= .sh
|
||||||
|
|
||||||
|
@ -147,7 +161,7 @@ libpkgconf_la_SOURCES = \
|
||||||
libpkgconf/path.c \
|
libpkgconf/path.c \
|
||||||
libpkgconf/personality.c \
|
libpkgconf/personality.c \
|
||||||
libpkgconf/parser.c
|
libpkgconf/parser.c
|
||||||
libpkgconf_la_LDFLAGS = -no-undefined -version-info 3:0:0 -export-symbols-regex '^pkgconf_'
|
libpkgconf_la_LDFLAGS = -no-undefined -version-info 5:0:0 -export-symbols-regex '^pkgconf_'
|
||||||
|
|
||||||
dist_man_MANS = \
|
dist_man_MANS = \
|
||||||
man/pkgconf.1 \
|
man/pkgconf.1 \
|
||||||
|
@ -160,11 +174,17 @@ pkgconf_SOURCES = \
|
||||||
cli/main.c \
|
cli/main.c \
|
||||||
cli/getopt_long.c \
|
cli/getopt_long.c \
|
||||||
cli/renderer-msvc.c
|
cli/renderer-msvc.c
|
||||||
pkgconf_CPPFLAGS = -Ilibpkgconf -Icli
|
pkgconf_CPPFLAGS = -I$(top_srcdir)/libpkgconf -I$(top_srcdir)/cli
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
cli/getopt_long.h \
|
cli/getopt_long.h \
|
||||||
cli/renderer-msvc.h
|
cli/renderer-msvc.h
|
||||||
|
|
||||||
|
bomtool_LDADD = libpkgconf.la
|
||||||
|
bomtool_SOURCES = \
|
||||||
|
cli/bomtool/main.c \
|
||||||
|
cli/getopt_long.c
|
||||||
|
bomtool_CPPFLAGS = -I$(top_srcdir)/libpkgconf -I$(top_srcdir)/cli -I$(top_srcdir)/cli/bomtool
|
||||||
|
|
||||||
dist_doc_DATA = README.md AUTHORS
|
dist_doc_DATA = README.md AUTHORS
|
||||||
|
|
||||||
m4datadir = $(datadir)/aclocal
|
m4datadir = $(datadir)/aclocal
|
||||||
|
|
|
@ -39,7 +39,7 @@ all: pkgconf-lite
|
||||||
libpkgconf/config.h:
|
libpkgconf/config.h:
|
||||||
@echo '#define PACKAGE_NAME "pkgconf-lite"' >> $@
|
@echo '#define PACKAGE_NAME "pkgconf-lite"' >> $@
|
||||||
@echo '#define PACKAGE_BUGREPORT "https://git.dereferenced.org/pkgconf/pkgconf/issues"' >> $@
|
@echo '#define PACKAGE_BUGREPORT "https://git.dereferenced.org/pkgconf/pkgconf/issues"' >> $@
|
||||||
@echo '#define PACKAGE_VERSION "1.6.2"' >> $@
|
@echo '#define PACKAGE_VERSION "2.3.0"' >> $@
|
||||||
@echo '#define PACKAGE PACKAGE_NAME " " PACKAGE_VERSION' >> $@
|
@echo '#define PACKAGE PACKAGE_NAME " " PACKAGE_VERSION' >> $@
|
||||||
@echo '#define HAVE_STRLCPY' >> $@
|
@echo '#define HAVE_STRLCPY' >> $@
|
||||||
@echo '#define HAVE_STRLCAT' >> $@
|
@echo '#define HAVE_STRLCAT' >> $@
|
||||||
|
|
250
NEWS
250
NEWS
|
@ -1,14 +1,262 @@
|
||||||
Changes from previous version of pkgconf
|
Changes from previous version of pkgconf
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
Changes from 1.8.0 to 1.8.1:
|
Changes from 2.2.0 to 2.3.0:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Fix compile with Meson on Solaris by defining __EXTENSIONS__.
|
||||||
|
|
||||||
|
* Add support for the PKG_CONFIG_RELOCATE_PATHS environmental variable.
|
||||||
|
When set, the program will act as if --define-prefix is always enabled.
|
||||||
|
|
||||||
|
* Color solution nodes that were part of the original query, and use
|
||||||
|
that coloring to skip over dependencies when generating DocumentNames
|
||||||
|
in bomtool.
|
||||||
|
|
||||||
|
* Enhance --env option to support variables with both --variable=varname
|
||||||
|
and --print-variables.
|
||||||
|
|
||||||
|
* Add --exists-cflags option which creates synthetic preprocessor
|
||||||
|
definition flags for every queried dependency when found.
|
||||||
|
|
||||||
|
* Document that Requires.private is always used for header paths.
|
||||||
|
Patch by Petr Písař.
|
||||||
|
|
||||||
|
* Fix minor documentation typos.
|
||||||
|
Patch by Pierce.
|
||||||
|
|
||||||
|
* Ensure string comparisons using <ctype.h> functions are done with
|
||||||
|
unsigned bytes to avoid undefined behavior.
|
||||||
|
Patch by Taylor R Campbell.
|
||||||
|
|
||||||
|
* Fix parsing edge-case bugs with dependency versions.
|
||||||
|
Patch by Kai Pastor.
|
||||||
|
|
||||||
|
* Change PKG_PROG_PKG_CONFIG autoconf macro to add a customizable
|
||||||
|
failure handler if pkg-config is not found.
|
||||||
|
Patch by Ismael Luceno.
|
||||||
|
|
||||||
|
Changes from 2.1.1 to 2.2.0:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* libpkgconf SOVERSION is now 5.
|
||||||
|
|
||||||
|
* Significant solver rework to flatten both requires and requires.private
|
||||||
|
dependencies in a single pass. Improves performance slightly and ensures
|
||||||
|
proper dependency order.
|
||||||
|
Patches by Kai Pastor.
|
||||||
|
|
||||||
|
* Improve `--digraph` output to reflect more of the solver's state in the
|
||||||
|
rendered dependency graph.
|
||||||
|
Patches by Kai Pastor.
|
||||||
|
|
||||||
|
* Do not reference the graph root by name when presenting error messages about
|
||||||
|
directly requested dependency nodes.
|
||||||
|
Patch by Kai Pastor.
|
||||||
|
|
||||||
|
Changes from 2.1.0 to 2.1.1:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Documentation fixes from Sam James and Stefan Weil.
|
||||||
|
|
||||||
|
* Fix --modversion with constraints.
|
||||||
|
Patch by Kai Pastor.
|
||||||
|
|
||||||
|
* Reintroduce an optimization to the dependency graph walker which avoids
|
||||||
|
revisiting already visited nodes.
|
||||||
|
Patch by Yi Chou with some modifications.
|
||||||
|
|
||||||
|
* Add a regression test to check that the dependency flattener is working
|
||||||
|
as expected.
|
||||||
|
Patch by Kai Pastor.
|
||||||
|
|
||||||
|
Changes from 2.0.3 to 2.1.0:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Do not flatten the solver solution into the original world used as
|
||||||
|
input to the solver.
|
||||||
|
Patches by Kai Pastor.
|
||||||
|
|
||||||
|
* Fix warnings with GCC 14 -Walloc-size.
|
||||||
|
Patch by Sam James.
|
||||||
|
|
||||||
|
* Add --solution to the pkgconf CLI to dump the solver state.
|
||||||
|
|
||||||
|
* Improve the --digraph output to clarify cancelled edges in a given
|
||||||
|
solution.
|
||||||
|
|
||||||
|
* Demote requires dependencies to requires.private when a parent
|
||||||
|
dependency is pulled in via requires.private.
|
||||||
|
|
||||||
|
* Trim trailing whitespace when processing package arguments.
|
||||||
|
Patch by Colin Gillespie.
|
||||||
|
|
||||||
|
* Avoid strncmp() in --modversion version comparison.
|
||||||
|
Patch by Colin Gillespie.
|
||||||
|
|
||||||
|
* Update autoconf compile flag checking macro.
|
||||||
|
Patch by Peter Kokot.
|
||||||
|
|
||||||
|
* Add system default path configuration to Meson.
|
||||||
|
Patch by L. E. Segovia.
|
||||||
|
|
||||||
|
* Fix order of PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH element processing.
|
||||||
|
|
||||||
|
Changes from 2.0.2 to 2.0.3:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Fix some edge-cases with the new `--modversion` implementation
|
||||||
|
and add additional regression tests.
|
||||||
|
Patch by Colin Gillespie.
|
||||||
|
|
||||||
|
* Fix some format specifiers to use PRIu64 in debug tracing.
|
||||||
|
|
||||||
|
Changes from 2.0.1 to 2.0.2:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Fix long-standing bug where package identifiers for "uninstalled"
|
||||||
|
packages incorrectly included the "-uninstalled" suffix.
|
||||||
|
|
||||||
|
This was exposed by the recent change to `--modversion` in 2.0.1.
|
||||||
|
|
||||||
|
Changes from 2.0.0 to 2.0.1:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* The behavior of --modversion was largely reverted back to the traditional
|
||||||
|
pkg-config behavior, but still operates on a solved dependency graph.
|
||||||
|
|
||||||
|
The order of --modversion output is based on the dependency resolution
|
||||||
|
queue which is passed to the solver, which itself generally maps to the
|
||||||
|
order of the constrants provided on the command line.
|
||||||
|
|
||||||
|
* A new flag, --verbose, has been added. When used with `--modversion`, it
|
||||||
|
is possible to disambiguate which version belongs to which module:
|
||||||
|
|
||||||
|
% pkgconf --modversion --verbose foo bar
|
||||||
|
foo: 1.2.3
|
||||||
|
bar: 1.3
|
||||||
|
|
||||||
|
Changes from 1.9.5 to 2.0.0:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* When flattening the dependency graph, retain the latest seen edges
|
||||||
|
rather than the earliest.
|
||||||
|
|
||||||
|
* Fix a long-standing bug where the dependency resolution queue was
|
||||||
|
evaluated in reverse. This bug masked the aforementioned dependency
|
||||||
|
flattening bug in many cases.
|
||||||
|
|
||||||
|
* Fix handling of --with-path, which was appending paths to the search
|
||||||
|
list rather than prepending them as intended.
|
||||||
|
|
||||||
|
* Error when --modversion is requested with more than one package, as
|
||||||
|
the output is ambiguous.
|
||||||
|
|
||||||
|
Changes from 1.9.4 to 1.9.5:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Fix incorrect assumptions involving the use of ctype(3) functions.
|
||||||
|
Patch by Taylor R Campbell.
|
||||||
|
|
||||||
|
* Fix detection of provided functions on autoconf.
|
||||||
|
Patches by Harmen Stoppels.
|
||||||
|
|
||||||
|
* Fix deletion of tests/meson.build by the autoconf build system.
|
||||||
|
Patch by h30032433.
|
||||||
|
|
||||||
|
* Fix quoting rules in argvsplit.c.
|
||||||
|
Patch by huyubiao.
|
||||||
|
|
||||||
|
* Update libpkgconf documentation and documentation building scripts.
|
||||||
|
Patches by Andrew Shadura.
|
||||||
|
|
||||||
|
* Enforce maximum package count correctly for --modversion.
|
||||||
|
|
||||||
|
Changes from 1.9.3 to 1.9.4:
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
* Fix a buffer overflow vulnerability involving very large variable expansions.
|
* Fix a buffer overflow vulnerability involving very large variable expansions.
|
||||||
CVE-2023-24056
|
CVE-2023-24056
|
||||||
|
|
||||||
|
* Fix a bunch of minor regressions with the solver.
|
||||||
|
|
||||||
|
* Create separate solutions for `--cflags` and `--libs` when `--static` is not
|
||||||
|
used.
|
||||||
|
|
||||||
|
* Remove final trailing whitespace in pkgconf_fragment_render_buf().
|
||||||
|
|
||||||
|
* Revert broken pkg.m4 change involving querying module versions in
|
||||||
|
PKG_CHECK_MODULES.
|
||||||
|
|
||||||
* Fix handling of tildes in version strings.
|
* Fix handling of tildes in version strings.
|
||||||
|
|
||||||
|
* Various C99 formatting string fixes involving SIZE_FMT_SPECIFIER.
|
||||||
|
|
||||||
|
Changes from 1.9.2 to 1.9.3:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Fix a bunch of minor code issues pointed out using Clang static analyzer.
|
||||||
|
|
||||||
|
* New API: pkgconf_solution_free(), which frees a compiled solution graph.
|
||||||
|
|
||||||
|
* Fix behavior when overriding global variables with `--define-variable`.
|
||||||
|
|
||||||
|
Changes from 1.9.1 to 1.9.2:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Do not try to break dependency cycles across dependency lists. This causes
|
||||||
|
the solved graph to sometimes miss required dependency nodes because the
|
||||||
|
solver detected an incorrect dependency cycle.
|
||||||
|
|
||||||
|
* New API: pkgconf_queue_solve(), which replaces pkgconf_queue_apply().
|
||||||
|
pkgconf_queue_apply is now deprecated and should not be used in new code.
|
||||||
|
|
||||||
|
Changes from 1.9.0 to 1.9.1:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* Skip graph flattening and traversal for query types which only make sense
|
||||||
|
for a single pkg-config module.
|
||||||
|
|
||||||
|
The old solver walked these graphs with --maximum-traverse-depth=1 in
|
||||||
|
these cases, but this is no longer helpful because the graph is flattened
|
||||||
|
by the new solver.
|
||||||
|
|
||||||
|
Changes from 1.8.0 to 1.9.0:
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
* pkgconf 1.9.0 is the first testing release in the pkgconf 2.0 development
|
||||||
|
series. While it is believed to be suitable for production, there may be
|
||||||
|
bugs due to the overall redesign of the solver and other initiatives.
|
||||||
|
Additionally, a future release of pkgconf plans will have additional ABI
|
||||||
|
breaks for the libpkgconf library before the pkgconf 2.0 release is cut.
|
||||||
|
|
||||||
|
* There is now a new solver that is designed to provide higher performance
|
||||||
|
with complicated graphs, which works by flattening the dependency graph
|
||||||
|
into a smaller set of dependencies. This graph can then be evaluated
|
||||||
|
instead of the original dependency graph without having to visit every
|
||||||
|
edge in the graph.
|
||||||
|
|
||||||
|
NOTE: This solver, while providing significant performance improvements,
|
||||||
|
does so, at the cost of changed behavior for some edge cases (such as
|
||||||
|
circular dependencies).
|
||||||
|
|
||||||
|
* Bug fixes:
|
||||||
|
- Resolved several memory leaks with edge cases when using libpkgconf
|
||||||
|
directly.
|
||||||
|
- pkgconf CLI now consistently frees libpkgconf resources under all
|
||||||
|
circumstances.
|
||||||
|
- SYSROOT rules are no longer applied to `-uninstalled` packages by
|
||||||
|
default. Use `PKG_CONFIG_PKGCONF1_SYSROOT_RULES` for legacy behavior.
|
||||||
|
|
||||||
|
* A new `--license` selector has been added to the pkgconf CLI. This uses
|
||||||
|
SPDX expressions which can be set as the `License` field in `.pc` files.
|
||||||
|
See the `pc(5)` manpage for more information.
|
||||||
|
|
||||||
|
* The canonical location for pkgconf maintenance going forward is
|
||||||
|
<https://gitea.treehouse.systems/ariadne/pkgconf>. This is presently
|
||||||
|
mirrored to GitHub for user convenience, but that mirroring will
|
||||||
|
be terminated at some point (due to GitHub Copilot).
|
||||||
|
|
||||||
Changes from 1.7.4 to 1.8.0:
|
Changes from 1.7.4 to 1.8.0:
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
|
50
README.md
50
README.md
|
@ -3,9 +3,9 @@
|
||||||
`pkgconf` is a program which helps to configure compiler and linker flags for
|
`pkgconf` is a program which helps to configure compiler and linker flags for
|
||||||
development libraries. It is similar to pkg-config from freedesktop.org.
|
development libraries. It is similar to pkg-config from freedesktop.org.
|
||||||
|
|
||||||
`libpkgconf` is a library which provides access to most of `pkgconf`'s functionality, to allow
|
`libpkgconf` is a library which provides access to most of `pkgconf`'s functionality,
|
||||||
other tooling such as compilers and IDEs to discover and use libraries configured by
|
to allow other tooling such as compilers and IDEs to discover and use libraries
|
||||||
pkgconf.
|
configured by pkgconf.
|
||||||
|
|
||||||
## using `pkgconf` with autotools
|
## using `pkgconf` with autotools
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ to improve this behaviour.
|
||||||
As of the 1.1 series, pkgconf also fully implements support for `Provides` rules,
|
As of the 1.1 series, pkgconf also fully implements support for `Provides` rules,
|
||||||
while pkg-config does not. pkg-config only provides the `--print-provides` functionality
|
while pkg-config does not. pkg-config only provides the `--print-provides` functionality
|
||||||
as a stub. There are other intentional implementation differences in pkgconf's dependency
|
as a stub. There are other intentional implementation differences in pkgconf's dependency
|
||||||
resolver verses pkg-config's dependency resolver in terms of completeness and correctness,
|
resolver versus pkg-config's dependency resolver in terms of completeness and correctness,
|
||||||
such as, for example, how `Conflicts` rules are processed.
|
such as, for example, how `Conflicts` rules are processed.
|
||||||
|
|
||||||
## linker flags optimization
|
## linker flags optimization
|
||||||
|
@ -50,7 +50,7 @@ As previously mentioned, pkgconf makes optimizations to the linker flags in both
|
||||||
case of static and shared linking in order to avoid overlinking binaries and also
|
case of static and shared linking in order to avoid overlinking binaries and also
|
||||||
simplifies the `CFLAGS` and `LIBS` output of the pkgconf tool for improved readability.
|
simplifies the `CFLAGS` and `LIBS` output of the pkgconf tool for improved readability.
|
||||||
|
|
||||||
This functionality depends on the pkg-config module properly declaring it's dependency
|
This functionality depends on the pkg-config module properly declaring its dependency
|
||||||
tree instead of using `Libs` and `Cflags` fields to directly link against other modules
|
tree instead of using `Libs` and `Cflags` fields to directly link against other modules
|
||||||
which have pkg-config metadata files installed.
|
which have pkg-config metadata files installed.
|
||||||
|
|
||||||
|
@ -71,16 +71,25 @@ do let us know, but also make sure that the .pc files are valid and follow the r
|
||||||
the [pkg-config tutorial][fd-tut], as most likely fixing them to follow the specified
|
the [pkg-config tutorial][fd-tut], as most likely fixing them to follow the specified
|
||||||
rules will solve the problem.
|
rules will solve the problem.
|
||||||
|
|
||||||
Additionally, **we do not consider pkgconf doing what you tell it to do, when pkg-config
|
Additionally, **we do not consider pkgconf doing what you tell it to do, in cases for
|
||||||
fails to do so, to be a bug**.
|
which pkg-config fails to do so, to be a bug**.
|
||||||
|
|
||||||
If, for example, you use environment variables such as `PKG_CONFIG_SYSTEM_[INCLUDE|LIBRARY]_PATH`
|
If, for example, you use environment variables such as `PKG_CONFIG_SYSTEM_[INCLUDE|LIBRARY]_PATH`
|
||||||
and then find yourself surprised that `pkgconf` is stripping `-I` and `-L` flags relating
|
and then find yourself surprised that `pkgconf` is stripping `-I` and `-L` flags relating
|
||||||
to those paths, it's not a `pkgconf` problem -- `pkgconf` is doing exactly what you told
|
to those paths, it is not a `pkgconf` problem -- `pkgconf` is doing exactly what you told
|
||||||
it to do.
|
it to do.
|
||||||
|
|
||||||
We will reject bugs like this, and if you choose to violate our [Code of Conduct](CODE_OF_CONDUCT.md)
|
We will reject bugs like this, and if someone insists on fixing such a non-bug, this
|
||||||
by demanding we fix your non-bug, we will fix the problem by banning you from the repo instead.
|
constitutes a violation of our [Code of Conduct](CODE_OF_CONDUCT.md), which may be
|
||||||
|
addressed by banning from this repository.
|
||||||
|
|
||||||
|
## debug output
|
||||||
|
|
||||||
|
Please use only the stable interfaces to query pkg-config. Do not screen-scrape the
|
||||||
|
output from `--debug`: this is sent to `stderr` for a reason, it is not intended to be
|
||||||
|
scraped. The `--debug` output is **not** a stable interface, and should **never** be
|
||||||
|
depended on as a source of information. If you need a stable interface to query pkg-config
|
||||||
|
which is not covered, please get in touch.
|
||||||
|
|
||||||
## compiling `pkgconf` and `libpkgconf` on UNIX
|
## compiling `pkgconf` and `libpkgconf` on UNIX
|
||||||
|
|
||||||
|
@ -103,17 +112,16 @@ flags like so:
|
||||||
$ make
|
$ make
|
||||||
$ sudo make install
|
$ sudo make install
|
||||||
|
|
||||||
## compiling `pkgconf` and `libpkgconf` with CMake (usually for Windows)
|
## compiling `pkgconf` and `libpkgconf` with Meson (usually for Windows)
|
||||||
|
|
||||||
pkgconf is compiled using CMake on Windows. In theory, you could also use CMake to build
|
|
||||||
on UNIX, but this is not recommended at this time as it pkgconf is typically built much earlier
|
|
||||||
than CMake.
|
|
||||||
|
|
||||||
$ mkdir build
|
pkgconf is compiled using [Meson](https://mesonbuild.com) on Windows. In theory, you could also use
|
||||||
$ cd build
|
Meson to build on UNIX, but this is not recommended at this time as pkgconf is typically built
|
||||||
$ cmake ..
|
much earlier than Meson.
|
||||||
$ make
|
|
||||||
$ sudo make install
|
$ meson setup build -Dtests=disabled
|
||||||
|
$ meson compile -C build
|
||||||
|
$ meson install -C build
|
||||||
|
|
||||||
There are a few defines such as SYSTEM_LIBDIR, PKGCONFIGDIR and SYSTEM_INCLUDEDIR.
|
There are a few defines such as SYSTEM_LIBDIR, PKGCONFIGDIR and SYSTEM_INCLUDEDIR.
|
||||||
However, on Windows, the default PKGCONFIGDIR value is usually overridden at runtime based
|
However, on Windows, the default PKGCONFIGDIR value is usually overridden at runtime based
|
||||||
|
@ -129,8 +137,8 @@ to make this determination themselves.
|
||||||
|
|
||||||
## release tarballs
|
## release tarballs
|
||||||
|
|
||||||
Release tarballs are available at <https://distfiles.dereferenced.org/pkgconf/>.
|
Release tarballs are available at <https://distfiles.ariadne.space/pkgconf/>.
|
||||||
Please only use the tarballs from distfiles.dereferenced.org.
|
Please only use the tarballs from distfiles.ariadne.space.
|
||||||
|
|
||||||
## contacts
|
## contacts
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,368 @@
|
||||||
|
/*
|
||||||
|
* bomtool/main.c
|
||||||
|
* main() routine, printer functions
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
|
||||||
|
* pkgconf authors (see AUTHORS).
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* This software is provided 'as is' and without any warranty, express or
|
||||||
|
* implied. In no event shall the authors be liable for any damages arising
|
||||||
|
* from the use of this software.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libpkgconf/config.h"
|
||||||
|
#include <libpkgconf/stdinc.h>
|
||||||
|
#include <libpkgconf/libpkgconf.h>
|
||||||
|
#include "getopt_long.h"
|
||||||
|
|
||||||
|
#define PKG_VERSION (((uint64_t) 1) << 1)
|
||||||
|
#define PKG_ABOUT (((uint64_t) 1) << 2)
|
||||||
|
#define PKG_HELP (((uint64_t) 1) << 3)
|
||||||
|
|
||||||
|
static const char *spdx_version = "SPDX-2.2";
|
||||||
|
static const char *bom_license = "CC0-1.0";
|
||||||
|
static const char *document_ref = "SPDXRef-DOCUMENT";
|
||||||
|
|
||||||
|
static pkgconf_client_t pkg_client;
|
||||||
|
static uint64_t want_flags;
|
||||||
|
static size_t maximum_package_count = 0;
|
||||||
|
static int maximum_traverse_depth = 2000;
|
||||||
|
FILE *error_msgout = NULL;
|
||||||
|
|
||||||
|
static bool
|
||||||
|
error_handler(const char *msg, const pkgconf_client_t *client, void *data)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
(void) data;
|
||||||
|
fprintf(error_msgout, "%s", msg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
sbom_spdx_identity(pkgconf_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
static char buf[PKGCONF_ITEM_SIZE];
|
||||||
|
|
||||||
|
snprintf(buf, sizeof buf, "%sC64%s", pkg->id, pkg->version);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
sbom_name(pkgconf_pkg_t *world)
|
||||||
|
{
|
||||||
|
static char buf[PKGCONF_BUFSIZE];
|
||||||
|
pkgconf_node_t *node;
|
||||||
|
|
||||||
|
pkgconf_strlcpy(buf, "SBOM-SPDX", sizeof buf);
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, node)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
pkgconf_pkg_t *match = dep->match;
|
||||||
|
|
||||||
|
if ((dep->flags & PKGCONF_PKG_DEPF_QUERY) != PKGCONF_PKG_DEPF_QUERY)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!dep->match)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
pkgconf_strlcat(buf, "-", sizeof buf);
|
||||||
|
pkgconf_strlcat(buf, sbom_spdx_identity(match), sizeof buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_sbom_header(pkgconf_client_t *client, pkgconf_pkg_t *world)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
(void) world;
|
||||||
|
|
||||||
|
printf("SPDXVersion: %s\n", spdx_version);
|
||||||
|
printf("DataLicense: %s\n", bom_license);
|
||||||
|
printf("SPDXID: %s\n", document_ref);
|
||||||
|
printf("DocumentName: %s\n", sbom_name(world));
|
||||||
|
printf("DocumentNamespace: https://spdx.org/spdxdocs/bomtool-%s\n", PACKAGE_VERSION);
|
||||||
|
printf("Creator: Tool: bomtool %s\n", PACKAGE_VERSION);
|
||||||
|
|
||||||
|
printf("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
sbom_identity(pkgconf_pkg_t *pkg)
|
||||||
|
{
|
||||||
|
static char buf[PKGCONF_ITEM_SIZE];
|
||||||
|
|
||||||
|
snprintf(buf, sizeof buf, "%s@%s", pkg->id, pkg->version);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_sbom_package(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
(void) unused;
|
||||||
|
|
||||||
|
if (pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf("##### Package: %s\n\n", sbom_identity(pkg));
|
||||||
|
|
||||||
|
printf("PackageName: %s\n", sbom_identity(pkg));
|
||||||
|
printf("SPDXID: SPDXRef-Package-%s\n", sbom_spdx_identity(pkg));
|
||||||
|
printf("PackageVersion: %s\n", pkg->version);
|
||||||
|
printf("PackageDownloadLocation: NOASSERTION\n");
|
||||||
|
printf("PackageVerificationCode: NOASSERTION\n");
|
||||||
|
|
||||||
|
/* XXX: What about projects? */
|
||||||
|
if (pkg->maintainer != NULL)
|
||||||
|
printf("PackageSupplier: Person: %s\n", pkg->maintainer);
|
||||||
|
|
||||||
|
if (pkg->url != NULL)
|
||||||
|
printf("PackageHomePage: %s\n", pkg->url);
|
||||||
|
|
||||||
|
printf("PackageLicenseDeclared: %s\n", pkg->license != NULL ? pkg->license : "NOASSERTION");
|
||||||
|
|
||||||
|
if (pkg->copyright != NULL)
|
||||||
|
printf("PackageCopyrightText: <text>%s</text>\n", pkg->copyright);
|
||||||
|
|
||||||
|
if (pkg->description != NULL)
|
||||||
|
printf("PackageSummary: <text>%s</text>\n", pkg->description);
|
||||||
|
|
||||||
|
printf("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
write_sbom_relationships(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
(void) unused;
|
||||||
|
|
||||||
|
char baseref[PKGCONF_ITEM_SIZE];
|
||||||
|
pkgconf_node_t *node;
|
||||||
|
|
||||||
|
if (pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
snprintf(baseref, sizeof baseref, "SPDXRef-Package-%sC64%s", pkg->id, pkg->version);
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
pkgconf_pkg_t *match = dep->match;
|
||||||
|
|
||||||
|
if (!dep->match)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
printf("Relationship: %s DEPENDS_ON SPDXRef-Package-%s\n", baseref, sbom_spdx_identity(match));
|
||||||
|
printf("Relationship: SPDXRef-Package-%s DEPENDENCY_OF %s\n", sbom_spdx_identity(match), baseref);
|
||||||
|
}
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
pkgconf_pkg_t *match = dep->match;
|
||||||
|
|
||||||
|
if (!dep->match)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
printf("Relationship: %s DEPENDS_ON SPDXRef-Package-%s\n", baseref, sbom_spdx_identity(match));
|
||||||
|
printf("Relationship: SPDXRef-Package-%s DEV_DEPENDENCY_OF %s\n", sbom_spdx_identity(match), baseref);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg->required.head != NULL || pkg->requires_private.head != NULL)
|
||||||
|
printf("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
generate_sbom_from_world(pkgconf_client_t *client, pkgconf_pkg_t *world)
|
||||||
|
{
|
||||||
|
int eflag;
|
||||||
|
pkgconf_node_t *node;
|
||||||
|
|
||||||
|
write_sbom_header(client, world);
|
||||||
|
|
||||||
|
eflag = pkgconf_pkg_traverse(client, world, write_sbom_package, NULL, maximum_traverse_depth, 0);
|
||||||
|
if (eflag != PKGCONF_PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
eflag = pkgconf_pkg_traverse(client, world, write_sbom_relationships, NULL, maximum_traverse_depth, 0);
|
||||||
|
if (eflag != PKGCONF_PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, node)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
pkgconf_pkg_t *match = dep->match;
|
||||||
|
|
||||||
|
if (!dep->match)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
printf("Relationship: %s DESCRIBES SPDXRef-Package-%s\n", document_ref, sbom_spdx_identity(match));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
version(void)
|
||||||
|
{
|
||||||
|
printf("bomtool %s\n", PACKAGE_VERSION);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
about(void)
|
||||||
|
{
|
||||||
|
printf("bomtool (%s %s)\n", PACKAGE_NAME, PACKAGE_VERSION);
|
||||||
|
printf("Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021\n");
|
||||||
|
printf(" pkgconf authors (see AUTHORS in documentation directory).\n\n");
|
||||||
|
printf("Permission to use, copy, modify, and/or distribute this software for any\n");
|
||||||
|
printf("purpose with or without fee is hereby granted, provided that the above\n");
|
||||||
|
printf("copyright notice and this permission notice appear in all copies.\n\n");
|
||||||
|
printf("This software is provided 'as is' and without any warranty, express or\n");
|
||||||
|
printf("implied. In no event shall the authors be liable for any damages arising\n");
|
||||||
|
printf("from the use of this software.\n\n");
|
||||||
|
printf("Report bugs at <%s>.\n", PACKAGE_BUGREPORT);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
printf("usage: bomtool [--flags] [modules]\n");
|
||||||
|
|
||||||
|
printf("\nbasic options:\n\n");
|
||||||
|
|
||||||
|
printf(" --help this message\n");
|
||||||
|
printf(" --about print bomtool version and license to stdout\n");
|
||||||
|
printf(" --version print bomtool version to stdout\n");
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int ret = EXIT_SUCCESS;
|
||||||
|
pkgconf_list_t pkgq = PKGCONF_LIST_INITIALIZER;
|
||||||
|
unsigned int want_client_flags = PKGCONF_PKG_PKGF_SEARCH_PRIVATE;
|
||||||
|
pkgconf_cross_personality_t *personality = pkgconf_cross_personality_default();
|
||||||
|
pkgconf_pkg_t world = {
|
||||||
|
.id = "virtual:world",
|
||||||
|
.realname = "virtual world package",
|
||||||
|
.flags = PKGCONF_PKG_PROPF_STATIC | PKGCONF_PKG_PROPF_VIRTUAL,
|
||||||
|
};
|
||||||
|
|
||||||
|
error_msgout = stderr;
|
||||||
|
|
||||||
|
struct pkg_option options[] = {
|
||||||
|
{ "version", no_argument, &want_flags, PKG_VERSION, },
|
||||||
|
{ "about", no_argument, &want_flags, PKG_ABOUT, },
|
||||||
|
{ "help", no_argument, &want_flags, PKG_HELP, },
|
||||||
|
{ NULL, 0, NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1)
|
||||||
|
{
|
||||||
|
switch (ret)
|
||||||
|
{
|
||||||
|
case '?':
|
||||||
|
case ':':
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgconf_client_init(&pkg_client, error_handler, NULL, personality);
|
||||||
|
|
||||||
|
/* we have determined what features we want most likely. in some cases, we override later. */
|
||||||
|
pkgconf_client_set_flags(&pkg_client, want_client_flags);
|
||||||
|
|
||||||
|
/* at this point, want_client_flags should be set, so build the dir list */
|
||||||
|
pkgconf_client_dir_list_build(&pkg_client, personality);
|
||||||
|
|
||||||
|
if ((want_flags & PKG_ABOUT) == PKG_ABOUT)
|
||||||
|
return about();
|
||||||
|
|
||||||
|
if ((want_flags & PKG_VERSION) == PKG_VERSION)
|
||||||
|
return version();
|
||||||
|
|
||||||
|
if ((want_flags & PKG_HELP) == PKG_HELP)
|
||||||
|
return usage();
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
const char *package = argv[pkg_optind];
|
||||||
|
|
||||||
|
if (package == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* check if there is a limit to the number of packages allowed to be included, if so and we have hit
|
||||||
|
* the limit, stop adding packages to the queue.
|
||||||
|
*/
|
||||||
|
if (maximum_package_count > 0 && pkgq.length > maximum_package_count)
|
||||||
|
break;
|
||||||
|
|
||||||
|
while (isspace((unsigned char)package[0]))
|
||||||
|
package++;
|
||||||
|
|
||||||
|
/* skip empty packages */
|
||||||
|
if (package[0] == '\0') {
|
||||||
|
pkg_optind++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1])))
|
||||||
|
{
|
||||||
|
pkgconf_queue_push(&pkgq, package);
|
||||||
|
pkg_optind++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char packagebuf[PKGCONF_BUFSIZE];
|
||||||
|
|
||||||
|
snprintf(packagebuf, sizeof packagebuf, "%s %s %s", package, argv[pkg_optind + 1], argv[pkg_optind + 2]);
|
||||||
|
pkg_optind += 3;
|
||||||
|
|
||||||
|
pkgconf_queue_push(&pkgq, packagebuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkgq.head == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Please specify at least one package name on the command line.\n");
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
|
if (!pkgconf_queue_solve(&pkg_client, &pkgq, &world, maximum_traverse_depth))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!generate_sbom_from_world(&pkg_client, &world))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
pkgconf_solution_free(&pkg_client, &world);
|
||||||
|
pkgconf_queue_free(&pkgq);
|
||||||
|
pkgconf_cross_personality_deinit(personality);
|
||||||
|
pkgconf_client_deinit(&pkg_client);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
573
cli/main.c
573
cli/main.c
|
@ -70,11 +70,15 @@
|
||||||
#define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42)
|
#define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42)
|
||||||
#define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43)
|
#define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43)
|
||||||
#define PKG_SHARED (((uint64_t) 1) << 44)
|
#define PKG_SHARED (((uint64_t) 1) << 44)
|
||||||
|
#define PKG_DUMP_LICENSE (((uint64_t) 1) << 45)
|
||||||
|
#define PKG_SOLUTION (((uint64_t) 1) << 46)
|
||||||
|
#define PKG_EXISTS_CFLAGS (((uint64_t) 1) << 47)
|
||||||
|
|
||||||
static pkgconf_client_t pkg_client;
|
static pkgconf_client_t pkg_client;
|
||||||
static const pkgconf_fragment_render_ops_t *want_render_ops = NULL;
|
static const pkgconf_fragment_render_ops_t *want_render_ops = NULL;
|
||||||
|
|
||||||
static uint64_t want_flags;
|
static uint64_t want_flags;
|
||||||
|
static int verbosity = 0;
|
||||||
static int maximum_traverse_depth = 2000;
|
static int maximum_traverse_depth = 2000;
|
||||||
static size_t maximum_package_count = 0;
|
static size_t maximum_package_count = 0;
|
||||||
|
|
||||||
|
@ -85,7 +89,7 @@ FILE *error_msgout = NULL;
|
||||||
FILE *logfile_out = NULL;
|
FILE *logfile_out = NULL;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
error_handler(const char *msg, const pkgconf_client_t *client, const void *data)
|
error_handler(const char *msg, const pkgconf_client_t *client, void *data)
|
||||||
{
|
{
|
||||||
(void) client;
|
(void) client;
|
||||||
(void) data;
|
(void) data;
|
||||||
|
@ -251,32 +255,71 @@ apply_provides(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
static void
|
static void
|
||||||
print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
|
print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
(void) client;
|
(void) client;
|
||||||
(void) unused;
|
pkgconf_pkg_t **last_seen = data;
|
||||||
|
|
||||||
printf("\"%s\" [fontname=Sans fontsize=8]\n", pkg->id);
|
if(pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pkg->flags & PKGCONF_PKG_PROPF_VISITED_PRIVATE)
|
||||||
|
printf("\"%s\" [fontname=Sans fontsize=8 fontcolor=gray color=gray]\n", pkg->id);
|
||||||
|
else
|
||||||
|
printf("\"%s\" [fontname=Sans fontsize=8]\n", pkg->id);
|
||||||
|
|
||||||
|
if (last_seen != NULL)
|
||||||
|
{
|
||||||
|
if (*last_seen != NULL)
|
||||||
|
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=red]\n", (*last_seen)->id, pkg->id);
|
||||||
|
|
||||||
|
*last_seen = pkg;
|
||||||
|
}
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
|
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep = node->data;
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
const char *dep_id = (dep->match != NULL) ? dep->match->id : dep->package;
|
||||||
|
|
||||||
printf("\"%s\" -- \"%s\" [fontname=Sans fontsize=8]\n", dep->package, pkg->id);
|
if ((dep->flags & PKGCONF_PKG_DEPF_PRIVATE) == 0)
|
||||||
|
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8]\n", pkg->id, dep_id);
|
||||||
|
else
|
||||||
|
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
const char *dep_id = (dep->match != NULL) ? dep->match->id : dep->package;
|
||||||
|
|
||||||
|
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
|
apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
|
||||||
{
|
{
|
||||||
int eflag;
|
int eflag;
|
||||||
|
pkgconf_list_t *list = data;
|
||||||
|
pkgconf_pkg_t *last_seen = NULL;
|
||||||
|
pkgconf_node_t *iter;
|
||||||
|
|
||||||
printf("graph deptree {\n");
|
printf("digraph deptree {\n");
|
||||||
printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n");
|
printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n");
|
||||||
printf("node [fontname=Sans fontsize=8]\n");
|
printf("node [fontname=Sans fontsize=8]\n");
|
||||||
|
printf("\"user:request\" [fontname=Sans fontsize=8]\n");
|
||||||
|
|
||||||
eflag = pkgconf_pkg_traverse(client, world, print_digraph_node, unused, maxdepth, 0);
|
PKGCONF_FOREACH_LIST_ENTRY(list->head, iter)
|
||||||
|
{
|
||||||
|
pkgconf_queue_t *pkgq = iter->data;
|
||||||
|
pkgconf_pkg_t *pkg = pkgconf_pkg_find(client, pkgq->package);
|
||||||
|
printf("\"user:request\" -> \"%s\" [fontname=Sans fontsize=8]\n", pkg == NULL ? pkgq->package : pkg->id);
|
||||||
|
if (pkg != NULL)
|
||||||
|
pkgconf_pkg_unref(client, pkg);
|
||||||
|
}
|
||||||
|
|
||||||
|
eflag = pkgconf_pkg_traverse(client, world, print_digraph_node, &last_seen, maxdepth, 0);
|
||||||
|
|
||||||
if (eflag != PKGCONF_PKG_ERRF_OK)
|
if (eflag != PKGCONF_PKG_ERRF_OK)
|
||||||
return false;
|
return false;
|
||||||
|
@ -284,23 +327,62 @@ apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
|
||||||
printf("}\n");
|
printf("}\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_solution_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
(void) unused;
|
||||||
|
|
||||||
|
printf("%s (%"PRIu64")\n", pkg->id, pkg->identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
apply_print_solution(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
|
||||||
|
{
|
||||||
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkgconf_pkg_traverse(client, world, print_solution_node, unused, maxdepth, 0);
|
||||||
|
|
||||||
|
return eflag == PKGCONF_PKG_ERRF_OK;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
|
apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *iter;
|
pkgconf_node_t *queue_iter;
|
||||||
|
pkgconf_list_t *pkgq = data;
|
||||||
(void) client;
|
(void) client;
|
||||||
(void) unused;
|
|
||||||
(void) maxdepth;
|
(void) maxdepth;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, iter)
|
PKGCONF_FOREACH_LIST_ENTRY(pkgq->head, queue_iter)
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep = iter->data;
|
pkgconf_node_t *world_iter;
|
||||||
pkgconf_pkg_t *pkg = dep->match;
|
pkgconf_queue_t *queue_node = queue_iter->data;
|
||||||
|
|
||||||
if (pkg->version != NULL)
|
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, world_iter)
|
||||||
printf("%s\n", pkg->version);
|
{
|
||||||
|
pkgconf_dependency_t *dep = world_iter->data;
|
||||||
|
pkgconf_pkg_t *pkg = dep->match;
|
||||||
|
|
||||||
|
const size_t name_len = strlen(pkg->why);
|
||||||
|
if (name_len > strlen(queue_node->package) ||
|
||||||
|
strncmp(pkg->why, queue_node->package, name_len) ||
|
||||||
|
(queue_node->package[name_len] != 0 &&
|
||||||
|
!isspace((unsigned char)queue_node->package[name_len]) &&
|
||||||
|
!PKGCONF_IS_OPERATOR_CHAR(queue_node->package[name_len])))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pkg->version != NULL) {
|
||||||
|
if (verbosity)
|
||||||
|
printf("%s: ", pkg->id);
|
||||||
|
|
||||||
|
printf("%s\n", pkg->version);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -346,16 +428,6 @@ apply_path(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int max
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
print_variable(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *variable)
|
|
||||||
{
|
|
||||||
const char *var;
|
|
||||||
|
|
||||||
var = pkgconf_tuple_find(client, &pkg->vars, variable);
|
|
||||||
if (var != NULL)
|
|
||||||
printf("%s", var);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, int maxdepth)
|
apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, int maxdepth)
|
||||||
{
|
{
|
||||||
|
@ -366,11 +438,12 @@ apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, i
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep = iter->data;
|
pkgconf_dependency_t *dep = iter->data;
|
||||||
pkgconf_pkg_t *pkg = dep->match;
|
pkgconf_pkg_t *pkg = dep->match;
|
||||||
|
const char *var;
|
||||||
|
|
||||||
if (iter->prev != NULL)
|
var = pkgconf_tuple_find(client, &pkg->vars, variable);
|
||||||
printf(" ");
|
|
||||||
|
|
||||||
print_variable(client, pkg, variable);
|
if (var != NULL)
|
||||||
|
printf("%s%s", iter->prev != NULL ? " " : "", var);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -381,7 +454,8 @@ apply_variable(pkgconf_client_t *client, pkgconf_pkg_t *world, void *variable, i
|
||||||
static bool
|
static bool
|
||||||
apply_env_var(const char *prefix, pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth,
|
apply_env_var(const char *prefix, pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth,
|
||||||
unsigned int (*collect_fn)(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth),
|
unsigned int (*collect_fn)(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth),
|
||||||
bool (*filter_fn)(const pkgconf_client_t *client, const pkgconf_fragment_t *frag, void *data))
|
bool (*filter_fn)(const pkgconf_client_t *client, const pkgconf_fragment_t *frag, void *data),
|
||||||
|
void (*postprocess_fn)(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *fragment_list))
|
||||||
{
|
{
|
||||||
pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t unfiltered_list = PKGCONF_LIST_INITIALIZER;
|
||||||
pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t filtered_list = PKGCONF_LIST_INITIALIZER;
|
||||||
|
@ -394,6 +468,9 @@ apply_env_var(const char *prefix, pkgconf_client_t *client, pkgconf_pkg_t *world
|
||||||
|
|
||||||
pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_fn, NULL);
|
pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_fn, NULL);
|
||||||
|
|
||||||
|
if (postprocess_fn != NULL)
|
||||||
|
postprocess_fn(client, world, &filtered_list);
|
||||||
|
|
||||||
if (filtered_list.head == NULL)
|
if (filtered_list.head == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -408,6 +485,94 @@ out:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
maybe_add_module_definitions(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *fragment_list)
|
||||||
|
{
|
||||||
|
pkgconf_node_t *world_iter;
|
||||||
|
|
||||||
|
if ((want_flags & PKG_EXISTS_CFLAGS) != PKG_EXISTS_CFLAGS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, world_iter)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = world_iter->data;
|
||||||
|
char havebuf[PKGCONF_ITEM_SIZE];
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
if ((dep->flags & PKGCONF_PKG_DEPF_QUERY) != PKGCONF_PKG_DEPF_QUERY)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (dep->match == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
snprintf(havebuf, sizeof havebuf, "HAVE_%s", dep->match->id);
|
||||||
|
|
||||||
|
for (p = havebuf; *p; p++)
|
||||||
|
{
|
||||||
|
switch (*p)
|
||||||
|
{
|
||||||
|
case ' ':
|
||||||
|
case '-':
|
||||||
|
*p = '_';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
*p = toupper((unsigned char) *p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgconf_fragment_insert(client, fragment_list, 'D', havebuf, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
apply_env_variables(pkgconf_client_t *client, pkgconf_pkg_t *world, const char *env_prefix)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
pkgconf_node_t *world_iter;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, world_iter)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = world_iter->data;
|
||||||
|
pkgconf_pkg_t *pkg = dep->match;
|
||||||
|
pkgconf_node_t *tuple_iter;
|
||||||
|
|
||||||
|
if ((dep->flags & PKGCONF_PKG_DEPF_QUERY) != PKGCONF_PKG_DEPF_QUERY)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (dep->match == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(pkg->vars.head, tuple_iter)
|
||||||
|
{
|
||||||
|
pkgconf_tuple_t *tuple = tuple_iter->data;
|
||||||
|
char havebuf[PKGCONF_ITEM_SIZE];
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
if (want_variable != NULL && strcmp(want_variable, tuple->key))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
snprintf(havebuf, sizeof havebuf, "%s_%s", env_prefix, tuple->key);
|
||||||
|
|
||||||
|
for (p = havebuf; *p; p++)
|
||||||
|
{
|
||||||
|
switch (*p)
|
||||||
|
{
|
||||||
|
case ' ':
|
||||||
|
case '-':
|
||||||
|
*p = '_';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
*p = toupper((unsigned char) *p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s='%s'\n", havebuf, tuple->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
apply_env(pkgconf_client_t *client, pkgconf_pkg_t *world, void *env_prefix_p, int maxdepth)
|
apply_env(pkgconf_client_t *client, pkgconf_pkg_t *world, void *env_prefix_p, int maxdepth)
|
||||||
{
|
{
|
||||||
|
@ -415,17 +580,21 @@ apply_env(pkgconf_client_t *client, pkgconf_pkg_t *world, void *env_prefix_p, in
|
||||||
char workbuf[PKGCONF_ITEM_SIZE];
|
char workbuf[PKGCONF_ITEM_SIZE];
|
||||||
|
|
||||||
for (it = want_env_prefix; *it != '\0'; it++)
|
for (it = want_env_prefix; *it != '\0'; it++)
|
||||||
if (!isalpha(*it) && !isdigit(*it))
|
if (!isalpha((unsigned char)*it) &&
|
||||||
|
!isdigit((unsigned char)*it))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
snprintf(workbuf, sizeof workbuf, "%s_CFLAGS", want_env_prefix);
|
snprintf(workbuf, sizeof workbuf, "%s_CFLAGS", want_env_prefix);
|
||||||
if (!apply_env_var(workbuf, client, world, maxdepth, pkgconf_pkg_cflags, filter_cflags))
|
if (!apply_env_var(workbuf, client, world, maxdepth, pkgconf_pkg_cflags, filter_cflags, maybe_add_module_definitions))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
snprintf(workbuf, sizeof workbuf, "%s_LIBS", want_env_prefix);
|
snprintf(workbuf, sizeof workbuf, "%s_LIBS", want_env_prefix);
|
||||||
if (!apply_env_var(workbuf, client, world, maxdepth, pkgconf_pkg_libs, filter_libs))
|
if (!apply_env_var(workbuf, client, world, maxdepth, pkgconf_pkg_libs, filter_libs, NULL))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES || want_variable != NULL)
|
||||||
|
apply_env_variables(client, world, want_env_prefix);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,6 +612,7 @@ apply_cflags(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int m
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_cflags, NULL);
|
pkgconf_fragment_filter(client, &filtered_list, &unfiltered_list, filter_cflags, NULL);
|
||||||
|
maybe_add_module_definitions(client, world, &filtered_list);
|
||||||
|
|
||||||
if (filtered_list.head == NULL)
|
if (filtered_list.head == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -593,6 +763,32 @@ apply_simulate(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int m
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_license(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
(void) data;
|
||||||
|
|
||||||
|
if (pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* NOASSERTION is the default when the license is unknown, per SPDX spec § 3.15 */
|
||||||
|
printf("%s: %s\n", pkg->id, pkg->license != NULL ? pkg->license : "NOASSERTION");
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
apply_license(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
|
||||||
|
{
|
||||||
|
int eflag;
|
||||||
|
|
||||||
|
eflag = pkgconf_pkg_traverse(client, world, print_license, data, maxdepth, 0);
|
||||||
|
|
||||||
|
if (eflag != PKGCONF_PKG_ERRF_OK)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
version(void)
|
version(void)
|
||||||
{
|
{
|
||||||
|
@ -624,6 +820,7 @@ usage(void)
|
||||||
printf(" --help this message\n");
|
printf(" --help this message\n");
|
||||||
printf(" --about print pkgconf version and license to stdout\n");
|
printf(" --about print pkgconf version and license to stdout\n");
|
||||||
printf(" --version print supported pkg-config version to stdout\n");
|
printf(" --version print supported pkg-config version to stdout\n");
|
||||||
|
printf(" --verbose print additional information\n");
|
||||||
printf(" --atleast-pkgconfig-version check whether or not pkgconf is compatible\n");
|
printf(" --atleast-pkgconfig-version check whether or not pkgconf is compatible\n");
|
||||||
printf(" with a specified pkg-config version\n");
|
printf(" with a specified pkg-config version\n");
|
||||||
printf(" --errors-to-stdout print all errors on stdout instead of stderr\n");
|
printf(" --errors-to-stdout print all errors on stdout instead of stderr\n");
|
||||||
|
@ -690,18 +887,22 @@ usage(void)
|
||||||
printf(" --print-variables print all known variables in module to stdout\n");
|
printf(" --print-variables print all known variables in module to stdout\n");
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
printf(" --digraph print entire dependency graph in graphviz 'dot' format\n");
|
printf(" --digraph print entire dependency graph in graphviz 'dot' format\n");
|
||||||
|
printf(" --solution print dependency graph solution in a simple format\n");
|
||||||
#endif
|
#endif
|
||||||
printf(" --keep-system-cflags keep -I%s entries in cflags output\n", SYSTEM_INCLUDEDIR);
|
printf(" --keep-system-cflags keep -I%s entries in cflags output\n", SYSTEM_INCLUDEDIR);
|
||||||
printf(" --keep-system-libs keep -L%s entries in libs output\n", SYSTEM_LIBDIR);
|
printf(" --keep-system-libs keep -L%s entries in libs output\n", SYSTEM_LIBDIR);
|
||||||
printf(" --path show the exact filenames for any matching .pc files\n");
|
printf(" --path show the exact filenames for any matching .pc files\n");
|
||||||
printf(" --modversion print the specified module's version to stdout\n");
|
printf(" --modversion print the specified module's version to stdout\n");
|
||||||
printf(" --internal-cflags do not filter 'internal' cflags from output\n");
|
printf(" --internal-cflags do not filter 'internal' cflags from output\n");
|
||||||
|
printf(" --license print the specified module's license to stdout if known\n");
|
||||||
|
printf(" --exists-cflags add -DHAVE_FOO fragments to cflags for each found module\n");
|
||||||
|
|
||||||
printf("\nfiltering output:\n\n");
|
printf("\nfiltering output:\n\n");
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
printf(" --msvc-syntax print translatable fragments in MSVC syntax\n");
|
printf(" --msvc-syntax print translatable fragments in MSVC syntax\n");
|
||||||
#endif
|
#endif
|
||||||
printf(" --fragment-filter=types filter output fragments to the specified types\n");
|
printf(" --fragment-filter=types filter output fragments to the specified types\n");
|
||||||
|
printf(" --env=prefix print output as shell-compatible environmental variables\n");
|
||||||
|
|
||||||
printf("\nreport bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
printf("\nreport bugs to <%s>.\n", PACKAGE_BUGREPORT);
|
||||||
}
|
}
|
||||||
|
@ -801,8 +1002,13 @@ main(int argc, char *argv[])
|
||||||
char *logfile_arg = NULL;
|
char *logfile_arg = NULL;
|
||||||
char *want_env_prefix = NULL;
|
char *want_env_prefix = NULL;
|
||||||
unsigned int want_client_flags = PKGCONF_PKG_PKGF_NONE;
|
unsigned int want_client_flags = PKGCONF_PKG_PKGF_NONE;
|
||||||
pkgconf_cross_personality_t *personality;
|
pkgconf_cross_personality_t *personality = NULL;
|
||||||
bool opened_error_msgout = false;
|
bool opened_error_msgout = false;
|
||||||
|
pkgconf_pkg_t world = {
|
||||||
|
.id = "virtual:world",
|
||||||
|
.realname = "virtual world package",
|
||||||
|
.flags = PKGCONF_PKG_PROPF_STATIC | PKGCONF_PKG_PROPF_VIRTUAL,
|
||||||
|
};
|
||||||
|
|
||||||
want_flags = 0;
|
want_flags = 0;
|
||||||
|
|
||||||
|
@ -836,6 +1042,7 @@ main(int argc, char *argv[])
|
||||||
{ "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, },
|
{ "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, },
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
{ "digraph", no_argument, &want_flags, PKG_DIGRAPH, },
|
{ "digraph", no_argument, &want_flags, PKG_DIGRAPH, },
|
||||||
|
{ "solution", no_argument, &want_flags, PKG_SOLUTION, },
|
||||||
#endif
|
#endif
|
||||||
{ "help", no_argument, &want_flags, PKG_HELP, },
|
{ "help", no_argument, &want_flags, PKG_HELP, },
|
||||||
{ "env-only", no_argument, &want_flags, PKG_ENV_ONLY, },
|
{ "env-only", no_argument, &want_flags, PKG_ENV_ONLY, },
|
||||||
|
@ -883,6 +1090,9 @@ main(int argc, char *argv[])
|
||||||
{ "dump-personality", no_argument, &want_flags, PKG_DUMP_PERSONALITY },
|
{ "dump-personality", no_argument, &want_flags, PKG_DUMP_PERSONALITY },
|
||||||
{ "personality", required_argument, NULL, 53 },
|
{ "personality", required_argument, NULL, 53 },
|
||||||
#endif
|
#endif
|
||||||
|
{ "license", no_argument, &want_flags, PKG_DUMP_LICENSE },
|
||||||
|
{ "verbose", no_argument, NULL, 55 },
|
||||||
|
{ "exists-cflags", no_argument, &want_flags, PKG_EXISTS_CFLAGS },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -894,12 +1104,6 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
|
||||||
personality = deduce_personality(argv);
|
|
||||||
#else
|
|
||||||
personality = pkgconf_cross_personality_default();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1)
|
while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1)
|
||||||
{
|
{
|
||||||
switch (ret)
|
switch (ret)
|
||||||
|
@ -929,7 +1133,7 @@ main(int argc, char *argv[])
|
||||||
logfile_arg = pkg_optarg;
|
logfile_arg = pkg_optarg;
|
||||||
break;
|
break;
|
||||||
case 42:
|
case 42:
|
||||||
pkgconf_path_add(pkg_optarg, &dir_list, true);
|
pkgconf_path_prepend(pkg_optarg, &dir_list, true);
|
||||||
break;
|
break;
|
||||||
case 43:
|
case 43:
|
||||||
pkgconf_client_set_prefix_varname(&pkg_client, pkg_optarg);
|
pkgconf_client_set_prefix_varname(&pkg_client, pkg_optarg);
|
||||||
|
@ -948,15 +1152,26 @@ main(int argc, char *argv[])
|
||||||
personality = pkgconf_cross_personality_find(pkg_optarg);
|
personality = pkgconf_cross_personality_find(pkg_optarg);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case 55:
|
||||||
|
verbosity++;
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
case ':':
|
case ':':
|
||||||
return EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
break;
|
goto out;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (personality == NULL) {
|
||||||
|
#ifndef PKGCONF_LITE
|
||||||
|
personality = deduce_personality(argv);
|
||||||
|
#else
|
||||||
|
personality = pkgconf_cross_personality_default();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
pkgconf_path_copy_list(&personality->dir_list, &dir_list);
|
pkgconf_path_copy_list(&personality->dir_list, &dir_list);
|
||||||
pkgconf_path_free(&dir_list);
|
pkgconf_path_free(&dir_list);
|
||||||
|
|
||||||
|
@ -1001,24 +1216,33 @@ main(int argc, char *argv[])
|
||||||
if ((want_flags & PKG_ABOUT) == PKG_ABOUT)
|
if ((want_flags & PKG_ABOUT) == PKG_ABOUT)
|
||||||
{
|
{
|
||||||
about();
|
about();
|
||||||
return EXIT_SUCCESS;
|
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_VERSION) == PKG_VERSION)
|
if ((want_flags & PKG_VERSION) == PKG_VERSION)
|
||||||
{
|
{
|
||||||
version();
|
version();
|
||||||
return EXIT_SUCCESS;
|
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_HELP) == PKG_HELP)
|
if ((want_flags & PKG_HELP) == PKG_HELP)
|
||||||
{
|
{
|
||||||
usage();
|
usage();
|
||||||
return EXIT_SUCCESS;
|
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getenv("PKG_CONFIG_FDO_SYSROOT_RULES"))
|
if (getenv("PKG_CONFIG_FDO_SYSROOT_RULES"))
|
||||||
want_client_flags |= PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES;
|
want_client_flags |= PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES;
|
||||||
|
|
||||||
|
if (getenv("PKG_CONFIG_PKGCONF1_SYSROOT_RULES"))
|
||||||
|
want_client_flags |= PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES;
|
||||||
|
|
||||||
if ((want_flags & PKG_SHORT_ERRORS) == PKG_SHORT_ERRORS)
|
if ((want_flags & PKG_SHORT_ERRORS) == PKG_SHORT_ERRORS)
|
||||||
want_client_flags |= PKGCONF_PKG_PKGF_SIMPLIFY_ERRORS;
|
want_client_flags |= PKGCONF_PKG_PKGF_SIMPLIFY_ERRORS;
|
||||||
|
|
||||||
|
@ -1039,9 +1263,6 @@ main(int argc, char *argv[])
|
||||||
if ((want_flags & PKG_STATIC) == PKG_STATIC || personality->want_default_static)
|
if ((want_flags & PKG_STATIC) == PKG_STATIC || personality->want_default_static)
|
||||||
want_client_flags |= (PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS);
|
want_client_flags |= (PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS);
|
||||||
|
|
||||||
if ((want_flags & PKG_EXISTS) == PKG_EXISTS)
|
|
||||||
want_client_flags |= PKGCONF_PKG_PKGF_SEARCH_PRIVATE;
|
|
||||||
|
|
||||||
if ((want_flags & PKG_SHARED) == PKG_SHARED)
|
if ((want_flags & PKG_SHARED) == PKG_SHARED)
|
||||||
want_client_flags &= ~(PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS);
|
want_client_flags &= ~(PKGCONF_PKG_PKGF_SEARCH_PRIVATE | PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS);
|
||||||
|
|
||||||
|
@ -1061,7 +1282,7 @@ main(int argc, char *argv[])
|
||||||
/* On Windows we want to always redefine the prefix by default
|
/* On Windows we want to always redefine the prefix by default
|
||||||
* but allow that behavior to be manually disabled */
|
* but allow that behavior to be manually disabled */
|
||||||
#if !defined(_WIN32) && !defined(_WIN64)
|
#if !defined(_WIN32) && !defined(_WIN64)
|
||||||
if ((want_flags & PKG_DEFINE_PREFIX) == PKG_DEFINE_PREFIX)
|
if ((want_flags & PKG_DEFINE_PREFIX) == PKG_DEFINE_PREFIX || getenv("PKG_CONFIG_RELOCATE_PATHS") != NULL)
|
||||||
#endif
|
#endif
|
||||||
want_client_flags |= PKGCONF_PKG_PKGF_REDEFINE_PREFIX;
|
want_client_flags |= PKGCONF_PKG_PKGF_REDEFINE_PREFIX;
|
||||||
|
|
||||||
|
@ -1077,28 +1298,24 @@ main(int argc, char *argv[])
|
||||||
if ((want_flags & PKG_INTERNAL_CFLAGS) == PKG_INTERNAL_CFLAGS)
|
if ((want_flags & PKG_INTERNAL_CFLAGS) == PKG_INTERNAL_CFLAGS)
|
||||||
want_client_flags |= PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS;
|
want_client_flags |= PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS;
|
||||||
|
|
||||||
#ifdef XXX_NOTYET
|
/* if these selectors are used, it means that we are querying metadata.
|
||||||
/* if these selectors are used, it means that we are inquiring about a single package.
|
* so signal to libpkgconf that we only want to walk the flattened dependency set.
|
||||||
* so signal to libpkgconf that we do not want to use the dependency resolver for more than one level,
|
|
||||||
* and also limit the SAT problem to a single package.
|
|
||||||
*
|
|
||||||
* i disabled this because too many upstream maintainers are still invoking pkg-config correctly to have
|
|
||||||
* the more sane behaviour as default. use --maximum-traverse-depth=1 or PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH
|
|
||||||
* environment variable to get the same results in meantime.
|
|
||||||
*/
|
*/
|
||||||
if ((want_flags & PKG_EXISTS) == 0 &&
|
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION ||
|
||||||
((want_flags & PKG_REQUIRES) == PKG_REQUIRES ||
|
(want_flags & PKG_REQUIRES) == PKG_REQUIRES ||
|
||||||
(want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE ||
|
(want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE ||
|
||||||
(want_flags & PKG_PROVIDES) == PKG_PROVIDES ||
|
(want_flags & PKG_PROVIDES) == PKG_PROVIDES ||
|
||||||
(want_flags & PKG_VARIABLES) == PKG_VARIABLES ||
|
(want_flags & PKG_VARIABLES) == PKG_VARIABLES ||
|
||||||
(want_flags & PKG_MODVERSION) == PKG_MODVERSION ||
|
(want_flags & PKG_PATH) == PKG_PATH)
|
||||||
(want_flags & PKG_PATH) == PKG_PATH ||
|
|
||||||
want_variable != NULL))
|
|
||||||
{
|
|
||||||
maximum_package_count = 1;
|
|
||||||
maximum_traverse_depth = 1;
|
maximum_traverse_depth = 1;
|
||||||
}
|
|
||||||
#endif
|
/* if we are asking for a variable, path or list of variables, this only makes sense
|
||||||
|
* for a single package.
|
||||||
|
*/
|
||||||
|
if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES ||
|
||||||
|
(want_flags & PKG_PATH) == PKG_PATH ||
|
||||||
|
want_variable != NULL)
|
||||||
|
maximum_package_count = 1;
|
||||||
|
|
||||||
if (getenv("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") != NULL)
|
if (getenv("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") != NULL)
|
||||||
want_flags |= PKG_KEEP_SYSTEM_CFLAGS;
|
want_flags |= PKG_KEEP_SYSTEM_CFLAGS;
|
||||||
|
@ -1109,6 +1326,12 @@ main(int argc, char *argv[])
|
||||||
if ((builddir = getenv("PKG_CONFIG_TOP_BUILD_DIR")) != NULL)
|
if ((builddir = getenv("PKG_CONFIG_TOP_BUILD_DIR")) != NULL)
|
||||||
pkgconf_client_set_buildroot_dir(&pkg_client, builddir);
|
pkgconf_client_set_buildroot_dir(&pkg_client, builddir);
|
||||||
|
|
||||||
|
if ((want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE ||
|
||||||
|
(want_flags & PKG_CFLAGS))
|
||||||
|
{
|
||||||
|
want_client_flags |= PKGCONF_PKG_PKGF_SEARCH_PRIVATE;
|
||||||
|
}
|
||||||
|
|
||||||
if ((sysroot_dir = getenv("PKG_CONFIG_SYSROOT_DIR")) != NULL)
|
if ((sysroot_dir = getenv("PKG_CONFIG_SYSROOT_DIR")) != NULL)
|
||||||
{
|
{
|
||||||
const char *destdir;
|
const char *destdir;
|
||||||
|
@ -1131,21 +1354,25 @@ main(int argc, char *argv[])
|
||||||
if (required_pkgconfig_version != NULL)
|
if (required_pkgconfig_version != NULL)
|
||||||
{
|
{
|
||||||
if (pkgconf_compare_version(PACKAGE_VERSION, required_pkgconfig_version) >= 0)
|
if (pkgconf_compare_version(PACKAGE_VERSION, required_pkgconfig_version) >= 0)
|
||||||
return EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
else
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_LIST) == PKG_LIST)
|
if ((want_flags & PKG_LIST) == PKG_LIST)
|
||||||
{
|
{
|
||||||
pkgconf_scan_all(&pkg_client, NULL, print_list_entry);
|
pkgconf_scan_all(&pkg_client, NULL, print_list_entry);
|
||||||
return EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_LIST_PACKAGE_NAMES) == PKG_LIST_PACKAGE_NAMES)
|
if ((want_flags & PKG_LIST_PACKAGE_NAMES) == PKG_LIST_PACKAGE_NAMES)
|
||||||
{
|
{
|
||||||
pkgconf_scan_all(&pkg_client, NULL, print_package_entry);
|
pkgconf_scan_all(&pkg_client, NULL, print_package_entry);
|
||||||
return EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logfile_arg == NULL)
|
if (logfile_arg == NULL)
|
||||||
|
@ -1159,7 +1386,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
if (required_module_version != NULL)
|
if (required_module_version != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg;
|
pkgconf_pkg_t *pkg = NULL;
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
||||||
|
|
||||||
|
@ -1178,18 +1405,28 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (want_flags & PKG_PRINT_ERRORS)
|
if (want_flags & PKG_PRINT_ERRORS)
|
||||||
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkgconf_compare_version(pkg->version, required_module_version) >= 0)
|
if (pkgconf_compare_version(pkg->version, required_module_version) >= 0)
|
||||||
return EXIT_SUCCESS;
|
{
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
|
cleanup:
|
||||||
|
if (pkg != NULL)
|
||||||
|
pkgconf_pkg_unref(&pkg_client, pkg);
|
||||||
|
pkgconf_dependency_free(&deplist);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
else if (required_exact_module_version != NULL)
|
else if (required_exact_module_version != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg;
|
pkgconf_pkg_t *pkg = NULL;
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
||||||
|
|
||||||
|
@ -1208,18 +1445,28 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (want_flags & PKG_PRINT_ERRORS)
|
if (want_flags & PKG_PRINT_ERRORS)
|
||||||
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto cleanup2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0)
|
if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0)
|
||||||
return EXIT_SUCCESS;
|
{
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
|
goto cleanup2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
|
cleanup2:
|
||||||
|
if (pkg != NULL)
|
||||||
|
pkgconf_pkg_unref(&pkg_client, pkg);
|
||||||
|
pkgconf_dependency_free(&deplist);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
else if (required_max_module_version != NULL)
|
else if (required_max_module_version != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg;
|
pkgconf_pkg_t *pkg = NULL;
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
||||||
|
|
||||||
|
@ -1238,19 +1485,30 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (want_flags & PKG_PRINT_ERRORS)
|
if (want_flags & PKG_PRINT_ERRORS)
|
||||||
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto cleanup3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0)
|
if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0)
|
||||||
return EXIT_SUCCESS;
|
{
|
||||||
|
ret = EXIT_SUCCESS;
|
||||||
|
goto cleanup3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
|
cleanup3:
|
||||||
|
if (pkg != NULL)
|
||||||
|
pkgconf_pkg_unref(&pkg_client, pkg);
|
||||||
|
pkgconf_dependency_free(&deplist);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
const char *package = argv[pkg_optind];
|
char *package = argv[pkg_optind];
|
||||||
|
char *end;
|
||||||
|
|
||||||
if (package == NULL)
|
if (package == NULL)
|
||||||
break;
|
break;
|
||||||
|
@ -1258,10 +1516,10 @@ main(int argc, char *argv[])
|
||||||
/* check if there is a limit to the number of packages allowed to be included, if so and we have hit
|
/* check if there is a limit to the number of packages allowed to be included, if so and we have hit
|
||||||
* the limit, stop adding packages to the queue.
|
* the limit, stop adding packages to the queue.
|
||||||
*/
|
*/
|
||||||
if (maximum_package_count > 0 && pkgq.length > maximum_package_count)
|
if (maximum_package_count > 0 && pkgq.length >= maximum_package_count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
while (isspace((unsigned int)package[0]))
|
while (isspace((unsigned char)package[0]))
|
||||||
package++;
|
package++;
|
||||||
|
|
||||||
/* skip empty packages */
|
/* skip empty packages */
|
||||||
|
@ -1270,11 +1528,24 @@ main(int argc, char *argv[])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end = package + strlen(package) - 1;
|
||||||
|
while(end > package && isspace((unsigned char)end[0])) end--;
|
||||||
|
end[1] = '\0';
|
||||||
|
|
||||||
if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1])))
|
if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1])))
|
||||||
{
|
{
|
||||||
pkgconf_queue_push(&pkgq, package);
|
pkgconf_queue_push(&pkgq, package);
|
||||||
pkg_optind++;
|
pkg_optind++;
|
||||||
}
|
}
|
||||||
|
else if (argv[pkg_optind + 2] == NULL)
|
||||||
|
{
|
||||||
|
char packagebuf[PKGCONF_BUFSIZE];
|
||||||
|
|
||||||
|
snprintf(packagebuf, sizeof packagebuf, "%s %s", package, argv[pkg_optind + 1]);
|
||||||
|
pkg_optind += 2;
|
||||||
|
|
||||||
|
pkgconf_queue_push(&pkgq, packagebuf);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char packagebuf[PKGCONF_BUFSIZE];
|
char packagebuf[PKGCONF_BUFSIZE];
|
||||||
|
@ -1289,85 +1560,74 @@ main(int argc, char *argv[])
|
||||||
if (pkgq.head == NULL)
|
if (pkgq.head == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Please specify at least one package name on the command line.\n");
|
fprintf(stderr, "Please specify at least one package name on the command line.\n");
|
||||||
return EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
|
if (!pkgconf_queue_solve(&pkg_client, &pkgq, &world, maximum_traverse_depth))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
if ((want_flags & PKG_SIMULATE) == PKG_SIMULATE)
|
if ((want_flags & PKG_SIMULATE) == PKG_SIMULATE)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ERRORS);
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ERRORS);
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_simulate, -1, NULL))
|
apply_simulate(&pkg_client, &world, NULL, -1);
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!pkgconf_queue_validate(&pkg_client, &pkgq, maximum_traverse_depth))
|
if ((want_flags & PKG_VALIDATE) == PKG_VALIDATE)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if ((want_flags & PKG_DUMP_LICENSE) == PKG_DUMP_LICENSE)
|
||||||
{
|
{
|
||||||
ret = EXIT_FAILURE;
|
apply_license(&pkg_client, &world, &ret, 2);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_VALIDATE) == PKG_VALIDATE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED)
|
if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED)
|
||||||
{
|
{
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
pkgconf_queue_apply(&pkg_client, &pkgq, apply_uninstalled, maximum_traverse_depth, &ret);
|
apply_uninstalled(&pkg_client, &world, &ret, 2);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (want_env_prefix != NULL)
|
if (want_env_prefix != NULL)
|
||||||
{
|
{
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_env, maximum_traverse_depth, want_env_prefix))
|
apply_env(&pkg_client, &world, want_env_prefix, 2);
|
||||||
{
|
goto out;
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
want_flags = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_PROVIDES) == PKG_PROVIDES)
|
if ((want_flags & PKG_PROVIDES) == PKG_PROVIDES)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
apply_provides(&pkg_client, &world, NULL, 2);
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_provides, maximum_traverse_depth, NULL))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
if ((want_flags & PKG_DIGRAPH) == PKG_DIGRAPH)
|
if ((want_flags & PKG_DIGRAPH) == PKG_DIGRAPH)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
apply_digraph(&pkg_client, &world, &pkgq, 2);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_digraph, maximum_traverse_depth, NULL))
|
if ((want_flags & PKG_SOLUTION) == PKG_SOLUTION)
|
||||||
{
|
{
|
||||||
ret = EXIT_FAILURE;
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
goto out;
|
apply_print_solution(&pkg_client, &world, NULL, 2);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION)
|
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
apply_modversion(&pkg_client, &world, &pkgq, 2);
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_modversion, maximum_traverse_depth, NULL))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_PATH) == PKG_PATH)
|
if ((want_flags & PKG_PATH) == PKG_PATH)
|
||||||
|
@ -1375,22 +1635,13 @@ main(int argc, char *argv[])
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_path, maximum_traverse_depth, NULL))
|
apply_path(&pkg_client, &world, NULL, 2);
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES)
|
if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
apply_variables(&pkg_client, &world, NULL, 2);
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variables, maximum_traverse_depth, NULL))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (want_variable)
|
if (want_variable)
|
||||||
|
@ -1398,68 +1649,44 @@ main(int argc, char *argv[])
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variable, maximum_traverse_depth, want_variable))
|
apply_variable(&pkg_client, &world, want_variable, 2);
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_REQUIRES) == PKG_REQUIRES)
|
if ((want_flags & PKG_REQUIRES) == PKG_REQUIRES)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
apply_requires(&pkg_client, &world, NULL, 2);
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires, maximum_traverse_depth, NULL))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE)
|
if ((want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
|
apply_requires_private(&pkg_client, &world, NULL, 2);
|
||||||
|
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires_private, maximum_traverse_depth, NULL))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_CFLAGS))
|
if ((want_flags & PKG_CFLAGS))
|
||||||
{
|
{
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
|
apply_cflags(&pkg_client, &world, NULL, 2);
|
||||||
|
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_cflags, maximum_traverse_depth, NULL))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out_println;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_LIBS))
|
if ((want_flags & PKG_LIBS))
|
||||||
{
|
{
|
||||||
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_libs, maximum_traverse_depth, NULL))
|
if (want_flags & PKG_CFLAGS)
|
||||||
{
|
printf(" ");
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out_println;
|
if (!(want_flags & PKG_STATIC))
|
||||||
}
|
pkgconf_client_set_flags(&pkg_client, pkg_client.flags & ~PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
|
||||||
|
|
||||||
|
apply_libs(&pkg_client, &world, NULL, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_queue_free(&pkgq);
|
|
||||||
|
|
||||||
out_println:
|
|
||||||
if (want_flags & (PKG_CFLAGS|PKG_LIBS))
|
if (want_flags & (PKG_CFLAGS|PKG_LIBS))
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
pkgconf_solution_free(&pkg_client, &world);
|
||||||
|
pkgconf_queue_free(&pkgq);
|
||||||
pkgconf_cross_personality_deinit(personality);
|
pkgconf_cross_personality_deinit(personality);
|
||||||
pkgconf_client_deinit(&pkg_client);
|
pkgconf_client_deinit(&pkg_client);
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,6 @@ msvc_renderer_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, b
|
||||||
{
|
{
|
||||||
cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining);
|
cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining);
|
||||||
bptr += cnt;
|
bptr += cnt;
|
||||||
buf_remaining -= cnt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (escape)
|
if (escape)
|
||||||
|
|
15
configure.ac
15
configure.ac
|
@ -11,8 +11,8 @@ dnl This software is provided 'as is' and without any warranty, express or
|
||||||
dnl implied. In no event shall the authors be liable for any damages arising
|
dnl implied. In no event shall the authors be liable for any damages arising
|
||||||
dnl from the use of this software.
|
dnl from the use of this software.
|
||||||
|
|
||||||
AC_PREREQ([2.68])
|
AC_PREREQ([2.71])
|
||||||
AC_INIT([pkgconf], [1.8.1], [https://github.com/pkgconf/pkgconf/issues/new])
|
AC_INIT([pkgconf],[2.3.0],[https://github.com/pkgconf/pkgconf/issues/new])
|
||||||
AC_CONFIG_SRCDIR([cli/main.c])
|
AC_CONFIG_SRCDIR([cli/main.c])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
|
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
|
||||||
|
@ -22,7 +22,8 @@ AX_CHECK_COMPILE_FLAG([-std=gnu99], [CFLAGS="$CFLAGS -std=gnu99"], [
|
||||||
AX_CHECK_COMPILE_FLAG([-std=c99], [CFLAGS="$CFLAGS -std=c99"])
|
AX_CHECK_COMPILE_FLAG([-std=c99], [CFLAGS="$CFLAGS -std=c99"])
|
||||||
])
|
])
|
||||||
AC_CONFIG_HEADERS([libpkgconf/config.h])
|
AC_CONFIG_HEADERS([libpkgconf/config.h])
|
||||||
AC_CHECK_FUNCS([strlcpy strlcat strndup])
|
AC_CHECK_DECLS([strlcpy, strlcat, strndup], [], [], [[#include <string.h>]])
|
||||||
|
AC_CHECK_DECLS([reallocarray])
|
||||||
AC_CHECK_HEADERS([sys/stat.h])
|
AC_CHECK_HEADERS([sys/stat.h])
|
||||||
AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects])
|
AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
@ -30,26 +31,26 @@ LT_INIT
|
||||||
|
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
AC_ARG_WITH([personality-dir],[AC_HELP_STRING([--with-personality-dir],[specify
|
AC_ARG_WITH([personality-dir],[AS_HELP_STRING([--with-personality-dir],[specify
|
||||||
the place where cross-compile personality files will be found])],
|
the place where cross-compile personality files will be found])],
|
||||||
PERSONALITY_PATH="$withval",
|
PERSONALITY_PATH="$withval",
|
||||||
PERSONALITY_PATH="${datadir}/pkgconfig/personality.d:${sysconfdir}/pkgconfig/personality.d")
|
PERSONALITY_PATH="${datadir}/pkgconfig/personality.d:${sysconfdir}/pkgconfig/personality.d")
|
||||||
|
|
||||||
AC_SUBST([PERSONALITY_PATH])
|
AC_SUBST([PERSONALITY_PATH])
|
||||||
|
|
||||||
AC_ARG_WITH([pkg-config-dir],[AC_HELP_STRING([--with-pkg-config-dir],[specify
|
AC_ARG_WITH([pkg-config-dir],[AS_HELP_STRING([--with-pkg-config-dir],[specify
|
||||||
the place where pc files will be found])],PKG_DEFAULT_PATH="$withval",
|
the place where pc files will be found])],PKG_DEFAULT_PATH="$withval",
|
||||||
PKG_DEFAULT_PATH="${libdir}/pkgconfig:${datadir}/pkgconfig")
|
PKG_DEFAULT_PATH="${libdir}/pkgconfig:${datadir}/pkgconfig")
|
||||||
|
|
||||||
AC_SUBST([PKG_DEFAULT_PATH])
|
AC_SUBST([PKG_DEFAULT_PATH])
|
||||||
|
|
||||||
AC_ARG_WITH([system-libdir],[AC_HELP_STRING([--with-system-libdir],[specify the
|
AC_ARG_WITH([system-libdir],[AS_HELP_STRING([--with-system-libdir],[specify the
|
||||||
system library directory (default LIBDIR)])],
|
system library directory (default LIBDIR)])],
|
||||||
SYSTEM_LIBDIR="$withval", SYSTEM_LIBDIR="${libdir}")
|
SYSTEM_LIBDIR="$withval", SYSTEM_LIBDIR="${libdir}")
|
||||||
|
|
||||||
AC_SUBST([SYSTEM_LIBDIR])
|
AC_SUBST([SYSTEM_LIBDIR])
|
||||||
|
|
||||||
AC_ARG_WITH([system-includedir],[AC_HELP_STRING([--with-system-includedir],[specify the
|
AC_ARG_WITH([system-includedir],[AS_HELP_STRING([--with-system-includedir],[specify the
|
||||||
system include directory (default INCLUDEDIR)])],
|
system include directory (default INCLUDEDIR)])],
|
||||||
SYSTEM_INCLUDEDIR="$withval", SYSTEM_INCLUDEDIR="${includedir}")
|
SYSTEM_INCLUDEDIR="$withval", SYSTEM_INCLUDEDIR="${includedir}")
|
||||||
|
|
||||||
|
|
|
@ -70,21 +70,21 @@ def extract_comments(filename):
|
||||||
while True:
|
while True:
|
||||||
char = source_file.read(1)
|
char = source_file.read(1)
|
||||||
if not char:
|
if not char:
|
||||||
if state is 3 or state is 4:
|
if state == 3 or state == 4:
|
||||||
raise UnterminatedCommentError()
|
raise UnterminatedCommentError()
|
||||||
if state is 2:
|
if state == 2:
|
||||||
# Was in single line comment. Create comment.
|
# Was in single line comment. Create comment.
|
||||||
comment = Comment(current_comment, line_counter, False)
|
comment = Comment(current_comment, line_counter, False)
|
||||||
comments.append(comment)
|
comments.append(comment)
|
||||||
return comments
|
return comments
|
||||||
if state is 0:
|
if state == 0:
|
||||||
# Waiting for comment start character or beginning of
|
# Waiting for comment start character or beginning of
|
||||||
# string.
|
# string.
|
||||||
if char == '/':
|
if char == '/':
|
||||||
state = 1
|
state = 1
|
||||||
elif char == '"':
|
elif char == '"':
|
||||||
state = 5
|
state = 5
|
||||||
elif state is 1:
|
elif state == 1:
|
||||||
# Found comment start character, classify next character and
|
# Found comment start character, classify next character and
|
||||||
# determine if single or multiline comment.
|
# determine if single or multiline comment.
|
||||||
if char == '/':
|
if char == '/':
|
||||||
|
@ -94,7 +94,7 @@ def extract_comments(filename):
|
||||||
state = 3
|
state = 3
|
||||||
else:
|
else:
|
||||||
state = 0
|
state = 0
|
||||||
elif state is 2:
|
elif state == 2:
|
||||||
# In single line comment, read characters until EOL.
|
# In single line comment, read characters until EOL.
|
||||||
if char == '\n':
|
if char == '\n':
|
||||||
comment = Comment(current_comment, line_counter, False)
|
comment = Comment(current_comment, line_counter, False)
|
||||||
|
@ -103,14 +103,14 @@ def extract_comments(filename):
|
||||||
state = 0
|
state = 0
|
||||||
else:
|
else:
|
||||||
current_comment += char
|
current_comment += char
|
||||||
elif state is 3:
|
elif state == 3:
|
||||||
# In multi-line comment, add characters until '*'
|
# In multi-line comment, add characters until '*'
|
||||||
# encountered.
|
# encountered.
|
||||||
if char == '*':
|
if char == '*':
|
||||||
state = 4
|
state = 4
|
||||||
else:
|
else:
|
||||||
current_comment += char
|
current_comment += char
|
||||||
elif state is 4:
|
elif state == 4:
|
||||||
# In multi-line comment with asterisk found. Determine if
|
# In multi-line comment with asterisk found. Determine if
|
||||||
# comment is ending.
|
# comment is ending.
|
||||||
if char == '/':
|
if char == '/':
|
||||||
|
@ -125,13 +125,13 @@ def extract_comments(filename):
|
||||||
if char != '*':
|
if char != '*':
|
||||||
current_comment += char
|
current_comment += char
|
||||||
state = 3
|
state = 3
|
||||||
elif state is 5:
|
elif state == 5:
|
||||||
# In string literal, expect literal end or escape char.
|
# In string literal, expect literal end or escape char.
|
||||||
if char == '"':
|
if char == '"':
|
||||||
state = 0
|
state = 0
|
||||||
elif char == '\\':
|
elif char == '\\':
|
||||||
state = 6
|
state = 6
|
||||||
elif state is 6:
|
elif state == 6:
|
||||||
# In string literal, escaping current char.
|
# In string literal, escaping current char.
|
||||||
state = 5
|
state = 5
|
||||||
if char == '\n':
|
if char == '\n':
|
||||||
|
|
|
@ -9,21 +9,32 @@ in parallel.
|
||||||
Client objects are not thread safe, in other words, a client object should not be shared across
|
Client objects are not thread safe, in other words, a client object should not be shared across
|
||||||
thread boundaries.
|
thread boundaries.
|
||||||
|
|
||||||
.. c:function:: void pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler)
|
.. c:function:: void pkgconf_client_dir_list_build(pkgconf_client_t *client)
|
||||||
|
|
||||||
|
Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is set on the client,
|
||||||
|
then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the
|
||||||
|
``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* client: The pkgconf client object to bootstrap.
|
||||||
|
:return: nothing
|
||||||
|
|
||||||
|
.. c:function:: void pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
|
||||||
|
|
||||||
Initialise a pkgconf client object.
|
Initialise a pkgconf client object.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The client to initialise.
|
:param pkgconf_client_t* client: The client to initialise.
|
||||||
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
||||||
:param void* error_handler_data: user data passed to optional error handler
|
:param void* error_handler_data: user data passed to optional error handler
|
||||||
|
:param pkgconf_cross_personality_t* personality: the cross-compile personality to use for defaults
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: pkgconf_client_t* pkgconf_client_new(pkgconf_error_handler_func_t error_handler)
|
.. c:function:: pkgconf_client_t* pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
|
||||||
|
|
||||||
Allocate and initialise a pkgconf client object.
|
Allocate and initialise a pkgconf client object.
|
||||||
|
|
||||||
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
||||||
:param void* error_handler_data: user data passed to optional error handler
|
:param void* error_handler_data: user data passed to optional error handler
|
||||||
|
:param pkgconf_cross_personality_t* personality: cross-compile personality to use
|
||||||
:return: A pkgconf client object.
|
:return: A pkgconf client object.
|
||||||
:rtype: pkgconf_client_t*
|
:rtype: pkgconf_client_t*
|
||||||
|
|
||||||
|
@ -97,11 +108,14 @@ thread boundaries.
|
||||||
:return: true if the warn handler processed the message, else false.
|
:return: true if the warn handler processed the message, else false.
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
|
|
||||||
.. c:function:: bool pkgconf_trace(const pkgconf_client_t *client, const char *format, ...)
|
.. c:function:: bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t len, const char *funcname, const char *format, ...)
|
||||||
|
|
||||||
Report a message to a client-registered trace handler.
|
Report a message to a client-registered trace handler.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to report the trace message to.
|
:param pkgconf_client_t* client: The pkgconf client object to report the trace message to.
|
||||||
|
:param char* filename: The file the function is in.
|
||||||
|
:param size_t lineno: The line number currently being executed.
|
||||||
|
:param char* funcname: The function name to use.
|
||||||
:param char* format: A printf-style format string to use for formatting the trace message.
|
:param char* format: A printf-style format string to use for formatting the trace message.
|
||||||
:return: true if the trace handler processed the message, else false.
|
:return: true if the trace handler processed the message, else false.
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
|
|
|
@ -14,6 +14,7 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param char* package: The package `atom` to set on the dependency node.
|
:param char* package: The package `atom` to set on the dependency node.
|
||||||
:param char* version: The package `version` to set on the dependency node.
|
:param char* version: The package `version` to set on the dependency node.
|
||||||
:param pkgconf_pkg_comparator_t compare: The comparison operator to set on the dependency node.
|
:param pkgconf_pkg_comparator_t compare: The comparison operator to set on the dependency node.
|
||||||
|
:param uint flags: Any flags to attach to the dependency node.
|
||||||
:return: A dependency node.
|
:return: A dependency node.
|
||||||
:rtype: pkgconf_dependency_t *
|
:rtype: pkgconf_dependency_t *
|
||||||
|
|
||||||
|
@ -25,9 +26,32 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param pkgconf_dependency_t* tail: The dependency node to add to the tail of the dependency list.
|
:param pkgconf_dependency_t* tail: The dependency node to add to the tail of the dependency list.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
|
.. c:function:: void pkgconf_dependency_free_one(pkgconf_dependency_t *dep)
|
||||||
|
|
||||||
|
Frees a dependency node.
|
||||||
|
|
||||||
|
:param pkgconf_dependency_t* dep: The dependency node to free.
|
||||||
|
:return: nothing
|
||||||
|
|
||||||
|
.. c:function:: pkgconf_dependency_t *pkgconf_dependency_ref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
|
||||||
|
|
||||||
|
Increases a dependency node's refcount.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
|
||||||
|
:param pkgconf_dependency_t* dep: The dependency to increase the refcount of.
|
||||||
|
:return: the dependency node on success, else NULL
|
||||||
|
|
||||||
|
.. c:function:: void pkgconf_dependency_unref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
|
||||||
|
|
||||||
|
Decreases a dependency node's refcount and frees it if necessary.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
|
||||||
|
:param pkgconf_dependency_t* dep: The dependency to decrease the refcount of.
|
||||||
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: void pkgconf_dependency_free(pkgconf_list_t *list)
|
.. c:function:: void pkgconf_dependency_free(pkgconf_list_t *list)
|
||||||
|
|
||||||
Release a dependency list and it's child dependency nodes.
|
Release a dependency list and its child dependency nodes.
|
||||||
|
|
||||||
:param pkgconf_list_t* list: The dependency list to release.
|
:param pkgconf_list_t* list: The dependency list to release.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
@ -41,6 +65,7 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param pkgconf_client_t* client: The client object that owns the package this dependency list belongs to.
|
:param pkgconf_client_t* client: The client object that owns the package this dependency list belongs to.
|
||||||
:param pkgconf_list_t* deplist_head: The dependency list to populate with dependency nodes.
|
:param pkgconf_list_t* deplist_head: The dependency list to populate with dependency nodes.
|
||||||
:param char* depends: The dependency data to parse.
|
:param char* depends: The dependency data to parse.
|
||||||
|
:param uint flags: Any flags to attach to the dependency nodes.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: void pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends)
|
.. c:function:: void pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends)
|
||||||
|
@ -53,4 +78,13 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param pkgconf_pkg_t* pkg: The package object that owns this dependency list.
|
:param pkgconf_pkg_t* pkg: The package object that owns this dependency list.
|
||||||
:param pkgconf_list_t* deplist: The dependency list to populate with dependency nodes.
|
:param pkgconf_list_t* deplist: The dependency list to populate with dependency nodes.
|
||||||
:param char* depends: The dependency data to parse.
|
:param char* depends: The dependency data to parse.
|
||||||
|
:param uint flags: Any flags to attach to the dependency nodes.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
|
.. c:function:: pkgconf_dependency_t *pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *dep)
|
||||||
|
|
||||||
|
Copies a dependency node to a new one.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* client: The client object that will own this dependency.
|
||||||
|
:param pkgconf_dependency_t* dep: The dependency node to copy.
|
||||||
|
:return: a pointer to a new dependency node, else NULL
|
||||||
|
|
|
@ -6,13 +6,14 @@ The `fragment` module provides low-level management and rendering of fragment li
|
||||||
`fragment list` contains various `fragments` of text (such as ``-I /usr/include``) in a matter
|
`fragment list` contains various `fragments` of text (such as ``-I /usr/include``) in a matter
|
||||||
which is composable, mergeable and reorderable.
|
which is composable, mergeable and reorderable.
|
||||||
|
|
||||||
.. c:function:: void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string)
|
.. c:function:: void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags)
|
||||||
|
|
||||||
Adds a `fragment` of text to a `fragment list`, possibly modifying the fragment if a sysroot is set.
|
Adds a `fragment` of text to a `fragment list`, possibly modifying the fragment if a sysroot is set.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
||||||
:param pkgconf_list_t* list: The fragment list.
|
:param pkgconf_list_t* list: The fragment list.
|
||||||
:param char* string: The string of text to add as a fragment to the fragment list.
|
:param char* string: The string of text to add as a fragment to the fragment list.
|
||||||
|
:param uint flags: Parsing-related flags for the package.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: bool pkgconf_fragment_has_system_dir(const pkgconf_client_t *client, const pkgconf_fragment_t *frag)
|
.. c:function:: bool pkgconf_fragment_has_system_dir(const pkgconf_client_t *client, const pkgconf_fragment_t *frag)
|
||||||
|
@ -110,5 +111,6 @@ which is composable, mergeable and reorderable.
|
||||||
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
||||||
:param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
:param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
||||||
:param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
:param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
||||||
|
:param uint flags: Any parsing flags to be aware of.
|
||||||
:param char* value: The string to parse into fragments.
|
:param char* value: The string to parse into fragments.
|
||||||
:return: true on success, false on parse error
|
:return: true on success, false on parse error
|
||||||
|
|
|
@ -25,12 +25,12 @@ variables.
|
||||||
:return: number of path nodes added to the path list
|
:return: number of path nodes added to the path list
|
||||||
:rtype: size_t
|
:rtype: size_t
|
||||||
|
|
||||||
.. c:function:: size_t pkgconf_path_build_from_environ(const char *environ, const char *fallback, pkgconf_list_t *dirlist)
|
.. c:function:: size_t pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist)
|
||||||
|
|
||||||
Adds the paths specified in an environment variable to a path list. If the environment variable is not set,
|
Adds the paths specified in an environment variable to a path list. If the environment variable is not set,
|
||||||
an optional default set of paths is added.
|
an optional default set of paths is added.
|
||||||
|
|
||||||
:param char* environ: The environment variable to look up.
|
:param char* envvarname: The environment variable to look up.
|
||||||
:param char* fallback: The fallback paths to use if the environment variable is not set.
|
:param char* fallback: The fallback paths to use if the environment variable is not set.
|
||||||
:param pkgconf_list_t* dirlist: The path list to add the path nodes to.
|
:param pkgconf_list_t* dirlist: The path list to add the path nodes to.
|
||||||
:param bool filter: Whether to perform duplicate filtering.
|
:param bool filter: Whether to perform duplicate filtering.
|
||||||
|
@ -46,6 +46,14 @@ variables.
|
||||||
:return: true if the path list has a matching prefix, otherwise false
|
:return: true if the path list has a matching prefix, otherwise false
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
|
|
||||||
|
.. c:function:: void pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src)
|
||||||
|
|
||||||
|
Copies a path list to another path list.
|
||||||
|
|
||||||
|
:param pkgconf_list_t* dst: The path list to copy to.
|
||||||
|
:param pkgconf_list_t* src: The path list to copy from.
|
||||||
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: void pkgconf_path_free(pkgconf_list_t *dirlist)
|
.. c:function:: void pkgconf_path_free(pkgconf_list_t *dirlist)
|
||||||
|
|
||||||
Releases any path nodes attached to the given path list.
|
Releases any path nodes attached to the given path list.
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
libpkgconf `personality` module
|
||||||
|
=========================
|
||||||
|
|
||||||
|
.. c:function:: const pkgconf_cross_personality_t *pkgconf_cross_personality_default(void)
|
||||||
|
|
||||||
|
Returns the default cross-compile personality.
|
||||||
|
|
||||||
|
Not thread safe.
|
||||||
|
|
||||||
|
:rtype: pkgconf_cross_personality_t*
|
||||||
|
:return: the default cross-compile personality
|
||||||
|
|
||||||
|
.. c:function:: void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *)
|
||||||
|
|
||||||
|
Decrements the count of default cross personality instances.
|
||||||
|
|
||||||
|
Not thread safe.
|
||||||
|
|
||||||
|
:rtype: void
|
||||||
|
|
||||||
|
.. c:function:: pkgconf_cross_personality_t *pkgconf_cross_personality_find(const char *triplet)
|
||||||
|
|
||||||
|
Attempts to find a cross-compile personality given a triplet.
|
||||||
|
|
||||||
|
:rtype: pkgconf_cross_personality_t*
|
||||||
|
:return: the default cross-compile personality
|
|
@ -5,22 +5,14 @@ libpkgconf `pkg` module
|
||||||
The `pkg` module provides dependency resolution services and the overall `.pc` file parsing
|
The `pkg` module provides dependency resolution services and the overall `.pc` file parsing
|
||||||
routines.
|
routines.
|
||||||
|
|
||||||
.. c:function:: void pkgconf_pkg_dir_list_build(pkgconf_client_t *client)
|
.. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f, unsigned int flags)
|
||||||
|
|
||||||
Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is set on the client,
|
|
||||||
then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the
|
|
||||||
``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to bootstrap.
|
|
||||||
:return: nothing
|
|
||||||
|
|
||||||
.. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f)
|
|
||||||
|
|
||||||
Parse a .pc file into a pkgconf_pkg_t object structure.
|
Parse a .pc file into a pkgconf_pkg_t object structure.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
:param char* filename: The filename of the package file (including full path).
|
:param char* filename: The filename of the package file (including full path).
|
||||||
:param FILE* f: The file object to read from.
|
:param FILE* f: The file object to read from.
|
||||||
|
:param uint flags: The flags to use when parsing.
|
||||||
:returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
:returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
||||||
:rtype: pkgconf_pkg_t *
|
:rtype: pkgconf_pkg_t *
|
||||||
|
|
||||||
|
@ -126,7 +118,7 @@ routines.
|
||||||
:return: On success, ``PKGCONF_PKG_ERRF_OK`` (0), else an error code.
|
:return: On success, ``PKGCONF_PKG_ERRF_OK`` (0), else an error code.
|
||||||
:rtype: unsigned int
|
:rtype: unsigned int
|
||||||
|
|
||||||
.. c:function:: unsigned int pkgconf_pkg_traverse(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth)
|
.. c:function:: unsigned int pkgconf_pkg_traverse(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth, unsigned int skip_flags)
|
||||||
|
|
||||||
Walk and resolve the dependency graph up to `maxdepth` levels.
|
Walk and resolve the dependency graph up to `maxdepth` levels.
|
||||||
|
|
||||||
|
@ -135,6 +127,7 @@ routines.
|
||||||
:param pkgconf_pkg_traverse_func_t func: A traversal function to call for each resolved node in the dependency graph.
|
:param pkgconf_pkg_traverse_func_t func: A traversal function to call for each resolved node in the dependency graph.
|
||||||
:param void* data: An opaque pointer to data to be passed to the traversal function.
|
:param void* data: An opaque pointer to data to be passed to the traversal function.
|
||||||
:param int maxdepth: The maximum depth to walk the dependency graph for. -1 means infinite recursion.
|
:param int maxdepth: The maximum depth to walk the dependency graph for. -1 means infinite recursion.
|
||||||
|
:param uint skip_flags: Skip over dependency nodes containing the specified flags. A setting of 0 skips no dependency nodes.
|
||||||
:return: ``PKGCONF_PKG_ERRF_OK`` on success, else an error code.
|
:return: ``PKGCONF_PKG_ERRF_OK`` on success, else an error code.
|
||||||
:rtype: unsigned int
|
:rtype: unsigned int
|
||||||
|
|
||||||
|
|
|
@ -33,11 +33,32 @@ Using the `queue` module functions is the recommended way of working with depend
|
||||||
:param pkgconf_list_t* list: The dependency resolution queue to release.
|
:param pkgconf_list_t* list: The dependency resolution queue to release.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
|
.. c:function:: void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth)
|
||||||
|
|
||||||
|
Removes references to package nodes contained in a solution.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
|
:param pkgconf_pkg_t* world: The root for the generated dependency graph. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
||||||
|
:returns: nothing
|
||||||
|
|
||||||
|
.. c:function:: bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth)
|
||||||
|
|
||||||
|
Solves and flattens the dependency graph for the supplied dependency list.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
|
:param pkgconf_list_t* list: The list of dependency requests to consider.
|
||||||
|
:param pkgconf_pkg_t* world: The root for the generated dependency graph, provided by the caller. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
||||||
|
:param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
|
||||||
|
:returns: true if the dependency resolver found a solution, otherwise false.
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
.. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
.. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
||||||
|
|
||||||
Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
||||||
feed the solution to a callback function if a complete dependency graph is found.
|
feed the solution to a callback function if a complete dependency graph is found.
|
||||||
|
|
||||||
|
This function should not be used in new code. Use pkgconf_queue_solve instead.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
:param pkgconf_list_t* list: The list of dependency requests to consider.
|
:param pkgconf_list_t* list: The list of dependency requests to consider.
|
||||||
:param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
:param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
||||||
|
|
|
@ -64,13 +64,14 @@ attached to a given client object.
|
||||||
:return: the value of the variable or ``NULL``
|
:return: the value of the variable or ``NULL``
|
||||||
:rtype: char *
|
:rtype: char *
|
||||||
|
|
||||||
.. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value)
|
.. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||||
|
|
||||||
Parse an expression for variable substitution.
|
Parse an expression for variable substitution.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to access.
|
:param pkgconf_client_t* client: The pkgconf client object to access.
|
||||||
:param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
:param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
||||||
:param char* value: The ``key=value`` string to parse.
|
:param char* value: The ``key=value`` string to parse.
|
||||||
|
:param uint flags: Any flags to consider while parsing.
|
||||||
:return: the variable data with any variables substituted
|
:return: the variable data with any variables substituted
|
||||||
:rtype: char *
|
:rtype: char *
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ libpkgconf - an API for managing `pkg-config` modules
|
||||||
libpkgconf-dependency
|
libpkgconf-dependency
|
||||||
libpkgconf-fragment
|
libpkgconf-fragment
|
||||||
libpkgconf-path
|
libpkgconf-path
|
||||||
|
libpkgconf-personality
|
||||||
libpkgconf-pkg
|
libpkgconf-pkg
|
||||||
libpkgconf-queue
|
libpkgconf-queue
|
||||||
libpkgconf-tuple
|
libpkgconf-tuple
|
||||||
|
|
|
@ -5,7 +5,8 @@ libdir=@libdir@
|
||||||
|
|
||||||
Name: libpkgconf
|
Name: libpkgconf
|
||||||
Description: a library for accessing and manipulating development framework configuration
|
Description: a library for accessing and manipulating development framework configuration
|
||||||
URL: http://github.com/pkgconf/pkgconf
|
URL: https://gitea.treehouse.systems/ariadne/pkgconf
|
||||||
|
License: ISC
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
CFlags: -I${includedir}/pkgconf
|
CFlags: -I${includedir}/pkgconf
|
||||||
Libs: -L${libdir} -lpkgconf
|
Libs: -L${libdir} -lpkgconf
|
||||||
|
|
|
@ -72,7 +72,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
|
|
||||||
memset(buf, 0, strlen(src) + 1);
|
memset(buf, 0, strlen(src) + 1);
|
||||||
|
|
||||||
*argv = calloc(sizeof (void *), argv_size);
|
*argv = calloc(argv_size, sizeof (void *));
|
||||||
(*argv)[argc_count] = dst_iter;
|
(*argv)[argc_count] = dst_iter;
|
||||||
|
|
||||||
while (*src_iter)
|
while (*src_iter)
|
||||||
|
@ -80,7 +80,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
if (escaped)
|
if (escaped)
|
||||||
{
|
{
|
||||||
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
||||||
if (quote == '\"')
|
if (quote == '"')
|
||||||
{
|
{
|
||||||
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
||||||
*dst_iter++ = '\\';
|
*dst_iter++ = '\\';
|
||||||
|
@ -88,7 +88,9 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
|
}
|
||||||
|
|
||||||
escaped = false;
|
escaped = false;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +103,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
else
|
else
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
}
|
}
|
||||||
else if (isspace((unsigned int)*src_iter))
|
else if (isspace((unsigned char)*src_iter))
|
||||||
{
|
{
|
||||||
if ((*argv)[argc_count] != NULL)
|
if ((*argv)[argc_count] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -118,11 +120,9 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
}
|
}
|
||||||
else switch(*src_iter)
|
else switch(*src_iter)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
case '\\':
|
case '\\':
|
||||||
escaped = true;
|
escaped = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
case '\"':
|
case '\"':
|
||||||
case '\'':
|
case '\'':
|
||||||
|
|
|
@ -20,11 +20,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <libpkgconf/bsdstubs.h>
|
#include <libpkgconf/bsdstubs.h>
|
||||||
#include <libpkgconf/config.h>
|
#include <libpkgconf/config.h>
|
||||||
|
|
||||||
#ifndef HAVE_STRLCPY
|
#if !HAVE_DECL_STRLCPY
|
||||||
/*
|
/*
|
||||||
* Copy src to string dst of size siz. At most siz-1 characters
|
* Copy src to string dst of size siz. At most siz-1 characters
|
||||||
* will be copied. Always NUL terminates (unless siz == 0).
|
* will be copied. Always NUL terminates (unless siz == 0).
|
||||||
|
@ -57,7 +58,7 @@ strlcpy(char *dst, const char *src, size_t siz)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRLCAT
|
#if !HAVE_DECL_STRLCAT
|
||||||
/*
|
/*
|
||||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||||
* full size of dst, not space left). At most siz-1 characters
|
* full size of dst, not space left). At most siz-1 characters
|
||||||
|
@ -106,7 +107,7 @@ strlcat(char *dst, const char *src, size_t siz)
|
||||||
* from the use of this software.
|
* from the use of this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HAVE_STRNDUP
|
#if !HAVE_DECL_STRNDUP
|
||||||
/*
|
/*
|
||||||
* Creates a memory buffer and copies at most 'len' characters to it.
|
* Creates a memory buffer and copies at most 'len' characters to it.
|
||||||
* If 'len' is less than the length of the source string, truncation occured.
|
* If 'len' is less than the length of the source string, truncation occured.
|
||||||
|
@ -137,3 +138,23 @@ pkgconf_strndup(const char *src, size_t len)
|
||||||
{
|
{
|
||||||
return strndup(src, len);
|
return strndup(src, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !HAVE_DECL_REALLOCARRAY
|
||||||
|
void *
|
||||||
|
reallocarray(void *ptr, size_t m, size_t n)
|
||||||
|
{
|
||||||
|
if (n && m > -1 / n)
|
||||||
|
{
|
||||||
|
errno = ENOMEM;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return realloc(ptr, m * n);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *
|
||||||
|
pkgconf_reallocarray(void *ptr, size_t m, size_t n)
|
||||||
|
{
|
||||||
|
return reallocarray(ptr, m, n);
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ extern "C" {
|
||||||
PKGCONF_API extern size_t pkgconf_strlcpy(char *dst, const char *src, size_t siz);
|
PKGCONF_API extern size_t pkgconf_strlcpy(char *dst, const char *src, size_t siz);
|
||||||
PKGCONF_API extern size_t pkgconf_strlcat(char *dst, const char *src, size_t siz);
|
PKGCONF_API extern size_t pkgconf_strlcat(char *dst, const char *src, size_t siz);
|
||||||
PKGCONF_API extern char *pkgconf_strndup(const char *src, size_t len);
|
PKGCONF_API extern char *pkgconf_strndup(const char *src, size_t len);
|
||||||
|
PKGCONF_API extern void *pkgconf_reallocarray(void *ptr, size_t m, size_t n);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include <libpkgconf/stdinc.h>
|
#include <libpkgconf/stdinc.h>
|
||||||
#include <libpkgconf/libpkgconf.h>
|
#include <libpkgconf/libpkgconf.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -29,6 +31,46 @@
|
||||||
* be shared across threads.
|
* be shared across threads.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static int
|
||||||
|
cache_member_cmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
|
const char *key = a;
|
||||||
|
const pkgconf_pkg_t *pkg = *(void **) b;
|
||||||
|
|
||||||
|
return strcmp(key, pkg->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cache_member_sort_cmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
|
const pkgconf_pkg_t *pkgA = *(void **) a;
|
||||||
|
const pkgconf_pkg_t *pkgB = *(void **) b;
|
||||||
|
|
||||||
|
if (pkgA == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (pkgB == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return strcmp(pkgA->id, pkgB->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cache_dump(const pkgconf_client_t *client)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "dumping package cache contents");
|
||||||
|
|
||||||
|
for (i = 0; i < client->cache_count; i++)
|
||||||
|
{
|
||||||
|
const pkgconf_pkg_t *pkg = client->cache_table[i];
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, SIZE_FMT_SPECIFIER": %p(%s)",
|
||||||
|
i, pkg, pkg == NULL ? "NULL" : pkg->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -46,17 +88,19 @@
|
||||||
pkgconf_pkg_t *
|
pkgconf_pkg_t *
|
||||||
pkgconf_cache_lookup(pkgconf_client_t *client, const char *id)
|
pkgconf_cache_lookup(pkgconf_client_t *client, const char *id)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *node;
|
if (client->cache_table == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(client->pkg_cache.head, node)
|
pkgconf_pkg_t **pkg;
|
||||||
|
|
||||||
|
pkg = bsearch(id, client->cache_table,
|
||||||
|
client->cache_count, sizeof (void *),
|
||||||
|
cache_member_cmp);
|
||||||
|
|
||||||
|
if (pkg != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg = node->data;
|
PKGCONF_TRACE(client, "found: %s @%p", id, *pkg);
|
||||||
|
return pkgconf_pkg_ref(client, *pkg);
|
||||||
if (!strcmp(pkg->id, id))
|
|
||||||
{
|
|
||||||
PKGCONF_TRACE(client, "found: %s @%p", id, pkg);
|
|
||||||
return pkgconf_pkg_ref(client, pkg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "miss: %s", id);
|
PKGCONF_TRACE(client, "miss: %s", id);
|
||||||
|
@ -82,12 +126,19 @@ pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pkgconf_pkg_ref(client, pkg);
|
pkgconf_pkg_ref(client, pkg);
|
||||||
pkgconf_node_insert(&pkg->cache_iter, pkg, &client->pkg_cache);
|
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "added @%p to cache", pkg);
|
PKGCONF_TRACE(client, "added @%p to cache", pkg);
|
||||||
|
|
||||||
/* mark package as cached */
|
/* mark package as cached */
|
||||||
pkg->flags |= PKGCONF_PKG_PROPF_CACHED;
|
pkg->flags |= PKGCONF_PKG_PROPF_CACHED;
|
||||||
|
|
||||||
|
++client->cache_count;
|
||||||
|
client->cache_table = pkgconf_reallocarray(client->cache_table,
|
||||||
|
client->cache_count, sizeof (void *));
|
||||||
|
client->cache_table[client->cache_count - 1] = pkg;
|
||||||
|
|
||||||
|
qsort(client->cache_table, client->cache_count,
|
||||||
|
sizeof(void *), cache_member_sort_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -104,6 +155,9 @@ pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
void
|
void
|
||||||
pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
if (client->cache_table == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (pkg == NULL)
|
if (pkg == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -112,7 +166,41 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "removed @%p from cache", pkg);
|
PKGCONF_TRACE(client, "removed @%p from cache", pkg);
|
||||||
|
|
||||||
pkgconf_node_delete(&pkg->cache_iter, &client->pkg_cache);
|
pkgconf_pkg_t **slot;
|
||||||
|
|
||||||
|
slot = bsearch(pkg->id, client->cache_table,
|
||||||
|
client->cache_count, sizeof (void *),
|
||||||
|
cache_member_cmp);
|
||||||
|
|
||||||
|
if (slot == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
(*slot)->flags &= ~PKGCONF_PKG_PROPF_CACHED;
|
||||||
|
pkgconf_pkg_unref(client, *slot);
|
||||||
|
*slot = NULL;
|
||||||
|
|
||||||
|
qsort(client->cache_table, client->cache_count,
|
||||||
|
sizeof(void *), cache_member_sort_cmp);
|
||||||
|
|
||||||
|
if (client->cache_table[client->cache_count - 1] != NULL)
|
||||||
|
{
|
||||||
|
PKGCONF_TRACE(client, "end of cache table refers to %p, not NULL",
|
||||||
|
client->cache_table[client->cache_count - 1]);
|
||||||
|
cache_dump(client);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
client->cache_count--;
|
||||||
|
if (client->cache_count > 0)
|
||||||
|
{
|
||||||
|
client->cache_table = pkgconf_reallocarray(client->cache_table,
|
||||||
|
client->cache_count, sizeof(void *));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
free(client->cache_table);
|
||||||
|
client->cache_table = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -129,15 +217,15 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
void
|
void
|
||||||
pkgconf_cache_free(pkgconf_client_t *client)
|
pkgconf_cache_free(pkgconf_client_t *client)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *iter, *iter2;
|
if (client->cache_table == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY_SAFE(client->pkg_cache.head, iter2, iter)
|
while (client->cache_count > 0)
|
||||||
{
|
pkgconf_cache_remove(client, client->cache_table[0]);
|
||||||
pkgconf_pkg_t *pkg = iter->data;
|
|
||||||
pkgconf_pkg_unref(client, pkg);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&client->pkg_cache, 0, sizeof client->pkg_cache);
|
free(client->cache_table);
|
||||||
|
client->cache_table = NULL;
|
||||||
|
client->cache_count = 0;
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "cleared package cache");
|
PKGCONF_TRACE(client, "cleared package cache");
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,8 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error
|
||||||
client->error_handler_data = error_handler_data;
|
client->error_handler_data = error_handler_data;
|
||||||
client->error_handler = error_handler;
|
client->error_handler = error_handler;
|
||||||
client->auditf = NULL;
|
client->auditf = NULL;
|
||||||
|
client->cache_table = NULL;
|
||||||
|
client->cache_count = 0;
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
if (client->trace_handler == NULL)
|
if (client->trace_handler == NULL)
|
||||||
|
@ -159,7 +161,7 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error
|
||||||
pkgconf_client_t *
|
pkgconf_client_t *
|
||||||
pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
|
pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
|
||||||
{
|
{
|
||||||
pkgconf_client_t *out = calloc(sizeof(pkgconf_client_t), 1);
|
pkgconf_client_t *out = calloc(1, sizeof(pkgconf_client_t));
|
||||||
pkgconf_client_init(out, error_handler, error_handler_data, personality);
|
pkgconf_client_init(out, error_handler, error_handler_data, personality);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -401,7 +403,7 @@ pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t linen
|
||||||
* :rtype: bool
|
* :rtype: bool
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, const void *data)
|
pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, void *data)
|
||||||
{
|
{
|
||||||
(void) msg;
|
(void) msg;
|
||||||
(void) client;
|
(void) client;
|
||||||
|
|
|
@ -9,6 +9,21 @@
|
||||||
/* Define to 1 if you have the `strndup' function. */
|
/* Define to 1 if you have the `strndup' function. */
|
||||||
#mesondefine HAVE_STRNDUP
|
#mesondefine HAVE_STRNDUP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `reallocarray' function. */
|
||||||
|
#mesondefine HAVE_REALLOCARRAY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strlcat' function. */
|
||||||
|
#mesondefine HAVE_DECL_STRLCAT
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strlcpy' function. */
|
||||||
|
#mesondefine HAVE_DECL_STRLCPY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strndup' function. */
|
||||||
|
#mesondefine HAVE_DECL_STRNDUP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `reallocarray' function. */
|
||||||
|
#mesondefine HAVE_DECL_REALLOCARRAY
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#mesondefine PACKAGE
|
#mesondefine PACKAGE
|
||||||
|
|
||||||
|
@ -51,3 +66,8 @@
|
||||||
#mesondefine SYSTEM_INCLUDEDIR
|
#mesondefine SYSTEM_INCLUDEDIR
|
||||||
#mesondefine SYSTEM_LIBDIR
|
#mesondefine SYSTEM_LIBDIR
|
||||||
#mesondefine PERSONALITY_PATH
|
#mesondefine PERSONALITY_PATH
|
||||||
|
|
||||||
|
/* Enable Solaris extensions. */
|
||||||
|
#ifndef __EXTENSIONS__
|
||||||
|
# define __EXTENSIONS__ 1
|
||||||
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ find_colliding_dependency(const pkgconf_dependency_t *dep, const pkgconf_list_t
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline pkgconf_dependency_t *
|
static inline pkgconf_dependency_t *
|
||||||
add_or_replace_dependency_node(const pkgconf_client_t *client, pkgconf_dependency_t *dep, pkgconf_list_t *list)
|
add_or_replace_dependency_node(pkgconf_client_t *client, pkgconf_dependency_t *dep, pkgconf_list_t *list)
|
||||||
{
|
{
|
||||||
char depbuf[PKGCONF_ITEM_SIZE];
|
char depbuf[PKGCONF_ITEM_SIZE];
|
||||||
pkgconf_dependency_t *dep2 = find_colliding_dependency(dep, list);
|
pkgconf_dependency_t *dep2 = find_colliding_dependency(dep, list);
|
||||||
|
@ -92,7 +92,7 @@ add_or_replace_dependency_node(const pkgconf_client_t *client, pkgconf_dependenc
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "dropping dependency [%s]@%p because of collision", depbuf, dep);
|
PKGCONF_TRACE(client, "dropping dependency [%s]@%p because of collision", depbuf, dep);
|
||||||
|
|
||||||
free(dep);
|
pkgconf_dependency_unref(dep->owner, dep);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else if (dep2->flags && dep->flags == 0)
|
else if (dep2->flags && dep->flags == 0)
|
||||||
|
@ -100,7 +100,7 @@ add_or_replace_dependency_node(const pkgconf_client_t *client, pkgconf_dependenc
|
||||||
PKGCONF_TRACE(client, "dropping dependency [%s]@%p because of collision", depbuf2, dep2);
|
PKGCONF_TRACE(client, "dropping dependency [%s]@%p because of collision", depbuf2, dep2);
|
||||||
|
|
||||||
pkgconf_node_delete(&dep2->iter, list);
|
pkgconf_node_delete(&dep2->iter, list);
|
||||||
free(dep2);
|
pkgconf_dependency_unref(dep2->owner, dep2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* If both dependencies have equal strength, we keep both, because of situations like:
|
/* If both dependencies have equal strength, we keep both, because of situations like:
|
||||||
|
@ -113,17 +113,24 @@ add_or_replace_dependency_node(const pkgconf_client_t *client, pkgconf_dependenc
|
||||||
}
|
}
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "added dependency [%s] to list @%p; flags=%x", dependency_to_str(dep, depbuf, sizeof depbuf), list, dep->flags);
|
PKGCONF_TRACE(client, "added dependency [%s] to list @%p; flags=%x", dependency_to_str(dep, depbuf, sizeof depbuf), list, dep->flags);
|
||||||
pkgconf_node_insert_tail(&dep->iter, dep, list);
|
pkgconf_node_insert_tail(&dep->iter, pkgconf_dependency_ref(dep->owner, dep), list);
|
||||||
|
|
||||||
|
/* This dependency is intentionally unowned.
|
||||||
|
*
|
||||||
|
* Internally we have no use for the returned type, and usually just
|
||||||
|
* discard it. However, there is a publig pkgconf_dependency_add
|
||||||
|
* function, which references this return value before returning it,
|
||||||
|
* giving ownership at that point.
|
||||||
|
*/
|
||||||
return dep;
|
return dep;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline pkgconf_dependency_t *
|
static inline pkgconf_dependency_t *
|
||||||
pkgconf_dependency_addraw(const pkgconf_client_t *client, pkgconf_list_t *list, const char *package, size_t package_sz, const char *version, size_t version_sz, pkgconf_pkg_comparator_t compare, unsigned int flags)
|
pkgconf_dependency_addraw(pkgconf_client_t *client, pkgconf_list_t *list, const char *package, size_t package_sz, const char *version, size_t version_sz, pkgconf_pkg_comparator_t compare, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep;
|
pkgconf_dependency_t *dep;
|
||||||
|
|
||||||
dep = calloc(sizeof(pkgconf_dependency_t), 1);
|
dep = calloc(1, sizeof(pkgconf_dependency_t));
|
||||||
dep->package = pkgconf_strndup(package, package_sz);
|
dep->package = pkgconf_strndup(package, package_sz);
|
||||||
|
|
||||||
if (version_sz != 0)
|
if (version_sz != 0)
|
||||||
|
@ -131,6 +138,8 @@ pkgconf_dependency_addraw(const pkgconf_client_t *client, pkgconf_list_t *list,
|
||||||
|
|
||||||
dep->compare = compare;
|
dep->compare = compare;
|
||||||
dep->flags = flags;
|
dep->flags = flags;
|
||||||
|
dep->owner = client;
|
||||||
|
dep->refcount = 0;
|
||||||
|
|
||||||
return add_or_replace_dependency_node(client, dep, list);
|
return add_or_replace_dependency_node(client, dep, list);
|
||||||
}
|
}
|
||||||
|
@ -152,12 +161,12 @@ pkgconf_dependency_addraw(const pkgconf_client_t *client, pkgconf_list_t *list,
|
||||||
* :rtype: pkgconf_dependency_t *
|
* :rtype: pkgconf_dependency_t *
|
||||||
*/
|
*/
|
||||||
pkgconf_dependency_t *
|
pkgconf_dependency_t *
|
||||||
pkgconf_dependency_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare, unsigned int flags)
|
pkgconf_dependency_add(pkgconf_client_t *client, pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare, unsigned int flags)
|
||||||
{
|
{
|
||||||
if (version != NULL)
|
pkgconf_dependency_t *dep;
|
||||||
return pkgconf_dependency_addraw(client, list, package, strlen(package), version, strlen(version), compare, flags);
|
dep = pkgconf_dependency_addraw(client, list, package, strlen(package), version,
|
||||||
|
version != NULL ? strlen(version) : 0, compare, flags);
|
||||||
return pkgconf_dependency_addraw(client, list, package, strlen(package), NULL, 0, compare, flags);
|
return pkgconf_dependency_ref(dep->owner, dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -177,12 +186,83 @@ pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail)
|
||||||
pkgconf_node_insert_tail(&tail->iter, tail, list);
|
pkgconf_node_insert_tail(&tail->iter, tail, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_dependency_free_one(pkgconf_dependency_t *dep)
|
||||||
|
*
|
||||||
|
* Frees a dependency node.
|
||||||
|
*
|
||||||
|
* :param pkgconf_dependency_t* dep: The dependency node to free.
|
||||||
|
* :return: nothing
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkgconf_dependency_free_one(pkgconf_dependency_t *dep)
|
||||||
|
{
|
||||||
|
if (dep->match != NULL)
|
||||||
|
pkgconf_pkg_unref(dep->match->owner, dep->match);
|
||||||
|
|
||||||
|
if (dep->package != NULL)
|
||||||
|
free(dep->package);
|
||||||
|
|
||||||
|
if (dep->version != NULL)
|
||||||
|
free(dep->version);
|
||||||
|
|
||||||
|
free(dep);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: pkgconf_dependency_t *pkgconf_dependency_ref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
|
||||||
|
*
|
||||||
|
* Increases a dependency node's refcount.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
|
||||||
|
* :param pkgconf_dependency_t* dep: The dependency to increase the refcount of.
|
||||||
|
* :return: the dependency node on success, else NULL
|
||||||
|
*/
|
||||||
|
pkgconf_dependency_t *
|
||||||
|
pkgconf_dependency_ref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
|
||||||
|
{
|
||||||
|
if (client != dep->owner)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dep->refcount++;
|
||||||
|
PKGCONF_TRACE(client, "%s refcount@%p: %d", dep->package, dep, dep->refcount);
|
||||||
|
return dep;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_dependency_unref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
|
||||||
|
*
|
||||||
|
* Decreases a dependency node's refcount and frees it if necessary.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
|
||||||
|
* :param pkgconf_dependency_t* dep: The dependency to decrease the refcount of.
|
||||||
|
* :return: nothing
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkgconf_dependency_unref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
|
||||||
|
{
|
||||||
|
if (client != dep->owner)
|
||||||
|
return;
|
||||||
|
|
||||||
|
--dep->refcount;
|
||||||
|
PKGCONF_TRACE(client, "%s refcount@%p: %d", dep->package, dep, dep->refcount);
|
||||||
|
|
||||||
|
if (dep->refcount <= 0)
|
||||||
|
pkgconf_dependency_free_one(dep);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
* .. c:function:: void pkgconf_dependency_free(pkgconf_list_t *list)
|
* .. c:function:: void pkgconf_dependency_free(pkgconf_list_t *list)
|
||||||
*
|
*
|
||||||
* Release a dependency list and it's child dependency nodes.
|
* Release a dependency list and its child dependency nodes.
|
||||||
*
|
*
|
||||||
* :param pkgconf_list_t* list: The dependency list to release.
|
* :param pkgconf_list_t* list: The dependency list to release.
|
||||||
* :return: nothing
|
* :return: nothing
|
||||||
|
@ -196,17 +276,11 @@ pkgconf_dependency_free(pkgconf_list_t *list)
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep = node->data;
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
|
||||||
if (dep->match != NULL)
|
pkgconf_node_delete(&dep->iter, list);
|
||||||
pkgconf_pkg_unref(NULL, dep->match);
|
pkgconf_dependency_unref(dep->owner, dep);
|
||||||
|
|
||||||
if (dep->package != NULL)
|
|
||||||
free(dep->package);
|
|
||||||
|
|
||||||
if (dep->version != NULL)
|
|
||||||
free(dep->version);
|
|
||||||
|
|
||||||
free(dep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkgconf_list_zero(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -225,7 +299,7 @@ pkgconf_dependency_free(pkgconf_list_t *list)
|
||||||
* :return: nothing
|
* :return: nothing
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pkgconf_dependency_parse_str(const pkgconf_client_t *client, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags)
|
pkgconf_dependency_parse_str(pkgconf_client_t *client, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags)
|
||||||
{
|
{
|
||||||
parse_state_t state = OUTSIDE_MODULE;
|
parse_state_t state = OUTSIDE_MODULE;
|
||||||
pkgconf_pkg_comparator_t compare = PKGCONF_CMP_ANY;
|
pkgconf_pkg_comparator_t compare = PKGCONF_CMP_ANY;
|
||||||
|
@ -255,11 +329,11 @@ pkgconf_dependency_parse_str(const pkgconf_client_t *client, pkgconf_list_t *dep
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INSIDE_MODULE_NAME:
|
case INSIDE_MODULE_NAME:
|
||||||
if (isspace((unsigned int)*ptr))
|
if (isspace((unsigned char)*ptr))
|
||||||
{
|
{
|
||||||
const char *sptr = ptr;
|
const char *sptr = ptr;
|
||||||
|
|
||||||
while (*sptr && isspace((unsigned int)*sptr))
|
while (*sptr && isspace((unsigned char)*sptr))
|
||||||
sptr++;
|
sptr++;
|
||||||
|
|
||||||
if (*sptr == '\0')
|
if (*sptr == '\0')
|
||||||
|
@ -312,18 +386,19 @@ pkgconf_dependency_parse_str(const pkgconf_client_t *client, pkgconf_list_t *dep
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INSIDE_OPERATOR:
|
case INSIDE_OPERATOR:
|
||||||
if (!PKGCONF_IS_OPERATOR_CHAR(*ptr))
|
if (PKGCONF_IS_OPERATOR_CHAR(*ptr))
|
||||||
{
|
{
|
||||||
state = AFTER_OPERATOR;
|
if (cnameptr < cnameend)
|
||||||
compare = pkgconf_pkg_comparator_lookup_by_name(cmpname);
|
*cnameptr++ = *ptr;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (cnameptr < cnameend)
|
|
||||||
*cnameptr++ = *ptr;
|
|
||||||
|
|
||||||
break;
|
state = AFTER_OPERATOR;
|
||||||
|
compare = pkgconf_pkg_comparator_lookup_by_name(cmpname);
|
||||||
|
// fallthrough
|
||||||
|
|
||||||
case AFTER_OPERATOR:
|
case AFTER_OPERATOR:
|
||||||
if (!isspace((unsigned int)*ptr))
|
if (!isspace((unsigned char)*ptr))
|
||||||
{
|
{
|
||||||
vstart = ptr;
|
vstart = ptr;
|
||||||
state = INSIDE_VERSION;
|
state = INSIDE_VERSION;
|
||||||
|
@ -371,10 +446,43 @@ pkgconf_dependency_parse_str(const pkgconf_client_t *client, pkgconf_list_t *dep
|
||||||
* :return: nothing
|
* :return: nothing
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends, unsigned int flags)
|
pkgconf_dependency_parse(pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends, unsigned int flags)
|
||||||
{
|
{
|
||||||
char *kvdepends = pkgconf_tuple_parse(client, &pkg->vars, depends);
|
char *kvdepends = pkgconf_tuple_parse(client, &pkg->vars, depends, pkg->flags);
|
||||||
|
|
||||||
pkgconf_dependency_parse_str(client, deplist, kvdepends, flags);
|
pkgconf_dependency_parse_str(client, deplist, kvdepends, flags);
|
||||||
free(kvdepends);
|
free(kvdepends);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: pkgconf_dependency_t *pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *dep)
|
||||||
|
*
|
||||||
|
* Copies a dependency node to a new one.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* client: The client object that will own this dependency.
|
||||||
|
* :param pkgconf_dependency_t* dep: The dependency node to copy.
|
||||||
|
* :return: a pointer to a new dependency node, else NULL
|
||||||
|
*/
|
||||||
|
pkgconf_dependency_t *
|
||||||
|
pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *dep)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *new_dep;
|
||||||
|
|
||||||
|
new_dep = calloc(1, sizeof(pkgconf_dependency_t));
|
||||||
|
new_dep->package = strdup(dep->package);
|
||||||
|
|
||||||
|
if (dep->version != NULL)
|
||||||
|
new_dep->version = strdup(dep->version);
|
||||||
|
|
||||||
|
new_dep->compare = dep->compare;
|
||||||
|
new_dep->flags = dep->flags;
|
||||||
|
new_dep->owner = client;
|
||||||
|
new_dep->refcount = 0;
|
||||||
|
|
||||||
|
if (dep->match != NULL)
|
||||||
|
new_dep->match = pkgconf_pkg_ref(client, dep->match);
|
||||||
|
|
||||||
|
return pkgconf_dependency_ref(client, new_dep);
|
||||||
|
}
|
||||||
|
|
|
@ -93,15 +93,18 @@ pkgconf_fragment_is_special(const char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
pkgconf_fragment_munge(const pkgconf_client_t *client, char *buf, size_t buflen, const char *source, const char *sysroot_dir)
|
pkgconf_fragment_munge(const pkgconf_client_t *client, char *buf, size_t buflen, const char *source, const char *sysroot_dir, unsigned int flags)
|
||||||
{
|
{
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
|
|
||||||
if (sysroot_dir == NULL)
|
if (!(flags & PKGCONF_PKG_PROPF_UNINSTALLED) || (client->flags & PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES))
|
||||||
sysroot_dir = pkgconf_tuple_find_global(client, "pc_sysrootdir");
|
{
|
||||||
|
if (sysroot_dir == NULL)
|
||||||
|
sysroot_dir = pkgconf_tuple_find_global(client, "pc_sysrootdir");
|
||||||
|
|
||||||
if (sysroot_dir != NULL && pkgconf_fragment_should_munge(source, sysroot_dir))
|
if (sysroot_dir != NULL && pkgconf_fragment_should_munge(source, sysroot_dir))
|
||||||
pkgconf_strlcat(buf, sysroot_dir, buflen);
|
pkgconf_strlcat(buf, sysroot_dir, buflen);
|
||||||
|
}
|
||||||
|
|
||||||
pkgconf_strlcat(buf, source, buflen);
|
pkgconf_strlcat(buf, source, buflen);
|
||||||
|
|
||||||
|
@ -110,27 +113,60 @@ pkgconf_fragment_munge(const pkgconf_client_t *client, char *buf, size_t buflen,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline char *
|
static inline char *
|
||||||
pkgconf_fragment_copy_munged(const pkgconf_client_t *client, const char *source)
|
pkgconf_fragment_copy_munged(const pkgconf_client_t *client, const char *source, unsigned int flags)
|
||||||
{
|
{
|
||||||
char mungebuf[PKGCONF_ITEM_SIZE];
|
char mungebuf[PKGCONF_ITEM_SIZE];
|
||||||
pkgconf_fragment_munge(client, mungebuf, sizeof mungebuf, source, client->sysroot_dir);
|
pkgconf_fragment_munge(client, mungebuf, sizeof mungebuf, source, client->sysroot_dir, flags);
|
||||||
return strdup(mungebuf);
|
return strdup(mungebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
* .. c:function:: void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string)
|
* .. c:function:: void pkgconf_fragment_insert(const pkgconf_client_t *client, pkgconf_list_t *list, char type, const char *data, bool tail)
|
||||||
|
*
|
||||||
|
* Adds a `fragment` of text to a `fragment list` directly without interpreting it.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* client: The pkgconf client being accessed.
|
||||||
|
* :param pkgconf_list_t* list: The fragment list.
|
||||||
|
* :param char type: The type of the fragment.
|
||||||
|
* :param char* data: The data of the fragment.
|
||||||
|
* :param bool tail: Whether to place the fragment at the beginning of the list or the end.
|
||||||
|
* :return: nothing
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkgconf_fragment_insert(const pkgconf_client_t *client, pkgconf_list_t *list, char type, const char *data, bool tail)
|
||||||
|
{
|
||||||
|
pkgconf_fragment_t *frag;
|
||||||
|
|
||||||
|
frag = calloc(1, sizeof(pkgconf_fragment_t));
|
||||||
|
frag->type = type;
|
||||||
|
frag->data = pkgconf_fragment_copy_munged(client, data, 0);
|
||||||
|
|
||||||
|
if (tail)
|
||||||
|
{
|
||||||
|
pkgconf_node_insert_tail(&frag->iter, frag, list);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgconf_node_insert(&frag->iter, frag, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags)
|
||||||
*
|
*
|
||||||
* Adds a `fragment` of text to a `fragment list`, possibly modifying the fragment if a sysroot is set.
|
* Adds a `fragment` of text to a `fragment list`, possibly modifying the fragment if a sysroot is set.
|
||||||
*
|
*
|
||||||
* :param pkgconf_client_t* client: The pkgconf client being accessed.
|
* :param pkgconf_client_t* client: The pkgconf client being accessed.
|
||||||
* :param pkgconf_list_t* list: The fragment list.
|
* :param pkgconf_list_t* list: The fragment list.
|
||||||
* :param char* string: The string of text to add as a fragment to the fragment list.
|
* :param char* string: The string of text to add as a fragment to the fragment list.
|
||||||
|
* :param uint flags: Parsing-related flags for the package.
|
||||||
* :return: nothing
|
* :return: nothing
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string)
|
pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkgconf_fragment_t *frag;
|
pkgconf_fragment_t *frag;
|
||||||
|
|
||||||
|
@ -139,10 +175,10 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
|
||||||
|
|
||||||
if (strlen(string) > 1 && !pkgconf_fragment_is_special(string))
|
if (strlen(string) > 1 && !pkgconf_fragment_is_special(string))
|
||||||
{
|
{
|
||||||
frag = calloc(sizeof(pkgconf_fragment_t), 1);
|
frag = calloc(1, sizeof(pkgconf_fragment_t));
|
||||||
|
|
||||||
frag->type = *(string + 1);
|
frag->type = *(string + 1);
|
||||||
frag->data = pkgconf_fragment_copy_munged(client, string + 2);
|
frag->data = pkgconf_fragment_copy_munged(client, string + 2, flags);
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "added fragment {%c, '%s'} to list @%p", frag->type, frag->data, list);
|
PKGCONF_TRACE(client, "added fragment {%c, '%s'} to list @%p", frag->type, frag->data, list);
|
||||||
}
|
}
|
||||||
|
@ -156,12 +192,12 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
|
||||||
pkgconf_fragment_t *parent = list->tail->data;
|
pkgconf_fragment_t *parent = list->tail->data;
|
||||||
|
|
||||||
/* only attempt to merge 'special' fragments together */
|
/* only attempt to merge 'special' fragments together */
|
||||||
if (!parent->type && pkgconf_fragment_is_unmergeable(parent->data))
|
if (!parent->type && parent->data != NULL && pkgconf_fragment_is_unmergeable(parent->data))
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *newdata;
|
char *newdata;
|
||||||
|
|
||||||
pkgconf_fragment_munge(client, mungebuf, sizeof mungebuf, string, NULL);
|
pkgconf_fragment_munge(client, mungebuf, sizeof mungebuf, string, NULL, flags);
|
||||||
|
|
||||||
len = strlen(parent->data) + strlen(mungebuf) + 2;
|
len = strlen(parent->data) + strlen(mungebuf) + 2;
|
||||||
newdata = malloc(len);
|
newdata = malloc(len);
|
||||||
|
@ -188,7 +224,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frag = calloc(sizeof(pkgconf_fragment_t), 1);
|
frag = calloc(1, sizeof(pkgconf_fragment_t));
|
||||||
|
|
||||||
frag->type = 0;
|
frag->type = 0;
|
||||||
frag->data = strdup(string);
|
frag->data = strdup(string);
|
||||||
|
@ -349,7 +385,7 @@ pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, cons
|
||||||
else if (!is_private && !pkgconf_fragment_can_merge_back(base, client->flags, is_private) && (pkgconf_fragment_lookup(list, base) != NULL))
|
else if (!is_private && !pkgconf_fragment_can_merge_back(base, client->flags, is_private) && (pkgconf_fragment_lookup(list, base) != NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
frag = calloc(sizeof(pkgconf_fragment_t), 1);
|
frag = calloc(1, sizeof(pkgconf_fragment_t));
|
||||||
|
|
||||||
frag->type = base->type;
|
frag->type = base->type;
|
||||||
frag->merged = base->merged;
|
frag->merged = base->merged;
|
||||||
|
@ -423,7 +459,7 @@ fragment_quote(const pkgconf_fragment_t *frag)
|
||||||
if (frag->data == NULL)
|
if (frag->data == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
out = dst = calloc(outlen, 1);
|
out = dst = calloc(1, outlen);
|
||||||
|
|
||||||
for (; *src; src++)
|
for (; *src; src++)
|
||||||
{
|
{
|
||||||
|
@ -527,7 +563,8 @@ fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, bool e
|
||||||
free(quoted);
|
free(quoted);
|
||||||
}
|
}
|
||||||
|
|
||||||
*bptr++ = ' ';
|
if (node->next != NULL)
|
||||||
|
*bptr++ = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
*bptr = '\0';
|
*bptr = '\0';
|
||||||
|
@ -663,15 +700,16 @@ pkgconf_fragment_free(pkgconf_list_t *list)
|
||||||
* :param pkgconf_client_t* client: The pkgconf client being accessed.
|
* :param pkgconf_client_t* client: The pkgconf client being accessed.
|
||||||
* :param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
* :param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
||||||
* :param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
* :param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
||||||
|
* :param uint flags: Any parsing flags to be aware of.
|
||||||
* :param char* value: The string to parse into fragments.
|
* :param char* value: The string to parse into fragments.
|
||||||
* :return: true on success, false on parse error
|
* :return: true on success, false on parse error
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value)
|
pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||||
{
|
{
|
||||||
int i, ret, argc;
|
int i, ret, argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
char *repstr = pkgconf_tuple_parse(client, vars, value);
|
char *repstr = pkgconf_tuple_parse(client, vars, value, flags);
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "post-subst: [%s] -> [%s]", value, repstr);
|
PKGCONF_TRACE(client, "post-subst: [%s] -> [%s]", value, repstr);
|
||||||
|
|
||||||
|
@ -685,6 +723,8 @@ pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkg
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
|
PKGCONF_TRACE(client, "processing %s", argv[i]);
|
||||||
|
|
||||||
if (argv[i] == NULL)
|
if (argv[i] == NULL)
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "parsed fragment string is inconsistent: argc = %d while argv[%d] == NULL", argc, i);
|
PKGCONF_TRACE(client, "parsed fragment string is inconsistent: argc = %d while argv[%d] == NULL", argc, i);
|
||||||
|
@ -693,7 +733,7 @@ pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkg
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_fragment_add(client, list, argv[i]);
|
pkgconf_fragment_add(client, list, argv[i], flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_argv_free(argv);
|
pkgconf_argv_free(argv);
|
||||||
|
|
|
@ -34,6 +34,14 @@ typedef struct {
|
||||||
|
|
||||||
#define PKGCONF_LIST_INITIALIZER { NULL, NULL, 0 }
|
#define PKGCONF_LIST_INITIALIZER { NULL, NULL, 0 }
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
pkgconf_list_zero(pkgconf_list_t *list)
|
||||||
|
{
|
||||||
|
list->head = NULL;
|
||||||
|
list->tail = NULL;
|
||||||
|
list->length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
pkgconf_node_insert(pkgconf_node_t *node, void *data, pkgconf_list_t *list)
|
pkgconf_node_insert(pkgconf_node_t *node, void *data, pkgconf_list_t *list)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
#define LIBPKGCONF_LIBPKGCONF_API_H
|
#define LIBPKGCONF_LIBPKGCONF_API_H
|
||||||
|
|
||||||
/* Makefile.am specifies visibility using the libtool option -export-symbols-regex '^pkgconf_'
|
/* Makefile.am specifies visibility using the libtool option -export-symbols-regex '^pkgconf_'
|
||||||
* Unfortunately, that is not available when building with cmake, so use attributes instead,
|
* Unfortunately, that is not available when building with meson, so use attributes instead.
|
||||||
* in a way that doesn't depend on any cmake magic.
|
|
||||||
*/
|
*/
|
||||||
#if defined(PKGCONFIG_IS_STATIC)
|
#if defined(PKGCONFIG_IS_STATIC)
|
||||||
# define PKGCONF_API
|
# define PKGCONF_API
|
||||||
|
|
|
@ -16,10 +16,12 @@
|
||||||
#ifndef LIBPKGCONF__LIBPKGCONF_H
|
#ifndef LIBPKGCONF__LIBPKGCONF_H
|
||||||
#define LIBPKGCONF__LIBPKGCONF_H
|
#define LIBPKGCONF__LIBPKGCONF_H
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <libpkgconf/libpkgconf-api.h>
|
#include <libpkgconf/libpkgconf-api.h>
|
||||||
#include <libpkgconf/iter.h>
|
#include <libpkgconf/iter.h>
|
||||||
#include <libpkgconf/bsdstubs.h>
|
#include <libpkgconf/bsdstubs.h>
|
||||||
|
@ -66,6 +68,7 @@ typedef struct pkgconf_fragment_ pkgconf_fragment_t;
|
||||||
typedef struct pkgconf_path_ pkgconf_path_t;
|
typedef struct pkgconf_path_ pkgconf_path_t;
|
||||||
typedef struct pkgconf_client_ pkgconf_client_t;
|
typedef struct pkgconf_client_ pkgconf_client_t;
|
||||||
typedef struct pkgconf_cross_personality_ pkgconf_cross_personality_t;
|
typedef struct pkgconf_cross_personality_ pkgconf_cross_personality_t;
|
||||||
|
typedef struct pkgconf_queue_ pkgconf_queue_t;
|
||||||
|
|
||||||
#define PKGCONF_ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
#define PKGCONF_ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||||
|
|
||||||
|
@ -78,8 +81,13 @@ typedef struct pkgconf_cross_personality_ pkgconf_cross_personality_t;
|
||||||
#define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \
|
#define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \
|
||||||
for ((value) = (tail); (value) != NULL; (value) = (value)->prev)
|
for ((value) = (tail); (value) != NULL; (value) = (value)->prev)
|
||||||
|
|
||||||
#define LIBPKGCONF_VERSION 10801
|
#define LIBPKGCONF_VERSION 20300
|
||||||
#define LIBPKGCONF_VERSION_STR "1.8.1"
|
#define LIBPKGCONF_VERSION_STR "2.3.0"
|
||||||
|
|
||||||
|
struct pkgconf_queue_ {
|
||||||
|
pkgconf_node_t iter;
|
||||||
|
char *package;
|
||||||
|
};
|
||||||
|
|
||||||
struct pkgconf_fragment_ {
|
struct pkgconf_fragment_ {
|
||||||
pkgconf_node_t iter;
|
pkgconf_node_t iter;
|
||||||
|
@ -100,6 +108,9 @@ struct pkgconf_dependency_ {
|
||||||
pkgconf_pkg_t *match;
|
pkgconf_pkg_t *match;
|
||||||
|
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
|
int refcount;
|
||||||
|
pkgconf_client_t *owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pkgconf_tuple_ {
|
struct pkgconf_tuple_ {
|
||||||
|
@ -107,8 +118,12 @@ struct pkgconf_tuple_ {
|
||||||
|
|
||||||
char *key;
|
char *key;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
|
unsigned int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PKGCONF_PKG_TUPLEF_OVERRIDE 0x1
|
||||||
|
|
||||||
struct pkgconf_path_ {
|
struct pkgconf_path_ {
|
||||||
pkgconf_node_t lnode;
|
pkgconf_node_t lnode;
|
||||||
|
|
||||||
|
@ -120,13 +135,12 @@ struct pkgconf_path_ {
|
||||||
#define PKGCONF_PKG_PROPF_NONE 0x00
|
#define PKGCONF_PKG_PROPF_NONE 0x00
|
||||||
#define PKGCONF_PKG_PROPF_STATIC 0x01
|
#define PKGCONF_PKG_PROPF_STATIC 0x01
|
||||||
#define PKGCONF_PKG_PROPF_CACHED 0x02
|
#define PKGCONF_PKG_PROPF_CACHED 0x02
|
||||||
#define PKGCONF_PKG_PROPF_SEEN 0x04
|
|
||||||
#define PKGCONF_PKG_PROPF_UNINSTALLED 0x08
|
#define PKGCONF_PKG_PROPF_UNINSTALLED 0x08
|
||||||
#define PKGCONF_PKG_PROPF_VIRTUAL 0x10
|
#define PKGCONF_PKG_PROPF_VIRTUAL 0x10
|
||||||
|
#define PKGCONF_PKG_PROPF_ANCESTOR 0x20
|
||||||
|
#define PKGCONF_PKG_PROPF_VISITED_PRIVATE 0x40
|
||||||
|
|
||||||
struct pkgconf_pkg_ {
|
struct pkgconf_pkg_ {
|
||||||
pkgconf_node_t cache_iter;
|
|
||||||
|
|
||||||
int refcount;
|
int refcount;
|
||||||
char *id;
|
char *id;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
@ -135,6 +149,10 @@ struct pkgconf_pkg_ {
|
||||||
char *description;
|
char *description;
|
||||||
char *url;
|
char *url;
|
||||||
char *pc_filedir;
|
char *pc_filedir;
|
||||||
|
char *license;
|
||||||
|
char *maintainer;
|
||||||
|
char *copyright;
|
||||||
|
char *why;
|
||||||
|
|
||||||
pkgconf_list_t libs;
|
pkgconf_list_t libs;
|
||||||
pkgconf_list_t libs_private;
|
pkgconf_list_t libs_private;
|
||||||
|
@ -157,16 +175,18 @@ struct pkgconf_pkg_ {
|
||||||
*/
|
*/
|
||||||
pkgconf_tuple_t *orig_prefix;
|
pkgconf_tuple_t *orig_prefix;
|
||||||
pkgconf_tuple_t *prefix;
|
pkgconf_tuple_t *prefix;
|
||||||
|
|
||||||
|
uint64_t serial;
|
||||||
|
uint64_t identifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data);
|
typedef bool (*pkgconf_pkg_iteration_func_t)(const pkgconf_pkg_t *pkg, void *data);
|
||||||
typedef void (*pkgconf_pkg_traverse_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data);
|
typedef void (*pkgconf_pkg_traverse_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data);
|
||||||
typedef bool (*pkgconf_queue_apply_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth);
|
typedef bool (*pkgconf_queue_apply_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth);
|
||||||
typedef bool (*pkgconf_error_handler_func_t)(const char *msg, const pkgconf_client_t *client, const void *data);
|
typedef bool (*pkgconf_error_handler_func_t)(const char *msg, const pkgconf_client_t *client, void *data);
|
||||||
|
|
||||||
struct pkgconf_client_ {
|
struct pkgconf_client_ {
|
||||||
pkgconf_list_t dir_list;
|
pkgconf_list_t dir_list;
|
||||||
pkgconf_list_t pkg_cache;
|
|
||||||
|
|
||||||
pkgconf_list_t filter_libdirs;
|
pkgconf_list_t filter_libdirs;
|
||||||
pkgconf_list_t filter_includedirs;
|
pkgconf_list_t filter_includedirs;
|
||||||
|
@ -191,6 +211,12 @@ struct pkgconf_client_ {
|
||||||
char *prefix_varname;
|
char *prefix_varname;
|
||||||
|
|
||||||
bool already_sent_notice;
|
bool already_sent_notice;
|
||||||
|
|
||||||
|
uint64_t serial;
|
||||||
|
uint64_t identifier;
|
||||||
|
|
||||||
|
pkgconf_pkg_t **cache_table;
|
||||||
|
size_t cache_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pkgconf_cross_personality_ {
|
struct pkgconf_cross_personality_ {
|
||||||
|
@ -233,7 +259,7 @@ PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_default(void)
|
||||||
PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_find(const char *triplet);
|
PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_find(const char *triplet);
|
||||||
PKGCONF_API void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality);
|
PKGCONF_API void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality);
|
||||||
|
|
||||||
#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned int)(c)))
|
#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned char)(c)))
|
||||||
#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
|
#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
|
||||||
|
|
||||||
#define PKGCONF_PKG_PKGF_NONE 0x0000
|
#define PKGCONF_PKG_PKGF_NONE 0x0000
|
||||||
|
@ -253,8 +279,11 @@ PKGCONF_API void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *p
|
||||||
#define PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS 0x2000
|
#define PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS 0x2000
|
||||||
#define PKGCONF_PKG_PKGF_DONT_MERGE_SPECIAL_FRAGMENTS 0x4000
|
#define PKGCONF_PKG_PKGF_DONT_MERGE_SPECIAL_FRAGMENTS 0x4000
|
||||||
#define PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES 0x8000
|
#define PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES 0x8000
|
||||||
|
#define PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES 0x10000
|
||||||
|
|
||||||
#define PKGCONF_PKG_DEPF_INTERNAL 0x1
|
#define PKGCONF_PKG_DEPF_INTERNAL 0x1
|
||||||
|
#define PKGCONF_PKG_DEPF_PRIVATE 0x2
|
||||||
|
#define PKGCONF_PKG_DEPF_QUERY 0x4
|
||||||
|
|
||||||
#define PKGCONF_PKG_ERRF_OK 0x0
|
#define PKGCONF_PKG_ERRF_OK 0x0
|
||||||
#define PKGCONF_PKG_ERRF_PACKAGE_NOT_FOUND 0x1
|
#define PKGCONF_PKG_ERRF_PACKAGE_NOT_FOUND 0x1
|
||||||
|
@ -282,17 +311,17 @@ PKGCONF_API void pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_
|
||||||
PKGCONF_API bool pkgconf_error(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3);
|
PKGCONF_API bool pkgconf_error(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3);
|
||||||
PKGCONF_API bool pkgconf_warn(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3);
|
PKGCONF_API bool pkgconf_warn(const pkgconf_client_t *client, const char *format, ...) PRINTFLIKE(2, 3);
|
||||||
PKGCONF_API bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t lineno, const char *funcname, const char *format, ...) PRINTFLIKE(5, 6);
|
PKGCONF_API bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t lineno, const char *funcname, const char *format, ...) PRINTFLIKE(5, 6);
|
||||||
PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, const void *data);
|
PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, void *data);
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||||
#define PKGCONF_TRACE(client, ...) do { \
|
#define PKGCONF_TRACE(client, ...) do { \
|
||||||
pkgconf_trace(client, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__); \
|
pkgconf_trace(client, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__); \
|
||||||
} while (0);
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define PKGCONF_TRACE(client, ...) do { \
|
#define PKGCONF_TRACE(client, ...) do { \
|
||||||
pkgconf_trace(client, __FILE__, __LINE__, __func__, __VA_ARGS__); \
|
pkgconf_trace(client, __FILE__, __LINE__, __func__, __VA_ARGS__); \
|
||||||
} while (0);
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define PKGCONF_TRACE(client, ...)
|
#define PKGCONF_TRACE(client, ...)
|
||||||
|
@ -315,12 +344,16 @@ PKGCONF_API int pkgconf_compare_version(const char *a, const char *b);
|
||||||
PKGCONF_API pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func);
|
PKGCONF_API pkgconf_pkg_t *pkgconf_scan_all(pkgconf_client_t *client, void *ptr, pkgconf_pkg_iteration_func_t func);
|
||||||
|
|
||||||
/* parse.c */
|
/* parse.c */
|
||||||
PKGCONF_API pkgconf_pkg_t *pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *path, FILE *f);
|
PKGCONF_API pkgconf_pkg_t *pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *path, FILE *f, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_dependency_parse_str(const pkgconf_client_t *client, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
PKGCONF_API void pkgconf_dependency_parse_str(pkgconf_client_t *client, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
PKGCONF_API void pkgconf_dependency_parse(pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist_head, const char *depends, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail);
|
PKGCONF_API void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail);
|
||||||
PKGCONF_API void pkgconf_dependency_free(pkgconf_list_t *list);
|
PKGCONF_API void pkgconf_dependency_free(pkgconf_list_t *list);
|
||||||
PKGCONF_API pkgconf_dependency_t *pkgconf_dependency_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare, unsigned int flags);
|
PKGCONF_API void pkgconf_dependency_free_one(pkgconf_dependency_t *dep);
|
||||||
|
PKGCONF_API pkgconf_dependency_t *pkgconf_dependency_add(pkgconf_client_t *client, pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare, unsigned int flags);
|
||||||
|
PKGCONF_API pkgconf_dependency_t *pkgconf_dependency_ref(pkgconf_client_t *client, pkgconf_dependency_t *dep);
|
||||||
|
PKGCONF_API void pkgconf_dependency_unref(pkgconf_client_t *client, pkgconf_dependency_t *dep);
|
||||||
|
PKGCONF_API pkgconf_dependency_t *pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *dep);
|
||||||
|
|
||||||
/* argvsplit.c */
|
/* argvsplit.c */
|
||||||
PKGCONF_API int pkgconf_argv_split(const char *src, int *argc, char ***argv);
|
PKGCONF_API int pkgconf_argv_split(const char *src, int *argc, char ***argv);
|
||||||
|
@ -333,8 +366,9 @@ typedef struct pkgconf_fragment_render_ops_ {
|
||||||
} pkgconf_fragment_render_ops_t;
|
} pkgconf_fragment_render_ops_t;
|
||||||
|
|
||||||
typedef bool (*pkgconf_fragment_filter_func_t)(const pkgconf_client_t *client, const pkgconf_fragment_t *frag, void *data);
|
typedef bool (*pkgconf_fragment_filter_func_t)(const pkgconf_client_t *client, const pkgconf_fragment_t *frag, void *data);
|
||||||
PKGCONF_API bool pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value);
|
PKGCONF_API bool pkgconf_fragment_parse(const pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_list_t *vars, const char *value, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string);
|
PKGCONF_API void pkgconf_fragment_insert(const pkgconf_client_t *client, pkgconf_list_t *list, char type, const char *data, bool tail);
|
||||||
|
PKGCONF_API void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_fragment_t *base, bool is_private);
|
PKGCONF_API void pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_fragment_t *base, bool is_private);
|
||||||
PKGCONF_API void pkgconf_fragment_copy_list(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_list_t *base);
|
PKGCONF_API void pkgconf_fragment_copy_list(const pkgconf_client_t *client, pkgconf_list_t *list, const pkgconf_list_t *base);
|
||||||
PKGCONF_API void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node);
|
PKGCONF_API void pkgconf_fragment_delete(pkgconf_list_t *list, pkgconf_fragment_t *node);
|
||||||
|
@ -349,9 +383,9 @@ PKGCONF_API bool pkgconf_fragment_has_system_dir(const pkgconf_client_t *client,
|
||||||
PKGCONF_API char *pkgconf_fgetline(char *line, size_t size, FILE *stream);
|
PKGCONF_API char *pkgconf_fgetline(char *line, size_t size, FILE *stream);
|
||||||
|
|
||||||
/* tuple.c */
|
/* tuple.c */
|
||||||
PKGCONF_API pkgconf_tuple_t *pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *parent, const char *key, const char *value, bool parse);
|
PKGCONF_API pkgconf_tuple_t *pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *parent, const char *key, const char *value, bool parse, unsigned int flags);
|
||||||
PKGCONF_API char *pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key);
|
PKGCONF_API char *pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key);
|
||||||
PKGCONF_API char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *list, const char *value);
|
PKGCONF_API char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *list, const char *value, unsigned int flags);
|
||||||
PKGCONF_API void pkgconf_tuple_free(pkgconf_list_t *list);
|
PKGCONF_API void pkgconf_tuple_free(pkgconf_list_t *list);
|
||||||
PKGCONF_API void pkgconf_tuple_free_entry(pkgconf_tuple_t *tuple, pkgconf_list_t *list);
|
PKGCONF_API void pkgconf_tuple_free_entry(pkgconf_tuple_t *tuple, pkgconf_list_t *list);
|
||||||
PKGCONF_API void pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *value);
|
PKGCONF_API void pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *value);
|
||||||
|
@ -362,9 +396,11 @@ PKGCONF_API void pkgconf_tuple_define_global(pkgconf_client_t *client, const cha
|
||||||
/* queue.c */
|
/* queue.c */
|
||||||
PKGCONF_API void pkgconf_queue_push(pkgconf_list_t *list, const char *package);
|
PKGCONF_API void pkgconf_queue_push(pkgconf_list_t *list, const char *package);
|
||||||
PKGCONF_API bool pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list);
|
PKGCONF_API bool pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list);
|
||||||
|
PKGCONF_API bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth);
|
||||||
PKGCONF_API void pkgconf_queue_free(pkgconf_list_t *list);
|
PKGCONF_API void pkgconf_queue_free(pkgconf_list_t *list);
|
||||||
PKGCONF_API bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data);
|
PKGCONF_API bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data);
|
||||||
PKGCONF_API bool pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth);
|
PKGCONF_API bool pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth);
|
||||||
|
PKGCONF_API void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world);
|
||||||
|
|
||||||
/* cache.c */
|
/* cache.c */
|
||||||
PKGCONF_API pkgconf_pkg_t *pkgconf_cache_lookup(pkgconf_client_t *client, const char *id);
|
PKGCONF_API pkgconf_pkg_t *pkgconf_cache_lookup(pkgconf_client_t *client, const char *id);
|
||||||
|
@ -379,6 +415,7 @@ PKGCONF_API void pkgconf_audit_log_dependency(pkgconf_client_t *client, const pk
|
||||||
|
|
||||||
/* path.c */
|
/* path.c */
|
||||||
PKGCONF_API void pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter);
|
PKGCONF_API void pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter);
|
||||||
|
PKGCONF_API void pkgconf_path_prepend(const char *text, pkgconf_list_t *dirlist, bool filter);
|
||||||
PKGCONF_API size_t pkgconf_path_split(const char *text, pkgconf_list_t *dirlist, bool filter);
|
PKGCONF_API size_t pkgconf_path_split(const char *text, pkgconf_list_t *dirlist, bool filter);
|
||||||
PKGCONF_API size_t pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist, bool filter);
|
PKGCONF_API size_t pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist, bool filter);
|
||||||
PKGCONF_API bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist);
|
PKGCONF_API bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist);
|
||||||
|
|
|
@ -44,7 +44,7 @@ pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_operand_func_t *o
|
||||||
lineno++;
|
lineno++;
|
||||||
|
|
||||||
p = readbuf;
|
p = readbuf;
|
||||||
while (*p && isspace((unsigned int)*p))
|
while (*p && isspace((unsigned char)*p))
|
||||||
p++;
|
p++;
|
||||||
if (*p && p != readbuf)
|
if (*p && p != readbuf)
|
||||||
{
|
{
|
||||||
|
@ -53,13 +53,14 @@ pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_operand_func_t *o
|
||||||
warned_key_whitespace = true;
|
warned_key_whitespace = true;
|
||||||
}
|
}
|
||||||
key = p;
|
key = p;
|
||||||
while (*p && (isalpha((unsigned int)*p) || isdigit((unsigned int)*p) || *p == '_' || *p == '.'))
|
while (*p && (isalpha((unsigned char)*p) || isdigit((unsigned char)*p) || *p == '_' || *p == '.'))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (!isalpha((unsigned int)*key) && !isdigit((unsigned int)*p))
|
if (!isalpha((unsigned char)*key) &&
|
||||||
|
!isdigit((unsigned char)*p))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
while (*p && isspace((unsigned int)*p))
|
while (*p && isspace((unsigned char)*p))
|
||||||
{
|
{
|
||||||
if (!warned_key_whitespace)
|
if (!warned_key_whitespace)
|
||||||
{
|
{
|
||||||
|
@ -80,12 +81,12 @@ pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_operand_func_t *o
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*p && isspace((unsigned int)*p))
|
while (*p && isspace((unsigned char)*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
value = p;
|
value = p;
|
||||||
p = value + (strlen(value) - 1);
|
p = value + (strlen(value) - 1);
|
||||||
while (*p && isspace((unsigned int) *p) && p > value)
|
while (*p && isspace((unsigned char) *p) && p > value)
|
||||||
{
|
{
|
||||||
if (!warned_value_whitespace && op == '=')
|
if (!warned_value_whitespace && op == '=')
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,51 @@ path_list_contains_entry(const char *text, pkgconf_list_t *dirlist)
|
||||||
* variables.
|
* variables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static pkgconf_path_t *
|
||||||
|
prepare_path_node(const char *text, pkgconf_list_t *dirlist, bool filter)
|
||||||
|
{
|
||||||
|
pkgconf_path_t *node;
|
||||||
|
char path[PKGCONF_ITEM_SIZE];
|
||||||
|
|
||||||
|
pkgconf_strlcpy(path, text, sizeof path);
|
||||||
|
pkgconf_path_relocate(path, sizeof path);
|
||||||
|
|
||||||
|
#ifdef PKGCONF_CACHE_INODES
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
if (filter)
|
||||||
|
{
|
||||||
|
if (lstat(path, &st) == -1)
|
||||||
|
return NULL;
|
||||||
|
if (S_ISLNK(st.st_mode))
|
||||||
|
{
|
||||||
|
char pathbuf[PKGCONF_ITEM_SIZE * 4];
|
||||||
|
char *linkdest = realpath(path, pathbuf);
|
||||||
|
|
||||||
|
if (linkdest != NULL && stat(linkdest, &st) == -1)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (path_list_contains_entry(path, dirlist, &st))
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (filter && path_list_contains_entry(path, dirlist))
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
node = calloc(1, sizeof(pkgconf_path_t));
|
||||||
|
node->path = strdup(path);
|
||||||
|
|
||||||
|
#ifdef PKGCONF_CACHE_INODES
|
||||||
|
if (filter) {
|
||||||
|
node->handle_path = (void *)(intptr_t) st.st_ino;
|
||||||
|
node->handle_device = (void *)(intptr_t) st.st_dev;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -73,48 +118,35 @@ path_list_contains_entry(const char *text, pkgconf_list_t *dirlist)
|
||||||
void
|
void
|
||||||
pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter)
|
pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter)
|
||||||
{
|
{
|
||||||
pkgconf_path_t *node;
|
pkgconf_path_t *node = prepare_path_node(text, dirlist, filter);
|
||||||
char path[PKGCONF_ITEM_SIZE];
|
if (node == NULL)
|
||||||
|
|
||||||
pkgconf_strlcpy(path, text, sizeof path);
|
|
||||||
pkgconf_path_relocate(path, sizeof path);
|
|
||||||
|
|
||||||
#ifdef PKGCONF_CACHE_INODES
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
if (filter)
|
|
||||||
{
|
|
||||||
if (lstat(path, &st) == -1)
|
|
||||||
return;
|
|
||||||
if (S_ISLNK(st.st_mode))
|
|
||||||
{
|
|
||||||
char pathbuf[PKGCONF_ITEM_SIZE * 4];
|
|
||||||
char *linkdest = realpath(path, pathbuf);
|
|
||||||
|
|
||||||
if (linkdest != NULL && stat(linkdest, &st) == -1)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (path_list_contains_entry(path, dirlist, &st))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (filter && path_list_contains_entry(path, dirlist))
|
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
node = calloc(sizeof(pkgconf_path_t), 1);
|
|
||||||
node->path = strdup(path);
|
|
||||||
|
|
||||||
#ifdef PKGCONF_CACHE_INODES
|
|
||||||
if (filter) {
|
|
||||||
node->handle_path = (void *)(intptr_t) st.st_ino;
|
|
||||||
node->handle_device = (void *)(intptr_t) st.st_dev;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pkgconf_node_insert_tail(&node->lnode, node, dirlist);
|
pkgconf_node_insert_tail(&node->lnode, node, dirlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_path_prepend(const char *text, pkgconf_list_t *dirlist)
|
||||||
|
*
|
||||||
|
* Prepends a path node to a path list. If the path is already in the list, do nothing.
|
||||||
|
*
|
||||||
|
* :param char* text: The path text to add as a path node.
|
||||||
|
* :param pkgconf_list_t* dirlist: The path list to add the path node to.
|
||||||
|
* :param bool filter: Whether to perform duplicate filtering.
|
||||||
|
* :return: nothing
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkgconf_path_prepend(const char *text, pkgconf_list_t *dirlist, bool filter)
|
||||||
|
{
|
||||||
|
pkgconf_path_t *node = prepare_path_node(text, dirlist, filter);
|
||||||
|
if (node == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pkgconf_node_insert(&node->lnode, node, dirlist);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -234,7 +266,7 @@ pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src)
|
||||||
{
|
{
|
||||||
pkgconf_path_t *srcpath = n->data, *path;
|
pkgconf_path_t *srcpath = n->data, *path;
|
||||||
|
|
||||||
path = calloc(sizeof(pkgconf_path_t), 1);
|
path = calloc(1, sizeof(pkgconf_path_t));
|
||||||
path->path = strdup(srcpath->path);
|
path->path = strdup(srcpath->path);
|
||||||
|
|
||||||
#ifdef PKGCONF_CACHE_INODES
|
#ifdef PKGCONF_CACHE_INODES
|
||||||
|
@ -268,6 +300,8 @@ pkgconf_path_free(pkgconf_list_t *dirlist)
|
||||||
free(pnode->path);
|
free(pnode->path);
|
||||||
free(pnode);
|
free(pnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkgconf_list_zero(dirlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
|
|
@ -17,16 +17,34 @@
|
||||||
#include <libpkgconf/stdinc.h>
|
#include <libpkgconf/stdinc.h>
|
||||||
#include <libpkgconf/libpkgconf.h>
|
#include <libpkgconf/libpkgconf.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* libpkgconf `personality` module
|
||||||
|
* =========================
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define strcasecmp _stricmp
|
# define strcasecmp _stricmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool default_personality_init = false;
|
/*
|
||||||
|
* Increment each time the default personality is inited, decrement each time
|
||||||
|
* it's deinited. Whenever it is 0, then the deinit frees the personality. In
|
||||||
|
* that case an additional call to init will create it anew.
|
||||||
|
*/
|
||||||
|
static unsigned default_personality_init = 0;
|
||||||
|
|
||||||
static pkgconf_cross_personality_t default_personality = {
|
static pkgconf_cross_personality_t default_personality = {
|
||||||
.name = "default",
|
.name = "default",
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
/* PE/COFF uses a different linking model than ELF and Mach-O, where
|
||||||
|
* all transitive dependency references must be processed by the linker
|
||||||
|
* when linking the final executable image, even if those dependencies
|
||||||
|
* are pulled in as DLLs.
|
||||||
|
* This translates to always using --static on Windows targets.
|
||||||
|
*/
|
||||||
.want_default_static = true,
|
.want_default_static = true,
|
||||||
.want_default_pure = true,
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,30 +103,47 @@ build_default_search_path(pkgconf_list_t* dirlist)
|
||||||
*
|
*
|
||||||
* Returns the default cross-compile personality.
|
* Returns the default cross-compile personality.
|
||||||
*
|
*
|
||||||
|
* Not thread safe.
|
||||||
|
*
|
||||||
* :rtype: pkgconf_cross_personality_t*
|
* :rtype: pkgconf_cross_personality_t*
|
||||||
* :return: the default cross-compile personality
|
* :return: the default cross-compile personality
|
||||||
*/
|
*/
|
||||||
pkgconf_cross_personality_t *
|
pkgconf_cross_personality_t *
|
||||||
pkgconf_cross_personality_default(void)
|
pkgconf_cross_personality_default(void)
|
||||||
{
|
{
|
||||||
if (default_personality_init)
|
if (default_personality_init) {
|
||||||
|
++default_personality_init;
|
||||||
return &default_personality;
|
return &default_personality;
|
||||||
|
}
|
||||||
|
|
||||||
build_default_search_path(&default_personality.dir_list);
|
build_default_search_path(&default_personality.dir_list);
|
||||||
|
|
||||||
pkgconf_path_split(SYSTEM_LIBDIR, &default_personality.filter_libdirs, false);
|
pkgconf_path_split(SYSTEM_LIBDIR, &default_personality.filter_libdirs, false);
|
||||||
pkgconf_path_split(SYSTEM_INCLUDEDIR, &default_personality.filter_includedirs, false);
|
pkgconf_path_split(SYSTEM_INCLUDEDIR, &default_personality.filter_includedirs, false);
|
||||||
|
|
||||||
default_personality_init = true;
|
++default_personality_init;
|
||||||
return &default_personality;
|
return &default_personality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *)
|
||||||
|
*
|
||||||
|
* Decrements the count of default cross personality instances.
|
||||||
|
*
|
||||||
|
* Not thread safe.
|
||||||
|
*
|
||||||
|
* :rtype: void
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality)
|
pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality)
|
||||||
{
|
{
|
||||||
pkgconf_path_free(&personality->dir_list);
|
if (--default_personality_init == 0) {
|
||||||
pkgconf_path_free(&personality->filter_libdirs);
|
pkgconf_path_free(&personality->dir_list);
|
||||||
pkgconf_path_free(&personality->filter_includedirs);
|
pkgconf_path_free(&personality->filter_libdirs);
|
||||||
|
pkgconf_path_free(&personality->filter_includedirs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
|
@ -118,7 +153,7 @@ valid_triplet(const char *triplet)
|
||||||
const char *c = triplet;
|
const char *c = triplet;
|
||||||
|
|
||||||
for (; *c; c++)
|
for (; *c; c++)
|
||||||
if (!isalnum(*c) && *c != '-' && *c != '_')
|
if (!isalnum((unsigned char)*c) && *c != '-' && *c != '_')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -211,23 +246,25 @@ personality_warn_func(void *p, const char *fmt, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
static pkgconf_cross_personality_t *
|
static pkgconf_cross_personality_t *
|
||||||
load_personality_with_path(const char *path, const char *triplet)
|
load_personality_with_path(const char *path, const char *triplet, bool datadir)
|
||||||
{
|
{
|
||||||
char pathbuf[PKGCONF_ITEM_SIZE];
|
char pathbuf[PKGCONF_ITEM_SIZE];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
pkgconf_cross_personality_t *p;
|
pkgconf_cross_personality_t *p;
|
||||||
|
|
||||||
/* if triplet is null, assume that path is a direct path to the personality file */
|
/* if triplet is null, assume that path is a direct path to the personality file */
|
||||||
if (triplet != NULL)
|
if (triplet == NULL)
|
||||||
snprintf(pathbuf, sizeof pathbuf, "%s/%s.personality", path, triplet);
|
|
||||||
else
|
|
||||||
pkgconf_strlcpy(pathbuf, path, sizeof pathbuf);
|
pkgconf_strlcpy(pathbuf, path, sizeof pathbuf);
|
||||||
|
else if (datadir)
|
||||||
|
snprintf(pathbuf, sizeof pathbuf, "%s/pkgconfig/personality.d/%s.personality", path, triplet);
|
||||||
|
else
|
||||||
|
snprintf(pathbuf, sizeof pathbuf, "%s/%s.personality", path, triplet);
|
||||||
|
|
||||||
f = fopen(pathbuf, "r");
|
f = fopen(pathbuf, "r");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
p = calloc(sizeof(pkgconf_cross_personality_t), 1);
|
p = calloc(1, sizeof(pkgconf_cross_personality_t));
|
||||||
if (triplet != NULL)
|
if (triplet != NULL)
|
||||||
p->name = strdup(triplet);
|
p->name = strdup(triplet);
|
||||||
pkgconf_parser_parse(f, p, personality_parser_ops, personality_warn_func, pathbuf);
|
pkgconf_parser_parse(f, p, personality_parser_ops, personality_warn_func, pathbuf);
|
||||||
|
@ -251,21 +288,51 @@ pkgconf_cross_personality_find(const char *triplet)
|
||||||
pkgconf_list_t plist = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t plist = PKGCONF_LIST_INITIALIZER;
|
||||||
pkgconf_node_t *n;
|
pkgconf_node_t *n;
|
||||||
pkgconf_cross_personality_t *out = NULL;
|
pkgconf_cross_personality_t *out = NULL;
|
||||||
|
#if ! defined(_WIN32) && ! defined(__HAIKU__)
|
||||||
|
char pathbuf[PKGCONF_ITEM_SIZE];
|
||||||
|
const char *envvar;
|
||||||
|
#endif
|
||||||
|
|
||||||
out = load_personality_with_path(triplet, NULL);
|
out = load_personality_with_path(triplet, NULL, false);
|
||||||
if (out != NULL)
|
if (out != NULL)
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
if (!valid_triplet(triplet))
|
if (!valid_triplet(triplet))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#if ! defined(_WIN32) && ! defined(__HAIKU__)
|
||||||
|
envvar = getenv("XDG_DATA_HOME");
|
||||||
|
if (envvar != NULL)
|
||||||
|
pkgconf_path_add(envvar, &plist, true);
|
||||||
|
else {
|
||||||
|
envvar = getenv("HOME");
|
||||||
|
if (envvar != NULL) {
|
||||||
|
pkgconf_strlcpy(pathbuf, envvar, sizeof pathbuf);
|
||||||
|
pkgconf_strlcat(pathbuf, "/.local/share", sizeof pathbuf);
|
||||||
|
pkgconf_path_add(pathbuf, &plist, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgconf_path_build_from_environ("XDG_DATA_DIRS", "/usr/local/share" PKG_CONFIG_PATH_SEP_S "/usr/share", &plist, true);
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)
|
||||||
|
{
|
||||||
|
pkgconf_path_t *pn = n->data;
|
||||||
|
|
||||||
|
out = load_personality_with_path(pn->path, triplet, true);
|
||||||
|
if (out != NULL)
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
pkgconf_path_free(&plist);
|
||||||
|
#endif
|
||||||
|
|
||||||
pkgconf_path_split(PERSONALITY_PATH, &plist, true);
|
pkgconf_path_split(PERSONALITY_PATH, &plist, true);
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)
|
PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)
|
||||||
{
|
{
|
||||||
pkgconf_path_t *pn = n->data;
|
pkgconf_path_t *pn = n->data;
|
||||||
|
|
||||||
out = load_personality_with_path(pn->path, triplet);
|
out = load_personality_with_path(pn->path, triplet, false);
|
||||||
if (out != NULL)
|
if (out != NULL)
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
255
libpkgconf/pkg.c
255
libpkgconf/pkg.c
|
@ -37,6 +37,14 @@
|
||||||
|
|
||||||
#define PKG_CONFIG_EXT ".pc"
|
#define PKG_CONFIG_EXT ".pc"
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
pkgconf_pkg_traverse_main(pkgconf_client_t *client,
|
||||||
|
pkgconf_pkg_t *root,
|
||||||
|
pkgconf_pkg_traverse_func_t func,
|
||||||
|
void *data,
|
||||||
|
int maxdepth,
|
||||||
|
unsigned int skip_flags);
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
str_has_suffix(const char *str, const char *suffix)
|
str_has_suffix(const char *str, const char *suffix)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +72,7 @@ pkg_get_parent_dir(pkgconf_pkg_t *pkg)
|
||||||
return strdup(buf);
|
return strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (*pkgconf_pkg_parser_keyword_func_t)(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value);
|
typedef void (*pkgconf_pkg_parser_keyword_func_t)(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *keyword;
|
const char *keyword;
|
||||||
const pkgconf_pkg_parser_keyword_func_t func;
|
const pkgconf_pkg_parser_keyword_func_t func;
|
||||||
|
@ -78,17 +86,17 @@ static int pkgconf_pkg_parser_keyword_pair_cmp(const void *key, const void *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pkgconf_pkg_parser_tuple_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
pkgconf_pkg_parser_tuple_func(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
||||||
{
|
{
|
||||||
(void) keyword;
|
(void) keyword;
|
||||||
(void) lineno;
|
(void) lineno;
|
||||||
|
|
||||||
char **dest = (char **)((char *) pkg + offset);
|
char **dest = (char **)((char *) pkg + offset);
|
||||||
*dest = pkgconf_tuple_parse(client, &pkg->vars, value);
|
*dest = pkgconf_tuple_parse(client, &pkg->vars, value, pkg->flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pkgconf_pkg_parser_version_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
pkgconf_pkg_parser_version_func(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
||||||
{
|
{
|
||||||
(void) keyword;
|
(void) keyword;
|
||||||
(void) lineno;
|
(void) lineno;
|
||||||
|
@ -97,7 +105,7 @@ pkgconf_pkg_parser_version_func(const pkgconf_client_t *client, pkgconf_pkg_t *p
|
||||||
char **dest = (char **)((char *) pkg + offset);
|
char **dest = (char **)((char *) pkg + offset);
|
||||||
|
|
||||||
/* cut at any detected whitespace */
|
/* cut at any detected whitespace */
|
||||||
p = pkgconf_tuple_parse(client, &pkg->vars, value);
|
p = pkgconf_tuple_parse(client, &pkg->vars, value, pkg->flags);
|
||||||
|
|
||||||
len = strcspn(p, " \t");
|
len = strcspn(p, " \t");
|
||||||
if (len != strlen(p))
|
if (len != strlen(p))
|
||||||
|
@ -113,10 +121,10 @@ pkgconf_pkg_parser_version_func(const pkgconf_client_t *client, pkgconf_pkg_t *p
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pkgconf_pkg_parser_fragment_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
pkgconf_pkg_parser_fragment_func(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
||||||
{
|
{
|
||||||
pkgconf_list_t *dest = (pkgconf_list_t *)((char *) pkg + offset);
|
pkgconf_list_t *dest = (pkgconf_list_t *)((char *) pkg + offset);
|
||||||
bool ret = pkgconf_fragment_parse(client, dest, &pkg->vars, value);
|
bool ret = pkgconf_fragment_parse(client, dest, &pkg->vars, value, pkg->flags);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
@ -126,7 +134,7 @@ pkgconf_pkg_parser_fragment_func(const pkgconf_client_t *client, pkgconf_pkg_t *
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pkgconf_pkg_parser_dependency_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
pkgconf_pkg_parser_dependency_func(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
||||||
{
|
{
|
||||||
(void) keyword;
|
(void) keyword;
|
||||||
(void) lineno;
|
(void) lineno;
|
||||||
|
@ -137,7 +145,7 @@ pkgconf_pkg_parser_dependency_func(const pkgconf_client_t *client, pkgconf_pkg_t
|
||||||
|
|
||||||
/* a variant of pkgconf_pkg_parser_dependency_func which colors the dependency node as an "internal" dependency. */
|
/* a variant of pkgconf_pkg_parser_dependency_func which colors the dependency node as an "internal" dependency. */
|
||||||
static void
|
static void
|
||||||
pkgconf_pkg_parser_internal_dependency_func(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
pkgconf_pkg_parser_internal_dependency_func(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
||||||
{
|
{
|
||||||
(void) keyword;
|
(void) keyword;
|
||||||
(void) lineno;
|
(void) lineno;
|
||||||
|
@ -146,19 +154,34 @@ pkgconf_pkg_parser_internal_dependency_func(const pkgconf_client_t *client, pkgc
|
||||||
pkgconf_dependency_parse(client, pkg, dest, value, PKGCONF_PKG_DEPF_INTERNAL);
|
pkgconf_dependency_parse(client, pkg, dest, value, PKGCONF_PKG_DEPF_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* a variant of pkgconf_pkg_parser_dependency_func which colors the dependency node as a "private" dependency. */
|
||||||
|
static void
|
||||||
|
pkgconf_pkg_parser_private_dependency_func(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
||||||
|
{
|
||||||
|
(void) keyword;
|
||||||
|
(void) lineno;
|
||||||
|
|
||||||
|
pkgconf_list_t *dest = (pkgconf_list_t *)((char *) pkg + offset);
|
||||||
|
pkgconf_dependency_parse(client, pkg, dest, value, PKGCONF_PKG_DEPF_PRIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
/* keep this in alphabetical order */
|
/* keep this in alphabetical order */
|
||||||
static const pkgconf_pkg_parser_keyword_pair_t pkgconf_pkg_parser_keyword_funcs[] = {
|
static const pkgconf_pkg_parser_keyword_pair_t pkgconf_pkg_parser_keyword_funcs[] = {
|
||||||
{"CFLAGS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags)},
|
{"CFLAGS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags)},
|
||||||
{"CFLAGS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags_private)},
|
{"CFLAGS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags_private)},
|
||||||
{"Conflicts", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, conflicts)},
|
{"Conflicts", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, conflicts)},
|
||||||
|
{"Copyright", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, copyright)},
|
||||||
{"Description", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, description)},
|
{"Description", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, description)},
|
||||||
{"LIBS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs)},
|
{"LIBS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs)},
|
||||||
{"LIBS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs_private)},
|
{"LIBS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs_private)},
|
||||||
|
{"License", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, license)},
|
||||||
|
{"Maintainer", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, maintainer)},
|
||||||
{"Name", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, realname)},
|
{"Name", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, realname)},
|
||||||
{"Provides", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, provides)},
|
{"Provides", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, provides)},
|
||||||
{"Requires", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, required)},
|
{"Requires", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, required)},
|
||||||
{"Requires.internal", pkgconf_pkg_parser_internal_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
{"Requires.internal", pkgconf_pkg_parser_internal_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
||||||
{"Requires.private", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
{"Requires.private", pkgconf_pkg_parser_private_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
||||||
|
{"URL", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, url)},
|
||||||
{"Version", pkgconf_pkg_parser_version_func, offsetof(pkgconf_pkg_t, version)},
|
{"Version", pkgconf_pkg_parser_version_func, offsetof(pkgconf_pkg_t, version)},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -227,7 +250,7 @@ determine_prefix(const pkgconf_pkg_t *pkg, char *buf, size_t buflen)
|
||||||
static char *
|
static char *
|
||||||
convert_path_to_value(const char *path)
|
convert_path_to_value(const char *path)
|
||||||
{
|
{
|
||||||
char *buf = calloc((strlen(path) + 1) * 2, 1);
|
char *buf = calloc(1, (strlen(path) + 1) * 2);
|
||||||
char *bptr = buf;
|
char *bptr = buf;
|
||||||
const char *i;
|
const char *i;
|
||||||
|
|
||||||
|
@ -297,19 +320,17 @@ pkgconf_pkg_parser_value_set(void *opaque, const size_t lineno, const char *keyw
|
||||||
* which is broken when redefining the prefix. We try to outsmart the
|
* which is broken when redefining the prefix. We try to outsmart the
|
||||||
* file and rewrite any directory that starts with the same prefix.
|
* file and rewrite any directory that starts with the same prefix.
|
||||||
*/
|
*/
|
||||||
if (strcmp(keyword, pkg->owner->prefix_varname) || !(pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX))
|
if (pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX && pkg->orig_prefix
|
||||||
{
|
|
||||||
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true);
|
|
||||||
}
|
|
||||||
else if (pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX && pkg->orig_prefix
|
|
||||||
&& is_path_prefix_equal(canonicalized_value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value)))
|
&& is_path_prefix_equal(canonicalized_value, pkg->orig_prefix->value, strlen(pkg->orig_prefix->value)))
|
||||||
{
|
{
|
||||||
char newvalue[PKGCONF_ITEM_SIZE];
|
char newvalue[PKGCONF_ITEM_SIZE];
|
||||||
|
|
||||||
pkgconf_strlcpy(newvalue, pkg->prefix->value, sizeof newvalue);
|
pkgconf_strlcpy(newvalue, pkg->prefix->value, sizeof newvalue);
|
||||||
pkgconf_strlcat(newvalue, canonicalized_value + strlen(pkg->orig_prefix->value), sizeof newvalue);
|
pkgconf_strlcat(newvalue, canonicalized_value + strlen(pkg->orig_prefix->value), sizeof newvalue);
|
||||||
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, newvalue, false);
|
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, newvalue, false, pkg->flags);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(keyword, pkg->owner->prefix_varname) || !(pkg->owner->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX))
|
||||||
|
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true, pkg->flags);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char pathbuf[PKGCONF_ITEM_SIZE];
|
char pathbuf[PKGCONF_ITEM_SIZE];
|
||||||
|
@ -318,12 +339,12 @@ pkgconf_pkg_parser_value_set(void *opaque, const size_t lineno, const char *keyw
|
||||||
if (relvalue != NULL)
|
if (relvalue != NULL)
|
||||||
{
|
{
|
||||||
char *prefix_value = convert_path_to_value(relvalue);
|
char *prefix_value = convert_path_to_value(relvalue);
|
||||||
pkg->orig_prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, "orig_prefix", canonicalized_value, true);
|
pkg->orig_prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, "orig_prefix", canonicalized_value, true, pkg->flags);
|
||||||
pkgconf_tuple_add_global(pkg->owner, keyword, prefix_value);
|
pkg->prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, prefix_value, false, pkg->flags);
|
||||||
free(prefix_value);
|
free(prefix_value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true);
|
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true, pkg->flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,40 +402,39 @@ pkgconf_pkg_validate(const pkgconf_client_t *client, const pkgconf_pkg_t *pkg)
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
* .. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f)
|
* .. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f, unsigned int flags)
|
||||||
*
|
*
|
||||||
* Parse a .pc file into a pkgconf_pkg_t object structure.
|
* Parse a .pc file into a pkgconf_pkg_t object structure.
|
||||||
*
|
*
|
||||||
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
* :param char* filename: The filename of the package file (including full path).
|
* :param char* filename: The filename of the package file (including full path).
|
||||||
* :param FILE* f: The file object to read from.
|
* :param FILE* f: The file object to read from.
|
||||||
|
* :param uint flags: The flags to use when parsing.
|
||||||
* :returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
* :returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
||||||
* :rtype: pkgconf_pkg_t *
|
* :rtype: pkgconf_pkg_t *
|
||||||
*/
|
*/
|
||||||
pkgconf_pkg_t *
|
pkgconf_pkg_t *
|
||||||
pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *f)
|
pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *f, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg;
|
pkgconf_pkg_t *pkg;
|
||||||
char *idptr;
|
char *idptr;
|
||||||
|
|
||||||
pkg = calloc(sizeof(pkgconf_pkg_t), 1);
|
pkg = calloc(1, sizeof(pkgconf_pkg_t));
|
||||||
pkg->owner = client;
|
pkg->owner = client;
|
||||||
pkg->filename = strdup(filename);
|
pkg->filename = strdup(filename);
|
||||||
pkg->pc_filedir = pkg_get_parent_dir(pkg);
|
pkg->pc_filedir = pkg_get_parent_dir(pkg);
|
||||||
|
pkg->flags = flags;
|
||||||
|
|
||||||
char *pc_filedir_value = convert_path_to_value(pkg->pc_filedir);
|
char *pc_filedir_value = convert_path_to_value(pkg->pc_filedir);
|
||||||
pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pc_filedir_value, true);
|
pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pc_filedir_value, true, pkg->flags);
|
||||||
free(pc_filedir_value);
|
free(pc_filedir_value);
|
||||||
|
|
||||||
/* If pc_filedir is outside of sysroot_dir, clear pc_filedir
|
/* If pc_filedir is outside of sysroot_dir, override sysroot_dir for this
|
||||||
|
* package.
|
||||||
* See https://github.com/pkgconf/pkgconf/issues/213
|
* See https://github.com/pkgconf/pkgconf/issues/213
|
||||||
*/
|
*/
|
||||||
if (client->sysroot_dir && strncmp(pkg->pc_filedir, client->sysroot_dir, strlen(client->sysroot_dir)))
|
if (client->sysroot_dir && strncmp(pkg->pc_filedir, client->sysroot_dir, strlen(client->sysroot_dir)))
|
||||||
{
|
pkgconf_tuple_add(client, &pkg->vars, "pc_sysrootdir", "", false, pkg->flags);
|
||||||
free(client->sysroot_dir);
|
|
||||||
client->sysroot_dir = NULL;
|
|
||||||
pkgconf_client_set_sysroot_dir(client, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make module id */
|
/* make module id */
|
||||||
if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)
|
if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)
|
||||||
|
@ -437,6 +457,13 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
|
||||||
if (idptr)
|
if (idptr)
|
||||||
*idptr = '\0';
|
*idptr = '\0';
|
||||||
|
|
||||||
|
if (pkg->flags & PKGCONF_PKG_PROPF_UNINSTALLED)
|
||||||
|
{
|
||||||
|
idptr = strrchr(pkg->id, '-');
|
||||||
|
if (idptr)
|
||||||
|
*idptr = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
pkgconf_parser_parse(f, pkg, pkg_parser_funcs, (pkgconf_parser_warn_func_t) pkg_warn_func, pkg->filename);
|
pkgconf_parser_parse(f, pkg, pkg_parser_funcs, (pkgconf_parser_warn_func_t) pkg_warn_func, pkg->filename);
|
||||||
|
|
||||||
if (!pkgconf_pkg_validate(client, pkg))
|
if (!pkgconf_pkg_validate(client, pkg))
|
||||||
|
@ -446,7 +473,8 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_dependency_add(client, &pkg->provides, pkg->id, pkg->version, PKGCONF_CMP_EQUAL, 0);
|
pkgconf_dependency_t *dep = pkgconf_dependency_add(client, &pkg->provides, pkg->id, pkg->version, PKGCONF_CMP_EQUAL, 0);
|
||||||
|
pkgconf_dependency_unref(dep->owner, dep);
|
||||||
|
|
||||||
return pkgconf_pkg_ref(client, pkg);
|
return pkgconf_pkg_ref(client, pkg);
|
||||||
}
|
}
|
||||||
|
@ -509,6 +537,18 @@ pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
if (pkg->pc_filedir != NULL)
|
if (pkg->pc_filedir != NULL)
|
||||||
free(pkg->pc_filedir);
|
free(pkg->pc_filedir);
|
||||||
|
|
||||||
|
if (pkg->license != NULL)
|
||||||
|
free(pkg->license);
|
||||||
|
|
||||||
|
if (pkg->maintainer != NULL)
|
||||||
|
free(pkg->maintainer);
|
||||||
|
|
||||||
|
if (pkg->copyright != NULL)
|
||||||
|
free(pkg->copyright);
|
||||||
|
|
||||||
|
if (pkg->why != NULL)
|
||||||
|
free(pkg->why);
|
||||||
|
|
||||||
free(pkg);
|
free(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +571,7 @@ pkgconf_pkg_ref(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
PKGCONF_TRACE(client, "WTF: client %p refers to package %p owned by other client %p", client, pkg, pkg->owner);
|
PKGCONF_TRACE(client, "WTF: client %p refers to package %p owned by other client %p", client, pkg, pkg->owner);
|
||||||
|
|
||||||
pkg->refcount++;
|
pkg->refcount++;
|
||||||
PKGCONF_TRACE(client, "refcount@%p: %d", pkg, pkg->refcount);
|
PKGCONF_TRACE(client, "%s refcount@%p: %d", pkg->id, pkg, pkg->refcount);
|
||||||
|
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
@ -554,7 +594,7 @@ pkgconf_pkg_unref(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
PKGCONF_TRACE(client, "WTF: client %p unrefs package %p owned by other client %p", client, pkg, pkg->owner);
|
PKGCONF_TRACE(client, "WTF: client %p unrefs package %p owned by other client %p", client, pkg, pkg->owner);
|
||||||
|
|
||||||
pkg->refcount--;
|
pkg->refcount--;
|
||||||
PKGCONF_TRACE(pkg->owner, "refcount@%p: %d", pkg, pkg->refcount);
|
PKGCONF_TRACE(pkg->owner, "%s refcount@%p: %d", pkg->id, pkg, pkg->refcount);
|
||||||
|
|
||||||
if (pkg->refcount <= 0)
|
if (pkg->refcount <= 0)
|
||||||
pkgconf_pkg_free(pkg->owner, pkg);
|
pkgconf_pkg_free(pkg->owner, pkg);
|
||||||
|
@ -576,14 +616,12 @@ pkgconf_pkg_try_specific_path(pkgconf_client_t *client, const char *path, const
|
||||||
if (!(client->flags & PKGCONF_PKG_PKGF_NO_UNINSTALLED) && (f = fopen(uninst_locbuf, "r")) != NULL)
|
if (!(client->flags & PKGCONF_PKG_PKGF_NO_UNINSTALLED) && (f = fopen(uninst_locbuf, "r")) != NULL)
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "found (uninstalled): %s", uninst_locbuf);
|
PKGCONF_TRACE(client, "found (uninstalled): %s", uninst_locbuf);
|
||||||
pkg = pkgconf_pkg_new_from_file(client, uninst_locbuf, f);
|
pkg = pkgconf_pkg_new_from_file(client, uninst_locbuf, f, PKGCONF_PKG_PROPF_UNINSTALLED);
|
||||||
if (pkg != NULL)
|
|
||||||
pkg->flags |= PKGCONF_PKG_PROPF_UNINSTALLED;
|
|
||||||
}
|
}
|
||||||
else if ((f = fopen(locbuf, "r")) != NULL)
|
else if ((f = fopen(locbuf, "r")) != NULL)
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "found: %s", locbuf);
|
PKGCONF_TRACE(client, "found: %s", locbuf);
|
||||||
pkg = pkgconf_pkg_new_from_file(client, locbuf, f);
|
pkg = pkgconf_pkg_new_from_file(client, locbuf, f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkg;
|
return pkg;
|
||||||
|
@ -621,7 +659,7 @@ pkgconf_pkg_scan_dir(pkgconf_client_t *client, const char *path, void *data, pkg
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pkg = pkgconf_pkg_new_from_file(client, filebuf, f);
|
pkg = pkgconf_pkg_new_from_file(client, filebuf, f, 0);
|
||||||
if (pkg != NULL)
|
if (pkg != NULL)
|
||||||
{
|
{
|
||||||
if (func(pkg, data))
|
if (func(pkg, data))
|
||||||
|
@ -737,15 +775,13 @@ pkgconf_pkg_find(pkgconf_client_t *client, const char *name)
|
||||||
{
|
{
|
||||||
if ((f = fopen(name, "r")) != NULL)
|
if ((f = fopen(name, "r")) != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg;
|
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "%s is a file", name);
|
PKGCONF_TRACE(client, "%s is a file", name);
|
||||||
|
|
||||||
pkg = pkgconf_pkg_new_from_file(client, name, f);
|
pkg = pkgconf_pkg_new_from_file(client, name, f, 0);
|
||||||
if (pkg != NULL)
|
if (pkg != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_path_add(pkg->pc_filedir, &client->dir_list, true);
|
pkgconf_path_add(pkg->pc_filedir, &client->dir_list, true);
|
||||||
return pkg;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -824,14 +860,14 @@ pkgconf_compare_version(const char *a, const char *b)
|
||||||
pkgconf_strlcpy(buf1, a, sizeof buf1);
|
pkgconf_strlcpy(buf1, a, sizeof buf1);
|
||||||
pkgconf_strlcpy(buf2, b, sizeof buf2);
|
pkgconf_strlcpy(buf2, b, sizeof buf2);
|
||||||
|
|
||||||
one = str1 = buf1;
|
one = buf1;
|
||||||
two = str2 = buf2;
|
two = buf2;
|
||||||
|
|
||||||
while (*one || *two)
|
while (*one || *two)
|
||||||
{
|
{
|
||||||
while (*one && !isalnum((unsigned int)*one) && *one != '~')
|
while (*one && !isalnum((unsigned char)*one) && *one != '~')
|
||||||
one++;
|
one++;
|
||||||
while (*two && !isalnum((unsigned int)*two) && *two != '~')
|
while (*two && !isalnum((unsigned char)*two) && *two != '~')
|
||||||
two++;
|
two++;
|
||||||
|
|
||||||
if (*one == '~' || *two == '~')
|
if (*one == '~' || *two == '~')
|
||||||
|
@ -852,22 +888,22 @@ pkgconf_compare_version(const char *a, const char *b)
|
||||||
str1 = one;
|
str1 = one;
|
||||||
str2 = two;
|
str2 = two;
|
||||||
|
|
||||||
if (isdigit((unsigned int)*str1))
|
if (isdigit((unsigned char)*str1))
|
||||||
{
|
{
|
||||||
while (*str1 && isdigit((unsigned int)*str1))
|
while (*str1 && isdigit((unsigned char)*str1))
|
||||||
str1++;
|
str1++;
|
||||||
|
|
||||||
while (*str2 && isdigit((unsigned int)*str2))
|
while (*str2 && isdigit((unsigned char)*str2))
|
||||||
str2++;
|
str2++;
|
||||||
|
|
||||||
isnum = true;
|
isnum = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (*str1 && isalpha((unsigned int)*str1))
|
while (*str1 && isalpha((unsigned char)*str1))
|
||||||
str1++;
|
str1++;
|
||||||
|
|
||||||
while (*str2 && isalpha((unsigned int)*str2))
|
while (*str2 && isalpha((unsigned char)*str2))
|
||||||
str2++;
|
str2++;
|
||||||
|
|
||||||
isnum = false;
|
isnum = false;
|
||||||
|
@ -960,6 +996,7 @@ static pkgconf_pkg_t pkgconf_virtual = {
|
||||||
.description = "virtual package defining pkgconf API version supported",
|
.description = "virtual package defining pkgconf API version supported",
|
||||||
.url = PACKAGE_BUGREPORT,
|
.url = PACKAGE_BUGREPORT,
|
||||||
.version = PACKAGE_VERSION,
|
.version = PACKAGE_VERSION,
|
||||||
|
.license = "ISC",
|
||||||
.flags = PKGCONF_PKG_PROPF_STATIC,
|
.flags = PKGCONF_PKG_PROPF_STATIC,
|
||||||
.vars = {
|
.vars = {
|
||||||
.head = &(pkgconf_node_t){
|
.head = &(pkgconf_node_t){
|
||||||
|
@ -1362,19 +1399,24 @@ pkgconf_pkg_verify_dependency(pkgconf_client_t *client, pkgconf_dependency_t *pk
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pkgconf_pkg_scan_providers(client, pkgdep, eflags);
|
pkg = pkgconf_pkg_scan_providers(client, pkgdep, eflags);
|
||||||
}
|
|
||||||
|
|
||||||
if (pkg->id == NULL)
|
|
||||||
pkg->id = strdup(pkgdep->package);
|
|
||||||
|
|
||||||
if (pkgconf_pkg_comparator_impls[pkgdep->compare](pkg->version, pkgdep->version) != true)
|
|
||||||
{
|
|
||||||
if (eflags != NULL)
|
|
||||||
*eflags |= PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pkgdep->match = pkgconf_pkg_ref(client, pkg);
|
{
|
||||||
|
if (pkg->id == NULL)
|
||||||
|
pkg->id = strdup(pkgdep->package);
|
||||||
|
|
||||||
|
if (pkgconf_pkg_comparator_impls[pkgdep->compare](pkg->version, pkgdep->version) != true)
|
||||||
|
{
|
||||||
|
if (eflags != NULL)
|
||||||
|
*eflags |= PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
pkgdep->match = pkgconf_pkg_ref(client, pkg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg != NULL && pkg->why == NULL)
|
||||||
|
pkg->why = strdup(pkgdep->package);
|
||||||
|
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
@ -1412,7 +1454,11 @@ pkgconf_pkg_report_graph_error(pkgconf_client_t *client, pkgconf_pkg_t *parent,
|
||||||
client->already_sent_notice = true;
|
client->already_sent_notice = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_error(client, "Package '%s', required by '%s', not found\n", node->package, parent->id);
|
if (parent->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
||||||
|
pkgconf_error(client, "Package '%s' not found\n", node->package);
|
||||||
|
else
|
||||||
|
pkgconf_error(client, "Package '%s', required by '%s', not found\n", node->package, parent->id);
|
||||||
|
|
||||||
pkgconf_audit_log(client, "%s NOT-FOUND\n", node->package);
|
pkgconf_audit_log(client, "%s NOT-FOUND\n", node->package);
|
||||||
}
|
}
|
||||||
else if (eflags & PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH)
|
else if (eflags & PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH)
|
||||||
|
@ -1441,9 +1487,11 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
|
||||||
unsigned int skip_flags)
|
unsigned int skip_flags)
|
||||||
{
|
{
|
||||||
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
|
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node, *next;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(deplist->head, node)
|
parent->flags |= PKGCONF_PKG_PROPF_ANCESTOR;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY_SAFE(deplist->head, next, node)
|
||||||
{
|
{
|
||||||
unsigned int eflags_local = PKGCONF_PKG_ERRF_OK;
|
unsigned int eflags_local = PKGCONF_PKG_ERRF_OK;
|
||||||
pkgconf_dependency_t *depnode = node->data;
|
pkgconf_dependency_t *depnode = node->data;
|
||||||
|
@ -1463,26 +1511,42 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
|
||||||
if (pkgdep == NULL)
|
if (pkgdep == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pkgdep->flags & PKGCONF_PKG_PROPF_SEEN)
|
if((pkgdep->flags & PKGCONF_PKG_PROPF_ANCESTOR) != 0)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_unref(client, pkgdep);
|
/* In this case we have a circular reference.
|
||||||
continue;
|
* We break that by deleteing the circular node from the
|
||||||
|
* the list, so that we dont create a situation where
|
||||||
|
* memory is leaked due to circular ownership.
|
||||||
|
* i.e: A owns B owns A
|
||||||
|
*
|
||||||
|
* TODO(ariadne): Breaking circular references between Requires and Requires.private
|
||||||
|
* lists causes problems. Find a way to refactor the Requires.private list out.
|
||||||
|
*/
|
||||||
|
if (!(depnode->flags & PKGCONF_PKG_DEPF_PRIVATE) &&
|
||||||
|
!(parent->flags & PKGCONF_PKG_PROPF_VIRTUAL))
|
||||||
|
{
|
||||||
|
pkgconf_warn(client, "%s: breaking circular reference (%s -> %s -> %s)\n",
|
||||||
|
parent->id, parent->id, pkgdep->id, parent->id);
|
||||||
|
|
||||||
|
pkgconf_node_delete(node, deplist);
|
||||||
|
pkgconf_dependency_unref(client, depnode);
|
||||||
|
}
|
||||||
|
|
||||||
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skip_flags && (depnode->flags & skip_flags) == skip_flags)
|
if (skip_flags && (depnode->flags & skip_flags) == skip_flags)
|
||||||
{
|
goto next;
|
||||||
pkgconf_pkg_unref(client, pkgdep);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pkgconf_audit_log_dependency(client, pkgdep, depnode);
|
pkgconf_audit_log_dependency(client, pkgdep, depnode);
|
||||||
|
|
||||||
pkgdep->flags |= PKGCONF_PKG_PROPF_SEEN;
|
eflags |= pkgconf_pkg_traverse_main(client, pkgdep, func, data, depth - 1, skip_flags);
|
||||||
eflags |= pkgconf_pkg_traverse(client, pkgdep, func, data, depth - 1, skip_flags);
|
next:
|
||||||
pkgdep->flags &= ~PKGCONF_PKG_PROPF_SEEN;
|
|
||||||
pkgconf_pkg_unref(client, pkgdep);
|
pkgconf_pkg_unref(client, pkgdep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parent->flags &= ~PKGCONF_PKG_PROPF_ANCESTOR;
|
||||||
|
|
||||||
return eflags;
|
return eflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,8 +1613,8 @@ pkgconf_pkg_walk_conflicts_list(pkgconf_client_t *client,
|
||||||
* :return: ``PKGCONF_PKG_ERRF_OK`` on success, else an error code.
|
* :return: ``PKGCONF_PKG_ERRF_OK`` on success, else an error code.
|
||||||
* :rtype: unsigned int
|
* :rtype: unsigned int
|
||||||
*/
|
*/
|
||||||
unsigned int
|
static unsigned int
|
||||||
pkgconf_pkg_traverse(pkgconf_client_t *client,
|
pkgconf_pkg_traverse_main(pkgconf_client_t *client,
|
||||||
pkgconf_pkg_t *root,
|
pkgconf_pkg_t *root,
|
||||||
pkgconf_pkg_traverse_func_t func,
|
pkgconf_pkg_traverse_func_t func,
|
||||||
void *data,
|
void *data,
|
||||||
|
@ -1562,7 +1626,17 @@ pkgconf_pkg_traverse(pkgconf_client_t *client,
|
||||||
if (maxdepth == 0)
|
if (maxdepth == 0)
|
||||||
return eflags;
|
return eflags;
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "%s: level %d", root->id, maxdepth);
|
/* Short-circuit if we have already visited this node.
|
||||||
|
*/
|
||||||
|
if (root->serial == client->serial)
|
||||||
|
return eflags;
|
||||||
|
|
||||||
|
root->serial = client->serial;
|
||||||
|
|
||||||
|
if (root->identifier == 0)
|
||||||
|
root->identifier = ++client->identifier;
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "%s: level %d, serial %"PRIu64, root->id, maxdepth, client->serial);
|
||||||
|
|
||||||
if ((root->flags & PKGCONF_PKG_PROPF_VIRTUAL) != PKGCONF_PKG_PROPF_VIRTUAL || (client->flags & PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL) != PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL)
|
if ((root->flags & PKGCONF_PKG_PROPF_VIRTUAL) != PKGCONF_PKG_PROPF_VIRTUAL || (client->flags & PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL) != PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL)
|
||||||
{
|
{
|
||||||
|
@ -1570,21 +1644,23 @@ pkgconf_pkg_traverse(pkgconf_client_t *client,
|
||||||
func(client, root, data);
|
func(client, root, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(client->flags & PKGCONF_PKG_PKGF_SKIP_CONFLICTS))
|
if (!(client->flags & PKGCONF_PKG_PKGF_SKIP_CONFLICTS) && root->conflicts.head != NULL)
|
||||||
{
|
{
|
||||||
|
PKGCONF_TRACE(client, "%s: walking 'Conflicts' list", root->id);
|
||||||
|
|
||||||
eflags = pkgconf_pkg_walk_conflicts_list(client, root, &root->conflicts);
|
eflags = pkgconf_pkg_walk_conflicts_list(client, root, &root->conflicts);
|
||||||
if (eflags != PKGCONF_PKG_ERRF_OK)
|
if (eflags != PKGCONF_PKG_ERRF_OK)
|
||||||
return eflags;
|
return eflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "%s: walking requires list", root->id);
|
PKGCONF_TRACE(client, "%s: walking 'Requires' list", root->id);
|
||||||
eflags = pkgconf_pkg_walk_list(client, root, &root->required, func, data, maxdepth, skip_flags);
|
eflags = pkgconf_pkg_walk_list(client, root, &root->required, func, data, maxdepth, skip_flags);
|
||||||
if (eflags != PKGCONF_PKG_ERRF_OK)
|
if (eflags != PKGCONF_PKG_ERRF_OK)
|
||||||
return eflags;
|
return eflags;
|
||||||
|
|
||||||
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
|
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "%s: walking requires.private list", root->id);
|
PKGCONF_TRACE(client, "%s: walking 'Requires.private' list", root->id);
|
||||||
|
|
||||||
/* XXX: ugly */
|
/* XXX: ugly */
|
||||||
client->flags |= PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE;
|
client->flags |= PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE;
|
||||||
|
@ -1598,6 +1674,23 @@ pkgconf_pkg_traverse(pkgconf_client_t *client,
|
||||||
return eflags;
|
return eflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
pkgconf_pkg_traverse(pkgconf_client_t *client,
|
||||||
|
pkgconf_pkg_t *root,
|
||||||
|
pkgconf_pkg_traverse_func_t func,
|
||||||
|
void *data,
|
||||||
|
int maxdepth,
|
||||||
|
unsigned int skip_flags)
|
||||||
|
{
|
||||||
|
if (root->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
||||||
|
client->serial++;
|
||||||
|
|
||||||
|
if ((client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE) == 0)
|
||||||
|
skip_flags |= PKGCONF_PKG_DEPF_PRIVATE;
|
||||||
|
|
||||||
|
return pkgconf_pkg_traverse_main(client, root, func, data, maxdepth, skip_flags);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pkgconf_pkg_cflags_collect(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
|
pkgconf_pkg_cflags_collect(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,11 +29,6 @@
|
||||||
* Using the `queue` module functions is the recommended way of working with dependency graphs.
|
* Using the `queue` module functions is the recommended way of working with dependency graphs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
pkgconf_node_t iter;
|
|
||||||
char *package;
|
|
||||||
} pkgconf_queue_t;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -48,7 +43,7 @@ typedef struct {
|
||||||
void
|
void
|
||||||
pkgconf_queue_push(pkgconf_list_t *list, const char *package)
|
pkgconf_queue_push(pkgconf_list_t *list, const char *package)
|
||||||
{
|
{
|
||||||
pkgconf_queue_t *pkgq = calloc(sizeof(pkgconf_queue_t), 1);
|
pkgconf_queue_t *pkgq = calloc(1, sizeof(pkgconf_queue_t));
|
||||||
|
|
||||||
pkgq->package = strdup(package);
|
pkgq->package = strdup(package);
|
||||||
pkgconf_node_insert_tail(&pkgq->iter, pkgq, list);
|
pkgconf_node_insert_tail(&pkgq->iter, pkgq, list);
|
||||||
|
@ -77,7 +72,7 @@ pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_li
|
||||||
pkgconf_queue_t *pkgq;
|
pkgconf_queue_t *pkgq;
|
||||||
|
|
||||||
pkgq = iter->data;
|
pkgq = iter->data;
|
||||||
pkgconf_dependency_parse(client, world, &world->required, pkgq->package, 0);
|
pkgconf_dependency_parse(client, world, &world->required, pkgq->package, PKGCONF_PKG_DEPF_QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (world->required.head != NULL);
|
return (world->required.head != NULL);
|
||||||
|
@ -107,13 +102,225 @@ pkgconf_queue_free(pkgconf_list_t *list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pkgconf_queue_mark_public(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
|
||||||
|
{
|
||||||
|
if (pkg->flags & PKGCONF_PKG_PROPF_VISITED_PRIVATE)
|
||||||
|
{
|
||||||
|
pkgconf_list_t *list = data;
|
||||||
|
pkgconf_node_t *node;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
if (dep->match == pkg)
|
||||||
|
dep->flags &= ~PKGCONF_PKG_DEPF_PRIVATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg->flags &= ~PKGCONF_PKG_PROPF_VISITED_PRIVATE;
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "%s: updated, public", pkg->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
pkgconf_queue_collect_dependencies_main(pkgconf_client_t *client,
|
||||||
|
pkgconf_pkg_t *root,
|
||||||
|
void *data,
|
||||||
|
int maxdepth);
|
||||||
|
|
||||||
|
static inline unsigned int
|
||||||
|
pkgconf_queue_collect_dependencies_walk(pkgconf_client_t *client,
|
||||||
|
pkgconf_list_t *deplist,
|
||||||
|
void *data,
|
||||||
|
int depth)
|
||||||
|
{
|
||||||
|
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
|
||||||
|
pkgconf_node_t *node;
|
||||||
|
pkgconf_pkg_t *world = data;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY_REVERSE(deplist->tail, node)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = node->data;
|
||||||
|
pkgconf_dependency_t *flattened_dep;
|
||||||
|
pkgconf_pkg_t *pkg = dep->match;
|
||||||
|
|
||||||
|
if (*dep->package == '\0')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pkg == NULL)
|
||||||
|
{
|
||||||
|
PKGCONF_TRACE(client, "WTF: unmatched dependency %p <%s>", dep, dep->package);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkg->serial == client->serial)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (client->flags & PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE)
|
||||||
|
pkg->flags |= PKGCONF_PKG_PROPF_VISITED_PRIVATE;
|
||||||
|
else
|
||||||
|
pkg->flags &= ~PKGCONF_PKG_PROPF_VISITED_PRIVATE;
|
||||||
|
|
||||||
|
eflags |= pkgconf_queue_collect_dependencies_main(client, pkg, data, depth - 1);
|
||||||
|
|
||||||
|
flattened_dep = pkgconf_dependency_copy(client, dep);
|
||||||
|
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required);
|
||||||
|
}
|
||||||
|
|
||||||
|
return eflags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
pkgconf_queue_collect_dependencies_main(pkgconf_client_t *client,
|
||||||
|
pkgconf_pkg_t *root,
|
||||||
|
void *data,
|
||||||
|
int maxdepth)
|
||||||
|
{
|
||||||
|
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
|
||||||
|
|
||||||
|
if (maxdepth == 0)
|
||||||
|
return eflags;
|
||||||
|
|
||||||
|
/* Short-circuit if we have already visited this node.
|
||||||
|
*/
|
||||||
|
if (root->serial == client->serial)
|
||||||
|
return eflags;
|
||||||
|
|
||||||
|
root->serial = client->serial;
|
||||||
|
|
||||||
|
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
|
||||||
|
{
|
||||||
|
PKGCONF_TRACE(client, "%s: collecting private dependencies, level %d", root->id, maxdepth);
|
||||||
|
|
||||||
|
/* XXX: ugly */
|
||||||
|
const unsigned int saved_flags = client->flags;
|
||||||
|
client->flags |= PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE;
|
||||||
|
eflags = pkgconf_queue_collect_dependencies_walk(client, &root->requires_private, data, maxdepth);
|
||||||
|
client->flags = saved_flags;
|
||||||
|
if (eflags != PKGCONF_PKG_ERRF_OK)
|
||||||
|
return eflags;
|
||||||
|
}
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "%s: collecting public dependencies, level %d", root->id, maxdepth);
|
||||||
|
|
||||||
|
eflags = pkgconf_queue_collect_dependencies_walk(client, &root->required, data, maxdepth);
|
||||||
|
if (eflags != PKGCONF_PKG_ERRF_OK)
|
||||||
|
return eflags;
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "%s: finished, %s", root->id, (root->flags & PKGCONF_PKG_PROPF_VISITED_PRIVATE) ? "private" : "public");
|
||||||
|
|
||||||
|
return eflags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned int
|
||||||
|
pkgconf_queue_collect_dependencies(pkgconf_client_t *client,
|
||||||
|
pkgconf_pkg_t *root,
|
||||||
|
void *data,
|
||||||
|
int maxdepth)
|
||||||
|
{
|
||||||
|
++client->serial;
|
||||||
|
return pkgconf_queue_collect_dependencies_main(client, root, data, maxdepth);
|
||||||
|
}
|
||||||
|
|
||||||
static inline unsigned int
|
static inline unsigned int
|
||||||
pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth)
|
pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth)
|
||||||
{
|
{
|
||||||
if (!pkgconf_queue_compile(client, world, list))
|
unsigned int result;
|
||||||
return PKGCONF_PKG_ERRF_DEPGRAPH_BREAK;
|
const unsigned int saved_flags = client->flags;
|
||||||
|
pkgconf_pkg_t initial_world = {
|
||||||
|
.id = "user:request",
|
||||||
|
.realname = "virtual world package",
|
||||||
|
.flags = PKGCONF_PKG_PROPF_STATIC | PKGCONF_PKG_PROPF_VIRTUAL,
|
||||||
|
};
|
||||||
|
|
||||||
return pkgconf_pkg_verify_graph(client, world, maxdepth);
|
if (!pkgconf_queue_compile(client, &initial_world, list))
|
||||||
|
{
|
||||||
|
pkgconf_solution_free(client, &initial_world);
|
||||||
|
return PKGCONF_PKG_ERRF_DEPGRAPH_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "solving");
|
||||||
|
result = pkgconf_pkg_traverse(client, &initial_world, NULL, NULL, maxdepth, 0);
|
||||||
|
if (result != PKGCONF_PKG_ERRF_OK)
|
||||||
|
{
|
||||||
|
pkgconf_solution_free(client, &initial_world);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "flattening");
|
||||||
|
result = pkgconf_queue_collect_dependencies(client, &initial_world, world, maxdepth);
|
||||||
|
if (result != PKGCONF_PKG_ERRF_OK)
|
||||||
|
{
|
||||||
|
pkgconf_solution_free(client, &initial_world);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
|
||||||
|
{
|
||||||
|
PKGCONF_TRACE(client, "marking public deps");
|
||||||
|
client->flags &= ~PKGCONF_PKG_PKGF_SEARCH_PRIVATE;
|
||||||
|
client->flags |= PKGCONF_PKG_PKGF_SKIP_CONFLICTS;
|
||||||
|
result = pkgconf_pkg_traverse(client, &initial_world, pkgconf_queue_mark_public, &world->required, maxdepth, 0);
|
||||||
|
client->flags = saved_flags;
|
||||||
|
if (result != PKGCONF_PKG_ERRF_OK)
|
||||||
|
{
|
||||||
|
pkgconf_solution_free(client, &initial_world);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free the initial solution */
|
||||||
|
pkgconf_solution_free(client, &initial_world);
|
||||||
|
|
||||||
|
return PKGCONF_PKG_ERRF_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth)
|
||||||
|
*
|
||||||
|
* Removes references to package nodes contained in a solution.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
|
* :param pkgconf_pkg_t* world: The root for the generated dependency graph. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
||||||
|
* :returns: nothing
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
|
||||||
|
if (world->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_free(&world->required);
|
||||||
|
pkgconf_dependency_free(&world->requires_private);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* !doc
|
||||||
|
*
|
||||||
|
* .. c:function:: bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth)
|
||||||
|
*
|
||||||
|
* Solves and flattens the dependency graph for the supplied dependency list.
|
||||||
|
*
|
||||||
|
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
|
* :param pkgconf_list_t* list: The list of dependency requests to consider.
|
||||||
|
* :param pkgconf_pkg_t* world: The root for the generated dependency graph, provided by the caller. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
||||||
|
* :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
|
||||||
|
* :returns: true if the dependency resolver found a solution, otherwise false.
|
||||||
|
* :rtype: bool
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth)
|
||||||
|
{
|
||||||
|
/* if maxdepth is one, then we will not traverse deeper than our virtual package. */
|
||||||
|
if (!maxdepth)
|
||||||
|
maxdepth = -1;
|
||||||
|
|
||||||
|
return pkgconf_queue_verify(client, world, list, maxdepth) == PKGCONF_PKG_ERRF_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -124,6 +331,8 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis
|
||||||
* Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
* Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
||||||
* feed the solution to a callback function if a complete dependency graph is found.
|
* feed the solution to a callback function if a complete dependency graph is found.
|
||||||
*
|
*
|
||||||
|
* This function should not be used in new code. Use pkgconf_queue_solve instead.
|
||||||
|
*
|
||||||
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
* :param pkgconf_list_t* list: The list of dependency requests to consider.
|
* :param pkgconf_list_t* list: The list of dependency requests to consider.
|
||||||
* :param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
* :param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
||||||
|
@ -135,6 +344,7 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis
|
||||||
bool
|
bool
|
||||||
pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
||||||
{
|
{
|
||||||
|
bool ret = false;
|
||||||
pkgconf_pkg_t world = {
|
pkgconf_pkg_t world = {
|
||||||
.id = "virtual:world",
|
.id = "virtual:world",
|
||||||
.realname = "virtual world package",
|
.realname = "virtual world package",
|
||||||
|
@ -145,18 +355,18 @@ pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queu
|
||||||
if (!maxdepth)
|
if (!maxdepth)
|
||||||
maxdepth = -1;
|
maxdepth = -1;
|
||||||
|
|
||||||
if (pkgconf_queue_verify(client, &world, list, maxdepth) != PKGCONF_PKG_ERRF_OK)
|
if (!pkgconf_queue_solve(client, list, &world, maxdepth))
|
||||||
return false;
|
goto cleanup;
|
||||||
|
|
||||||
|
/* the world dependency set is flattened after it is returned from pkgconf_queue_verify */
|
||||||
if (!func(client, &world, data, maxdepth))
|
if (!func(client, &world, data, maxdepth))
|
||||||
{
|
goto cleanup;
|
||||||
pkgconf_pkg_free(client, &world);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
ret = true;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
pkgconf_pkg_free(client, &world);
|
pkgconf_pkg_free(client, &world);
|
||||||
|
return ret;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <limits.h>
|
# include <limits.h>
|
||||||
|
# include <strings.h>
|
||||||
# ifdef PATH_MAX
|
# ifdef PATH_MAX
|
||||||
# define PKGCONF_ITEM_SIZE (PATH_MAX + 1024)
|
# define PKGCONF_ITEM_SIZE (PATH_MAX + 1024)
|
||||||
# else
|
# else
|
||||||
|
|
|
@ -45,7 +45,23 @@
|
||||||
void
|
void
|
||||||
pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *value)
|
pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *value)
|
||||||
{
|
{
|
||||||
pkgconf_tuple_add(client, &client->global_vars, key, value, false);
|
pkgconf_tuple_add(client, &client->global_vars, key, value, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static pkgconf_tuple_t *
|
||||||
|
lookup_global_tuple(const pkgconf_client_t *client, const char *key)
|
||||||
|
{
|
||||||
|
pkgconf_node_t *node;
|
||||||
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(client->global_vars.head, node)
|
||||||
|
{
|
||||||
|
pkgconf_tuple_t *tuple = node->data;
|
||||||
|
|
||||||
|
if (!strcmp(tuple->key, key))
|
||||||
|
return tuple;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -63,17 +79,13 @@ pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *
|
||||||
char *
|
char *
|
||||||
pkgconf_tuple_find_global(const pkgconf_client_t *client, const char *key)
|
pkgconf_tuple_find_global(const pkgconf_client_t *client, const char *key)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *node;
|
pkgconf_tuple_t *tuple;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(client->global_vars.head, node)
|
tuple = lookup_global_tuple(client, key);
|
||||||
{
|
if (tuple == NULL)
|
||||||
pkgconf_tuple_t *tuple = node->data;
|
return NULL;
|
||||||
|
|
||||||
if (!strcmp(tuple->key, key))
|
return tuple->value;
|
||||||
return tuple->value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -108,13 +120,18 @@ pkgconf_tuple_define_global(pkgconf_client_t *client, const char *kv)
|
||||||
{
|
{
|
||||||
char *workbuf = strdup(kv);
|
char *workbuf = strdup(kv);
|
||||||
char *value;
|
char *value;
|
||||||
|
pkgconf_tuple_t *tuple;
|
||||||
|
|
||||||
value = strchr(workbuf, '=');
|
value = strchr(workbuf, '=');
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
*value++ = '\0';
|
*value++ = '\0';
|
||||||
pkgconf_tuple_add_global(client, workbuf, value);
|
|
||||||
|
tuple = pkgconf_tuple_add(client, &client->global_vars, workbuf, value, false, 0);
|
||||||
|
if (tuple != NULL)
|
||||||
|
tuple->flags = PKGCONF_PKG_TUPLEF_OVERRIDE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(workbuf);
|
free(workbuf);
|
||||||
}
|
}
|
||||||
|
@ -139,7 +156,7 @@ pkgconf_tuple_find_delete(pkgconf_list_t *list, const char *key)
|
||||||
static char *
|
static char *
|
||||||
dequote(const char *value)
|
dequote(const char *value)
|
||||||
{
|
{
|
||||||
char *buf = calloc((strlen(value) + 1) * 2, 1);
|
char *buf = calloc(1, (strlen(value) + 1) * 2);
|
||||||
char *bptr = buf;
|
char *bptr = buf;
|
||||||
const char *i;
|
const char *i;
|
||||||
char quote = 0;
|
char quote = 0;
|
||||||
|
@ -161,6 +178,45 @@ dequote(const char *value)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
find_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars)
|
||||||
|
{
|
||||||
|
const char *sysroot_dir;
|
||||||
|
|
||||||
|
sysroot_dir = pkgconf_tuple_find(client, vars, "pc_sysrootdir");
|
||||||
|
if (sysroot_dir == NULL)
|
||||||
|
sysroot_dir = client->sysroot_dir;
|
||||||
|
|
||||||
|
return sysroot_dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
should_rewrite_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *buf, unsigned int flags)
|
||||||
|
{
|
||||||
|
const char *sysroot_dir;
|
||||||
|
|
||||||
|
if (flags & PKGCONF_PKG_PROPF_UNINSTALLED && !(client->flags & PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
sysroot_dir = find_sysroot(client, vars);
|
||||||
|
if (sysroot_dir == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (*buf != '/')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!strcmp(sysroot_dir, "/"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (strlen(buf) <= strlen(sysroot_dir))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (strstr(buf + strlen(sysroot_dir), sysroot_dir) == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -177,23 +233,23 @@ dequote(const char *value)
|
||||||
* :rtype: pkgconf_tuple_t *
|
* :rtype: pkgconf_tuple_t *
|
||||||
*/
|
*/
|
||||||
pkgconf_tuple_t *
|
pkgconf_tuple_t *
|
||||||
pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key, const char *value, bool parse)
|
pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key, const char *value, bool parse, unsigned int flags)
|
||||||
{
|
{
|
||||||
char *dequote_value;
|
char *dequote_value;
|
||||||
pkgconf_tuple_t *tuple = calloc(sizeof(pkgconf_tuple_t), 1);
|
pkgconf_tuple_t *tuple = calloc(1, sizeof(pkgconf_tuple_t));
|
||||||
|
|
||||||
pkgconf_tuple_find_delete(list, key);
|
pkgconf_tuple_find_delete(list, key);
|
||||||
|
|
||||||
dequote_value = dequote(value);
|
dequote_value = dequote(value);
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "adding tuple to @%p: %s => %s (parsed? %d)", list, key, dequote_value, parse);
|
|
||||||
|
|
||||||
tuple->key = strdup(key);
|
tuple->key = strdup(key);
|
||||||
if (parse)
|
if (parse)
|
||||||
tuple->value = pkgconf_tuple_parse(client, list, dequote_value);
|
tuple->value = pkgconf_tuple_parse(client, list, dequote_value, flags);
|
||||||
else
|
else
|
||||||
tuple->value = strdup(dequote_value);
|
tuple->value = strdup(dequote_value);
|
||||||
|
|
||||||
|
PKGCONF_TRACE(client, "adding tuple to @%p: %s => %s (parsed? %d)", list, key, tuple->value, parse);
|
||||||
|
|
||||||
pkgconf_node_insert(&tuple->iter, tuple, list);
|
pkgconf_node_insert(&tuple->iter, tuple, list);
|
||||||
|
|
||||||
free(dequote_value);
|
free(dequote_value);
|
||||||
|
@ -218,10 +274,11 @@ char *
|
||||||
pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key)
|
pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
char *res;
|
pkgconf_tuple_t *global_tuple;
|
||||||
|
|
||||||
if ((res = pkgconf_tuple_find_global(client, key)) != NULL)
|
global_tuple = lookup_global_tuple(client, key);
|
||||||
return res;
|
if (global_tuple != NULL && global_tuple->flags & PKGCONF_PKG_TUPLEF_OVERRIDE)
|
||||||
|
return global_tuple->value;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
|
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
|
||||||
{
|
{
|
||||||
|
@ -231,30 +288,35 @@ pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const c
|
||||||
return tuple->value;
|
return tuple->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (global_tuple != NULL)
|
||||||
|
return global_tuple->value;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
* .. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value)
|
* .. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||||
*
|
*
|
||||||
* Parse an expression for variable substitution.
|
* Parse an expression for variable substitution.
|
||||||
*
|
*
|
||||||
* :param pkgconf_client_t* client: The pkgconf client object to access.
|
* :param pkgconf_client_t* client: The pkgconf client object to access.
|
||||||
* :param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
* :param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
||||||
* :param char* value: The ``key=value`` string to parse.
|
* :param char* value: The ``key=value`` string to parse.
|
||||||
|
* :param uint flags: Any flags to consider while parsing.
|
||||||
* :return: the variable data with any variables substituted
|
* :return: the variable data with any variables substituted
|
||||||
* :rtype: char *
|
* :rtype: char *
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value)
|
pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||||
{
|
{
|
||||||
char buf[PKGCONF_BUFSIZE];
|
char buf[PKGCONF_BUFSIZE];
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
char *bptr = buf;
|
char *bptr = buf;
|
||||||
|
|
||||||
if (!(client->flags & PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES))
|
if (!(client->flags & PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES) &&
|
||||||
|
(!(flags & PKGCONF_PKG_PROPF_UNINSTALLED) || (client->flags & PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES)))
|
||||||
{
|
{
|
||||||
if (*value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
|
if (*value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
|
||||||
bptr += pkgconf_strlcpy(buf, client->sysroot_dir, sizeof buf);
|
bptr += pkgconf_strlcpy(buf, client->sysroot_dir, sizeof buf);
|
||||||
|
@ -319,7 +381,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||||
{
|
{
|
||||||
size_t nlen;
|
size_t nlen;
|
||||||
|
|
||||||
parsekv = pkgconf_tuple_parse(client, vars, kv);
|
parsekv = pkgconf_tuple_parse(client, vars, kv, flags);
|
||||||
nlen = pkgconf_strlcpy(bptr, parsekv, remain);
|
nlen = pkgconf_strlcpy(bptr, parsekv, remain);
|
||||||
free(parsekv);
|
free(parsekv);
|
||||||
|
|
||||||
|
@ -353,16 +415,15 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||||
* safe to skip ahead in the string to scan for our sysroot dir.
|
* safe to skip ahead in the string to scan for our sysroot dir.
|
||||||
*
|
*
|
||||||
* Finally, we call pkgconf_path_relocate() to clean the path of spurious elements.
|
* Finally, we call pkgconf_path_relocate() to clean the path of spurious elements.
|
||||||
|
*
|
||||||
|
* New in 1.9: Only attempt to rewrite the sysroot if we are not processing an uninstalled package.
|
||||||
*/
|
*/
|
||||||
if (*buf == '/' &&
|
if (should_rewrite_sysroot(client, vars, buf, flags))
|
||||||
client->sysroot_dir != NULL &&
|
|
||||||
strcmp(client->sysroot_dir, "/") != 0 &&
|
|
||||||
strlen(buf) > strlen(client->sysroot_dir) &&
|
|
||||||
strstr(buf + strlen(client->sysroot_dir), client->sysroot_dir) != NULL)
|
|
||||||
{
|
{
|
||||||
char cleanpath[PKGCONF_ITEM_SIZE];
|
char cleanpath[PKGCONF_ITEM_SIZE];
|
||||||
|
const char *sysroot_dir = find_sysroot(client, vars);
|
||||||
|
|
||||||
pkgconf_strlcpy(cleanpath, buf + strlen(client->sysroot_dir), sizeof cleanpath);
|
pkgconf_strlcpy(cleanpath, buf + strlen(sysroot_dir), sizeof cleanpath);
|
||||||
pkgconf_path_relocate(cleanpath, sizeof cleanpath);
|
pkgconf_path_relocate(cleanpath, sizeof cleanpath);
|
||||||
|
|
||||||
return strdup(cleanpath);
|
return strdup(cleanpath);
|
||||||
|
@ -410,4 +471,6 @@ pkgconf_tuple_free(pkgconf_list_t *list)
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
|
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
|
||||||
pkgconf_tuple_free_entry(node->data, list);
|
pkgconf_tuple_free_entry(node->data, list);
|
||||||
|
|
||||||
|
pkgconf_list_zero(list);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,33 +29,12 @@
|
||||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# Copying and distribution of this file, with or without modification, are
|
||||||
# under the terms of the GNU General Public License as published by the
|
# permitted in any medium without royalty provided the copyright notice
|
||||||
# Free Software Foundation, either version 3 of the License, or (at your
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# option) any later version.
|
# warranty.
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
||||||
# Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along
|
|
||||||
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
# As a special exception, the respective Autoconf Macro's copyright owner
|
|
||||||
# gives unlimited permission to copy, distribute and modify the configure
|
|
||||||
# scripts that are the output of Autoconf when processing the Macro. You
|
|
||||||
# need not follow the terms of the GNU General Public License when using
|
|
||||||
# or distributing such scripts, even though portions of the text of the
|
|
||||||
# Macro appear in them. The GNU General Public License (GPL) does govern
|
|
||||||
# all other use of the material that constitutes the Autoconf Macro.
|
|
||||||
#
|
|
||||||
# This special exception to the GPL applies to versions of the Autoconf
|
|
||||||
# Macro released by the Autoconf Archive. When you make and distribute a
|
|
||||||
# modified version of the Autoconf Macro, you may extend this special
|
|
||||||
# exception to the GPL to apply to your modified version as well.
|
|
||||||
|
|
||||||
#serial 5
|
#serial 6
|
||||||
|
|
||||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||||
|
|
18
man/pc.5
18
man/pc.5
|
@ -99,6 +99,9 @@ These flags are always used, regardless of whether static compilation is request
|
||||||
.It Cflags.private
|
.It Cflags.private
|
||||||
Required compiler flags for static compilation.
|
Required compiler flags for static compilation.
|
||||||
(optional; fragment list; pkgconf extension)
|
(optional; fragment list; pkgconf extension)
|
||||||
|
.It Copyright
|
||||||
|
A copyright attestation statement.
|
||||||
|
(optional; literal; pkgconf extension)
|
||||||
.It Libs
|
.It Libs
|
||||||
Required linking flags for this package.
|
Required linking flags for this package.
|
||||||
Libraries this package depends on for linking against it, which are not
|
Libraries this package depends on for linking against it, which are not
|
||||||
|
@ -110,15 +113,23 @@ statically.
|
||||||
Libraries this package depends on for linking against it statically, which are
|
Libraries this package depends on for linking against it statically, which are
|
||||||
not described as dependencies should be specified here.
|
not described as dependencies should be specified here.
|
||||||
(optional; fragment list)
|
(optional; fragment list)
|
||||||
|
.It License
|
||||||
|
The asserted SPDX license tag that should be applied to the given package.
|
||||||
|
(optional; literal; pkgconf extension)
|
||||||
|
.It Maintainer
|
||||||
|
The preferred contact for the maintainer. This should be in the format of a
|
||||||
|
name followed by an e-mail address or website.
|
||||||
|
(optional; literal; pkgconf extension)
|
||||||
.It Requires
|
.It Requires
|
||||||
Required dependencies that must be met for the package to be usable.
|
Required dependencies that must be met for the package to be usable.
|
||||||
All dependencies must be satisfied or the pkg-config implementation must not use
|
All dependencies must be satisfied or the pkg-config implementation must not use
|
||||||
the package.
|
the package.
|
||||||
(optional; dependency list)
|
(optional; dependency list)
|
||||||
.It Requires.private
|
.It Requires.private
|
||||||
Required dependencies that must be met for the package to be usable for static linking.
|
Required dependencies that must be met for the package to be usable for header
|
||||||
|
inclusion and static linking.
|
||||||
All dependencies must be satisfied or the pkg-config implementation must not use
|
All dependencies must be satisfied or the pkg-config implementation must not use
|
||||||
the package for static linking.
|
the package for header inclusion and static linking.
|
||||||
(optional; dependency list)
|
(optional; dependency list)
|
||||||
.It Conflicts
|
.It Conflicts
|
||||||
Dependencies that must not be met for the package to be usable.
|
Dependencies that must not be met for the package to be usable.
|
||||||
|
@ -151,6 +162,9 @@ includedir=${prefix}/include
|
||||||
|
|
||||||
Name: libfoo # human-readable name
|
Name: libfoo # human-readable name
|
||||||
Description: an example library called libfoo # human-readable description
|
Description: an example library called libfoo # human-readable description
|
||||||
|
Copyright: Copyright (c) 2022 pkgconf project authors
|
||||||
|
License: Apache-2.0
|
||||||
|
Maintainer: the pkgconf project <http://www.pkgconf.org>
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
URL: http://www.pkgconf.org
|
URL: http://www.pkgconf.org
|
||||||
Requires: libbar > 2.0.0
|
Requires: libbar > 2.0.0
|
||||||
|
|
83
meson.build
83
meson.build
|
@ -1,23 +1,41 @@
|
||||||
project('pkgconf', 'c',
|
project('pkgconf', 'c',
|
||||||
version : '1.8.1',
|
version : '2.3.0',
|
||||||
license : 'ISC',
|
license : 'ISC',
|
||||||
meson_version : '>=0.47')
|
meson_version : '>=0.49',
|
||||||
|
default_options : ['c_std=c99'],
|
||||||
|
)
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
|
add_project_arguments(
|
||||||
|
'-D_BSD_SOURCE',
|
||||||
|
'-D_DEFAULT_SOURCE',
|
||||||
|
cc.get_supported_arguments(
|
||||||
|
'-Wimplicit-function-declaration',
|
||||||
|
'-Wmisleading-indentation',
|
||||||
|
),
|
||||||
|
language : 'c',
|
||||||
|
)
|
||||||
|
|
||||||
cdata = configuration_data()
|
cdata = configuration_data()
|
||||||
|
|
||||||
check_functions = [
|
check_functions = [
|
||||||
['HAVE_STRLCAT', 'strlcat', 'string.h'],
|
['strlcat', 'string.h'],
|
||||||
['HAVE_STRLCPY', 'strlcpy', 'string.h'],
|
['strlcpy', 'string.h'],
|
||||||
['HAVE_STRNDUP', 'strndup', 'string.h'],
|
['strndup', 'string.h'],
|
||||||
|
['strdup', 'string.h'],
|
||||||
|
['strncasecmp', 'strings.h'],
|
||||||
|
['strcasecmp', 'strings.h'],
|
||||||
|
['reallocarray', 'stdlib.h'],
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach f : check_functions
|
foreach f : check_functions
|
||||||
if cc.has_function(f.get(1), prefix : '#include <' + f.get(2) + '>') and cc.has_header_symbol(f.get(2), f.get(1))
|
name = f[0].to_upper().underscorify()
|
||||||
cdata.set(f.get(0), 1)
|
if cc.has_function(f[0], prefix : '#define _BSD_SOURCE\n#define _DEFAULT_SOURCE\n#include <@0@>'.format(f[1])) and cc.has_header_symbol(f[1], f[0], prefix : '#define _BSD_SOURCE\n#define _DEFAULT_SOURCE')
|
||||||
|
cdata.set('HAVE_@0@'.format(name), 1)
|
||||||
|
cdata.set('HAVE_DECL_@0@'.format(name), 1)
|
||||||
|
else
|
||||||
|
cdata.set('HAVE_DECL_@0@'.format(name), 0)
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
@ -31,15 +49,25 @@ foreach f : ['libdir', 'datadir']
|
||||||
personality_path += [join_paths(get_option('prefix'), get_option(f), 'pkgconfig', 'personality.d')]
|
personality_path += [join_paths(get_option('prefix'), get_option(f), 'pkgconfig', 'personality.d')]
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
cdata.set_quoted('SYSTEM_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
|
SYSTEM_LIBDIR = get_option('with-system-libdir')
|
||||||
cdata.set_quoted('SYSTEM_INCLUDEDIR', join_paths(get_option('prefix'), get_option('includedir')))
|
if SYSTEM_LIBDIR != ''
|
||||||
|
cdata.set_quoted('SYSTEM_LIBDIR', SYSTEM_LIBDIR)
|
||||||
|
else
|
||||||
|
cdata.set_quoted('SYSTEM_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
|
||||||
|
endif
|
||||||
|
SYSTEM_INCLUDEDIR = get_option('with-system-includedir')
|
||||||
|
if SYSTEM_INCLUDEDIR != ''
|
||||||
|
cdata.set_quoted('SYSTEM_INCLUDEDIR', SYSTEM_INCLUDEDIR)
|
||||||
|
else
|
||||||
|
cdata.set_quoted('SYSTEM_INCLUDEDIR', join_paths(get_option('prefix'), get_option('includedir')))
|
||||||
|
endif
|
||||||
cdata.set_quoted('PKG_DEFAULT_PATH', ':'.join(default_path))
|
cdata.set_quoted('PKG_DEFAULT_PATH', ':'.join(default_path))
|
||||||
cdata.set_quoted('PERSONALITY_PATH', ':'.join(personality_path))
|
cdata.set_quoted('PERSONALITY_PATH', ':'.join(personality_path))
|
||||||
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
|
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||||
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||||
cdata.set_quoted('PACKAGE_BUGREPORT', 'https://todo.sr.ht/~kaniini/pkgconf')
|
cdata.set_quoted('PACKAGE_BUGREPORT', 'https://todo.sr.ht/~kaniini/pkgconf')
|
||||||
cdata.set('abs_top_srcdir', meson.source_root())
|
cdata.set('abs_top_srcdir', meson.current_source_dir())
|
||||||
cdata.set('abs_top_builddir', meson.build_root())
|
cdata.set('abs_top_builddir', meson.current_build_dir())
|
||||||
|
|
||||||
|
|
||||||
subdir('libpkgconf')
|
subdir('libpkgconf')
|
||||||
|
@ -68,10 +96,22 @@ libpkgconf = library('pkgconf',
|
||||||
'libpkgconf/tuple.c',
|
'libpkgconf/tuple.c',
|
||||||
c_args: ['-DLIBPKGCONF_EXPORT', build_static],
|
c_args: ['-DLIBPKGCONF_EXPORT', build_static],
|
||||||
install : true,
|
install : true,
|
||||||
version : '3.0.0',
|
version : '5.0.0',
|
||||||
soversion : '3',
|
soversion : '5',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# For other projects using libpkgconfig as a subproject
|
||||||
|
dep_libpkgconf = declare_dependency(
|
||||||
|
link_with : libpkgconf,
|
||||||
|
include_directories : include_directories('.'),
|
||||||
|
)
|
||||||
|
|
||||||
|
# If we have a new enough meson override the dependency so that only
|
||||||
|
# `dependency('libpkgconf')` is required from the consumer
|
||||||
|
if meson.version().version_compare('>= 0.54.0')
|
||||||
|
meson.override_dependency('libpkgconf', dep_libpkgconf)
|
||||||
|
endif
|
||||||
|
|
||||||
pkg = import('pkgconfig')
|
pkg = import('pkgconfig')
|
||||||
pkg.generate(libpkgconf,
|
pkg.generate(libpkgconf,
|
||||||
name : 'libpkgconf',
|
name : 'libpkgconf',
|
||||||
|
@ -91,15 +131,12 @@ pkgconf_exe = executable('pkgconf',
|
||||||
c_args: build_static,
|
c_args: build_static,
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
if get_option('tests')
|
with_tests = get_option('tests')
|
||||||
kyua_exe = find_program('kyua')
|
kyua_exe = find_program('kyua', required : with_tests, disabler : true)
|
||||||
atf_sh_exe = find_program('atf-sh')
|
atf_sh_exe = find_program('atf-sh', required : with_tests, disabler : true)
|
||||||
test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile=' + join_paths(meson.build_root(), 'Kyuafile'), '--build-root=' + meson.build_root()])
|
kyuafile = configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata)
|
||||||
|
test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile', kyuafile, '--build-root', meson.current_build_dir()])
|
||||||
|
subdir('tests')
|
||||||
configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata)
|
|
||||||
subdir('tests')
|
|
||||||
endif
|
|
||||||
|
|
||||||
install_man('man/pkgconf.1')
|
install_man('man/pkgconf.1')
|
||||||
install_man('man/pkg.m4.7')
|
install_man('man/pkg.m4.7')
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
option('tests', type: 'boolean', value: true,
|
option(
|
||||||
description: 'Build tests which depends upon the kyua framework'
|
'tests',
|
||||||
|
type: 'feature',
|
||||||
|
description: 'Build tests which depends upon the kyua framework',
|
||||||
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'with-system-libdir',
|
||||||
|
type: 'string',
|
||||||
|
value: '',
|
||||||
|
description: 'Specify the system library directory (default {prefix}/{libdir})'
|
||||||
|
)
|
||||||
|
|
||||||
|
option(
|
||||||
|
'with-system-includedir',
|
||||||
|
type: 'string',
|
||||||
|
value: '',
|
||||||
|
description: 'Specify the system include directory (default {prefix}/{includedir})'
|
||||||
)
|
)
|
45
pkg.m4
45
pkg.m4
|
@ -1,5 +1,5 @@
|
||||||
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
|
||||||
# serial 11 (pkg-config-0.29.1)
|
# serial 12 (pkg-config-0.29.2)
|
||||||
|
|
||||||
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||||
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
||||||
|
@ -41,13 +41,13 @@ dnl
|
||||||
dnl See the "Since" comment for each macro you use to see what version
|
dnl See the "Since" comment for each macro you use to see what version
|
||||||
dnl of the macros you require.
|
dnl of the macros you require.
|
||||||
m4_defun([PKG_PREREQ],
|
m4_defun([PKG_PREREQ],
|
||||||
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
[m4_define([PKG_MACROS_VERSION], [0.29.2])
|
||||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||||
])dnl PKG_PREREQ
|
])dnl PKG_PREREQ
|
||||||
|
|
||||||
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
|
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND])
|
||||||
dnl ----------------------------------
|
dnl ---------------------------------------------------------
|
||||||
dnl Since: 0.16
|
dnl Since: 0.16
|
||||||
dnl
|
dnl
|
||||||
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
|
||||||
|
@ -55,6 +55,12 @@ dnl first found in the path. Checks that the version of pkg-config found
|
||||||
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
|
||||||
dnl used since that's the first version where most current features of
|
dnl used since that's the first version where most current features of
|
||||||
dnl pkg-config existed.
|
dnl pkg-config existed.
|
||||||
|
dnl
|
||||||
|
dnl If pkg-config is not found or older than specified, it will result
|
||||||
|
dnl in an empty PKG_CONFIG variable. To avoid widespread issues with
|
||||||
|
dnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting.
|
||||||
|
dnl You can specify [PKG_CONFIG=false] as an action instead, which would
|
||||||
|
dnl result in pkg-config tests failing, but no bogus error messages.
|
||||||
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
AC_DEFUN([PKG_PROG_PKG_CONFIG],
|
||||||
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
|
||||||
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
|
||||||
|
@ -75,6 +81,9 @@ if test -n "$PKG_CONFIG"; then
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
PKG_CONFIG=""
|
PKG_CONFIG=""
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
if test -z "$PKG_CONFIG"; then
|
||||||
|
m4_default([$2], [AC_MSG_ERROR([pkg-config not found])])
|
||||||
fi[]dnl
|
fi[]dnl
|
||||||
])dnl PKG_PROG_PKG_CONFIG
|
])dnl PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
|
@ -86,7 +95,7 @@ dnl Check to see whether a particular set of modules exists. Similar to
|
||||||
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||||
dnl
|
dnl
|
||||||
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||||
dnl only at the first occurence in configure.ac, so if the first place
|
dnl only at the first occurrence in configure.ac, so if the first place
|
||||||
dnl it's called might be skipped (such as if it is within an "if", you
|
dnl it's called might be skipped (such as if it is within an "if", you
|
||||||
dnl have to call PKG_CHECK_EXISTS manually
|
dnl have to call PKG_CHECK_EXISTS manually
|
||||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||||
|
@ -142,7 +151,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||||
|
|
||||||
pkg_failed=no
|
pkg_failed=no
|
||||||
AC_MSG_CHECKING([for $1])
|
AC_MSG_CHECKING([for $2])
|
||||||
|
|
||||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||||
|
@ -152,17 +161,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
|
||||||
See the pkg-config man page for more details.])
|
See the pkg-config man page for more details.])
|
||||||
|
|
||||||
if test $pkg_failed = yes; then
|
if test $pkg_failed = yes; then
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
_PKG_SHORT_ERRORS_SUPPORTED
|
_PKG_SHORT_ERRORS_SUPPORTED
|
||||||
if test $_pkg_short_errors_supported = yes; then
|
if test $_pkg_short_errors_supported = yes; then
|
||||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
|
||||||
else
|
else
|
||||||
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
|
||||||
fi
|
fi
|
||||||
# Put the nasty error message in config.log where it belongs
|
# Put the nasty error message in config.log where it belongs
|
||||||
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
|
||||||
|
|
||||||
m4_default([$4], [AC_MSG_ERROR(
|
m4_default([$4], [AC_MSG_ERROR(
|
||||||
[Package requirements ($2) were not met:
|
[Package requirements ($2) were not met:
|
||||||
|
|
||||||
$$1_PKG_ERRORS
|
$$1_PKG_ERRORS
|
||||||
|
@ -173,8 +182,8 @@ installed software in a non-standard prefix.
|
||||||
_PKG_TEXT])[]dnl
|
_PKG_TEXT])[]dnl
|
||||||
])
|
])
|
||||||
elif test $pkg_failed = untried; then
|
elif test $pkg_failed = untried; then
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
m4_default([$4], [AC_MSG_FAILURE(
|
m4_default([$4], [AC_MSG_FAILURE(
|
||||||
[The pkg-config script could not be found or is too old. Make sure it
|
[The pkg-config script could not be found or is too old. Make sure it
|
||||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||||
path to pkg-config.
|
path to pkg-config.
|
||||||
|
@ -184,10 +193,10 @@ _PKG_TEXT
|
||||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
||||||
])
|
])
|
||||||
else
|
else
|
||||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
$3
|
$3
|
||||||
fi[]dnl
|
fi[]dnl
|
||||||
])dnl PKG_CHECK_MODULES
|
])dnl PKG_CHECK_MODULES
|
||||||
|
|
||||||
|
|
128
tests/basic.sh
128
tests/basic.sh
|
@ -11,6 +11,7 @@ tests_init \
|
||||||
libs_cflags_version_alt \
|
libs_cflags_version_alt \
|
||||||
libs_cflags_version_different \
|
libs_cflags_version_different \
|
||||||
libs_cflags_version_different_bad \
|
libs_cflags_version_different_bad \
|
||||||
|
libs_env \
|
||||||
exists_nonexitent \
|
exists_nonexitent \
|
||||||
nonexitent \
|
nonexitent \
|
||||||
exists_version \
|
exists_version \
|
||||||
|
@ -21,6 +22,8 @@ tests_init \
|
||||||
exists2 \
|
exists2 \
|
||||||
exists3 \
|
exists3 \
|
||||||
exists_version_alt \
|
exists_version_alt \
|
||||||
|
exists_cflags \
|
||||||
|
exists_cflags_env \
|
||||||
uninstalled_bad \
|
uninstalled_bad \
|
||||||
uninstalled \
|
uninstalled \
|
||||||
libs_intermediary \
|
libs_intermediary \
|
||||||
|
@ -29,13 +32,19 @@ tests_init \
|
||||||
libs_circular_directpc \
|
libs_circular_directpc \
|
||||||
libs_static \
|
libs_static \
|
||||||
libs_static_ordering \
|
libs_static_ordering \
|
||||||
|
libs_metapackage \
|
||||||
|
license_isc \
|
||||||
|
license_noassertion \
|
||||||
|
modversion_noflatten \
|
||||||
pkg_config_path \
|
pkg_config_path \
|
||||||
nolibs \
|
nolibs \
|
||||||
nocflags \
|
nocflags \
|
||||||
arbitary_path \
|
arbitary_path \
|
||||||
with_path \
|
with_path \
|
||||||
relocatable \
|
relocatable \
|
||||||
single_depth_selectors
|
single_depth_selectors \
|
||||||
|
print_variables_env \
|
||||||
|
variable_env
|
||||||
|
|
||||||
noargs_body()
|
noargs_body()
|
||||||
{
|
{
|
||||||
|
@ -47,7 +56,7 @@ libs_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lfoo \n" \
|
-o inline:"-L/test/lib -lfoo\n" \
|
||||||
pkgconf --libs foo
|
pkgconf --libs foo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +64,7 @@ libs_cflags_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo \n" \
|
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
|
||||||
pkgconf --cflags --libs foo
|
pkgconf --cflags --libs foo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +73,7 @@ libs_cflags_version_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo \n" \
|
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
|
||||||
pkgconf --cflags --libs 'foo > 1.2'
|
pkgconf --cflags --libs 'foo > 1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +81,7 @@ libs_cflags_version_multiple_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/test/include/foo -fPIC -L/test/lib -lbar -lfoo \n" \
|
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n" \
|
||||||
pkgconf --cflags --libs 'foo > 1.2 bar >= 1.3'
|
pkgconf --cflags --libs 'foo > 1.2 bar >= 1.3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +89,7 @@ libs_cflags_version_multiple_coma_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/test/include/foo -fPIC -L/test/lib -lbar -lfoo \n" \
|
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbar -lfoo\n" \
|
||||||
pkgconf --cflags --libs 'foo > 1.2,bar >= 1.3'
|
pkgconf --cflags --libs 'foo > 1.2,bar >= 1.3'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +97,7 @@ libs_cflags_version_alt_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo \n" \
|
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
|
||||||
pkgconf --cflags --libs 'foo' '>' '1.2'
|
pkgconf --cflags --libs 'foo' '>' '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +105,7 @@ libs_cflags_version_different_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo \n" \
|
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lfoo\n" \
|
||||||
pkgconf --cflags --libs 'foo' '!=' '1.3.0'
|
pkgconf --cflags --libs 'foo' '!=' '1.3.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,30 +213,30 @@ libs_intermediary_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz \n" \
|
-o inline:"-lintermediary-1 -lintermediary-2 -lfoo -lbar -lbaz\n" \
|
||||||
pkgconf --libs intermediary-1 intermediary-2
|
pkgconf --libs intermediary-1 intermediary-2
|
||||||
}
|
}
|
||||||
|
|
||||||
libs_circular1_body()
|
|
||||||
{
|
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
||||||
atf_check \
|
|
||||||
-o inline:"-lcircular-1 -lcircular-2 -lcircular-3 \n" \
|
|
||||||
pkgconf --libs circular-1
|
|
||||||
}
|
|
||||||
|
|
||||||
libs_circular2_body()
|
libs_circular2_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lcircular-3 -lcircular-1 -lcircular-2 \n" \
|
-o inline:"circular-1: breaking circular reference (circular-1 -> circular-2 -> circular-1)\n" \
|
||||||
pkgconf --libs circular-3
|
pkgconf circular-2 --validate
|
||||||
|
}
|
||||||
|
|
||||||
|
libs_circular1_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
atf_check \
|
||||||
|
-o inline:"circular-3: breaking circular reference (circular-3 -> circular-1 -> circular-3)\n" \
|
||||||
|
pkgconf circular-1 --validate
|
||||||
}
|
}
|
||||||
|
|
||||||
libs_circular_directpc_body()
|
libs_circular_directpc_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lcircular-1 -lcircular-2 -lcircular-3 \n" \
|
-o inline:"-lcircular-3 -lcircular-1 -lcircular-2\n" \
|
||||||
pkgconf --libs ${selfdir}/lib1/circular-3.pc
|
pkgconf --libs ${selfdir}/lib1/circular-3.pc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +244,7 @@ libs_static_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"/libfoo.a -pthread \n" \
|
-o inline:"/libfoo.a -pthread\n" \
|
||||||
pkgconf --libs static-archive-libs
|
pkgconf --libs static-archive-libs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,28 +252,36 @@ libs_static_ordering_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lbar -lfoo \n" \
|
-o inline:"-L/test/lib -lbar -lfoo\n" \
|
||||||
pkgconf --libs foo bar
|
pkgconf --libs foo bar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
libs_metapackage_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-L/test/lib -lbar -lfoo\n" \
|
||||||
|
pkgconf --static --libs metapackage-3
|
||||||
|
}
|
||||||
|
|
||||||
pkg_config_path_body()
|
pkg_config_path_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1${PATH_SEP}${selfdir}/lib2"
|
export PKG_CONFIG_PATH="${selfdir}/lib1${PATH_SEP}${selfdir}/lib2"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lfoo \n" \
|
-o inline:"-L/test/lib -lfoo\n" \
|
||||||
pkgconf --libs foo
|
pkgconf --libs foo
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lbar -lfoo \n" \
|
-o inline:"-L/test/lib -lbar -lfoo\n" \
|
||||||
pkgconf --libs bar
|
pkgconf --libs bar
|
||||||
}
|
}
|
||||||
|
|
||||||
with_path_body()
|
with_path_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lfoo \n" \
|
-o inline:"-L/test/lib -lfoo\n" \
|
||||||
pkgconf --with-path=${selfdir}/lib1 --with-path=${selfdir}/lib2 --libs foo
|
pkgconf --with-path=${selfdir}/lib1 --with-path=${selfdir}/lib2 --libs foo
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lbar -lfoo \n" \
|
-o inline:"-L/test/lib -lbar -lfoo\n" \
|
||||||
pkgconf --with-path=${selfdir}/lib1 --with-path=${selfdir}/lib2 --libs bar
|
pkgconf --with-path=${selfdir}/lib1 --with-path=${selfdir}/lib2 --libs bar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +305,7 @@ arbitary_path_body()
|
||||||
{
|
{
|
||||||
cp ${selfdir}/lib1/foo.pc .
|
cp ${selfdir}/lib1/foo.pc .
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lfoo \n" \
|
-o inline:"-L/test/lib -lfoo\n" \
|
||||||
pkgconf --libs foo.pc
|
pkgconf --libs foo.pc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,3 +324,60 @@ single_depth_selectors_body()
|
||||||
-o inline:"foo\n" \
|
-o inline:"foo\n" \
|
||||||
pkgconf --with-path=${selfdir}/lib3 --print-requires bar
|
pkgconf --with-path=${selfdir}/lib3 --print-requires bar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
license_isc_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"foo: ISC\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --license foo
|
||||||
|
}
|
||||||
|
|
||||||
|
license_noassertion_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"bar: NOASSERTION\nfoo: ISC\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --license bar
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_noflatten_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"1.3\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --modversion bar
|
||||||
|
}
|
||||||
|
|
||||||
|
exists_cflags_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-DHAVE_FOO\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --cflags --exists-cflags --fragment-filter=D foo
|
||||||
|
}
|
||||||
|
|
||||||
|
exists_cflags_env_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"FOO_CFLAGS='-DHAVE_FOO'\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --cflags --exists-cflags --fragment-filter=D --env=FOO foo
|
||||||
|
}
|
||||||
|
|
||||||
|
libs_env_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"FOO_LIBS='-L/test/lib -lfoo'\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --libs --env=FOO foo
|
||||||
|
}
|
||||||
|
|
||||||
|
print_variables_env_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"FOO_CFLAGS='-fPIC -I/test/include/foo'\nFOO_LIBS='-L/test/lib -lfoo'\nFOO_INCLUDEDIR='/test/include'\nFOO_LIBDIR='/test/lib'\nFOO_EXEC_PREFIX='/test'\nFOO_PREFIX='/test'\nFOO_PCFILEDIR='${selfdir}/lib1'\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --env=FOO --print-variables --cflags --libs foo
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable_env_body()
|
||||||
|
{
|
||||||
|
atf_check \
|
||||||
|
-o inline:"FOO_INCLUDEDIR='/test/include'\n" \
|
||||||
|
pkgconf --with-path=${selfdir}/lib1 --env=FOO --variable=includedir foo
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ libs_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lconflicts \n" \
|
-o inline:"-L/test/lib -lconflicts\n" \
|
||||||
pkgconf --libs conflicts
|
pkgconf --libs conflicts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,6 @@ ignore_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lconflicts \n" \
|
-o inline:"-L/test/lib -lconflicts\n" \
|
||||||
pkgconf --ignore-conflicts --libs conflicts
|
pkgconf --ignore-conflicts --libs conflicts
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,12 @@ libs_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-F/test/lib -framework framework-1 \n" \
|
-o inline:"-F/test/lib -framework framework-1\n" \
|
||||||
pkgconf --libs framework-1
|
pkgconf --libs framework-1
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-F/test/lib -framework framework-2 -framework framework-1 \n" \
|
-o inline:"-F/test/lib -framework framework-2 -framework framework-1\n" \
|
||||||
pkgconf --libs framework-2
|
pkgconf --libs framework-2
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-F/test/lib -framework framework-2 -framework framework-1 \n" \
|
-o inline:"-F/test/lib -framework framework-2 -framework framework-1\n" \
|
||||||
pkgconf --libs framework-1 framework-2
|
pkgconf --libs framework-1 framework-2
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=/usr
|
||||||
|
exec_prefix=/usr
|
||||||
|
libdir=${prefix}/lib64
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: child-prefix-1
|
||||||
|
Description: child prefix 1 test data
|
||||||
|
Requires:
|
||||||
|
Version: 1.0
|
||||||
|
Libs: -L${libdir} -lchild-prefix-1
|
||||||
|
Cflags: -I${includedir}/child-prefix-1
|
|
@ -9,3 +9,4 @@ Version: 1.2.3
|
||||||
Libs: -L${libdir} -lfoo
|
Libs: -L${libdir} -lfoo
|
||||||
Cflags: -fPIC -I${includedir}/foo
|
Cflags: -fPIC -I${includedir}/foo
|
||||||
Cflags.private: -DFOO_STATIC
|
Cflags.private: -DFOO_STATIC
|
||||||
|
License: ISC
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
prefix=/test
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: foobar
|
||||||
|
Description: A testing pkg-config file
|
||||||
|
Version: 3.2.1
|
||||||
|
Libs: -L${libdir} -lfoobar
|
||||||
|
Cflags: -fPIC -I${includedir}/foobar
|
||||||
|
Cflags.private: -DFOOBAR_STATIC
|
||||||
|
License: ISC
|
|
@ -0,0 +1,6 @@
|
||||||
|
Name: metapackage-1
|
||||||
|
Version: 0.1
|
||||||
|
Description: metapackage for testing purposes
|
||||||
|
Requires.private: metapackage-2
|
||||||
|
Libs: -lmetapackage-1
|
||||||
|
Cflags: -I/metapackage-1
|
|
@ -0,0 +1,5 @@
|
||||||
|
Name: metapackage-2
|
||||||
|
Version: 0.1
|
||||||
|
Description: metapackage for testing purposes
|
||||||
|
Libs: -lmetapackage-2
|
||||||
|
Cflags: -I/metapackage-2
|
|
@ -0,0 +1,4 @@
|
||||||
|
Name: metapackage-3
|
||||||
|
Version: 0.1
|
||||||
|
Description: metapackage for testing purposes
|
||||||
|
Requires.private: bar
|
|
@ -0,0 +1,4 @@
|
||||||
|
Name: metapackage
|
||||||
|
Version: 0.1
|
||||||
|
Description: metapackage for testing purposes
|
||||||
|
Requires: metapackage-1, metapackage-2
|
|
@ -0,0 +1,10 @@
|
||||||
|
prefix=${pc_sysrootdir}/test
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: omg-sysroot
|
||||||
|
Description: A testing pkg-config file
|
||||||
|
Version: 1.2.3
|
||||||
|
Libs: -L${libdir} -lomg
|
||||||
|
Cflags: -fPIC -I${includedir}/omg
|
|
@ -7,4 +7,4 @@ Name: quotes
|
||||||
Description: A testing pkg-config file
|
Description: A testing pkg-config file
|
||||||
Version: 1.2.3
|
Version: 1.2.3
|
||||||
Libs: -L${libdir} -lfoo
|
Libs: -L${libdir} -lfoo
|
||||||
Cflags: -DQUOTED=\"bla\"
|
Cflags: -DQUOTED=\"bla\" -DA=\"escaped\ string\'\ \literal\" -DB="\1\$" -DC='bla'
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
prefix=/test\ with\ spaces
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: spaces-in-paths
|
||||||
|
Version: 1
|
||||||
|
Description: test package for properly expanding spaces in variables
|
||||||
|
Cflags: -I${includedir} -I${includedir}/subdir
|
|
@ -0,0 +1,7 @@
|
||||||
|
prefix=${pc_sysrootdir}/usr
|
||||||
|
|
||||||
|
Name: sysroot-dir
|
||||||
|
Description: Package for testing whether sysroot dirs are repeated or not
|
||||||
|
Version: 1
|
||||||
|
CFlags: -I${prefix}/include
|
||||||
|
Libs: -L${prefix}/lib -lfoo
|
|
@ -0,0 +1,9 @@
|
||||||
|
prefix=/sysroot/usr
|
||||||
|
includedir=${prefix}/include
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
|
||||||
|
Name: sysroot-dir
|
||||||
|
Description: Package for testing whether sysroot dirs are repeated or not
|
||||||
|
Version: 1
|
||||||
|
CFlags: -I${includedir}
|
||||||
|
Libs: -L${libdir} -lfoo
|
|
@ -0,0 +1,9 @@
|
||||||
|
prefix=${pc_sysrootdir}/usr
|
||||||
|
includedir=${prefix}/include
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
|
||||||
|
Name: sysroot-dir
|
||||||
|
Description: Package for testing whether sysroot dirs are repeated or not
|
||||||
|
Version: 1
|
||||||
|
CFlags: -I${includedir}
|
||||||
|
Libs: -L${libdir} -lfoo
|
|
@ -0,0 +1,9 @@
|
||||||
|
prefix=/sysroot/usr
|
||||||
|
includedir=${prefix}/include
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
|
||||||
|
Name: sysroot-dir
|
||||||
|
Description: Package for testing whether sysroot dirs are repeated or not
|
||||||
|
Version: 1
|
||||||
|
CFlags: -I${includedir}
|
||||||
|
Libs: -L${libdir} -lfoo
|
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=/test
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: unavailable_provider
|
||||||
|
Description: Provides an otherwise unavailable package
|
||||||
|
Version: 1.2.3
|
||||||
|
Provides: unavailable = 1.2.3
|
||||||
|
Libs: -lunavailable
|
||||||
|
Cflags:
|
|
@ -0,0 +1,10 @@
|
||||||
|
prefix=/tëst
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${prefix}/lib
|
||||||
|
includedir=${prefix}/include
|
||||||
|
|
||||||
|
Name: utf8
|
||||||
|
Description: Library installed in a prefix with UTF-8
|
||||||
|
Version: 0
|
||||||
|
Libs: -L${libdir} -lutf8
|
||||||
|
Cflags: -I${includedir}
|
|
@ -18,5 +18,5 @@ tests = [
|
||||||
|
|
||||||
# yuck
|
# yuck
|
||||||
foreach test : tests
|
foreach test : tests
|
||||||
configure_file(input: test + '.sh', output: test, copy: true)
|
test_file = configure_file(input: test + '.sh', output: test, copy: true)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
|
@ -41,7 +41,7 @@ comments_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lfoo \n" \
|
-o inline:"-lfoo\n" \
|
||||||
pkgconf --libs comments
|
pkgconf --libs comments
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ comments_in_fields_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lfoo \n" \
|
-o inline:"-lfoo\n" \
|
||||||
pkgconf --libs comments-in-fields
|
pkgconf --libs comments-in-fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ dos_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib/dos-lineendings -ldos-lineendings \n" \
|
-o inline:"-L/test/lib/dos-lineendings -ldos-lineendings\n" \
|
||||||
pkgconf --libs dos-lineendings
|
pkgconf --libs dos-lineendings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ no_trailing_newline_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/test/include/no-trailing-newline \n" \
|
-o inline:"-I/test/include/no-trailing-newline\n" \
|
||||||
pkgconf --cflags no-trailing-newline
|
pkgconf --cflags no-trailing-newline
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ argv_parse_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-llib-3 -llib-1 -llib-2 -lpthread \n" \
|
-o inline:"-llib-3 -llib-1 -llib-2 -lpthread\n" \
|
||||||
pkgconf --libs argv-parse
|
pkgconf --libs argv-parse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ argv_parse_3_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-llib-1 -pthread /test/lib/lib2.so \n" \
|
-o inline:"-llib-1 -pthread /test/lib/lib2.so\n" \
|
||||||
pkgconf --libs argv-parse-3
|
pkgconf --libs argv-parse-3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,10 +98,10 @@ tilde_quoting_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L~ -ltilde \n" \
|
-o inline:"-L~ -ltilde\n" \
|
||||||
pkgconf --libs tilde-quoting
|
pkgconf --libs tilde-quoting
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I~ \n" \
|
-o inline:"-I~\n" \
|
||||||
pkgconf --cflags tilde-quoting
|
pkgconf --cflags tilde-quoting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ paren_quoting_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L\$(libdir) -ltilde \n" \
|
-o inline:"-L\$(libdir) -ltilde\n" \
|
||||||
pkgconf --libs paren-quoting
|
pkgconf --libs paren-quoting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ escaped_backslash_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-e ignore \
|
-e ignore \
|
||||||
-o inline:"-IC:\\\\\\\\A \n" \
|
-o inline:"-IC:\\\\\\\\A\n" \
|
||||||
pkgconf --with-path=${selfdir}/lib1 --cflags escaped-backslash
|
pkgconf --with-path=${selfdir}/lib1 --cflags escaped-backslash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ quoted_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-DQUOTED=\\\"bla\\\" \n" \
|
-o inline:"-DQUOTED=\\\"bla\\\" -DA=\\\"escaped\\ string\\\'\\ literal\\\" -DB=\\\\\\1\$ -DC=bla\n" \
|
||||||
pkgconf --cflags quotes
|
pkgconf --cflags quotes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ flag_order_1_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -Bdynamic -lfoo -Bstatic -lbar \n" \
|
-o inline:"-L/test/lib -Bdynamic -lfoo -Bstatic -lbar\n" \
|
||||||
pkgconf --libs flag-order-1
|
pkgconf --libs flag-order-1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ flag_order_2_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -Bdynamic -lfoo -Bstatic -lbar -lfoo \n" \
|
-o inline:"-L/test/lib -Bdynamic -lfoo -Bstatic -lbar -lfoo\n" \
|
||||||
pkgconf --libs flag-order-1 foo
|
pkgconf --libs flag-order-1 foo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ flag_order_3_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -Wl,--start-group -lfoo -lbar -Wl,--end-group \n" \
|
-o inline:"-L/test/lib -Wl,--start-group -lfoo -lbar -Wl,--end-group\n" \
|
||||||
pkgconf --libs flag-order-3
|
pkgconf --libs flag-order-3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ flag_order_4_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -Wl,--start-group -lfoo -lbar -Wl,--end-group -lfoo \n" \
|
-o inline:"-L/test/lib -Wl,--start-group -lfoo -lbar -Wl,--end-group -lfoo\n" \
|
||||||
pkgconf --libs flag-order-3 foo
|
pkgconf --libs flag-order-3 foo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ variable_whitespace_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/test/include \n" \
|
-o inline:"-I/test/include\n" \
|
||||||
pkgconf --cflags variable-whitespace
|
pkgconf --cflags variable-whitespace
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ fragment_quoting_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -DQUOTED=\\\"/test/share/doc\\\" \n" \
|
-o inline:"-fPIC -I/test/include/foo -DQUOTED=\\\"/test/share/doc\\\"\n" \
|
||||||
pkgconf --cflags fragment-quoting
|
pkgconf --cflags fragment-quoting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ fragment_quoting_2_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -DQUOTED=/test/share/doc \n" \
|
-o inline:"-fPIC -I/test/include/foo -DQUOTED=/test/share/doc\n" \
|
||||||
pkgconf --cflags fragment-quoting-2
|
pkgconf --cflags fragment-quoting-2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ fragment_quoting_3_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -DQUOTED=\\\"/test/share/doc\\\" \n" \
|
-o inline:"-fPIC -I/test/include/foo -DQUOTED=\\\"/test/share/doc\\\"\n" \
|
||||||
pkgconf --cflags fragment-quoting-3
|
pkgconf --cflags fragment-quoting-3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ fragment_quoting_5_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -DQUOTED=/test/share/doc \n" \
|
-o inline:"-fPIC -I/test/include/foo -DQUOTED=/test/share/doc\n" \
|
||||||
pkgconf --cflags fragment-quoting-5
|
pkgconf --cflags fragment-quoting-5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,28 +222,28 @@ fragment_quoting_7_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-Dhello=10 -Dworld=+32 -DDEFINED_FROM_PKG_CONFIG=hello\\ world \n" \
|
-o inline:"-Dhello=10 -Dworld=+32 -DDEFINED_FROM_PKG_CONFIG=hello\\ world\n" \
|
||||||
pkgconf --cflags fragment-quoting-7
|
pkgconf --cflags fragment-quoting-7
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment_escaping_1_body()
|
fragment_escaping_1_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-IC:\\\\\\\\D\\ E \n" \
|
-o inline:"-IC:\\\\\\\\D\\ E\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-escaping-1
|
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-escaping-1
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment_escaping_2_body()
|
fragment_escaping_2_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-IC:\\\\\\\\D\\ E \n" \
|
-o inline:"-IC:\\\\\\\\D\\ E\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-escaping-2
|
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-escaping-2
|
||||||
}
|
}
|
||||||
|
|
||||||
fragment_escaping_3_body()
|
fragment_escaping_3_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-IC:\\\\\\\\D\\ E \n" \
|
-o inline:"-IC:\\\\\\\\D\\ E\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-escaping-3
|
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-escaping-3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ fragment_quoting_7a_body()
|
||||||
fragment_comment_body()
|
fragment_comment_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:'kuku=\#ttt \n' \
|
-o inline:'kuku=\#ttt\n' \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-comment
|
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-comment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ msvc_fragment_render_cflags_body()
|
||||||
tuple_dequote_body()
|
tuple_dequote_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:'-L/test/lib -lfoo \n' \
|
-o inline:'-L/test/lib -lfoo\n' \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --libs tuple-quoting
|
pkgconf --with-path="${selfdir}/lib1" --libs tuple-quoting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ provides = 1.2.3
|
||||||
-o inline:"${OUTPUT}" \
|
-o inline:"${OUTPUT}" \
|
||||||
pkgconf --print-provides provides
|
pkgconf --print-provides provides
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lfoo \n" \
|
-o inline:"-lfoo\n" \
|
||||||
pkgconf --libs provides-request-simple
|
pkgconf --libs provides-request-simple
|
||||||
atf_check \
|
atf_check \
|
||||||
-e ignore \
|
-e ignore \
|
||||||
|
|
122
tests/regress.sh
122
tests/regress.sh
|
@ -8,6 +8,7 @@ tests_init \
|
||||||
depgraph_break_2 \
|
depgraph_break_2 \
|
||||||
depgraph_break_3 \
|
depgraph_break_3 \
|
||||||
define_variable \
|
define_variable \
|
||||||
|
define_variable_override \
|
||||||
variable \
|
variable \
|
||||||
keep_system_libs \
|
keep_system_libs \
|
||||||
libs \
|
libs \
|
||||||
|
@ -22,6 +23,15 @@ tests_init \
|
||||||
idirafter_munge_order \
|
idirafter_munge_order \
|
||||||
idirafter_munge_sysroot \
|
idirafter_munge_sysroot \
|
||||||
idirafter_ordering \
|
idirafter_ordering \
|
||||||
|
modversion_common_prefix \
|
||||||
|
modversion_fullpath \
|
||||||
|
modversion_provides \
|
||||||
|
modversion_uninstalled \
|
||||||
|
modversion_one_word_expression \
|
||||||
|
modversion_two_word_expression \
|
||||||
|
modversion_three_word_expression \
|
||||||
|
modversion_one_word_expression_no_space \
|
||||||
|
modversion_one_word_expression_no_space_zero \
|
||||||
pcpath \
|
pcpath \
|
||||||
virtual_variable \
|
virtual_variable \
|
||||||
fragment_collision \
|
fragment_collision \
|
||||||
|
@ -29,7 +39,10 @@ tests_init \
|
||||||
malformed_quoting \
|
malformed_quoting \
|
||||||
explicit_sysroot \
|
explicit_sysroot \
|
||||||
empty_tuple \
|
empty_tuple \
|
||||||
billion_laughs
|
solver_requires_private_debounce \
|
||||||
|
billion_laughs \
|
||||||
|
define_prefix_child_prefix_1 \
|
||||||
|
define_prefix_child_prefix_1_env
|
||||||
|
|
||||||
# sysroot_munge \
|
# sysroot_munge \
|
||||||
|
|
||||||
|
@ -72,6 +85,13 @@ define_variable_body()
|
||||||
pkgconf --variable=typelibdir --define-variable='libdir=\${libdir}' typelibdir
|
pkgconf --variable=typelibdir --define-variable='libdir=\${libdir}' typelibdir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define_variable_override_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
atf_check -o inline:"/test\n" \
|
||||||
|
pkgconf --variable=prefix --define-variable='prefix=/test' typelibdir
|
||||||
|
}
|
||||||
|
|
||||||
variable_body()
|
variable_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
@ -89,7 +109,7 @@ keep_system_libs_body()
|
||||||
pkgconf --libs-only-L cflags-libs-only
|
pkgconf --libs-only-L cflags-libs-only
|
||||||
|
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/local/lib \n" \
|
-o inline:"-L/test/local/lib\n" \
|
||||||
pkgconf --libs-only-L --keep-system-libs cflags-libs-only
|
pkgconf --libs-only-L --keep-system-libs cflags-libs-only
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +117,7 @@ libs_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/local/lib -lfoo \n" \
|
-o inline:"-L/test/local/lib -lfoo\n" \
|
||||||
pkgconf --libs cflags-libs-only
|
pkgconf --libs cflags-libs-only
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +125,7 @@ libs_only_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/local/lib -lfoo \n" \
|
-o inline:"-L/test/local/lib -lfoo\n" \
|
||||||
pkgconf --libs-only-L --libs-only-l cflags-libs-only
|
pkgconf --libs-only-L --libs-only-l cflags-libs-only
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,10 +133,10 @@ libs_never_mergeback_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/bar/lib -lfoo1 \n" \
|
-o inline:"-L/test/bar/lib -lfoo1\n" \
|
||||||
pkgconf --libs prefix-foo1
|
pkgconf --libs prefix-foo1
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/bar/lib -lfoo1 -lfoo2 \n" \
|
-o inline:"-L/test/bar/lib -lfoo1 -lfoo2\n" \
|
||||||
pkgconf --libs prefix-foo1 prefix-foo2
|
pkgconf --libs prefix-foo1 prefix-foo2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +144,7 @@ cflags_only_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/test/local/include/foo \n" \
|
-o inline:"-I/test/local/include/foo\n" \
|
||||||
pkgconf --cflags-only-I --cflags-only-other cflags-libs-only
|
pkgconf --cflags-only-I --cflags-only-other cflags-libs-only
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +152,7 @@ cflags_never_mergeback_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/test/bar/include/foo -DBAR -fPIC -DFOO \n" \
|
-o inline:"-I/test/bar/include/foo -DBAR -fPIC -DFOO\n" \
|
||||||
pkgconf --cflags prefix-foo1 prefix-foo2
|
pkgconf --cflags prefix-foo1 prefix-foo2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +176,7 @@ isystem_munge_order_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-isystem /opt/bad/include -isystem /opt/bad2/include \n" \
|
-o inline:"-isystem /opt/bad/include -isystem /opt/bad2/include\n" \
|
||||||
pkgconf --cflags isystem
|
pkgconf --cflags isystem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +192,7 @@ idirafter_munge_order_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-idirafter /opt/bad/include -idirafter /opt/bad2/include \n" \
|
-o inline:"-idirafter /opt/bad/include -idirafter /opt/bad2/include\n" \
|
||||||
pkgconf --cflags idirafter
|
pkgconf --cflags idirafter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +208,7 @@ idirafter_ordering_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/opt/bad/include1 -idirafter -I/opt/bad/include2 -I/opt/bad/include3 \n" \
|
-o inline:"-I/opt/bad/include1 -idirafter -I/opt/bad/include2 -I/opt/bad/include3\n" \
|
||||||
pkgconf --cflags idirafter-ordering
|
pkgconf --cflags idirafter-ordering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +216,7 @@ pcpath_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib2"
|
export PKG_CONFIG_PATH="${selfdir}/lib2"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo \n" \
|
-o inline:"-fPIC -I/test/include/foo\n" \
|
||||||
pkgconf --cflags ${selfdir}/lib3/bar.pc
|
pkgconf --cflags ${selfdir}/lib3/bar.pc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +225,7 @@ sysroot_munge_body()
|
||||||
sed "s|/sysroot/|${selfdir}/|g" ${selfdir}/lib1/sysroot-dir.pc > ${selfdir}/lib1/sysroot-dir-selfdir.pc
|
sed "s|/sysroot/|${selfdir}/|g" ${selfdir}/lib1/sysroot-dir.pc > ${selfdir}/lib1/sysroot-dir-selfdir.pc
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1" PKG_CONFIG_SYSROOT_DIR="${selfdir}"
|
export PKG_CONFIG_PATH="${selfdir}/lib1" PKG_CONFIG_SYSROOT_DIR="${selfdir}"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L${selfdir}/lib -lfoo \n" \
|
-o inline:"-L${selfdir}/lib -lfoo\n" \
|
||||||
pkgconf --libs sysroot-dir-selfdir
|
pkgconf --libs sysroot-dir-selfdir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +244,7 @@ virtual_variable_body()
|
||||||
|
|
||||||
fragment_collision_body()
|
fragment_collision_body()
|
||||||
{
|
{
|
||||||
atf_check -o inline:"-D_BAZ -D_BAR -D_FOO -D_THREAD_SAFE -pthread \n" \
|
atf_check -o inline:"-D_BAZ -D_BAR -D_FOO -D_THREAD_SAFE -pthread\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-collision
|
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-collision
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +273,82 @@ empty_tuple_body()
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags empty-tuple
|
pkgconf --with-path="${selfdir}/lib1" --cflags empty-tuple
|
||||||
}
|
}
|
||||||
|
|
||||||
|
solver_requires_private_debounce_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"-I/metapackage-1 -I/metapackage-2 -lmetapackage-1 -lmetapackage-2\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --cflags --libs metapackage
|
||||||
|
}
|
||||||
|
|
||||||
billion_laughs_body()
|
billion_laughs_body()
|
||||||
{
|
{
|
||||||
atf_check -o inline:"warning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\n" \
|
atf_check -o inline:"warning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --validate billion-laughs
|
pkgconf --with-path="${selfdir}/lib1" --validate billion-laughs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modversion_common_prefix_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"foo: 1.2.3\nfoobar: 3.2.1\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion --verbose foo foobar
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_fullpath_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --modversion "${selfdir}/lib1/foo.pc"
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_provides_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion unavailable
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_uninstalled_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion omg
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_one_word_expression_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion "foo > 1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_two_word_expression_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion foo "> 1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_three_word_expression_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion foo ">" 1.0
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_one_word_expression_no_space_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion "foo >1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
modversion_one_word_expression_no_space_zero_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"1.2.3\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1" --modversion "foo >0.5"
|
||||||
|
}
|
||||||
|
|
||||||
|
define_prefix_child_prefix_1_body()
|
||||||
|
{
|
||||||
|
atf_check -o inline:"-I${selfdir}/lib1/include/child-prefix-1 -L${selfdir}/lib1/lib64 -lchild-prefix-1\n" \
|
||||||
|
pkgconf --with-path="${selfdir}/lib1/child-prefix/pkgconfig" --define-prefix --cflags --libs child-prefix-1
|
||||||
|
}
|
||||||
|
|
||||||
|
define_prefix_child_prefix_1_env_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1/child-prefix/pkgconfig"
|
||||||
|
export PKG_CONFIG_RELOCATE_PATHS=1
|
||||||
|
atf_check -o inline:"-I${selfdir}/lib1/include/child-prefix-1 -L${selfdir}/lib1/lib64 -lchild-prefix-1\n" \
|
||||||
|
pkgconf --cflags --libs child-prefix-1
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,10 @@ tests_init \
|
||||||
argv_parse2 \
|
argv_parse2 \
|
||||||
static_cflags \
|
static_cflags \
|
||||||
private_duplication \
|
private_duplication \
|
||||||
|
private_duplication_digraph \
|
||||||
|
foo_bar \
|
||||||
|
bar_foo \
|
||||||
|
foo_metapackage_3 \
|
||||||
libs_static2 \
|
libs_static2 \
|
||||||
missing \
|
missing \
|
||||||
requires_internal \
|
requires_internal \
|
||||||
|
@ -21,7 +25,7 @@ libs_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lbar -lfoo \n" \
|
-o inline:"-L/test/lib -lbar -lfoo\n" \
|
||||||
pkgconf --libs bar
|
pkgconf --libs bar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +33,7 @@ libs_cflags_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbaz \n" \
|
-o inline:"-fPIC -I/test/include/foo -L/test/lib -lbaz\n" \
|
||||||
pkgconf --libs --cflags baz
|
pkgconf --libs --cflags baz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +41,7 @@ libs_static_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lbaz -L/test/lib -lzee -L/test/lib -lfoo \n" \
|
-o inline:"-L/test/lib -lbaz -L/test/lib -lzee -lfoo\n" \
|
||||||
pkgconf --static --libs baz
|
pkgconf --static --libs baz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +49,7 @@ libs_static_pure_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-L/test/lib -lbaz -L/test/lib -lfoo \n" \
|
-o inline:"-L/test/lib -lbaz -lfoo\n" \
|
||||||
pkgconf --static --pure --libs baz
|
pkgconf --static --pure --libs baz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +57,7 @@ argv_parse2_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-llib-1 -pthread /test/lib/lib2.so \n" \
|
-o inline:"-llib-1 -pthread /test/lib/lib2.so\n" \
|
||||||
pkgconf --static --libs argv-parse-2
|
pkgconf --static --libs argv-parse-2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +65,7 @@ static_cflags_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo -DFOO_STATIC \n" \
|
-o inline:"-fPIC -I/test/include/foo -DFOO_STATIC\n" \
|
||||||
pkgconf --static --cflags baz
|
pkgconf --static --cflags baz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,15 +73,51 @@ private_duplication_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lprivate -lfoo -lbaz -lzee -lbar -lfoo \n" \
|
-o inline:"-lprivate -lbaz -lzee -lbar -lfoo\n" \
|
||||||
pkgconf --static --libs-only-l private-libs-duplication
|
pkgconf --static --libs-only-l private-libs-duplication
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private_duplication_digraph_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
atf_check \
|
||||||
|
-o 'match:"user:request" -> "private-libs-duplication"' \
|
||||||
|
-o 'match:"private-libs-duplication" -> "bar"' \
|
||||||
|
-o 'match:"private-libs-duplication" -> "baz"' \
|
||||||
|
-o 'match:"bar" -> "foo"' \
|
||||||
|
-o 'match:"baz" -> "foo"' \
|
||||||
|
pkgconf --static --libs-only-l private-libs-duplication --digraph
|
||||||
|
}
|
||||||
|
|
||||||
|
bar_foo_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-lbar -lfoo\n" \
|
||||||
|
pkgconf --static --libs-only-l bar foo
|
||||||
|
}
|
||||||
|
|
||||||
|
foo_bar_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-lbar -lfoo\n" \
|
||||||
|
pkgconf --static --libs-only-l foo bar
|
||||||
|
}
|
||||||
|
|
||||||
|
foo_metapackage_3_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-lbar -lfoo\n" \
|
||||||
|
pkgconf --static --libs-only-l foo metapackage-3
|
||||||
|
}
|
||||||
|
|
||||||
libs_static2_body()
|
libs_static2_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lbar -lbar-private -L/test/lib -lfoo \n" \
|
-o inline:"-lbar -lbar-private -L/test/lib -lfoo\n" \
|
||||||
pkgconf --static --libs static-libs
|
pkgconf --static --libs static-libs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,14 +127,14 @@ missing_body()
|
||||||
atf_check \
|
atf_check \
|
||||||
-s exit:1 \
|
-s exit:1 \
|
||||||
-e ignore \
|
-e ignore \
|
||||||
-o inline:"\n" \
|
-o ignore \
|
||||||
pkgconf --cflags missing-require
|
pkgconf --cflags missing-require
|
||||||
}
|
}
|
||||||
|
|
||||||
requires_internal_body()
|
requires_internal_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lbar -lbar-private -L/test/lib -lfoo \n" \
|
-o inline:"-lbar -lbar-private -L/test/lib -lfoo\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --static --libs requires-internal
|
pkgconf --with-path="${selfdir}/lib1" --static --libs requires-internal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +150,7 @@ requires_internal_missing_body()
|
||||||
requires_internal_collision_body()
|
requires_internal_collision_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-I/test/local/include/foo \n" \
|
-o inline:"-I/test/local/include/foo\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags requires-internal-collision
|
pkgconf --with-path="${selfdir}/lib1" --cflags requires-internal-collision
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,18 @@ tests_init \
|
||||||
cflags \
|
cflags \
|
||||||
variable \
|
variable \
|
||||||
do_not_eat_slash \
|
do_not_eat_slash \
|
||||||
|
do_not_duplicate_sysroot_dir \
|
||||||
|
uninstalled \
|
||||||
|
uninstalled_pkgconf1 \
|
||||||
|
uninstalled_fdo \
|
||||||
|
uninstalled_fdo_pc_sysrootdir
|
||||||
|
|
||||||
do_not_eat_slash_body()
|
do_not_eat_slash_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
export PKG_CONFIG_SYSROOT_DIR="/"
|
export PKG_CONFIG_SYSROOT_DIR="/"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I/test/include/foo \n" \
|
-o inline:"-fPIC -I/test/include/foo\n" \
|
||||||
pkgconf --cflags baz
|
pkgconf --cflags baz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +26,7 @@ cflags_body()
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
|
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-fPIC -I${SYSROOT_DIR}/test/include/foo \n" \
|
-o inline:"-fPIC -I${SYSROOT_DIR}/test/include/foo\n" \
|
||||||
pkgconf --cflags baz
|
pkgconf --cflags baz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,3 +41,70 @@ variable_body()
|
||||||
-o inline:"${SYSROOT_DIR}/test/include\n" \
|
-o inline:"${SYSROOT_DIR}/test/include\n" \
|
||||||
pkgconf --variable=includedir foo
|
pkgconf --variable=includedir foo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_not_duplicate_sysroot_dir_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="/sysroot"
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-I/sysroot/usr/include\n" \
|
||||||
|
pkgconf --cflags sysroot-dir-2
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-I/sysroot/usr/include\n" \
|
||||||
|
pkgconf --cflags sysroot-dir-3
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-I/sysroot/usr/include\n" \
|
||||||
|
pkgconf --cflags sysroot-dir-5
|
||||||
|
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-I${SYSROOT_DIR}/usr/include\n" \
|
||||||
|
pkgconf --cflags sysroot-dir-4
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstalled_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="/sysroot"
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-L/test/lib -lomg\n" \
|
||||||
|
pkgconf --libs omg
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstalled_pkgconf1_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="/sysroot"
|
||||||
|
export PKG_CONFIG_PKGCONF1_SYSROOT_RULES="1"
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-L/sysroot/test/lib -lomg\n" \
|
||||||
|
pkgconf --libs omg
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstalled_fdo_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="/sysroot"
|
||||||
|
export PKG_CONFIG_FDO_SYSROOT_RULES="1"
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-L/test/lib -lomg\n" \
|
||||||
|
pkgconf --libs omg
|
||||||
|
}
|
||||||
|
|
||||||
|
uninstalled_fdo_pc_sysrootdir_body()
|
||||||
|
{
|
||||||
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR="/sysroot"
|
||||||
|
export PKG_CONFIG_FDO_SYSROOT_RULES="1"
|
||||||
|
|
||||||
|
atf_check \
|
||||||
|
-o inline:"-L/sysroot/test/lib -lomg\n" \
|
||||||
|
pkgconf --libs omg-sysroot
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue