1#         $NetBSD: xorg-pkg-ver.mk,v 1.10 2018/05/31 09:31:39 mrg Exp $
2
3# when including this make sure PROG is set so that $X11SRCDIR.$PROG
4# is a valid setting.  set XORG_PKG_VER_PROG if PROG is wrong.
5# set XORG_PKG_VER_CONFIG_PATH if "configure" at the top-level is wrong.
6
7XORG_PKG_VER_PROG?= ${PROG}
8
9XORG_PKG_VER_CONFIG_PATH?=    configure
10_XORG_PKG_CONFIGURE_PATH=     ${X11SRCDIR.${XORG_PKG_VER_PROG}}/${XORG_PKG_VER_CONFIG_PATH}
11
12.if exists(${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure)
13XORG_PKG_PACKAGE_VERSION!= \
14          ${TOOL_AWK} -F= '/^PACKAGE_VERSION=/ {                      \
15               match($$2, "([0-9]+\\.)+[0-9]+");                      \
16               version = substr($$2, RSTART, RLENGTH);                \
17               print version;                                         \
18               exit 0;                                                          \
19          }' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure
20.if !empty(XORG_PKG_PACKAGE_VERSION)
21CPPFLAGS+=          -DPACKAGE_VERSION=\"${XORG_PKG_PACKAGE_VERSION:Q}\"
22CPPFLAGS+=          -DVERSION=\"${XORG_PKG_PACKAGE_VERSION:q}\"
23.endif
24
25XORG_PKG_PACKAGE_STRING!= \
26          ${TOOL_AWK} -F= '/^PACKAGE_STRING=/ {                       \
27               match($$2, "[-_a-zA-Z]+[           ]+([0-9]+\\.)+[0-9]+");       \
28               string = substr($$2, RSTART, RLENGTH);                 \
29               print string;                                          \
30               exit 0;                                                          \
31          }' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure
32.if !empty(XORG_PKG_PACKAGE_STRING)
33CPPFLAGS+=          -DPACKAGE_STRING=\"${XORG_PKG_PACKAGE_STRING:Q}\"
34.endif
35
36XORG_PKG_PACKAGE_NAME!= \
37          ${TOOL_AWK} -F= '/^PACKAGE_NAME=/ {                         \
38               match($$2, "[-_a-zA-Z0-9]+");                          \
39               name = substr($$2, RSTART, RLENGTH);                   \
40               print name;                                            \
41               exit 0;                                                          \
42          }' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure
43.if !empty(XORG_PKG_PACKAGE_NAME)
44CPPFLAGS+=          -DPACKAGE_NAME=\"${XORG_PKG_PACKAGE_NAME:Q}\"
45.endif
46
47XORG_PKG_RELEASE_DATE!= \
48          ${TOOL_AWK} -F= '/^RELEASE_DATE=/ {                         \
49               match($$2, "[-_a-zA-Z0-9]+");                          \
50               name = substr($$2, RSTART, RLENGTH);                   \
51               print name;                                            \
52               exit 0;                                                          \
53          }' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure
54.if !empty(XORG_PKG_RELEASE_DATE)
55CPPFLAGS+=          -DRELEASE_DATE=\"${XORG_PKG_RELEASE_DATE:Q}\"
56.endif
57
58.endif
59