mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
![Kyle Evans](/assets/img/avatar_default.png)
This cuts out a large chunk of duplicated *.ucl files that just needed dependencies tacked on, and gives generate-ucl.sh some leeway in case a future pkg may need more than one dependency. Run-through to determine which ones could simply be removed done with for i in *.ucl; do diff -U3 template.ucl ${i}; done | less and inspecting for any differences beyond just adding deps at the end. The remaining ucl files are basically all differently-licensed, require scripts, or are marked vital. I've opted to remove %PKGDEPS% entirely without regard for third-party ucl, as pkgbase is not yet considered production. However, I do not hold a strong position on this and there is approximately 0 chance it will return. clibs should have been added previously in generate-ucl.sh as one that doesn't have any dependencies, but do so now that we would otherwise be tacking on the runtime dependency. Reviewed by: manu, bapt (earlier version) Differential Revision: https://reviews.freebsd.org/D23415
162 lines
3.4 KiB
Bash
Executable file
162 lines
3.4 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
main() {
|
|
desc=
|
|
comment=
|
|
debug=
|
|
uclsource=
|
|
while getopts "do:s:u:" arg; do
|
|
case ${arg} in
|
|
d)
|
|
debug=1
|
|
;;
|
|
o)
|
|
outname="${OPTARG}"
|
|
origname="${OPTARG}"
|
|
;;
|
|
s)
|
|
srctree="${OPTARG}"
|
|
;;
|
|
u)
|
|
uclfile="${OPTARG}"
|
|
;;
|
|
*)
|
|
echo "Unknown argument"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
shift $(( ${OPTIND} - 1 ))
|
|
|
|
outname="$(echo ${outname} | tr '-' '_')"
|
|
|
|
case "${outname}" in
|
|
clibs)
|
|
# clibs should not have any dependencies or anything
|
|
# else imposed on it.
|
|
;;
|
|
caroot)
|
|
pkgdeps="utilities"
|
|
;;
|
|
runtime)
|
|
outname="runtime"
|
|
uclfile="${uclfile}"
|
|
;;
|
|
runtime_manuals)
|
|
outname="${origname}"
|
|
pkgdeps="runtime"
|
|
;;
|
|
runtime_*)
|
|
outname="${origname}"
|
|
uclfile="${outname##*}${uclfile}"
|
|
pkgdeps="runtime"
|
|
_descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)"
|
|
;;
|
|
jail_*)
|
|
outname="${origname}"
|
|
uclfile="${outname##*}${uclfile}"
|
|
pkgdeps="runtime"
|
|
_descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)"
|
|
;;
|
|
*_lib32_development)
|
|
outname="${outname%%_lib32_development}"
|
|
_descr="32-bit Libraries, Development Files"
|
|
pkgdeps="${outname}"
|
|
;;
|
|
*_lib32_debug)
|
|
outname="${outname%%_lib32_debug}"
|
|
_descr="32-bit Libraries, Debugging Symbols"
|
|
pkgdeps="${outname}"
|
|
;;
|
|
*_lib32_profile)
|
|
outname="${outname%%_lib32_profile}"
|
|
_descr="32-bit Libraries, Profiling"
|
|
pkgdeps="${outname}"
|
|
;;
|
|
*_lib32)
|
|
outname="${outname%%_lib32}"
|
|
_descr="32-bit Libraries"
|
|
pkgdeps="${outname}"
|
|
;;
|
|
*_development)
|
|
outname="${outname%%_development}"
|
|
_descr="Development Files"
|
|
pkgdeps="${outname}"
|
|
;;
|
|
*_profile)
|
|
outname="${outname%%_profile}"
|
|
_descr="Profiling Libraries"
|
|
pkgdeps="${outname}"
|
|
;;
|
|
*_debug)
|
|
outname="${outname%%_debug}"
|
|
_descr="Debugging Symbols"
|
|
pkgdeps="${outname}"
|
|
;;
|
|
${origname})
|
|
pkgdeps="runtime"
|
|
;;
|
|
*)
|
|
uclfile="${outname##*}${origname}"
|
|
outname="${outname##*}${origname}"
|
|
;;
|
|
esac
|
|
|
|
outname="${outname%%_*}"
|
|
|
|
desc="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESC)"
|
|
comment="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_COMMENT)"
|
|
|
|
uclsource="${srctree}/release/packages/${outname}.ucl"
|
|
if [ ! -e "${uclsource}" ]; then
|
|
uclsource="${srctree}/release/packages/template.ucl"
|
|
fi
|
|
|
|
if [ ! -z "${debug}" ]; then
|
|
echo ""
|
|
echo "==============================================================="
|
|
echo "DEBUG:"
|
|
echo "_descr=${_descr}"
|
|
echo "outname=${outname}"
|
|
echo "origname=${origname}"
|
|
echo "srctree=${srctree}"
|
|
echo "uclfile=${uclfile}"
|
|
echo "desc=${desc}"
|
|
echo "comment=${comment}"
|
|
echo "cp ${uclsource} -> ${uclfile}"
|
|
echo "==============================================================="
|
|
echo ""
|
|
echo ""
|
|
echo ""
|
|
fi
|
|
|
|
[ -z "${comment}" ] && comment="${outname} package"
|
|
[ ! -z "${_descr}" ] && comment="${comment} (${_descr})"
|
|
[ -z "${desc}" ] && desc="${outname} package"
|
|
|
|
cp "${uclsource}" "${uclfile}"
|
|
if [ ! -z "${pkgdeps}" ]; then
|
|
cat <<EOF >> ${uclfile}
|
|
deps: {
|
|
FreeBSD-${pkgdeps}: {
|
|
origin: "base",
|
|
version: "${PKG_VERSION}"
|
|
}
|
|
}
|
|
EOF
|
|
fi
|
|
cap_arg="$( make -f ${srctree}/share/mk/bsd.endian.mk -VCAP_MKDB_ENDIAN )"
|
|
sed -i '' -e "s/%VERSION%/${PKG_VERSION}/" \
|
|
-e "s/%PKGNAME%/${origname}/" \
|
|
-e "s/%COMMENT%/${comment}/" \
|
|
-e "s/%DESC%/${desc}/" \
|
|
-e "s/%CAP_MKDB_ENDIAN%/${cap_arg}/g" \
|
|
${uclfile}
|
|
return 0
|
|
}
|
|
|
|
main "${@}"
|