From 727a5aedceb27bd99778654636716a4f61841fce Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Tue, 11 Jun 2024 19:04:05 +0000 Subject: [PATCH] Fix hard coded proto, use make rules for po installation --- src/Makefile.com | 4 ++++ src/man/Makefile | 4 ++-- src/po/Makefile | 41 +++++++++++++++++++++-------------------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/Makefile.com b/src/Makefile.com index 2ea262363..a9fc9fcee 100644 --- a/src/Makefile.com +++ b/src/Makefile.com @@ -22,6 +22,7 @@ ROOTETCZONES = $(ROOTETC)/zones ROOTETCBRAND = $(ROOTETC)/brand ROOTUSRLIB = $(ROOT)/usr/lib ROOTUSRSHARE = $(ROOT)/usr/share +ROOTUSRSHARELOCALE = $(ROOTUSRSHARE)/locale ROOTBRAND = $(ROOTUSRLIB)/brand ROOTPKGLIB = $(ROOTUSRLIB)/pkg @@ -39,6 +40,9 @@ SHELL= /usr/bin/ksh93 INSTALL = /usr/sbin/install CTFCONVERT = /opt/onbld/bin/i386/ctfconvert STRIP = /usr/bin/strip +RM = /usr/bin/rm -f +MV = /usr/bin/mv +MKDIR = /usr/bin/mkdir -p CTFCONVERT_BIN = $(CTFCONVERT) -l pkg5 POST_PROCESS = $(CTFCONVERT_BIN) $@; $(STRIP) -x $@ diff --git a/src/man/Makefile b/src/man/Makefile index e17b8d0dc..c624527ff 100644 --- a/src/man/Makefile +++ b/src/man/Makefile @@ -62,7 +62,7 @@ check: clean clobber: $(MAN1DIR) $(MAN7DIR) $(MAN8DIR): - mkdir -p $@ + $(MKDIR) $@ $(MAN1DIR)/% $(MAN7DIR)/% $(MAN8DIR)/%: % - rm -f $@; $(INSTALL) -f $(@D) -m 0444 $< + $(RM) $@; $(INSTALL) -f $(@D) -m 0444 $< diff --git a/src/po/Makefile b/src/po/Makefile index 74f98b2b3..ef1121fd6 100644 --- a/src/po/Makefile +++ b/src/po/Makefile @@ -21,44 +21,45 @@ # # Copyright (c) 2024, Oracle and/or its affiliates. +# Copyright 2024 OmniOS Community Edition (OmniOSce) Association. # +include ../Makefile.com + XGETTEXT = /usr/gnu/bin/xgettext MSGFMT = /usr/bin/msgfmt -MKDIR = mkdir -p -INSTALL = cp - -PROTO_AREA:sh = echo $(dirname $(dirname $(pwd)))/proto/root_$(uname -p) -LOCALE_DIR = $(PROTO_AREA)/usr/share/locale LOCALES:sh = grep -v "^\#" LINGUAS CATALOGS = $(LOCALES:=.mo) +ROOTLOCALES = $(LOCALES:%=$(ROOTUSRSHARELOCALE)/%/LC_MESSAGES/pkg.mo) +ROOTPOT = $(ROOTUSRSHARELOCALE)/__LOCALE__/LC_MESSAGES/pkg.pot all: $(CATALOGS) pkg.pot +$(ROOTPOT): pkg.pot + $(MKDIR) $(@D) + $(RM) $@; $(INSTALL) -f $(@D) -m 0444 pkg.pot + +$(ROOTUSRSHARELOCALE)/%/LC_MESSAGES/pkg.mo: %.mo + $(MKDIR) $(@D) + $(RM) $@; $(INSTALL) -f $(@D) -m 0444 $< + $(MV) $(@D)/$( $$dir/pkg.mo"; \ - done; \ - dir=$(LOCALE_DIR)/__LOCALE__/LC_MESSAGES; \ - $(MKDIR) $$dir; \ - $(INSTALL) pkg.pot $$dir/pkg.pot; \ - echo "copying pkg.pot -> $$dir/pkg.pot" + $(XGETTEXT) --add-comments --keyword=N_ \ + --from-code=UTF-8 -f POTFILES.in -D .. -o pkg.pot check: - $(XGETTEXT) --keyword=N_ --from-code=UTF-8 -f POTFILES.in -D .. -o /dev/null 2>i18n_errs.txt + $(XGETTEXT) --keyword=N_ --from-code=UTF-8 -f POTFILES.in \ + -D .. -o /dev/null 2>i18n_errs.txt @if [ -s i18n_errs.txt ]; then \ - echo "The following i18n errors were detected and should be corrected:"; \ + echo "The following i18n errors were detected:"; \ echo "(this list is saved in i18n_errs.txt)"; \ cat i18n_errs.txt; \ exit 1; \