From 39868630e1ea4af9fde5e1397b173f2cadaecb3e Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 21 Jun 2013 18:53:31 -0400 Subject: Add patch to replace a Perl script. --- (limited to 'patches') diff --git a/patches/07_noperl-gen-translit.patch b/patches/07_noperl-gen-translit.patch new file mode 100644 index 0000000..cffc8cd --- /dev/null +++ b/patches/07_noperl-gen-translit.patch @@ -0,0 +1,218 @@ +From: "P. J. McDermott" +Description: Replace locale/gen-translit.pl with a shell script + If a Perl interpreter isn't found, run the shell script instead. + +diff -Naur src.orig/libc/locale/gen-translit.sh src/libc/locale/gen-translit.sh +--- src.orig/libc/locale/gen-translit.sh 1969-12-31 19:00:00.000000000 -0500 ++++ src/libc/locale/gen-translit.sh 2013-06-21 18:04:13.414351956 -0400 +@@ -0,0 +1,195 @@ ++#!/bin/sh ++# A POSIX.1 shell command language translation of gen-translit.pl. ++ ++set -e ++ ++LF=' ++' ++ ++die() { ++ printf '%s\n' "${*}" ++ exit 1 ++} ++ ++substr() { ++ str="${1}" ++ off=${2} ++ len=${3} ++ ++ while [ ${off} -gt 0 ]; do ++ str="${str#?}" ++ off=$(($off - 1)) ++ done ++ while [ ${#str} -gt ${len} ]; do ++ str="${str%?}" ++ done ++ ++ printf '%s\n' "${str}" ++} ++ ++cstrlen() { ++ str="${*}" ++ len=${#str} ++ cnt=0 ++ res=0 ++ ++ while [ ${cnt} -lt $len ]; do ++ if [ "x$(substr "${str}" ${cnt} 1)" = 'x\' ]; then ++ # Recognize the escape sequence. ++ if [ "x$(substr "${str}" $(($cnt + 1)) 1)" = 'xx' ]; then ++ inner=$(($cnt + 2)) ++ while [ ${inner} -lt ${len} \ ++ -a ${inner} -lt $(($cnt + 10)) ]; do ++ ch="$(substr "${str}" ${inner} 1)" ++ if [ "x${ch}" != "x${ch#[0-9a-fA-F]}" ]; then ++ inner=$(($inner + 1)) ++ continue ++ fi ++ break ++ inner=$(($inner + 1)) ++ done ++ cnt=${inner} ++ res=$(($res + 1)) ++ else ++ if [ $(($cnt + 1)) -ge ${len} ]; then ++ die 'Invalid input' ++ fi ++ res=$(($res + 1)) ++ cnt=$(($cnt + 1)) ++ fi ++ else ++ res=$(($res + 1)) ++ fi ++ cnt=$(($cnt + 1)) ++ done ++ ++ printf '%d\n' ${res} ++} ++ ++ntranslit=0 ++while read -r line; do ++ [ "x${line}" != "x${line#\#}" ] && continue ++ [ -z "${line}" ] && continue ++ ++ line="${line#\"}" ++ line="${line%\"}" ++ from="${line%%\"[ ]*}" ++ to="${line##*[ ]\"}" ++ fromlen="$(cstrlen "${from}")" ++ tolen="$(cstrlen "${to}")" ++ ++ froms="${froms}${from}${LF}" ++ fromlens="${fromlens}${fromlen}${LF}" ++ tos="${tos}${to}${LF}" ++ tolens="${tolens}${tolen}${LF}" ++ ++ ntranslit=$(($ntranslit + 1)) ++done < $@.tmp ++else ++ /bin/sh gen-translit.sh < $< > $@.tmp ++endif + mv -f $@.tmp $@ + + localepath = "$(localedir):$(i18ndir)" -- cgit v0.9.1