Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/Mk/Scripts/qa.sh
16461 views
1
#!/bin/sh
2
# MAINTAINER: [email protected]
3
4
set -o pipefail
5
6
if [ -z "${STAGEDIR}" -o -z "${PREFIX}" -o -z "${LOCALBASE}" ]; then
7
echo "STAGEDIR, PREFIX, LOCALBASE required in environment." >&2
8
exit 1
9
fi
10
11
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_QA}" ] && set -x
12
13
LF=$(printf '\nX')
14
LF=${LF%X}
15
16
notice() {
17
echo "Notice: $*" >&2
18
}
19
20
warn() {
21
echo "Warning: $*" >&2
22
}
23
24
err() {
25
echo "Error: $*" >&2
26
}
27
28
list_stagedir_elfs() {
29
cd ${STAGEDIR} && find -s . -type f \( -perm +111 -o -name '*.so*' \) "$@"
30
}
31
32
shebangonefile() {
33
local f interp interparg badinterp rc
34
35
f="$*"
36
rc=0
37
38
# whitelist some files
39
case "${f}" in
40
*.pm|*.pod|*.txt|${STAGEDIR}${LINUXBASE}/*)
41
return 0
42
;;
43
esac
44
45
interp=$(sed -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p;2q' "${f}")
46
badinterp=""
47
case "${interp}" in
48
"") ;;
49
/bin/rc)
50
# whitelist some interpreters
51
;;
52
${LOCALBASE}/bin/python|${PREFIX}/bin/python|${LOCALBASE}/bin/python2|${PREFIX}/bin/python2|${LOCALBASE}/bin/python3|${PREFIX}/bin/python3)
53
badinterp="${interp}"
54
;;
55
${LINUXBASE}/*) ;;
56
${LOCALBASE}/bin/perl5.* | ${PREFIX}/bin/perl5.*)
57
# lang/perl5* are allowed to have these shebangs.
58
if ! expr ${PKGORIGIN} : '^lang/perl5.*' > /dev/null; then
59
err "'${interp}' is an invalid shebang for '${f#${STAGEDIR}${PREFIX}/}' you must use ${LOCALBASE}/bin/perl."
60
err "Either pass \${PERL} to the build or use USES=shebangfix"
61
rc=1
62
fi
63
;;
64
${LOCALBASE}/*) ;;
65
${PREFIX}/*) ;;
66
/bin/csh) ;;
67
/bin/sh) ;;
68
/bin/tcsh) ;;
69
/usr/bin/awk) ;;
70
/usr/bin/env)
71
interparg=$(sed -n -e '1s/^#![[:space:]]*[^[:space:]]*[[:space:]]*\([^[:space:]]*\).*/\1/p;2q' "${f}")
72
case "${interparg}" in
73
python|python2|python3)
74
badinterp="${interp} ${interparg}"
75
;;
76
esac
77
;;
78
/usr/bin/nawk) ;;
79
/usr/bin/sed) ;;
80
/usr/sbin/dtrace) ;;
81
/usr/bin/make) ;;
82
/usr/libexec/atf-sh) ;;
83
*)
84
badinterp="${interp}"
85
;;
86
esac
87
88
if [ -n "${badinterp}" ]; then
89
err "'${badinterp}' is an invalid shebang you need USES=shebangfix for '${f#${STAGEDIR}${PREFIX}/}'"
90
rc=1
91
fi
92
93
return ${rc}
94
}
95
96
shebang() {
97
local f l link rc
98
99
rc=0
100
101
while read -r f; do
102
# No results presents a blank line from heredoc.
103
[ -z "${f}" ] && continue
104
shebangonefile "${f}" || rc=1
105
# Use heredoc to avoid losing rc from find|while subshell
106
done <<-EOF
107
$(find ${STAGEDIR}${PREFIX} \
108
-type f -perm +111 2>/dev/null)
109
EOF
110
111
return ${rc}
112
}
113
114
baselibs() {
115
local rc
116
local found_openssl
117
local file
118
[ "${PKGBASE}" = "pkg" -o "${PKGBASE}" = "pkg-devel" ] && return
119
120
while read -r f; do
121
case ${f} in
122
File:\ .*)
123
file=${f#File: .}
124
;;
125
*NEEDED*\[libarchive.so.[56]])
126
err "Bad linking on ${f##* } for ${file} please add USES=libarchive"
127
rc=1
128
;;
129
*NEEDED*\[libedit.so.7])
130
err "Bad linking on ${f##* } for ${file} please add USES=libedit"
131
rc=1
132
;;
133
*NEEDED*\[libcrypto.so.*]|*NEEDED*\[libssl.so.*])
134
found_openssl=1
135
;;
136
esac
137
done <<-EOF
138
$(list_stagedir_elfs -exec readelf -d {} + 2>/dev/null)
139
EOF
140
141
if ! list_stagedir_elfs | egrep -q 'lib(crypto|ssl).so*'; then
142
if [ -z "${USESSSL}" -a -n "${found_openssl}" ]; then
143
warn "you need USES=ssl"
144
elif [ -n "${USESSSL}" -a -z "${found_openssl}" ]; then
145
warn "you may not need USES=ssl"
146
fi
147
fi
148
return ${rc}
149
}
150
151
symlinks() {
152
local rc
153
154
rc=0
155
156
# Split stat(1) result into 2 lines and read each line separately to
157
# retain spaces in filenames.
158
while read -r l; do
159
# No results presents a blank line from heredoc.
160
[ -z "${l}" ] && continue
161
read -r link
162
case "${link}" in
163
${STAGEDIR}*)
164
err "Bad symlink '${l#${STAGEDIR}${PREFIX}/}' pointing inside the stage directory"
165
rc=1
166
;;
167
/*)
168
# Only warn for symlinks within the package.
169
if [ -e "${STAGEDIR}${link}" ]; then
170
warn "Bad symlink '${l#${STAGEDIR}}' pointing to an absolute pathname '${link}'"
171
fi
172
# Also warn if the symlink exists nowhere.
173
if [ ! -e "${STAGEDIR}${link}" -a ! -e "${link}" ]; then
174
warn "Symlink '${l#${STAGEDIR}}' pointing to '${link}' which does not exist in the stage directory or in localbase"
175
fi
176
;;
177
esac
178
# Use heredoc to avoid losing rc from find|while subshell.
179
done <<-EOF
180
$(find ${STAGEDIR} -type l -exec stat -f "%N${LF}%Y" {} +)
181
EOF
182
183
return ${rc}
184
}
185
186
paths() {
187
local rc
188
189
rc=0
190
191
while read -r f; do
192
# No results presents a blank line from heredoc.
193
[ -z "${f}" ] && continue
194
# Ignore false-positive/harmless files
195
case "${f}" in
196
*/lib/ruby/gems/*) continue ;;
197
*/share/texmf-var/web2c/*/*.fmt) continue ;;
198
*/share/texmf-var/web2c/*/*.log) continue ;;
199
esac
200
err "'${f#${STAGEDIR}${PREFIX}/}' is referring to ${STAGEDIR}"
201
rc=1
202
# Use heredoc to avoid losing rc from find|while subshell
203
done <<-EOF
204
$(find ${TMPPLIST} ${STAGEDIR} -type f -exec grep -l "${STAGEDIR}" {} +)
205
EOF
206
207
return ${rc}
208
}
209
210
# For now do not raise an error, just warnings
211
stripped() {
212
[ -x /usr/bin/file ] || return # this is fatal
213
[ -n "${STRIP}" ] || return 0
214
# Split file and result into 2 lines and read separately to ensure
215
# files with spaces are kept intact.
216
# Using readelf -h ... /ELF Header:/ will match on all ELF files.
217
find ${STAGEDIR} -type f ! -name '*.a' ! -name '*.o' \
218
-exec sh -c 'readelf -S -- /dev/null "$0" "$@" || :' -- {} + 2>/dev/null | awk '
219
/File:/ {sub(/File: /, "", $0); file=$0}
220
/[[:space:]]\.debug_info[[:space:]]*PROGBITS/ {print file}' |
221
while read -r f; do
222
warn "'${f#${STAGEDIR}${PREFIX}/}' is not stripped consider trying INSTALL_TARGET=install-strip or using \${STRIP_CMD}"
223
done
224
}
225
226
desktopfileutils() {
227
if [ -z "${USESDESKTOPFILEUTILS}" ]; then
228
grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null &&
229
warn "you need USES=desktop-file-utils"
230
else
231
grep -q MimeType= ${STAGEDIR}${PREFIX}/share/applications/*.desktop 2>/dev/null ||
232
warn "you may not need USES=desktop-file-utils"
233
fi
234
return 0
235
}
236
237
sharedmimeinfo() {
238
local f found
239
240
found=0
241
for f in ${STAGEDIR}${PREFIX}/share/mime/packages/*.xml; do
242
[ "${f}" = "${STAGEDIR}${PREFIX}/share/mime/packages/*.xml" ] && break #no matches
243
[ "${f}" = "${STAGEDIR}${PREFIX}/share/mime/packages/freedesktop.org.xml" ] && continue
244
found=1
245
break
246
done
247
if [ -z "${USESSHAREDMIMEINFO}" -a ${found} -eq 1 ]; then
248
warn "you need USES=shared-mime-info"
249
elif [ -n "${USESSHAREDMIMEINFO}" -a ${found} -eq 0 ]; then
250
warn "you may not need USES=shared-mime-info"
251
fi
252
return 0
253
}
254
255
suidfiles() {
256
local filelist
257
258
filelist=$(find ${STAGEDIR} -type f \
259
\( -perm -u+x -or -perm -g+x -or -perm -o+x \) \
260
\( -perm -u+s -or -perm -g+s \))
261
if [ -n "${filelist}" ]; then
262
warn "setuid files in the stage directory (are these necessary?):"
263
ls -liTd ${filelist}
264
fi
265
return 0
266
}
267
268
libtool() {
269
if [ -z "${USESLIBTOOL}" ]; then
270
find ${STAGEDIR} -name '*.la' | while read -r f; do
271
if grep -q 'libtool library' "${f}"; then
272
err ".la libraries found, port needs USES=libtool"
273
return 1
274
fi
275
done
276
# The return above continues here.
277
fi
278
}
279
280
libperl() {
281
local has_some_libperl_so files found
282
if [ -n "${SITE_ARCH_REL}" -a -d "${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}" ]; then
283
has_some_libperl_so=0
284
files=0
285
while read -r f; do
286
# No results presents a blank line from heredoc.
287
[ -z "${f}" ] && continue
288
files=$((files+1))
289
found=$(readelf -d ${f} | awk "BEGIN {libperl=1}
290
/NEEDED.*${LIBPERL}/ { libperl = 0 }
291
END {print libperl}
292
")
293
case "${found}" in
294
1)
295
warn "${f} is not linked with ${LIBPERL}, not respecting lddlflags?"
296
;;
297
0)
298
has_some_libperl_so=1
299
;;
300
esac
301
# Use heredoc to avoid losing rc from find|while subshell
302
done <<-EOT
303
$(find ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} -name '*.so')
304
EOT
305
306
if [ ${files} -gt 0 -a ${has_some_libperl_so} -eq 0 ]; then
307
err "None of the ${files} .so in ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL} are linked with ${LIBPERL}, see above for the full list."
308
return 1
309
else
310
return 0
311
fi
312
fi
313
}
314
315
prefixvar() {
316
if [ ${PREFIX} != ${LINUXBASE} -a -d ${STAGEDIR}${PREFIX}/var ]; then
317
warn "port uses ${PREFIX}/var instead of /var"
318
fi
319
}
320
321
terminfo() {
322
local f found
323
324
for f in ${STAGEDIR}${PREFIX}/share/misc/*.terminfo; do
325
[ "${f}" = "${STAGEDIR}${PREFIX}/share/misc/*.terminfo" ] && break #no matches
326
found=1
327
break
328
done
329
for f in ${STAGEDIR}${PREFIX}/share/misc/terminfo.db*; do
330
[ "${f}" = "${STAGEDIR}${PREFIX}/share/misc/terminfo.db*" ] && break #no matches
331
found=1
332
break
333
done
334
if [ -z "${USESTERMINFO}" -a -n "${found}" ]; then
335
warn "you need USES=terminfo"
336
elif [ -n "${USESTERMINFO}" -a -z "${found}" ]; then
337
warn "you may not need USES=terminfo"
338
fi
339
return 0
340
}
341
342
listcontains() {
343
local str lst elt
344
str=$1
345
lst=$2
346
347
for elt in ${lst} ; do
348
if [ ${elt} = ${str} ]; then
349
return 0
350
fi
351
done
352
return 1
353
}
354
355
proxydeps_suggest_uses() {
356
local pkg=$1
357
local lib_file=$2
358
359
# miscellaneous USE clauses
360
if [ ${pkg} = 'devel/gettext-runtime' ]; then
361
warn "you need USES+=gettext-runtime"
362
elif [ ${pkg} = 'databases/sqlite3' ]; then
363
warn "you need USES+=sqlite"
364
elif [ ${pkg} = 'databases/sqlite2' ]; then
365
warn "you need USES+=sqlite:2"
366
# Gnome -> same as port
367
# grep LIB_DEPENDS= Mk/Uses/gnome.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|[ "\1" = "\3" ] \&\& echo "\\${pkg} = \\\"\2/\3\\\" -o \\\\"|'|sort|sh
368
elif [ ${pkg} = "accessibility/atk" -o \
369
${pkg} = "accessibility/atkmm" -o \
370
${pkg} = "graphics/cairo" -o \
371
${pkg} = "graphics/cairomm" -o \
372
${pkg} = "devel/dconf" -o \
373
${pkg} = "devel/gconf2" -o \
374
${pkg} = "devel/glib20" -o \
375
${pkg} = "devel/glibmm" -o \
376
${pkg} = "audio/gsound" -o \
377
${pkg} = "x11-toolkits/gtk20" -o \
378
${pkg} = "x11-toolkits/gtk30" -o \
379
${pkg} = "www/gtkhtml4" -o \
380
${pkg} = "x11-toolkits/gtkmm20" -o \
381
${pkg} = "x11-toolkits/gtkmm24" -o \
382
${pkg} = "x11-toolkits/gtkmm30" -o \
383
${pkg} = "x11-toolkits/gtksourceview2" -o \
384
${pkg} = "x11-toolkits/gtksourceview3" -o \
385
${pkg} = "x11-toolkits/gtksourceviewmm3" -o \
386
${pkg} = "databases/libgda5" -o \
387
${pkg} = "databases/libgda5-ui" -o \
388
${pkg} = "devel/libglade2" -o \
389
${pkg} = "graphics/libgnomecanvas" -o \
390
${pkg} = "x11/libgnomekbd" -o \
391
${pkg} = "devel/libgsf" -o \
392
${pkg} = "graphics/librsvg2" -o \
393
${pkg} = "devel/libsigc++12" -o \
394
${pkg} = "devel/libsigc++20" -o \
395
${pkg} = "x11-toolkits/libwnck" -o \
396
${pkg} = "x11-toolkits/libwnck3" -o \
397
${pkg} = "textproc/libxml++26" -o \
398
${pkg} = "textproc/libxml2" -o \
399
${pkg} = "textproc/libxslt" -o \
400
${pkg} = "x11-toolkits/pango" -o \
401
${pkg} = "x11-toolkits/pangomm" -o \
402
${pkg} = "x11-toolkits/pangox-compat" -o \
403
${pkg} = "x11-toolkits/vte" -o \
404
${pkg} = "x11-toolkits/vte3" ]; then
405
warn "you need USE_GNOME+=${pkg#*/}"
406
# Gnome different as port
407
# grep LIB_DEPENDS= Mk/Uses/gnome.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|[ "\1" = "\3" ] \|\| echo "elif [ \\${pkg} = \\\"\2/\3\\\" ]; then; warn \\\"you need USE_GNOME+=\1\\\""|'|sort|sh
408
elif [ ${pkg} = "databases/evolution-data-server" ]; then warn "you need USE_GNOME+=evolutiondataserver3"
409
elif [ ${pkg} = "graphics/gdk-pixbuf" ]; then warn "you need USE_GNOME+=gdkpixbuf"
410
elif [ ${pkg} = "graphics/gdk-pixbuf2" ]; then warn "you need USE_GNOME+=gdkpixbuf"
411
elif [ ${pkg} = "x11/gnome-desktop" ]; then warn "you need USE_GNOME+=gnomedesktop3"
412
elif [ ${pkg} = "devel/gobject-introspection" ]; then warn "you need USE_GNOME+=introspection"
413
elif [ ${pkg} = "graphics/libart_lgpl" ]; then warn "you need USE_GNOME+=libartlgpl2"
414
elif [ ${pkg} = "devel/libIDL" ]; then warn "you need USE_GNOME+=libidl"
415
elif [ ${pkg} = "x11-fm/nautilus" ]; then warn "you need USE_GNOME+=nautilus4"
416
elif [ ${pkg} = "graphics/librsvg2-rust" ]; then warn "you need USE_GNOME+=librsvg2"
417
# mate
418
# grep LIB_DEPENDS= Mk/Uses/mate.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_MATE+=\1"|'
419
elif [ ${pkg} = "x11-fm/caja" ]; then warn "you need USE_MATE+=caja"
420
elif [ ${pkg} = "sysutils/mate-control-center" ]; then warn "you need USE_MATE+=controlcenter"
421
elif [ ${pkg} = "x11/mate-desktop" ]; then warn "you need USE_MATE+=desktop"
422
elif [ ${pkg} = "x11/libmatekbd" ]; then warn "you need USE_MATE+=libmatekbd"
423
elif [ ${pkg} = "net/libmateweather" ]; then warn "you need USE_MATE+=libmateweather"
424
elif [ ${pkg} = "x11-wm/marco" ]; then warn "you need USE_MATE+=marco"
425
elif [ ${pkg} = "x11/mate-menus" ]; then warn "you need USE_MATE+=menus"
426
elif [ ${pkg} = "x11/mate-panel" ]; then warn "you need USE_MATE+=panel"
427
elif [ ${pkg} = "sysutils/mate-polkit" ]; then warn "you need USE_MATE+=polkit"
428
# KDE
429
# grep -B1 _LIB= Mk/Uses/kde.mk | grep _PORT=|sed -e 's/^kde-\(.*\)_PORT=[[:space:]]*\([^[:space:]]*\).*/elif [ ${pkg} = "\2" ]; then warn "you need to use USE_KDE+=\1"/'
430
# KDE Applications
431
elif [ ${pkg} = "net/akonadi-contacts" ]; then warn "you need to use USE_KDE+=akonadicontacts"
432
elif [ ${pkg} = "deskutils/akonadi-import-wizard" ]; then warn "you need to use USE_KDE+=akonadiimportwizard"
433
elif [ ${pkg} = "net/akonadi-mime" ]; then warn "you need to use USE_KDE+=akonadimime"
434
elif [ ${pkg} = "net/akonadi-notes" ]; then warn "you need to use USE_KDE+=akonadinotes"
435
elif [ ${pkg} = "net/akonadi-calendar" ]; then warn "you need to use USE_KDE+=akonadicalendar"
436
elif [ ${pkg} = "net/akonadi-search" ]; then warn "you need to use USE_KDE+=akonadisearch"
437
elif [ ${pkg} = "net/calendarsupport" ]; then warn "you need to use USE_KDE+=calendarsupport"
438
elif [ ${pkg} = "net/kcalcore" ]; then warn "you need to use USE_KDE+=calendarcore"
439
elif [ ${pkg} = "net/kcalutils" ]; then warn "you need to use USE_KDE+=calendarutils"
440
elif [ ${pkg} = "net/kcontacts" ]; then warn "you need to use USE_KDE+=contacts"
441
elif [ ${pkg} = "net/eventviews" ]; then warn "you need to use USE_KDE+=eventviews"
442
elif [ ${pkg} = "net/libkgapi" ]; then warn "you need to use USE_KDE+=gapi"
443
elif [ ${pkg} = "deskutils/grantleetheme" ]; then warn "you need to use USE_KDE+=grantleetheme"
444
elif [ ${pkg} = "net/libgravatar" ]; then warn "you need to use USE_KDE+=gravatar"
445
elif [ ${pkg} = "net/kidentitymanagement" ]; then warn "you need to use USE_KDE+=identitymanagement"
446
elif [ ${pkg} = "net/kimap" ]; then warn "you need to use USE_KDE+=imap"
447
elif [ ${pkg} = "net/incidenceeditor" ]; then warn "you need to use USE_KDE+=incidenceeditor"
448
elif [ ${pkg} = "deskutils/kdepim-apps-libs" ]; then warn "you need to use USE_KDE+=kdepim-apps-libs"
449
elif [ ${pkg} = "net/kitinerary" ]; then warn "you need to use USE_KDE+=kitinerary"
450
elif [ ${pkg} = "net/kontactinterface" ]; then warn "you need to use USE_KDE+=kontactinterface"
451
elif [ ${pkg} = "net/kf5-kdav" ]; then warn "you need to use USE_KDE+=kdav"
452
elif [ ${pkg} = "security/kpkpass" ]; then warn "you need to use USE_KDE+=kpkpass"
453
elif [ ${pkg} = "net/ksmtp" ]; then warn "you need to use USE_KDE+=ksmtp"
454
elif [ ${pkg} = "net/kldap" ]; then warn "you need to use USE_KDE+=ldap"
455
elif [ ${pkg} = "deskutils/libkdepim" ]; then warn "you need to use USE_KDE+=libkdepim"
456
elif [ ${pkg} = "security/libkleo" ]; then warn "you need to use USE_KDE+=libkleo"
457
elif [ ${pkg} = "net/libksieve" ]; then warn "you need to use USE_KDE+=libksieve"
458
elif [ ${pkg} = "net/mailcommon" ]; then warn "you need to use USE_KDE+=mailcommon"
459
elif [ ${pkg} = "net/mailimporter" ]; then warn "you need to use USE_KDE+=mailimporter"
460
elif [ ${pkg} = "net/kmailtransport" ]; then warn "you need to use USE_KDE+=mailtransport"
461
elif [ ${pkg} = "net/kmbox" ]; then warn "you need to use USE_KDE+=mbox"
462
elif [ ${pkg} = "net/messagelib" ]; then warn "you need to use USE_KDE+=messagelib"
463
elif [ ${pkg} = "net/kmime" ]; then warn "you need to use USE_KDE+=mime"
464
elif [ ${pkg} = "net/pimcommon" ]; then warn "you need to use USE_KDE+=pimcommon"
465
elif [ ${pkg} = "net/kpimtextedit" ]; then warn "you need to use USE_KDE+=pimtextedit"
466
elif [ ${pkg} = "net/ktnef" ]; then warn "you need to use USE_KDE+=tnef"
467
elif [ ${pkg} = "databases/akonadi" ]; then warn "you need to use USE_KDE+=akonadi"
468
elif [ ${pkg} = "sysutils/baloo-widgets" ]; then warn "you need to use USE_KDE+=baloo-widgets"
469
elif [ ${pkg} = "audio/libkcddb" ]; then warn "you need to use USE_KDE+=libkcddb"
470
elif [ ${pkg} = "audio/libkcompactdisc" ]; then warn "you need to use USE_KDE+=libkcompactdisc"
471
elif [ ${pkg} = "graphics/libkdcraw" ]; then warn "you need to use USE_KDE+=libkdcraw"
472
elif [ ${pkg} = "games/libkdegames" ]; then warn "you need to use USE_KDE+=libkdegames"
473
elif [ ${pkg} = "misc/libkeduvocdocument" ]; then warn "you need to use USE_KDE+=libkeduvocdocument"
474
elif [ ${pkg} = "graphics/libkexiv2" ]; then warn "you need to use USE_KDE+=libkexiv2"
475
elif [ ${pkg} = "graphics/libksane" ]; then warn "you need to use USE_KDE+=libksane"
476
elif [ ${pkg} = "astro/marble" ]; then warn "you need to use USE_KDE+=marble"
477
elif [ ${pkg} = "graphics/okular" ]; then warn "you need to use USE_KDE+=okular"
478
# KDE Plasma
479
elif [ ${pkg} = "x11/plasma5-kactivitymanagerd" ]; then warn "you need to use USE_KDE+=activitymanagerd"
480
elif [ ${pkg} = "x11-wm/plasma5-kdecoration" ]; then warn "you need to use USE_KDE+=decoration"
481
elif [ ${pkg} = "devel/plasma5-khotkeys" ]; then warn "you need to use USE_KDE+=hotkeys"
482
elif [ ${pkg} = "sysutils/plasma5-kmenuedit" ]; then warn "you need to use USE_KDE+=kmenuedit"
483
elif [ ${pkg} = "security/plasma5-kscreenlocker" ]; then warn "you need to use USE_KDE+=kscreenlocker"
484
elif [ ${pkg} = "x11/plasma5-libkscreen" ]; then warn "you need to use USE_KDE+=libkscreen"
485
elif [ ${pkg} = "sysutils/plasma5-libksysguard" ]; then warn "you need to use USE_KDE+=libksysguard"
486
elif [ ${pkg} = "deskutils/plasma5-milou" ]; then warn "you need to use USE_KDE+=milou"
487
elif [ ${pkg} = "x11-themes/plasma5-oxygen" ]; then warn "you need to use USE_KDE+=oxygen"
488
elif [ ${pkg} = "x11/plasma5-plasma-workspace" ]; then warn "you need to use USE_KDE+=plasma-workspace"
489
elif [ ${pkg} = "sysutils/plasma5-powerdevil" ]; then warn "you need to use USE_KDE+=powerdevil"
490
# KDE Frameworks
491
elif [ ${pkg} = "x11-toolkits/kf5-attica" ]; then warn "you need to use USE_KDE+=attica"
492
elif [ ${pkg} = "sysutils/kf5-baloo" ]; then warn "you need to use USE_KDE+=baloo"
493
elif [ ${pkg} = "x11/kf5-frameworkintegration" ]; then warn "you need to use USE_KDE+=frameworkintegration"
494
elif [ ${pkg} = "devel/kf5-kcmutils" ]; then warn "you need to use USE_KDE+=kcmutils"
495
elif [ ${pkg} = "devel/kf5-kdeclarative" ]; then warn "you need to use USE_KDE+=kdeclarative"
496
elif [ ${pkg} = "x11/kf5-kded" ]; then warn "you need to use USE_KDE+=kded"
497
elif [ ${pkg} = "x11/kf5-kdelibs4support" ]; then warn "you need to use USE_KDE+=kdelibs4support"
498
elif [ ${pkg} = "security/kf5-kdesu" ]; then warn "you need to use USE_KDE+=kdesu"
499
elif [ ${pkg} = "www/kf5-khtml" ]; then warn "you need to use USE_KDE+=khtml"
500
elif [ ${pkg} = "devel/kf5-kio" ]; then warn "you need to use USE_KDE+=kio"
501
elif [ ${pkg} = "lang/kf5-kross" ]; then warn "you need to use USE_KDE+=kross"
502
elif [ ${pkg} = "x11/kf5-plasma-framework" ]; then warn "you need to use USE_KDE+=plasma-framework"
503
elif [ ${pkg} = "graphics/kf5-prison" ]; then warn "you need to use USE_KDE+=prison"
504
elif [ ${pkg} = "misc/kf5-purpose" ]; then warn "you need to use USE_KDE+=purpose"
505
elif [ ${pkg} = "devel/kf5-solid" ]; then warn "you need to use USE_KDE+=solid"
506
elif [ ${pkg} = "textproc/kf5-sonnet" ]; then warn "you need to use USE_KDE+=sonnet"
507
elif [ ${pkg} = "net/kf5-syndication" ]; then warn "you need to use USE_KDE+=syndication"
508
elif [ ${pkg} = "textproc/kf5-syntax-highlighting" ]; then warn "you need to use USE_KDE+=syntaxhighlighting"
509
elif [ ${pkg} = "devel/kf5-threadweaver" ]; then warn "you need to use USE_KDE+=threadweaver"
510
elif expr ${pkg} : '.*/kf5-.*' > /dev/null; then
511
warn "you need USE_KDE+=$(echo ${pkg} | sed -E 's|.*/kf5-k||')"
512
# GStreamer 0.10
513
elif [ ${pkg} = "multimedia/gstreamer" ]; then warn "you need to use USE_GSTREAMER+=yes"
514
elif [ ${pkg} = "multimedia/gstreamer-plugins" ]; then warn "you need to use USE_GSTREAMER+=yes"
515
elif [ ${pkg} = "multimedia/gstreamer-plugins-bad" ]; then warn "you need to use USE_GSTREAMER+=bad"
516
# GStreamer 1
517
elif [ ${pkg} = "multimedia/gstreamer1" ]; then warn "you need to use USE_GSTREAMER1+=yes"
518
elif [ ${pkg} = "multimedia/gstreamer1-plugins" ]; then warn "you need to use USE_GSTREAMER1+=yes"
519
elif [ ${pkg} = "multimedia/gstreamer1-plugins-bad" ]; then warn "you need to use USE_GSTREAMER1+=bad"
520
# boost related
521
elif [ ${pkg} = "devel/boost-python-libs" ]; then warn "you need to add LIB_DEPENDS+=\${PY_BOOST} and maybe USES+=python"
522
# sdl-related
523
elif [ ${pkg} = 'devel/sdl12' ]; then
524
warn "you need USE_SDL+=sdl"
525
elif echo ${pkg} | grep -E '/sdl_(console|gfx|image|mixer|mm|net|pango|sound|ttf)$' > /dev/null; then
526
warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl_||')"
527
elif [ ${pkg} = 'devel/sdl20' ]; then
528
warn "you need USE_SDL+=sdl2"
529
elif echo ${pkg} | grep -E '/sdl2_(gfx|image|mixer|net|ttf)$' > /dev/null; then
530
warn "you need USE_SDL+=$(echo ${pkg} | sed -E 's|.*/sdl2_||')2"
531
# gl-related
532
elif expr ${lib_file} : "${LOCALBASE}/lib/libGL.so.*$" > /dev/null; then
533
warn "you need USE_GL+=gl"
534
elif expr ${lib_file} : "${LOCALBASE}/lib/libGLX.so.*$" > /dev/null; then
535
warn "you need USE_GL+=gl"
536
elif expr ${lib_file} : "${LOCALBASE}/lib/libgbm.so.*$" > /dev/null; then
537
warn "you need USE_GL+=gbm"
538
elif expr ${lib_file} : "${LOCALBASE}/lib/libGLESv2.so.*$" > /dev/null; then
539
warn "you need USE_GL+=glesv2"
540
elif expr ${lib_file} : "${LOCALBASE}/lib/libEGL.so.*$" > /dev/null; then
541
warn "you need USE_GL+=egl"
542
elif expr ${lib_file} : "${LOCALBASE}/lib/libOpenGL.so.*$" > /dev/null; then
543
warn "you need USE_GL+=opengl"
544
elif [ ${pkg} = 'graphics/glew' ]; then
545
warn "you need USE_GL+=glew"
546
elif [ ${pkg} = 'graphics/libGLU' ]; then
547
warn "you need USE_GL+=glu"
548
elif [ ${pkg} = 'graphics/libGLw' ]; then
549
warn "you need USE_GL+=glw"
550
elif [ ${pkg} = 'graphics/freeglut' ]; then
551
warn "you need USE_GL+=glut"
552
# Xorg-libraries: this should be by XORG_MODULES @ bsd.xorg.mk
553
elif echo ${pkg} | grep -E '/lib(X11|Xau|Xdmcp|Xext|SM|ICE|Xfixes|Xft|Xdamage|Xcomposite|Xcursor|Xinerama|Xmu|Xmuu|Xpm|Xt|Xtst|Xi|Xrandr|Xrender|Xres|XScrnSaver|Xv|Xxf86vm|Xxf86dga|Xxf86misc|xcb)$' > /dev/null; then
554
warn "you need USE_XORG+=$(echo ${pkg} | sed -E 's|.*/lib||' | tr '[:upper:]' '[:lower:]')"
555
elif [ ${pkg} = 'x11/pixman' ]; then
556
warn "you need USE_XORG+=pixman"
557
# Qt5
558
elif expr ${pkg} : '.*/qt5-.*' > /dev/null; then
559
warn "you need USES=qt:5 and USE_QT+=$(echo ${pkg} | sed -E 's|.*/qt5-||')"
560
# Qt6
561
elif expr ${pkg} : '.*/qt6-.*' > /dev/null; then
562
warn "you need USES=qt:6 and USE_QT+=$(echo ${pkg} | sed -E 's|.*/qt6-||')"
563
# MySQL
564
elif expr ${lib_file} : "${LOCALBASE}/lib/mysql/[^/]*$" > /dev/null; then
565
warn "you need USES+=mysql"
566
# postgresql
567
elif expr ${pkg} : "^databases/postgresql.*-client" > /dev/null; then
568
warn "you need USES+=pgsql"
569
# bdb
570
elif expr ${pkg} : "^databases/db[456]" > /dev/null; then
571
warn "you need USES+=bdb"
572
# fam/gamin
573
elif [ ${pkg} = "devel/fam" -o ${pkg} = "devel/gamin" ]; then
574
warn "you need USES+=fam"
575
# firebird
576
elif [ ${pkg} = "databases/firebird25-client" ]; then
577
warn "you need USES+=firebird"
578
# fuse
579
elif [ ${pkg} = "filesystems/fusefs-libs" ]; then
580
warn "you need USES+=fuse"
581
# gnustep
582
elif [ ${pkg} = "lang/gnustep-base" ]; then
583
warn "you need USES+=gnustep and USE_GNUSTEP+=base"
584
elif [ ${pkg} = "x11-toolkits/gnustep-gui" ]; then
585
warn "you need USES+=gnustep and USE_GNUSTEP+=gui"
586
# iconv
587
elif [ ${pkg} = "converters/libiconv" ]; then
588
warn "you need USES+=iconv, USES+=iconv:wchar_t, or USES+=iconv:translit depending on needs"
589
# jpeg
590
elif [ ${pkg} = "graphics/jpeg-turbo" ]; then
591
warn "you need USES+=jpeg"
592
# libarchive
593
elif [ ${pkg} = "archivers/libarchive" ]; then
594
warn "you need USES+=libarchive"
595
elif [ ${pkg} = "devel/libedit" ]; then
596
warn "you need USES+=libedit"
597
# lua
598
elif expr ${pkg} : "^lang/lua" > /dev/null; then
599
warn "you need USES+=lua"
600
# magick
601
elif [ ${pkg} = "graphics/ImageMagick6" ] ; then
602
warn "you need USES=magick:6"
603
elif [ ${pkg} = "graphics/ImageMagick6-nox11" ] ; then
604
warn "you need USES=magick:6,nox11"
605
elif [ ${pkg} = "graphics/ImageMagick7" ] ; then
606
warn "you need USES=magick:7"
607
elif [ ${pkg} = "graphics/ImageMagick7-nox11" ] ; then
608
warn "you need USES=magick:7,nox11"
609
# motif
610
elif [ ${pkg} = "x11-toolkits/lesstif" -o ${pkg} = "x11-toolkits/open-motif" ]; then
611
warn "you need USES+=motif"
612
# ncurses
613
elif [ ${pkg} = "devel/ncurses" ]; then
614
warn "you need USES+=ncurses"
615
# objc
616
elif [ ${pkg} = "lang/libobjc2" ]; then
617
warn "you need USES+=objc"
618
# openal
619
elif [ ${pkg} = "audio/openal" -o ${pkg} = "audio/openal-soft" -o ${pkg} = "audio/freealut" ]; then
620
warn "you need USES+=openal"
621
# readline
622
elif [ ${pkg} = "devel/readline" ]; then
623
warn "you need USES+=readline"
624
# ssl
625
# When updating this, please also update the versions list in
626
# bsd.default-versions.mk and ssl.mk!
627
elif [ ${pkg} = "security/openssl" -o ${pkg} = "security/openssl111" \
628
-o ${pkg} = "security/openssl31" -o ${pkg} = "security/openssl32" \
629
-o ${pkg} = "security/openssl33" \
630
-o ${pkg} = "security/libressl" -o ${pkg} = "security/libressl-devel" \
631
]; then
632
warn "you need USES=ssl"
633
# Tcl
634
elif expr ${pkg} : "^lang/tcl" > /dev/null; then
635
warn "you need USES+=tcl"
636
# Tk
637
elif expr ${pkg} : "^x11-toolkits/tk" > /dev/null; then
638
warn "you need USES+=tk"
639
# Xfce
640
# grep LIB_DEPENDS= Mk/Uses/xfce.mk |sed -e 's|\(.*\)_LIB_DEPENDS.*:\(.*\)\/\(.*\)|elif [ ${pkg} = "\2/\3" ]; then warn "you need USE_XFCE+=\1"|'
641
elif [ ${pkg} = "sysutils/garcon" ]; then warn "you need USE_XFCE+=garcon"
642
elif [ ${pkg} = "x11/libexo" ]; then warn "you need USE_XFCE+=libexo"
643
elif [ ${pkg} = "x11-toolkits/libxfce4gui" ]; then warn "you need USE_XFCE+=libgui"
644
elif [ ${pkg} = "x11/libxfce4menu" ]; then warn "you need USE_XFCE+=libmenu"
645
elif [ ${pkg} = "x11/libxfce4util" ]; then warn "you need USE_XFCE+=libutil"
646
elif [ ${pkg} = "x11-wm/xfce4-panel" ]; then warn "you need USE_XFCE+=panel"
647
elif [ ${pkg} = "x11-fm/thunar" ]; then warn "you need USE_XFCE+=thunar"
648
elif [ ${pkg} = "x11/xfce4-conf" ]; then warn "you need USE_XFCE+=xfconf"
649
# default
650
elif expr ${lib_file} : "${LOCALBASE}/lib/[^/]*$" > /dev/null; then
651
lib_file=${lib_file#${LOCALBASE}/lib/}
652
lib_file=${lib_file%.so*}.so
653
warn "you need LIB_DEPENDS+=${lib_file}:${pkg}"
654
fi
655
}
656
657
proxydeps() {
658
local file dep_file dep_file_pkg already rc dep_lib_file dep_lib_files
659
660
rc=0
661
662
# Check all dynamically linked ELF files
663
# Some .so are not executable, but we want to check them too.
664
while read -r file; do
665
# No results presents a blank line from heredoc.
666
[ -z "${file}" ] && continue
667
while read -r dep_file; do
668
# No results presents a blank line from heredoc.
669
[ -z "${dep_file}" ] && continue
670
# Skip files we already checked.
671
if listcontains ${dep_file} "${already}"; then
672
continue
673
fi
674
if pkg which -q ${dep_file} > /dev/null 2>&1; then
675
dep_file_pkg=$(pkg which -qo ${dep_file})
676
677
# Check that the .so we need has a SONAME
678
if [ "${dep_file_pkg}" != "${PKGORIGIN}" ]; then
679
# When grep -q finds a match it will close the pipe immediately.
680
# This may cause the test to fail when pipefail is turned on.
681
set +o pipefail
682
if ! readelf -d "${dep_file}" | grep SONAME > /dev/null; then
683
err "${file} is linked to ${dep_file} which does not have a SONAME. ${dep_file_pkg} needs to be fixed."
684
fi
685
set -o pipefail
686
fi
687
688
# If we don't already depend on it, and we don't provide it
689
if ! listcontains ${dep_file_pkg} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
690
# If the package has a flavor, check that the dependency is not on that particular flavor.
691
flavor=$(pkg annotate -q -S "$(pkg which -q "${dep_file}")" flavor)
692
if [ -n "${flavor}" ]; then
693
if listcontains ${dep_file_pkg}@${flavor} "${LIB_RUN_DEPENDS} ${PKGORIGIN}"; then
694
continue
695
fi
696
fi
697
err "${file} is linked to ${dep_file} from ${dep_file_pkg} but it is not declared as a dependency"
698
proxydeps_suggest_uses ${dep_file_pkg} ${dep_file}
699
rc=1
700
fi
701
else
702
err "${file} is linked to ${dep_file} that does not belong to any package"
703
rc=1
704
fi
705
already="${already} ${dep_file}"
706
dep_lib_file=$(basename ${dep_file})
707
dep_lib_files="${dep_lib_files} ${dep_lib_file%%.so*}.so"
708
done <<-EOT
709
$(env LD_LIBMAP_DISABLE=1 ldd -a "${STAGEDIR}${file}" | \
710
awk '
711
BEGIN {section=0}
712
/^\// {section++}
713
!/^\// && section<=1 && ($3 ~ "^'${PREFIX}'" || $3 ~ "^'${LOCALBASE}'") {print $3}')
714
EOT
715
done <<-EOT
716
$(list_stagedir_elfs | \
717
file -F $'\1' -f - | \
718
grep -a 'ELF.*FreeBSD.*dynamically linked' | \
719
cut -f 1 -d $'\1'| \
720
sed -e 's/^\.//')
721
EOT
722
723
# Check whether all files in LIB_DEPENDS are actually linked against
724
for _library in ${WANTED_LIBRARIES} ; do
725
if ! listcontains ${_library%%.so*}.so "${dep_lib_files}" ; then
726
warn "you might not need LIB_DEPENDS on ${_library}"
727
fi
728
done
729
730
[ -z "${PROXYDEPS_FATAL}" ] && return 0
731
732
return ${rc}
733
}
734
735
sonames() {
736
[ ! -d ${STAGEDIR}${PREFIX}/lib -o -n "${BUNDLE_LIBS}" ] && return 0
737
while read -r f; do
738
# No results presents a blank line from heredoc.
739
[ -z "${f}" ] && continue
740
# Ignore symlinks
741
[ -f "${f}" -a ! -L "${f}" ] || continue
742
# Ignore .debug files
743
[ "${f}" == "${f%.debug}" ] || continue
744
if ! readelf -d ${f} | grep SONAME > /dev/null; then
745
warn "${f} doesn't have a SONAME."
746
warn "pkg(8) will not register it as being provided by the port."
747
warn "If another port depend on it, pkg will not be able to know where it comes from."
748
case "${f}" in
749
${STAGEDIR}${PREFIX}/lib/*/*)
750
warn "It is in a subdirectory, it may not be used in another port."
751
;;
752
*)
753
warn "It is directly in ${PREFIX}/lib, it is probably used by other ports."
754
;;
755
esac
756
fi
757
# Use heredoc to avoid losing rc from find|while subshell
758
done <<-EOT
759
$(find ${STAGEDIR}${PREFIX}/lib -name '*.so.*')
760
EOT
761
}
762
763
perlcore_port_module_mapping() {
764
case "$1" in
765
Net)
766
echo "Net::Config"
767
;;
768
libwww)
769
echo "LWP"
770
;;
771
*)
772
echo "$1" | sed -e 's/-/::/g'
773
;;
774
esac
775
}
776
777
perlcore() {
778
local portname version module gotsome
779
[ -x "${LOCALBASE}/bin/corelist" ] || return 0
780
for dep in ${UNIFIED_DEPENDS}; do
781
portname=$(expr "${dep}" : ".*/p5-\(.*\)")
782
if [ -n "${portname}" ]; then
783
gotsome=1
784
module=$(perlcore_port_module_mapping "${portname}")
785
version=$(expr "${dep}" : ".*>=*\([^:<]*\)")
786
787
while read -r l; do
788
case "${l}" in
789
*was\ not\ in\ CORE*)
790
# This never was with Perl
791
# CORE, so nothing to do here
792
;;
793
*and\ removed*)
794
# This was in Perl CORE but has
795
# been removed since.
796
warn "${dep##*:} was in Perl CORE. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if it should be conditionally added depending on PERL_LEVEL"
797
;;
798
*deprecated*in*)
799
# This is in Perl CORE but is
800
# deprecated.
801
warn "${dep##*:} is in Perl CORE but deprecated. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if the dependency is really needed or if it should be conditionally added depending on PERL_LEVEL"
802
;;
803
*was\ first\ released*)
804
# This is in Perl CORE and is
805
# maybe not needed.
806
warn "${dep##*:} is present in Perl CORE. Check with \`corelist ${module} ${version}\` and \`corelist -a ${module}\` if the dependency is really needed or if it should be conditionally added depending on PERL_LEVEL"
807
;;
808
*)
809
err "This line is not handled: \"${l}\""
810
esac
811
done <<-EOT
812
$(${LOCALBASE}/bin/corelist "${module}"|tail -1)
813
EOT
814
fi
815
done
816
if [ -n "${gotsome}" ] && ! pkg info -e devel/p5-Module-CoreList; then
817
notice "You have some Perl modules as dependencies but you do not have devel/p5-Module-CoreList installed, the perlcore QA check gets better results when using it, especially with older Perl versions."
818
fi
819
}
820
821
no_arch() {
822
[ -z "$NO_ARCH" ] && return
823
rc=0
824
while read -r f; do
825
[ -z "$f" ] && continue
826
if [ -n "$NO_ARCH_IGNORE" ]; then
827
skip=
828
for blacklist in $NO_ARCH_IGNORE; do
829
case $f in
830
*$blacklist) skip=1; break;;
831
esac
832
done
833
[ "$skip" ] && continue
834
fi
835
err "'${f#.}' is a architecture specific binary file and you have set NO_ARCH. Either remove NO_ARCH or add '$(basename $f)' to NO_ARCH_IGNORE."
836
rc=1
837
done <<-EOF
838
$(list_stagedir_elfs \
839
| file -F $'\1' -f - -N \
840
| grep -aE 'ELF .* [LM]SB .*, .*, version [0-9]+ \(FreeBSD\)' \
841
| cut -f 1 -d $'\1')
842
EOF
843
return $rc
844
}
845
846
gemdeps()
847
{
848
rc=0
849
if [ "${PKGBASE%%-*}" = "rubygem" ]; then
850
# shellcheck disable=SC2153
851
# In the heredoc, ${PORTNAME} comes from the environment, not
852
# to be confused with ${portname}
853
while read -r l; do
854
if [ -n "${l}" ]; then
855
name=${l%% *}
856
vers=${l#* }
857
while read -r v; do
858
if ! while read -r p; do
859
${LOCALBASE}/bin/ruby -e "puts 'OK' if Gem::Dependency.new('${name}','${v}').match?('${name}','${p}')"
860
done | grep -qFx OK; then
861
err RubyGem dependency ${name} ${v} is not satisfied.
862
rc=1
863
fi <<-EOF
864
$(${LOCALBASE}/bin/gem list -e "${name}" \
865
| sed "s|.*(\(.*\))|\1|" \
866
| tr -d ' ' \
867
| tr , '\n')
868
EOF
869
done <<-EOF
870
$(while echo "${vers}" | grep -q '"'; do
871
echo "${vers}" | cut -d '"' -f2
872
vers=$(echo "${vers}"|cut -d '"' -f3-)
873
done)
874
EOF
875
fi
876
done <<-EOF
877
$(grep -a 's.add_runtime_dependency' ${STAGEDIR}${PREFIX}/lib/ruby/gems/*/specifications/${PORTNAME}-*.gemspec \
878
| sed 's|.*<\(.*\)>.*\[\(.*\)\])|\1 \2|' \
879
| sort -u)
880
EOF
881
fi
882
return $rc
883
}
884
885
# If an non rubygem-port has a 'Gemfile' file
886
# it is checked with bundle to be sure
887
# all dependencies are satisfied.
888
# Without the check missing/wrong dependencies
889
# are just found when executing the application
890
gemfiledeps()
891
{
892
# skip check if port does not use ruby at all
893
if [ -z "$USE_RUBY" ]; then
894
return 0
895
fi
896
897
# skip check if port is a rubygem-* one; they have no Gemfiles
898
if [ "${PKGBASE%%-*}" = "rubygem" ]; then
899
return 0
900
fi
901
902
# advise install of bundler if its not present for check
903
if ! type bundle > /dev/null 2>&1; then
904
notice "Please install sysutils/rubygem-bundler for additional Gemfile-checks"
905
return 0
906
fi
907
908
# locate the Gemfile(s)
909
while read -r f; do
910
911
# no results presents a blank line from heredoc
912
[ -z "$f" ] && continue
913
914
# if there is no Gemfile everything is fine - stop here
915
[ ! -f "$f" ] && return 0;
916
917
# use bundle to check if Gemfile is satisfied
918
# if bundle returns 1 the Gemfile is not satisfied
919
# and so stage-qa isn't also
920
if ! bundle check --dry-run --gemfile $f > /dev/null 2>&1; then
921
warn "Dependencies defined in ${f} are not satisfied"
922
fi
923
924
done <<-EOF
925
$(find ${STAGEDIR} -name Gemfile)
926
EOF
927
return 0
928
}
929
930
flavors()
931
{
932
local rc pkgnames uniques
933
rc=0
934
if [ -n "${FLAVOR}" ]; then
935
pkgnames=$(make -C "${CURDIR}" flavors-package-names|sort)
936
uniques=$(echo "${pkgnames}"|uniq)
937
if [ "$pkgnames" != "${uniques}" ]; then
938
err "Package names are not unique with flavors:"
939
make -C "${CURDIR}" pretty-flavors-package-names >&2
940
err "maybe use <flavor>_PKGNAMEPREFIX/SUFFIX".
941
rc=1
942
fi
943
fi
944
return ${rc}
945
}
946
947
license()
948
{
949
local lic autoaccept pkgmirror #distsell distmirror pkgsell
950
951
if [ -n "$DISABLE_LICENSES" ]; then
952
warn "You have disabled the licenses framework with DISABLE_LICENSES, unable to run checks"
953
elif [ -n "$LICENSE" ]; then
954
for lic in $LICENSE_PERMS; do
955
case "$lic" in
956
auto-accept) autoaccept=1 ;;
957
#dist-mirror) distmirror=1 ;;
958
#dist-sell) distsell=1 ;;
959
pkg-mirror) pkgmirror=1 ;;
960
#pkg-sell) pkgsell=1 ;;
961
esac
962
done
963
964
if [ -z "$autoaccept" ]; then
965
warn "License is not auto-accepted, packages will not be built, ports depending on this one will be ignored."
966
fi
967
if [ -z "$pkgmirror" ]; then
968
warn "License does not allow package to be distributed, ports depending on this one will be ignored"
969
fi
970
fi
971
972
return 0
973
}
974
975
# This is to prevent adding dependencies to meta ports that are only there to
976
# improve the end user experience.
977
depends_blacklist()
978
{
979
local dep rc instead
980
981
rc=0
982
983
for dep in ${UNIFIED_DEPENDS}; do
984
origin=$(expr "${dep}" : ".*:\([^@]*\)")
985
instead=""
986
987
case "$origin" in
988
lang/python|lang/python2|lang/python3)
989
# lang/python depends on lang/pythonX, but it's
990
# ok, it is also in the blacklist.
991
if [ ${PKGORIGIN} != lang/python ]; then
992
instead="USES=python:xy with a specific version"
993
fi
994
;;
995
lang/gcc)
996
instead="USE_GCC"
997
;;
998
lang/go)
999
instead="USES=go"
1000
;;
1001
lang/mono)
1002
instead="USES=mono"
1003
;;
1004
devel/llvm)
1005
instead="USES=llvm"
1006
;;
1007
esac
1008
1009
if [ -n "${instead}" ]; then
1010
err "$origin should not be depended upon. Instead, use $instead."
1011
rc=1
1012
fi
1013
done
1014
1015
return $rc
1016
}
1017
1018
pkgmessage()
1019
{
1020
for message in ${PKGMESSAGES}; do
1021
if [ -f "${message}" ]; then
1022
if ! head -1 "${message}" | grep -q '^\['; then
1023
warn "${message} not in UCL format, will be shown on initial install only."
1024
warn "See https://docs.freebsd.org/en/books/porters-handbook/pkg-files/#porting-message"
1025
fi
1026
fi
1027
done
1028
1029
return 0
1030
}
1031
1032
reinplace()
1033
{
1034
if [ -f ${REWARNFILE} ]; then
1035
warn "Possible REINPLACE_CMD issues:"
1036
cat ${REWARNFILE}
1037
fi
1038
}
1039
1040
prefixman() {
1041
if [ -d "${STAGEDIR}${PREFIX}/man" ]; then
1042
warn "Installing man files in ${PREFIX}/man is no longer supported. Consider installing these files in ${PREFIX}/share/man instead."
1043
ls -liTd ${STAGEDIR}${PREFIX}/man
1044
fi
1045
return 0
1046
}
1047
1048
checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo"
1049
checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo"
1050
checks="$checks proxydeps sonames perlcore no_arch gemdeps gemfiledeps flavors"
1051
checks="$checks license depends_blacklist pkgmessage reinplace prefixman"
1052
1053
ret=0
1054
cd ${STAGEDIR} || exit 1
1055
for check in ${checks}; do
1056
eval check_test="\$IGNORE_QA_$check"
1057
if [ -z "${check_test}" ]; then
1058
${check} || ret=1
1059
else
1060
warn "Ignoring $check QA test"
1061
fi
1062
done
1063
1064
exit ${ret}
1065
1066