aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses/pathfix.mk
blob: 0306f6ddb9b402d85b9c9afb6cd11613e04e5a28 (plain) (blame)
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
55
56
57
58
# $FreeBSD$
#
# Lookup common paths in Makefile.in, configure and similar files, and replace
# their values to respect FreeBSD hier(7) for file installation.
#
# Feature:  pathfix
# Usage:    USES=pathfix
# Valid ARGS:   does not require args
#
# MAINTAINER: portmgr@FreeBSD.org

.if !defined(_INCLUDE_USES_PATHFIX_MK)
_INCLUDE_USES_PATHFIX_MK=   yes

.if !empty(pathfix_ARGS)
IGNORE= USES=pathfix does not require args
.endif

PATHFIX_CMAKELISTSTXT?= CMakeLists.txt
.if ${USES:Mautoreconf*}
PATHFIX_MAKEFILEIN?=    Makefile.am
.else
PATHFIX_MAKEFILEIN?=    Makefile.in
.endif
PATHFIX_WRKSRC?=    ${WRKSRC}

_USES_patch+=   190:pathfix
pathfix:
.if ${USES:Mcmake*}
    @${FIND} ${PATHFIX_WRKSRC} -name "${PATHFIX_CMAKELISTSTXT}" -type f | ${XARGS} ${REINPLACE_CMD} -e \
        's|[{]CMAKE_INSTALL_LIBDIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]INSTALL_LIB_DIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]INSTALL_LIBDIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]LIB_DESTINATION[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]LIB_DIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]LIB_INSTALL_DIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]KDE_INSTALL_LIBDIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]LIBRARY_INSTALL_DIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|[{]libdir[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \
        s|lib/pkgconfig|libdata/pkgconfig|g'
.else
    @${FIND} ${PATHFIX_WRKSRC} -name "${PATHFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} -e \
        's|[(]libdir[)]/locale|(prefix)/share/locale|g ; \
        s|[(]libdir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
        s|[(]LIBDIR[)]/pkgconfig|(PREFIX)/libdata/pkgconfig|g ; \
        s|@libdir@/locale|@prefix@/share/locale|g ; \
        s|@libdir@/pkgconfig|@prefix@/libdata/pkgconfig|g ; \
        s|[{]libdir[}]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
        s|[{]LIBDIR[}]/pkgconfig|(PREFIX)/libdata/pkgconfig|g ; \
        s|[(]datadir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
        s|[{]datadir[}]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
        s|[(]prefix[)]/lib/pkgconfig|(prefix)/libdata/pkgconfig|g ; \
        s|[[:<:]]lib/pkgconfig|libdata/pkgconfig|g; \
        s|[$$][(]localstatedir[)]/scrollkeeper|${SCROLLKEEPER_DIR}|g ; \
        s|[(]libdir[)]/bonobo/servers|(prefix)/libdata/bonobo/servers|g'
.endif

.endif