Browse Source

Merge pull request #54 from fancycode/automake_styles_i18n

Automake updates
pull/56/head
Simon Eisenmann 11 years ago
parent
commit
3a5f5afadb
  1. 9
      Makefile.am
  2. 75
      configure.ac
  3. 42
      src/i18n/Makefile
  4. 58
      src/i18n/Makefile.am
  5. 4
      src/styles/Makefile.am

9
Makefile.am

@ -104,6 +104,15 @@ jsbeautify: @@ -104,6 +104,15 @@ jsbeautify:
@if [ "$(JS_BEAUTIFY)" = "" ]; then echo "Command 'js-beautify' not found"; exit 1; fi
$(FIND) static/ \( -path static/js/libs -o -path static/translation \) -prune -o -name "*.js" -exec $(JS_BEAUTIFY) -t -o {}.new {} \; -exec mv -f {}.new {} \;
build-i18n:
cd $(CURDIR)/src/i18n && $(MAKE) build
extract-i18n:
cd $(CURDIR)/src/i18n && $(MAKE) extract
update-i18n:
cd $(CURDIR)/src/i18n && $(MAKE) update
release: GOPATH = "$(DIST):$(VENDOR):$(CURDIR)"
release: LDFLAGS = -X main.version $(PACKAGE_VERSION) -X main.defaultConfig $(CONFIG_PATH)/$(CONFIG_FILE)
release: OUTPUT = $(DIST_BIN)

75
configure.ac

@ -23,6 +23,15 @@ AC_PREREQ([2.53]) @@ -23,6 +23,15 @@ AC_PREREQ([2.53])
AC_INIT([spreed-webrtc],[unknown],[opensource@struktur.de],[],[https://github.com/strukturag/spreed-webrtc])
I18N_VERSION="1.0"
I18N_PROJECT="Spreed WebRTC"
I18N_COPYRIGHT="struktur AG"
I18N_BUG_ADDRESS="simon@struktur.de"
AC_SUBST(I18N_VERSION)
AC_SUBST(I18N_PROJECT)
AC_SUBST(I18N_COPYRIGHT)
AC_SUBST(I18N_BUG_ADDRESS)
# minimum required versions
GO_VERSION_MIN=1.1
NODEJS_VERSION_MIN=0.6.0
@ -43,19 +52,23 @@ AC_PROG_MKDIR_P @@ -43,19 +52,23 @@ AC_PROG_MKDIR_P
AC_PROG_INSTALL
AC_PROG_GREP
AC_PROG_SED
AC_PROG_AWK
AC_SUBST(MKDIR_P)
AC_SUBST(INSTALL)
AC_SUBST(GREP)
AC_SUBST(SED)
AC_SUBST(AWK)
AC_PATH_PROGS([FIND],[find])
AC_PATH_PROGS([JSHINT],[jshint])
AC_PATH_PROGS([JS_BEAUTIFY],[js-beautify])
AC_PATH_PROGS([PYTHON],[python2 python])
AC_SUBST(FIND)
AC_SUBST(JSHINT)
AC_SUBST(JS_BEAUTIFY)
AC_SUBST(PYTHON)
AC_PATH_PROGS([GO],[go])
if test x"${GO}" == x"" ; then
@ -74,46 +87,74 @@ else @@ -74,46 +87,74 @@ else
AX_COMPARE_VERSION([$NODEJS_VERSION], [lt], [$NODEJS_VERSION_MIN],
[AC_MSG_ERROR([Please install node.js $NODEJS_VERSION_MIN or newer before trying to build spreed-webrtc (found node.js $NODEJS_VERSION).])])
AX_COMPARE_VERSION([$NODEJS_VERSION], [lt], [$NODEJS_VERSION_STYLES_MIN],
[AC_MSG_WARN([Please install node.js NODEJS_VERSION_STYLES_MIN or newer before trying to build styles (found node.js $NODEJS_VERSION).])])
[AC_MSG_WARN([Please install node.js $NODEJS_VERSION_STYLES_MIN or newer before trying to build styles (found node.js $NODEJS_VERSION).])
NODEJS_SUPPORT_STYLES=no],[NODEJS_SUPPORT_STYLES=yes])
fi
AC_SUBST(NODEJS)
AC_SUBST(NODEJS_SUPPORT_STYLES)
AC_PATH_PROGS([SASS],[sass])
if test x"${SASS}" == x"" ; then
AC_MSG_WARN([Please install sass before trying to build spreed-webrtc.])
SASS=sass
AC_MSG_WARN([Please install sass before trying to build styles.])
else
SASS_VERSION=`$SASS --version | $SED 's/^Sass //' | $SED 's/ .*//'`
AX_COMPARE_VERSION([$SASS_VERSION], [lt], [$SASS_VERSION_MIN],
[AC_MSG_WARN([Please install sass $SASS_VERSION_MIN or newer before trying to build styles (found sass $SASS_VERSION).])])
[AC_MSG_WARN([Please install sass $SASS_VERSION_MIN or newer before trying to build styles (found sass $SASS_VERSION).])
SASS_SUPPORT_STYLES=no],[SASS_SUPPORT_STYLES=yes])
fi
AC_SUBST(SASS)
AC_PATH_PROGS([COMPASS],[compass])
if test x"${COMPASS}" == x"" ; then
AC_MSG_WARN([Please install compass before trying to build styles.])
COMPASS=compass
fi
AC_SUBST(COMPASS)
AC_MSG_CHECKING([for compass support in sass])
tempfile=`mktemp`
$SASS --compass $tempfile > /dev/null 2> /dev/null
sass_compass=$?
rm $tempfile
if test x"${sass_compass}" != x"0" ; then
AC_MSG_RESULT([not available])
AC_MSG_WARN([Please install compass so it can be used using "sass --compass ...".])
if test x"${SASS}" != x"" ; then
AC_MSG_CHECKING([for compass support in sass])
tempfile=`mktemp`
$SASS --compass $tempfile > /dev/null 2> /dev/null
sass_compass=$?
rm $tempfile
if test x"${sass_compass}" != x"0" ; then
AC_MSG_RESULT([not available])
AC_MSG_WARN([Please install compass so it can be used using "sass --compass ...".])
SASS_SUPPORT_STYLES=no
else
AC_MSG_RESULT([ok])
fi
fi
AC_MSG_RESULT([ok])
AC_SUBST(SASS_SUPPORT_STYLES)
AC_PATH_PROGS([AUTOPREFIXER],[autoprefixer])
if test x"${AUTOPREFIXER}" == x"" ; then
AC_MSG_WARN([Please install autoprefixer before trying to build styles.])
AUTOPREFIXER=autoprefixer
fi
AC_SUBST(AUTOPREFIXER)
AC_PATH_PROGS([PYBABEL],[pybabel])
if test x"${PYBABEL}" == x"" ; then
AC_MSG_WARN([Please install pybabel before trying to build i18n.])
fi
AC_SUBST(PYBABEL)
AC_PATH_PROGS([NPM],[npm])
NODEJS_SUPPORT_PO2JSON=no
if test x"${NPM}" != x"" ; then
AC_MSG_CHECKING([for po2json support in node.js])
found_po2json=`$NPM list --global 2> /dev/null | $GREP po2json`
if test x"${found_po2json}" == x"" ; then
AC_MSG_RESULT([not available])
AC_MSG_WARN([Please install the node.js module po2json to build i18n.])
else
AC_MSG_RESULT([ok])
NODEJS_SUPPORT_PO2JSON=yes
fi
else
AC_MSG_WARN([Please install npm and the the node.js module po2json to build i18n.])
fi
AC_SUBST(NODEJS_SUPPORT_PO2JSON)
VERSION=`dpkg-parsechangelog | sed -n 's/^Version: //p'`
PACKAGE_VERSION="$VERSION"
PACKAGE_STRING="$PACKAGE_NAME $PACKAGE_VERSION"
@ -122,6 +163,8 @@ AC_DEFINE_UNQUOTED(PACKAGE_VERSION, ["$PACKAGE_VERSION"], [Define to the version @@ -122,6 +163,8 @@ AC_DEFINE_UNQUOTED(PACKAGE_VERSION, ["$PACKAGE_VERSION"], [Define to the version
AC_DEFINE_UNQUOTED(PACKAGE_STRING, ["$PACKAGE_STRING"], [Define to the full name and version of this package.])
AC_CONFIG_FILES([
Makefile src/styles/Makefile
Makefile
src/styles/Makefile
src/i18n/Makefile
])
AC_OUTPUT

42
src/i18n/Makefile

@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
VERSION := "1.0"
PROJECT := "Spreed WebRTC"
COPYRIGHT := "struktur AG"
EMAIL := "simon@struktur.de"
ROOT := "$(CURDIR)/../.."
LANGUAGES := $(shell find ./ -iname '*.po' -printf '%f\n' | sed 's/\.po$$//' | sed 's/\messages-//')
# Tools
NODEJS := nodejs
PYBABEL := pybabel
NODE_PATH := /usr/local/lib/node_modules:/usr/lib/node_modules
PYTHON := python
build: update
for lang in $(LANGUAGES) ; do \
NODE_PATH=$(NODE_PATH) $(NODEJS) helpers/po2json messages-$$lang.po $(ROOT)/static/translation/messages-$$lang.json ; \
done
$(PYTHON) helpers/languages.py >$(ROOT)/static/translation/languages.js
extract:
$(PYBABEL) extract -F babel.cfg --no-default-keywords -k _n:1,2 -k _ \
--no-location --project=$(PROJECT) --version=$(VERSION) \
--copyright-holder=$(COPYRIGHT) --msgid-bugs-address=$(EMAIL) \
-o messages.pot \
$(ROOT)/html \
$(ROOT)/static/partials \
$(ROOT)/static/partials/page \
$(ROOT)/static/js/ \
$(ROOT)/static/js/controllers \
$(ROOT)/static/js/directives \
$(ROOT)/static/js/services \
$(ROOT)/static/js/filters
update:
for lang in $(LANGUAGES) ; do \
l=$$lang ; \
if echo $$l | grep -q -; then \
l=`echo $$lang | awk '{split($$0,a,"-"); printf "%s_%s", a[1],toupper(a[2])}'` ; \
fi ; \
$(PYBABEL) update -l $$l -i messages.pot -o messages-$$lang.po ; \
done

58
src/i18n/Makefile.am

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
#
# Spreed WebRTC.
# Copyright (C) 2013-2014 struktur AG
#
# This file is part of Spreed WebRTC.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
AUTOMAKE_OPTIONS = -Wno-portability
ROOT=$(CURDIR)/../..
build: LANGUAGES = $(shell $(FIND) ./ -iname '*.po' -printf '%f\n' | $(SED) 's/\.po$$//' | $(SED) 's/\messages-//')
build: update
@if [ "$(NODEJS_SUPPORT_PO2JSON)" = "no" ]; then echo "Node.js module 'po2json' not found, required when building i18n"; exit 1; fi
@if [ "$(PYTHON)" = "" ]; then echo "Command 'python' not found, required when building i18n"; exit 1; fi
for lang in $(LANGUAGES) ; do \
$(NODEJS) "$(CURDIR)/helpers/po2json" "$(CURDIR)/messages-$$lang.po" "$(ROOT)/static/translation/messages-$$lang.json" ; \
done
$(PYTHON) "$(CURDIR)/helpers/languages.py" > "$(ROOT)/static/translation/languages.js"
extract:
@if [ "$(PYBABEL)" = "" ]; then echo "Command 'pybabel' not found, required when extracting i18n"; exit 1; fi
$(PYBABEL) extract -F babel.cfg --no-default-keywords -k _n:1,2 -k _ \
--no-location --project="$(I18N_PROJECT)" --version="$(I18N_VERSION)" \
--copyright-holder="$(I18N_COPYRIGHT)" --msgid-bugs-address="$(I18N_BUG_ADDRESS)" \
-o "$(CURDIR)/messages.pot" \
"$(ROOT)/html" \
"$(ROOT)/static/partials" \
"$(ROOT)/static/partials/page" \
"$(ROOT)/static/js" \
"$(ROOT)/static/js/controllers" \
"$(ROOT)/static/js/directives" \
"$(ROOT)/static/js/services" \
"$(ROOT)/static/js/filters"
update: LANGUAGES = $(shell $(FIND) ./ -iname '*.po' -printf '%f\n' | $(SED) 's/\.po$$//' | $(SED) 's/\messages-//')
update:
@if [ "$(PYBABEL)" = "" ]; then echo "Command 'pybabel' not found, required when updating i18n"; exit 1; fi
for lang in $(LANGUAGES) ; do \
l=$$lang ; \
if echo $$l | grep -q -; then \
l=`echo $$lang | $(AWK) '{split($$0,a,"-"); printf "%s_%s", a[1],toupper(a[2])}'` ; \
fi ; \
$(PYBABEL) update -l $$l -i "$(CURDIR)/messages.pot" -o "$(CURDIR)/messages-$$lang.po" ; \
done

4
src/styles/Makefile.am

@ -23,6 +23,10 @@ AUTOPREFIXER_BROWSER_SUPPORT := "> 1%, last 2 versions, Firefox ESR, Opera 12.1" @@ -23,6 +23,10 @@ AUTOPREFIXER_BROWSER_SUPPORT := "> 1%, last 2 versions, Firefox ESR, Opera 12.1"
STATIC = ../../static
styles:
@if [ "$(SASS)" = "" ]; then echo "Command 'sass' not found, required when building styles"; exit 1; fi
@if [ "$(AUTOPREFIXER)" = "" ]; then echo "Command 'autoprefixer' not found, required when building styles"; exit 1; fi
@if [ "$(NODEJS_SUPPORT_STYLES)" = "no" ]; then echo "Your version of node.js does not support building styles"; exit 1; fi
@if [ "$(SASS_SUPPORT_STYLES)" = "no" ]; then echo "Your version of sass does not support building styles"; exit 1; fi
$(MKDIR_P) $(STATIC)/css
$(SASS) --compass --scss $(SASSFLAGS) \
$(CURDIR)/main.scss:$(STATIC)/css/main.min.css

Loading…
Cancel
Save