Mon Jul 19 09:55:04 2021 UTC ()
mk: Fix PR pkg/56299

Add a test to check that an xbase set is installed when a tool depends on
X11 and X11_TYPE=native.
Thanks to Greg and Edgar for their comments and suggestions!


(triaxx)
diff -r1.291 -r1.292 pkgsrc/mk/tools/replace.mk

cvs diff -r1.291 -r1.292 pkgsrc/mk/tools/replace.mk (expand / switch to unified diff)

--- pkgsrc/mk/tools/replace.mk 2020/10/06 17:36:50 1.291
+++ pkgsrc/mk/tools/replace.mk 2021/07/19 09:55:04 1.292
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: replace.mk,v 1.291 2020/10/06 17:36:50 rillig Exp $ 1# $NetBSD: replace.mk,v 1.292 2021/07/19 09:55:04 triaxx Exp $
2# 2#
3# Copyright (c) 2005 The NetBSD Foundation, Inc. 3# Copyright (c) 2005 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# This code is derived from software contributed to The NetBSD Foundation 6# This code is derived from software contributed to The NetBSD Foundation
7# by Johnny C. Lam. 7# by Johnny C. Lam.
8# 8#
9# Redistribution and use in source and binary forms, with or without 9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions 10# modification, are permitted provided that the following conditions
11# are met: 11# are met:
12# 1. Redistributions of source code must retain the above copyright 12# 1. Redistributions of source code must retain the above copyright
13# notice, this list of conditions and the following disclaimer. 13# notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright 14# 2. Redistributions in binary form must reproduce the above copyright
@@ -1266,26 +1266,36 @@ TOOLS_PATH.${_t_}= ${LOCALBASE}/bin/${_t @@ -1266,26 +1266,36 @@ TOOLS_PATH.${_t_}= ${LOCALBASE}/bin/${_t
1266 !empty(_TOOLS_USE_PKGSRC.makedepend:M[yY][eE][sS]) 1266 !empty(_TOOLS_USE_PKGSRC.makedepend:M[yY][eE][sS])
1267TOOLS_CREATE+= makedepend 1267TOOLS_CREATE+= makedepend
1268. if defined(X11_TYPE) && !empty(X11_TYPE:Mmodular) 1268. if defined(X11_TYPE) && !empty(X11_TYPE:Mmodular)
1269TOOLS_DEPENDS.makedepend?= makedepend-[0-9]*:../../devel/makedepend 1269TOOLS_DEPENDS.makedepend?= makedepend-[0-9]*:../../devel/makedepend
1270TOOLS_PATH.makedepend= ${LOCALBASE}/bin/makedepend 1270TOOLS_PATH.makedepend= ${LOCALBASE}/bin/makedepend
1271. else # !empty(X11_TYPE:Mnative) 1271. else # !empty(X11_TYPE:Mnative)
1272TOOLS_PATH.makedepend= ${X11BASE}/bin/makedepend 1272TOOLS_PATH.makedepend= ${X11BASE}/bin/makedepend
1273. endif 1273. endif
1274.endif 1274.endif
1275 1275
1276###################################################################### 1276######################################################################
1277 1277
1278.for _t_ in ${_USE_TOOLS} 1278.for _t_ in ${_USE_TOOLS}
 1279###
 1280### For each tool that depends on X11 for its native version, make
 1281### sure it is really installed (i.e. xbase has been installed).
 1282###
 1283. if defined(TOOLS_PATH.${_t_}) && !empty(X11_TYPE:Mnative)
 1284. if !exists(${TOOLS_PATH.${_t_}}) && !empty(TOOLS_PATH.${_t_}:M${X11BASE}*)
 1285_tmiss_+= ${_t_}
 1286. endif
 1287. endif
 1288
1279. if !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS]) && \ 1289. if !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS]) && \
1280 !defined(TOOLS_IGNORE.${_t_}) 1290 !defined(TOOLS_IGNORE.${_t_})
1281##### 1291#####
1282##### Add the dependencies for each pkgsrc-supplied tool. 1292##### Add the dependencies for each pkgsrc-supplied tool.
1283##### 1293#####
1284. if defined(_TOOLS_DEPMETHOD.${_t_}) && defined(TOOLS_DEPENDS.${_t_}) 1294. if defined(_TOOLS_DEPMETHOD.${_t_}) && defined(TOOLS_DEPENDS.${_t_})
1285. for _dep_ in ${TOOLS_DEPENDS.${_t_}} 1295. for _dep_ in ${TOOLS_DEPENDS.${_t_}}
1286_dep_test:= ${_dep_:C/\:.*$//} 1296_dep_test:= ${_dep_:C/\:.*$//}
1287. if empty(${_TOOLS_DEPMETHOD.${_t_}}:C/\:.*$//:M${_dep_test}) 1297. if empty(${_TOOLS_DEPMETHOD.${_t_}}:C/\:.*$//:M${_dep_test})
1288${_TOOLS_DEPMETHOD.${_t_}}+= ${_dep_} 1298${_TOOLS_DEPMETHOD.${_t_}}+= ${_dep_}
1289. endif 1299. endif
1290. endfor 1300. endfor
1291. endif 1301. endif
@@ -1326,26 +1336,30 @@ TOOLS_CMDLINE.${_t_}?= ${TOOLS_PATH.${_t @@ -1326,26 +1336,30 @@ TOOLS_CMDLINE.${_t_}?= ${TOOLS_PATH.${_t
1326. if defined(_TOOLS_VARNAME.${_t_}) 1336. if defined(_TOOLS_VARNAME.${_t_})
1327. if defined(TOOLS_PATH.${_t_}) 1337. if defined(TOOLS_PATH.${_t_})
1328TOOLS_${_TOOLS_VARNAME.${_t_}}= ${TOOLS_PATH.${_t_}} 1338TOOLS_${_TOOLS_VARNAME.${_t_}}= ${TOOLS_PATH.${_t_}}
1329. endif 1339. endif
1330. if defined(TOOLS_CMDLINE.${_t_}) 1340. if defined(TOOLS_CMDLINE.${_t_})
1331TOOLS_CMDLINE_${_TOOLS_VARNAME.${_t_}}= ${TOOLS_CMDLINE.${_t_}} 1341TOOLS_CMDLINE_${_TOOLS_VARNAME.${_t_}}= ${TOOLS_CMDLINE.${_t_}}
1332. for _v_ in ${_TOOLS_VARNAME.${_t_}} 1342. for _v_ in ${_TOOLS_VARNAME.${_t_}}
1333${_v_}?= ${TOOLS_CMDLINE_${_TOOLS_VARNAME.${_t_}}} 1343${_v_}?= ${TOOLS_CMDLINE_${_TOOLS_VARNAME.${_t_}}}
1334. endfor 1344. endfor
1335. endif 1345. endif
1336. endif 1346. endif
1337.endfor 1347.endfor
1338 1348
 1349.if !empty(_tmiss_)
 1350PKG_FAIL_REASON+= "${X11BASE}: X11_TYPE=native but xbase set is not installed (missing: ${_tmiss_}). Either set X11_TYPE to modular or install xbase."
 1351.endif
 1352
1339###################################################################### 1353######################################################################
1340 1354
1341# For each tool that pkgsrc requires, make sure that the "TOOL" name 1355# For each tool that pkgsrc requires, make sure that the "TOOL" name
1342# points to the real command, e.g., AWK, SED, etc., provided that 1356# points to the real command, e.g., AWK, SED, etc., provided that
1343# "TOOL" has been associated with <tool>. 1357# "TOOL" has been associated with <tool>.
1344# 1358#
1345.for _t_ in ${USE_TOOLS:M*\:pkgsrc:C/:.*//:O:u} 1359.for _t_ in ${USE_TOOLS:M*\:pkgsrc:C/:.*//:O:u}
1346_TOOLS_USE_PKGSRC.${_t_}?= no 1360_TOOLS_USE_PKGSRC.${_t_}?= no
1347. if defined(_TOOLS_VARNAME.${_t_}) 1361. if defined(_TOOLS_VARNAME.${_t_})
1348. if !empty(_TOOLS_USE_PKGSRC.${_t_}:M[nN][oO]) 1362. if !empty(_TOOLS_USE_PKGSRC.${_t_}:M[nN][oO])
1349. if defined(TOOLS_PLATFORM.${_t_}) && !empty(TOOLS_PLATFORM.${_t_}) 1363. if defined(TOOLS_PLATFORM.${_t_}) && !empty(TOOLS_PLATFORM.${_t_})
1350${_TOOLS_VARNAME.${_t_}}= ${TOOLS_PLATFORM.${_t_}} 1364${_TOOLS_VARNAME.${_t_}}= ${TOOLS_PLATFORM.${_t_}}
1351. endif 1365. endif