| @@ -1,44 +1,49 @@ | | | @@ -1,44 +1,49 @@ |
1 | # $NetBSD: builtin.mk,v 1.2 2011/11/30 07:57:09 sbd Exp $ | | 1 | # $NetBSD: builtin.mk,v 1.3 2011/11/30 08:04:20 sbd Exp $ |
2 | | | 2 | |
3 | BUILTIN_PKG:= libuuid | | 3 | BUILTIN_PKG:= libuuid |
4 | | | 4 | |
5 | BUILTIN_FIND_FILES_VAR= H_UUID | | 5 | BUILTIN_FIND_FILES_VAR= UUID_PC H_UUID |
| | | 6 | BUILTIN_FIND_FILES.UUID_PC= /usr/lib/pkgconfig/uuid.pc |
6 | BUILTIN_FIND_FILES.H_UUID= /usr/include/uuid/uuid.h | | 7 | BUILTIN_FIND_FILES.H_UUID= /usr/include/uuid/uuid.h |
7 | BUILTIN_FIND_GREP.H_UUID= uuid_generate | | 8 | BUILTIN_FIND_GREP.H_UUID= uuid_generate |
8 | BUILTIN_FIND_LIBS:= uuid | | 9 | BUILTIN_FIND_LIBS:= uuid |
9 | | | 10 | |
10 | .include "../../mk/buildlink3/bsd.builtin.mk" | | 11 | .include "../../mk/buildlink3/bsd.builtin.mk" |
11 | | | 12 | |
12 | ## | | 13 | ## |
13 | ## Determine if there is a built-in implementation of the package and | | 14 | ## Determine if there is a built-in implementation of the package and |
14 | ## set IS_BUILTIN.<pkg> appropriately ("yes" or "no"). | | 15 | ## set IS_BUILTIN.<pkg> appropriately ("yes" or "no"). |
15 | ## | | 16 | ## |
16 | .if !defined(IS_BUILTIN.libuuid) | | 17 | .if !defined(IS_BUILTIN.libuuid) |
17 | IS_BUILTIN.libuuid= no | | 18 | IS_BUILTIN.libuuid= no |
18 | . if !empty(BUILTIN_LIB_FOUND.uuid:M[yY][eE][sS]) && \ | | 19 | . if !empty(BUILTIN_LIB_FOUND.uuid:M[yY][eE][sS]) && \ |
19 | empty(H_UUID:M__nonexistent__) | | 20 | empty(H_UUID:M__nonexistent__) |
20 | IS_BUILTIN.libuuid= yes | | 21 | IS_BUILTIN.libuuid= yes |
21 | . endif | | 22 | . endif |
22 | .endif | | 23 | .endif |
23 | MAKEVARS+= IS_BUILTIN.libuuid | | 24 | MAKEVARS+= IS_BUILTIN.libuuid |
24 | | | 25 | |
25 | ### | | 26 | ### |
26 | ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to | | 27 | ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to |
27 | ### a package name to represent the built-in package. | | 28 | ### a package name to represent the built-in package. |
28 | ### | | 29 | ### |
29 | .if !defined(BUILTIN_PKG.libuuid) && \ | | 30 | .if !defined(BUILTIN_PKG.libuuid) && \ |
30 | !empty(IS_BUILTIN.libuuid:M[yY][eE][sS]) | | 31 | !empty(IS_BUILTIN.libuuid:M[yY][eE][sS]) |
| | | 32 | . if empty(UUID_PC:M__nonexistent__) |
| | | 33 | BUILTIN_PKG.libuuid!= ${SED} -n -e 's/Version: //p' ${UUID_PC} |
| | | 34 | . else |
31 | BUILTIN_PKG.libuuid= libuuid-2.18 # whatever, as long as it is big enough | | 35 | BUILTIN_PKG.libuuid= libuuid-2.18 # whatever, as long as it is big enough |
| | | 36 | . endif |
32 | .endif | | 37 | .endif |
33 | | | 38 | |
34 | ### | | 39 | ### |
35 | ### Determine whether we should use the built-in implementation if it | | 40 | ### Determine whether we should use the built-in implementation if it |
36 | ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no"). | | 41 | ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no"). |
37 | ### | | 42 | ### |
38 | .if !defined(USE_BUILTIN.libuuid) | | 43 | .if !defined(USE_BUILTIN.libuuid) |
39 | . if ${PREFER.libuuid} == "pkgsrc" | | 44 | . if ${PREFER.libuuid} == "pkgsrc" |
40 | USE_BUILTIN.libuuid= no | | 45 | USE_BUILTIN.libuuid= no |
41 | . else | | 46 | . else |
42 | USE_BUILTIN.libuuid= ${IS_BUILTIN.libuuid} | | 47 | USE_BUILTIN.libuuid= ${IS_BUILTIN.libuuid} |
43 | . if defined(BUILTIN_PKG.libuuid) && \ | | 48 | . if defined(BUILTIN_PKG.libuuid) && \ |
44 | !empty(IS_BUILTIN.libuuid:M[yY][eE][sS]) | | 49 | !empty(IS_BUILTIN.libuuid:M[yY][eE][sS]) |
| @@ -61,21 +66,27 @@ MAKEVARS+= USE_BUILTIN.libuuid | | | @@ -61,21 +66,27 @@ MAKEVARS+= USE_BUILTIN.libuuid |
61 | ### | | 66 | ### |
62 | ### The section below only applies if we are not including this file | | 67 | ### The section below only applies if we are not including this file |
63 | ### solely to determine whether a built-in implementation exists. | | 68 | ### solely to determine whether a built-in implementation exists. |
64 | ### | | 69 | ### |
65 | CHECK_BUILTIN.libuuid?= no | | 70 | CHECK_BUILTIN.libuuid?= no |
66 | .if !empty(CHECK_BUILTIN.libuuid:M[nN][oO]) | | 71 | .if !empty(CHECK_BUILTIN.libuuid:M[nN][oO]) |
67 | . if !empty(USE_BUILTIN.libuuid:M[yY][eE][sS]) && \ | | 72 | . if !empty(USE_BUILTIN.libuuid:M[yY][eE][sS]) && \ |
68 | !empty(USE_TOOLS:C/:.*//:Mpkg-config) | | 73 | !empty(USE_TOOLS:C/:.*//:Mpkg-config) |
69 | BUILDLINK_TARGETS+= libuuid-fake-pc | | 74 | BUILDLINK_TARGETS+= libuuid-fake-pc |
70 | | | 75 | |
71 | libuuid-fake-pc: | | 76 | libuuid-fake-pc: |
72 | ${RUN} \ | | 77 | ${RUN} \ |
73 | ${MKDIR} ${BUILDLINK_DIR}/lib/pkgconfig; \ | | 78 | ${MKDIR} ${BUILDLINK_DIR}/lib/pkgconfig; \ |
74 | { ${ECHO} "Name: uuid"; \ | | 79 | src=${UUID_PC}; \ |
75 | ${ECHO} "Description: Universally unique id library"; \ | | 80 | dst=${BUILDLINK_DIR}/lib/pkgconfig/uuid.pc; \ |
76 | ${ECHO} "Version: ${BUILTIN_VERSION.libuuid}"; \ | | 81 | if ${TEST} -f $${src}; then \ |
77 | ${ECHO} "Libs: -L/usr/lib -luuid" \ | | 82 | ${LN} -sf $${src} $${dst}; \ |
78 | ${ECHO} "Cflags: -I/usr/include"; \ | | 83 | else \ |
79 | } >${BUILDLINK_DIR}/lib/pkgconfig/uuid.pc | | 84 | { ${ECHO} "Name: uuid"; \ |
| | | 85 | ${ECHO} "Description: Universally unique id library"; \ |
| | | 86 | ${ECHO} "Version: ${BUILTIN_VERSION.libuuid}"; \ |
| | | 87 | ${ECHO} "Libs: -L/usr/lib -luuid" \ |
| | | 88 | ${ECHO} "Cflags: -I/usr/include"; \ |
| | | 89 | } >$${dst} ;\ |
| | | 90 | fi |
80 | . endif | | 91 | . endif |
81 | .endif # CHECK_BUILTIN.libuuid | | 92 | .endif # CHECK_BUILTIN.libuuid |