## Process this file with automake to produce Makefile.in
## Copyright (C) 2011 Samediggi
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU 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 General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with this program. If not, see .
####### Distribution files, *.oxt and MacVoikko : #######
# rsync options: do not use -av - -v is for verbosity, and that is now
# controlled by $(VERBOSITY). -a implies -t, which keeps the timestamp from the
# source location. This makes the rsynced files look older than the source for
# 'make', causing the targets built using rsync to be constantly out-of-date,
# and thus constantly being rebuilt. The option list given corresponds to
# -a without the -t option.
RSYNC_OPTIONS=-rlpgoD
# wget options: -r for recursive, -nH to skip the host name as the first local
# dir, --cut-dirs=2 to ???, --no-parent to avoid wget going upwards in the dir
# hierarchy, and finally -e robots=off to actually traverse the dir tree (we
# have a robot.txt file to avoid Google etc to constantly index our svn tree).
WGET_OPTIONS=-r -nH --no-parent -e robots=off --reject "index.html*"
SCP=scp -q
#### LibreOffice-Voikko version: ####
# This value corresponds to the version in the dir name of
# the oxt template in prooftools/toollibs/LbreOffice-voikko/:
LOVOIKKO_VERSION=5.0
OXT_FILES=
MACVOIKKOFILE=
MACVOIKKOZIPFILE=
MOZVOIKKO_FILE=
# Variable to collect all final targets - needs to be conditional on whether
# we are able to actually build the targets
INST_FILES=
if WANT_SPELLERS
if CAN_HFST
# Only build final speller packages if is enabled (default=yes):
if WANT_HFST_DESKTOP_SPELLER
# Generate target file name dynamically based on the variables LOVOIKKO_VERSION
# and GTLANG2. LO-voikko 5.0+
OXT_FILES+=$(GTLANG2)_LO-voikko-$(LOVOIKKO_VERSION).oxt
# Generate target file names dynamically based on the variables VK_VERSIONS
# and VK_PLATFORMS, whose cross product is available in VOIKKO_VERS_PLATFORMS.
# The resulting file names follow this pattern:
#
#$(GTLANG2)_LO-voikko-4.0-win.oxt
OXT_FILES+=$(addsuffix .oxt, \
$(addprefix $(GTLANG2)_LO-voikko-,$(VOIKKO_VERS_PLATFORMS)))
# Generate target filename as follows:
#
# MacVoikko-North_Sami-se.service
LANGSTRING=$(shell echo "${GTLANGUAGE}" | sed -e 's/ /_/g')
MACVOIKKO_STEM=$(addsuffix $(LANGSTRING),MacVoikko-)
MACVOIKKOFILE+=$(addsuffix .service,$(addsuffix -$(GTLANG2),$(MACVOIKKO_STEM)))
MACVOIKKOZIPFILE+=$(addsuffix .zip,$(MACVOIKKOFILE))
MOZVOIKKO_FILE+=Mozvoikko2-$(GTLANG2).xpi
if CAN_LOCALSYNC
TOOLLIBS_DIR=$(GIELLA_LIBS)
GET_LIBS_COMMAND=$(RSYNC) $(RSYNC_OPTIONS) $(VERBOSITY)
TARGET_DIR=.
# The following variable only makes sense for wget:
SKIP_DIR_NUM=
INST_FILES+=$(OXT_FILES) \
$(MOZVOIKKO_FILE) \
$(MACVOIKKOFILE) \
$(MACVOIKKOZIPFILE) \
$(ALT_WS_OXT_FILES) \
$(ALT_ORTH_OXT_FILES)
else
if CAN_REMOTE_SYNC
TOOLLIBS_DIR=https://gtsvn.uit.no/langtech/trunk/giella-libs
GET_LIBS_COMMAND=$(WGET) $(WGET_OPTIONS) $(VERBOSITY)
TARGET_DIR=--directory-prefix=.
# The following variable is required to remove intermediate dirs that clutter
# the dir structure when building the final speller packages:
SKIP_DIR_NUM= --cut-dirs=
INST_FILES+=$(OXT_FILES) \
$(MOZVOIKKO_FILE) \
$(MACVOIKKOFILE) \
$(MACVOIKKOZIPFILE) \
$(ALT_WS_OXT_FILES) \
$(ALT_ORTH_OXT_FILES)
endif # CAN_REMOTE_SYNC
endif # CAN_LOCALSYNC
endif # WANT_HFST_DESKTOP_SPELLER
endif # CAN_HFST
endif # WANT_SPELLERS
#### Voikko versions: ####
# 3.4.1
# 4.0
#
# These values corresponds to the version ID in the dir name of
# the oxt template
VK_VERSIONS=4.0
# LO-Voikko platforms:
VK_PLATFORMS=mac win
VOIKKO_VERS_PLATFORMS=$(foreach version,$(VK_VERSIONS), \
$(addprefix $(version)-,$(VK_PLATFORMS)))
OXT_ROOT_DIR=$(TOOLLIBS_DIR)/LibreOffice-voikko
MACVKO_ROOT_DIR=$(TOOLLIBS_DIR)/mac/MacVoikko
MOZVOIKKO_DIR=$(TOOLLIBS_DIR)/Mozvoikko
#### OXT file: ####
# - mkdir build dir
# - rsync into build/subdir
# - cp zhfst
# - modify oxt index file - (?) - looks like this is not done anymore.
# - zip build/subdir to ./
$(GTLANG2)_LO-voikko-4%.oxt: $(GT_SPELLING_HFST)
$(AM_V_GEN)rm -f $@ && \
$(MKDIR_P) build/4$*/ ; \
if test "x$(SKIP_DIR_NUM)" != "x" ; then \
remdirnum=$$(echo $(OXT_ROOT_DIR)/4$*/ \
| sed 's|https://gtsvn.uit.no/langtech/||' | tr '/' '\n' \
| wc -l) ; \
fi ; \
cd build/4$* && \
$(GET_LIBS_COMMAND) $(OXT_ROOT_DIR)/4$*/ $(TARGET_DIR)/ \
$(SKIP_DIR_NUM)$$remdirnum && \
cp ../../$< 3/ && \
$(ZIP) -r $(VERBOSITY) $(ZIPFLAGS) ../../$@ *
$(GTLANG2)_LO-voikko-5%.oxt: $(GT_SPELLING_HFST)
$(AM_V_GEN)rm -f $@ && \
$(MKDIR_P) build/5$*/ ; \
if test "x$(SKIP_DIR_NUM)" != "x" ; then \
remdirnum=$$(echo $(OXT_ROOT_DIR)/5$*/ \
| sed 's|https://gtsvn.uit.no/langtech/||' | tr '/' '\n' \
| wc -l) ; \
fi ; \
cd build/5$* && \
$(GET_LIBS_COMMAND) $(OXT_ROOT_DIR)/5$*/ $(TARGET_DIR)/ \
$(SKIP_DIR_NUM)$$remdirnum && \
cp ../../$< voikko/3/ && \
$(ZIP) -r $(VERBOSITY) $(ZIPFLAGS) ../../$@ *
#### MacVoikko: ####
# - create package dir
# - rsynk package content from template
# - cp zhfst file
# - replace und language code with correct language code
%.service: %.zhfst
$(AM_V_GEN)rm -rf $@ && \
$(MKDIR_P) $@
$(AM_V_GEN)if test "x$(SKIP_DIR_NUM)" != "x" ; then \
remdirnum=$$(echo $(MACVKO_ROOT_DIR)/MacVoikko.service/ \
| sed 's|https://gtsvn.uit.no/langtech/||' | tr '/' '\n' \
| wc -l) ; \
fi ; \
$(GET_LIBS_COMMAND) $(SKIP_DIR_NUM)$$remdirnum \
$(MACVKO_ROOT_DIR)/MacVoikko.service/ $(TARGET_DIR)/$@/
$(AM_V_at)sed "s/und<\/string>/$*<\/string>/" \
< ./$@/Contents/Info.plist > ./$@/Contents/Info.plist.tmp
$(AM_V_at)mv -f ./$@/Contents/Info.plist.tmp ./$@/Contents/Info.plist
$(AM_V_at)cp $< $@/Contents/Resources/Dictionaries/3/$<
# Rename service dir:
$(MACVOIKKO_STEM)-%.service: %.service
$(AM_V_at)rm -rf $@/
$(AM_V_MV)mv $< $@
# Zip service dir for distro (for now):
%.service.zip: %.service
$(AM_V_GEN)$(ZIP) -r $(VERBOSITY) $(ZIPFLAGS) $@ $<
#### Mozvoikko: ####
# - create package build dir
# - rsynk package content from template
# - cp zhfst file
# - zip to target file
Mozvoikko2-%.xpi: %.zhfst
$(AM_V_at)$(MKDIR_P) build/$@
$(AM_V_GEN)cd build/$@ ; \
if test "x$(SKIP_DIR_NUM)" != "x" ; then \
remdirnum=$$(echo $(MOZVOIKKO_DIR)/ \
| sed 's|https://gtsvn.uit.no/langtech/||' | tr '/' '\n' \
| wc -l) ; \
fi ; \
$(GET_LIBS_COMMAND) $(SKIP_DIR_NUM)$$remdirnum \
$(MOZVOIKKO_DIR)/ $(TARGET_DIR)/ && \
cp ../../$< voikko/3/ && \
$(ZIP) -r $(VERBOSITY) $(ZIPFLAGS) ../../$@ *
#### Upload for distro: ####
####
#### Variable defs:
####
DATE=$(shell date +%Y%m%d)
UPLOADUSR=sd
UPLOADSRV=divvun.no
UPLOADDIR=static_files
UPLOADSITE=$(UPLOADUSR)@$(UPLOADSRV):$(UPLOADDIR)
####
#### Targets:
####
# Upload everything:
upload: uploadoxt uploadxpi uploadzip uploadzhfst
# Upload OXT only:
uploadoxt: $(OXT_FILES) $(ALT_WS_OXT_FILES)
$(AM_V_GEN)for file in $^ ; do \
if [ -e $$file ]; then \
stem=$$(basename $$file .oxt) ; \
$(SCP) $$file $(UPLOADSITE)/oxts/$$stem-$(DATE).oxt ; \
ssh $(UPLOADUSR)@$(UPLOADSRV) "cd $(UPLOADDIR)/oxts/ && \
ln -sf $$stem-$(DATE).oxt $$file" ; \
echo " SYMLINK $$file" ; \
echo " DWNLOAD LINK this version: http://$(UPLOADSRV)/$(UPLOADDIR)/oxts/$$stem-$(DATE).oxt" ; \
echo " DWNLOAD LINK newest version: http://$(UPLOADSRV)/$(UPLOADDIR)/oxts/$$file" ; \
fi \
done
# Upload XPI only:
uploadxpi: $(MOZVOIKKO_FILE)
$(AM_V_GEN)for file in $^ ; do \
if [ -e $$file ]; then \
stem=$$(basename $$file .xpi) ; \
$(SCP) $$file $(UPLOADSITE)/xpis/$$stem-$(DATE).xpi ; \
ssh $(UPLOADUSR)@$(UPLOADSRV) "cd $(UPLOADDIR)/xpis/ && \
ln -sf $$stem-$(DATE).xpi $$file" ; \
echo " SYMLINK $$file" ; \
echo " DWNLOAD LINK this version: http://$(UPLOADSRV)/$(UPLOADDIR)/xpis/$$stem-$(DATE).xpi" ; \
echo " DWNLOAD LINK newest version: http://$(UPLOADSRV)/$(UPLOADDIR)/xpis/$$file" ; \
fi \
done
# Upload ZIP only:
uploadzip: $(MACVOIKKOZIPFILE)
$(AM_V_GEN)for file in $^ ; do \
if [ -e $$file ]; then \
stem=$$(basename $$file .zip) ; \
$(SCP) $$file $(UPLOADSITE)/zips/$$stem-$(DATE).zip ; \
ssh $(UPLOADUSR)@$(UPLOADSRV) "cd $(UPLOADDIR)/zips/ && \
ln -sf $$stem-$(DATE).zip $$file" ; \
echo " SYMLINK $$file" ; \
echo " DWNLOAD LINK this version: http://$(UPLOADSRV)/$(UPLOADDIR)/zips/$$stem-$(DATE).zip" ; \
echo " DWNLOAD LINK newest version: http://$(UPLOADSRV)/$(UPLOADDIR)/zips/$$file" ; \
fi \
done
# Upload ZHFST only:
uploadzhfst: $(GT_SPELLING_HFST) $(ALT_WS_ZHFST_FILES)
$(AM_V_GEN)for file in $^ ; do \
if [ -e $$file ]; then \
stem=$$(basename $$file .zhfst) ; \
$(SCP) $$file $(UPLOADSITE)/zhfsts/$$stem-$(DATE).zhfst ; \
ssh $(UPLOADUSR)@$(UPLOADSRV) "cd $(UPLOADDIR)/zhfsts/ && \
ln -sf $$stem-$(DATE).zhfst $$file" ; \
echo " SYMLINK $$file" ; \
echo " DWNLOAD LINK this version: http://$(UPLOADSRV)/$(UPLOADDIR)/zhfsts/$$stem-$(DATE).zhfst" ; \
echo " DWNLOAD LINK newest version: http://$(UPLOADSRV)/$(UPLOADDIR)/zhfsts/$$file" ; \
fi \
done