po-sun.mk
author Bayard Bell <buffer.g.overflow@gmail.com>
Mon, 17 Oct 2011 21:30:04 +0100
changeset 0 c86b2b393e56
permissions -rw-r--r--
Initial import of code provided by Alasdairrr and aszeszo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     1
COMPONENT_PREP_ACTION += \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     2
POFILES=`cd Solaris/po-sun; echo *.po`; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     3
PODIR=$(@D)/po; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     4
MSGCAT=$${MSGCAT:-msgcat}; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     5
MSGCAT_VERSION=`$$MSGCAT --version | head -1 | awk '{print $$NF}'`; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     6
MSGCAT_VERSION=`echo $$MSGCAT_VERSION | awk -F. '{ print $$1 * 1000 + $$2  * 100 + $$3; }'`; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     7
if [ $$MSGCAT_VERSION -lt 1500 ] ; then \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     8
  MSGCAT=/usr/bin/msgcat; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
     9
  MSGCAT_VERSION=`$$MSGCAT --version | head -1 | awk '{print $$NF}'`; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    10
  MSGCAT_VERSION=`echo $$MSGCAT_VERSION | awk -F. '{ print $$1 * 1000 + $$2  * 100 + $$3; }'`; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    11
  if [ $$MSGCAT_VERSION -lt 1500 ] ; then \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    12
    printf "msgcat version 0.15 is required for msgctxt\n"; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    13
    printf "rf. http://live.gnome.org/GnomeGoals/MsgctxtMigration\n"; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    14
    exit 1; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    15
  fi; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    16
fi; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    17
\
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    18
for po_sun in $POFILES; do \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    19
  po=$PODIR/$$po_sun; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    20
  if test ! -f $$po; then \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    21
    continue; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    22
  fi; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    23
  \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    24
  echo "Merging $$po_sun ..."; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    25
  \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    26
  header_community=$${po_sun}.header; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    27
  I=0; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    28
  exec < $$po; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    29
  while read line; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    30
  do \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    31
    is_comment=`echo $$line | grep '^\#' | grep -v '^\#,'`; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    32
    if [ x"$$is_comment" = x ] ; then \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    33
      break; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    34
    fi; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    35
    I=`expr $$I + 1`; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    36
  done; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    37
  exec <&-; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    38
  if [ $$I -ne 0 ] ; then \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    39
    sed -ne "1,$${I}p" $$po > $$header_community; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    40
  fi; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    41
  \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    42
  po_sun_no_obs=$$po_sun.no_obs; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    43
  sed -e "/^\#~/d" $$po_sun > $$po_sun_no_obs; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    44
  \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    45
  if [ -f $$header_community ] ; then \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    46
    $$MSGCAT --use-first $$po_sun_no_obs $$po -o $$po.$$; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    47
    cat $$header_community $$po.$$ > $$po; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    48
    rm $$header_community $$po.$$; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    49
  else \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    50
    $$MSGCAT --use-first $$po_sun_no_obs $$po -o $$po; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    51
  fi; \
c86b2b393e56 Initial import of code provided by Alasdairrr and aszeszo
Bayard Bell <buffer.g.overflow@gmail.com>
parents:
diff changeset
    52
done;