summaryrefslogtreecommitdiff
path: root/libpkgconf/README-DEV
blob: 1a1dd23bee35793de0ffc57f5b79a231ed345438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
This document describes how libpkgconf was packaged for build2. In particular,
this understanding will be useful when upgrading to a new upstream version.
See ../README-DEV for general notes on pkgconf packaging.

Symlink the required upstream files and provide our own implementation for
auto-generated config.h:

$ ln -s ../upstream/{AUTHORS,COPYING} ./
$ ln -s ../../upstream/libpkgconf/config.h.meson libpkgconf/config.h.meson.orig
$ cd libpkgconf && ln -s ../../upstream/libpkgconf/*.{c,h} ./

Use libpkgconf/config.h.meson.orig for creating libpkgconf/config.h.in,
defining/undefining macros introduced with #mesondefine.

Re-creating libpkgconf/config.h.in from scratch every time we upgrade to a new
upstream version would be a real pain. Instead we can only (un)define the
newly introduced macros, comparing the already defined and currently used
macro sets:

$ for m in `cat libpkgconf/config.h.meson.orig | \
            sed -n 's/.*#\s*mesondefine\s\{1,\}\([_a-zA-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\1/p' | sort -u`; do
    if grep -q -e "\b$m\b" `find -L . -name '*.h' -a ! -name config.h -o -name '*.c'`; then
      echo "$m"
    fi
  done >used-macros

$ cat libpkgconf/config.h.in |
  sed -n 's/#\s*\(define\|undef\)\s\{1,\}\([_a-zA-Z0-9]\{1,\}\)\(\s.*\)\{0,1\}$/\2/p' |
  sort -u >defined-macros

$ diff defined-macros used-macros

We also extend the upstream package functionality allowing to prevent merging
of "special" fragments, such as `-framework <name>`, into a single fragment.

$ mv libpkgconf.h libpkgconf.h.orig
$ cp libpkgconf.h.orig libpkgconf.h

$ mv fragment.c fragment.c.orig
$ cp fragment.c.orig fragment.c

$ git apply dont-merge-fragments.patch
$ git apply dont-drop-fragments.patch

Also fix the MinGW GCC 10 -Wformat warning:

$ mv stdinc.h stdinc.h.orig
$ cp stdinc.h.orig stdinc.h

$ git apply fix-mingw-wformat-warning.patch

Note that the patches are produces by commands similar to the following:

$ git diff >dont-merge-fragments.patch