Skip to content

Commit

Permalink
Fix hard coded proto, use make rules for po installation
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus-it committed Jun 11, 2024
1 parent c40c4dc commit 727a5ae
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
4 changes: 4 additions & 0 deletions src/Makefile.com
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 $@
Expand Down
4 changes: 2 additions & 2 deletions src/man/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<
41 changes: 21 additions & 20 deletions src/po/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)/$(<F) $@

install: all $(ROOTPOT) $(ROOTLOCALES)

%.mo: %.po
$(MSGFMT) -o $@ $^

pkg.pot: POTFILES.in
$(XGETTEXT) --add-comments --keyword=N_ --from-code=UTF-8 -f POTFILES.in -D .. -o pkg.pot

install: all
@for locale in $(LOCALES); do \
dir=$(LOCALE_DIR)/$$locale/LC_MESSAGES; \
$(MKDIR) $$dir; \
$(INSTALL) $$locale.mo $$dir/pkg.mo; \
echo "copying $$locale.mo -> $$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; \
Expand Down

0 comments on commit 727a5ae

Please sign in to comment.