diff --git a/T/TermInfoDB/build_tarballs.jl b/T/TermInfoDB/build_tarballs.jl new file mode 100644 index 00000000000..75b7ac95ccb --- /dev/null +++ b/T/TermInfoDB/build_tarballs.jl @@ -0,0 +1,84 @@ +using BinaryBuilder + +# This is based on https://www.freshports.org/misc/terminfo-db/ +name = "TermInfoDB" +version = v"2023.12.9" + +v = string(version.major, lpad(version.minor, 2, '0'), lpad(version.patch, 2, '0')) +sources = [ + FileSource("https://invisible-island.net/archives/ncurses/current/terminfo-$v.src.gz", + "2debcf2fd689988d44558bcd8a26a104b96542ffc9540f19e2586b3aeecd1c79"), + DirectorySource("./bundled"), +] + +script = raw""" +cd ${WORKSPACE}/srcdir/ + +# Adopting the wisdom of https://mywiki.wooledge.org/ParsingLs (🙏 Mosè) +shopt -s nullglob + +gunzip terminfo-* +mkdir -p "${prefix}/share/terminfo" +tic -sx -o "${prefix}/share/terminfo" ./terminfo-* + +pushd "${prefix}/share/terminfo/" + +# The terminfo filesystem-based database contains both upper- and lowercase directory +# names, which presents a problem for case-insensitive filesystems. Let's rename all +# files and directories to lowercase. Unfortunately, we can't just `mv` the filename +# to its lowercase counterpart because many of these files, including but not limited +# to those whose names differ only by case, are actually hard links to one another +# (they have the same inode) so `mv` sees it as a no-op and just does nothing. +# Hence... this. +for dir in *; do + lcdir="${dir,,}" + mkdir -p "${lcdir}" + for file in ${dir}/*; do + file=$(basename "${file}") + lcfile="${file,,}" + if [ "${dir}/${file}" = "${lcdir}/${lcfile}" ]; then + # Already all lowercase, nothing to do + continue + fi + mv -f "${dir}/${file}" "${lcdir}/${lcfile}.TEMP" + rm -f "${lcdir}/${lcfile}" + mv -f "${lcdir}/${lcfile}.TEMP" "${lcdir}/${lcfile}" + if [ -e "${dir}/${file}" ] || [ -e "${lcdir}/${lcfile}.TEMP" ]; then + echo "ERROR: '${dir}/${file}' not successfully renamed to lowercase!!!" + exit 1 + fi + done + if [ -z "$(ls -A "${dir}")" ]; then + rm -rf "${dir}" + fi +done + +# I'm not about to list the entire contents out as `FileProduct`s, so we'll do our +# own mini-audit by checking that the expected directories exist. We know each is +# non-empty based on the above. +dirs=(*) +expected=(1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x z) +if [ ! -z "$(echo ${dirs[@]} ${expected[@]} | tr ' ' '\n' | sort | uniq -u)" ]; then + echo "ERROR: Build did not produce the expected set of directories!!!" + exit 1 +fi + +popd + +install_license "${WORKSPACE}/srcdir/COPYING" +""" + +platforms = [AnyPlatform()] + +# I'd rather not list out >2k individual `FileProduct`s so let's just call the entry +# for xterm our "product" and hope the rest are there +products = [ + FileProduct("share/terminfo/x/xterm", :terminfo_xterm), +] + +dependencies = [ + HostBuildDependency("Ncurses_jll"), # for `tic` +] + +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; + julia_compat="1.6") diff --git a/T/TermInfoDB/bundled/COPYING b/T/TermInfoDB/bundled/COPYING new file mode 100644 index 00000000000..2abcc60d6cd --- /dev/null +++ b/T/TermInfoDB/bundled/COPYING @@ -0,0 +1,29 @@ +Copyright 2018-2022,2023 Thomas E. Dickey +Copyright 1998-2017,2018 Free Software Foundation, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, distribute with modifications, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization. + +-- vile:txtmode fc=72 +-- $Id: COPYING,v 1.12 2023/01/07 17:55:53 tom Exp $