From 9d6cd60188fb1eb53b70f94089552f34d78270c0 Mon Sep 17 00:00:00 2001 From: zrj Date: Fri, 11 Nov 2016 14:51:43 +0200 Subject: [PATCH] nvi: Convert catalog creation to use hostprog. nvi dump utility is not part of btools, so just split vidump as hostprog. There were few issues: * build races like dump and say spanish get created twice (and raced) * buildworld failures, from time to time i hit ./dump linking race (rare) * ./dump being used as target program (problems on crosscompilations) * missing env LANG=C for sort, minor issues in awk script and SHAREDIR. Now even "cd usr.bin/vi && make -j9 depend all" should be race free. --- usr.bin/vi/Makefile | 2 +- usr.bin/vi/catalog/Makefile | 34 ++++++++++++++-------------------- usr.bin/vi/vidump/Makefile | 12 ++++++++++++ 3 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 usr.bin/vi/vidump/Makefile diff --git a/usr.bin/vi/Makefile b/usr.bin/vi/Makefile index 56f4316f88..68ede24f29 100644 --- a/usr.bin/vi/Makefile +++ b/usr.bin/vi/Makefile @@ -5,7 +5,7 @@ .include SRCDIR= ${.CURDIR}/../../contrib/nvi2 -SUBDIR+= catalog +SUBDIR+= vidump catalog WARNS?= 1 diff --git a/usr.bin/vi/catalog/Makefile b/usr.bin/vi/catalog/Makefile index 30630ea5e8..d84efd62d7 100644 --- a/usr.bin/vi/catalog/Makefile +++ b/usr.bin/vi/catalog/Makefile @@ -12,12 +12,10 @@ SCAN= ${V}/cl/*.c ${V}/common/*.c ${V}/ex/*.c ${V}/vi/*.c .PATH: ${V}/catalog -all: dump - -build-tools: dump +buildfiles: # Helper since iconv is non trivial to make a build tool -utf8convert: +utf8convert: .PHONY .for c in dutch french german spanish swedish iconv -f ISO8859-1 -t UTF-8 $V/catalog/$c.base > $c.UTF-8.base .endfor @@ -25,16 +23,18 @@ utf8convert: iconv -f GB2312 -t UTF-8 $V/catalog/zh_CN.GB2312.base > zh_CN.UTF-8.base iconv -f KOI8-R -t UTF-8 $V/catalog/ru_RU.KOI8-R.base > ru_RU.UTF-8.base iconv -f KOI8-U -t UTF-8 $V/catalog/uk_UA.KOI8-U.base > uk_UA.UTF-8.base - + .for c in dutch french german polish spanish swedish zh_CN ru_RU uk_UA CAT+= $c.UTF-8 .endfor +all: ${CAT} + .for c in ${CAT} -${c}: ${c}.base +${c}: ${c}.base @echo "... $c"; \ rm -f $c; \ - sort -u ${.ALLSRC} | \ + env LANG=C sort -u ${.ALLSRC} | \ awk '{ \ if ($$1 == 1) { \ print "\nMESSAGE NUMBER 1 IS NOT LEGAL"; \ @@ -44,7 +44,7 @@ ${c}: ${c}.base print "DUPLICATE MESSAGE NUMBER " $$1; \ exit 1; \ } \ - print $0; \ + print $$0; \ }' | \ sed -e '1s/^/$$set 1~$$quote "~/; 1y/~/\n/' | \ gencat $c /dev/stdin; \ @@ -92,18 +92,11 @@ ${c}.check: ${c}.base echo =========================) > $c .endfor -english.base: dump ${SCAN} #Makefile - ./dump ${SCAN} |\ - sed -e '/|/!d' \ - -e 's/|/ "/' \ - -e 's/^"//' |\ - sort -nu > $@ - - -dump: dump.c - ${CC} -o ${.TARGET} ${.ALLSRC} +english.base: ${SCAN} + ${.OBJDIR}/../vidump/vidump.nx ${SCAN} | \ + sed -e '/|/!d' -e 's/|/ "/' -e 's/^"//' | sort -nu > $@ -CLEANFILES+= dump ${CAT} english.base *.check __ck1 __ck2 +CLEANFILES+= ${CAT} english.base *.check __ck1 __ck2 CATALOGS= ${CAT} NLLINKS= nl_NL @@ -115,7 +108,8 @@ SVLINKS= sv_SE PLLINKS= pl_PL FILES= ${CATALOGS} -FILESDIR= /usr/share/vi/catalog +FILESFROUPS= FILES +FILESDIR= ${SHAREDIR}/vi/catalog SYMLINKS= .for l in ${NLLINKS} SYMLINKS+= dutch ${FILESDIR}/$l.ISO8859-1 diff --git a/usr.bin/vi/vidump/Makefile b/usr.bin/vi/vidump/Makefile new file mode 100644 index 0000000000..f32c83cace --- /dev/null +++ b/usr.bin/vi/vidump/Makefile @@ -0,0 +1,12 @@ +# $Id: Makefile,v 9.0 2012/10/19 15:13:11 zy Exp $ +# $FreeBSD: head/usr.bin/vi/catalog/Makefile 254244 2013-08-12 09:56:52Z peter $ + +.PATH: ${.CURDIR}/../../../contrib/nvi2/catalog + +PROG= vidump +SRCS= dump.c + +# vi dump is used in place, it is not installed anywhere +install: + +.include -- 2.11.4.GIT