## 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
#### 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=
if WANT_SPELLERS
if CAN_HFST
if CAN_LOCALSYNC
# 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))
#MACVKOFST=$(MACVOIKKOFILE)/Contents/Resources/Dictionaries/3/$(GT_SPELLING_HFST)
MOZVOIKKO_FILE=Mozvoikko2-$(GTLANG2).xpi
endif # CAN_LOCALSYNC
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)))
TOOLLIBS_DIR=$(GTHOME)/prooftools/toollibs
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 $@ && \
if [ -d "$(OXT_ROOT_DIR)/4$*" ]; then \
$(MKDIR_P) build/4$*/ && \
cd build/4$* && \
$(RSYNC) $(RSYNC_OPTIONS) $(VERBOSITY) $(OXT_ROOT_DIR)/4$*/ ./ && \
cp ../../$< 3/ && \
$(ZIP) -r $(VERBOSITY) $(ZIPFLAGS) ../../$@ * ; \
else \
echo " SKIP $@: Not yet supported." ; \
fi
$(GTLANG2)_LO-voikko-5%.oxt: $(GT_SPELLING_HFST)
$(AM_V_GEN)rm -f $@ && \
if [ -d "$(OXT_ROOT_DIR)/5$*" ]; then \
$(MKDIR_P) build/5$*/ && \
cd build/5$* && \
$(RSYNC) $(RSYNC_OPTIONS) $(VERBOSITY) $(OXT_ROOT_DIR)/5$*/ ./ && \
cp ../../$< voikko/3/ && \
$(ZIP) -r $(VERBOSITY) $(ZIPFLAGS) ../../$@ * ; \
else \
echo " SKIP $@: Not yet supported." ; \
fi
#### 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 $@ && \
if [ -d "$(MACVKO_ROOT_DIR)/MacVoikko.service" ]; then \
$(MKDIR_P) $@ && \
$(RSYNC) $(RSYNC_OPTIONS) $(VERBOSITY) \
$(MACVKO_ROOT_DIR)/MacVoikko.service/ ./$@/ ; \
fi
$(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
$(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/$@ && \
$(RSYNC) $(RSYNC_OPTIONS) $(VERBOSITY) $(MOZVOIKKO_DIR)/ ./ && \
cp ../../$< voikko/3/ && \
$(ZIP) -r $(VERBOSITY) $(ZIPFLAGS) ../../$@ *
#### Upload for distro: ####
DATE=$(shell date +%Y%m%d)
UPLOADSITE=sd@divvun.no:static_files
upload: uploadoxt uploadxpi uploadzip uploadzhfst
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 sd@divvun.no "cd staticfiles/oxts/ && \
ln -sf $$stem-$(DATE).oxt $$file" ; \
echo " SYMLINK $$file" ; \
fi \
done
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 sd@divvun.no "cd staticfiles/xpis/ && \
ln -sf $$stem-$(DATE).xpi $$file" ; \
echo " SYMLINK $$file" ; \
fi \
done
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 sd@divvun.no "cd staticfiles/zips/ && \
ln -sf $$stem-$(DATE).zip $$file" ; \
echo " SYMLINK $$file" ; \
fi \
done
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 sd@divvun.no "cd staticfiles/zhfsts/ && \
ln -sf $$stem-$(DATE).zhfst $$file" ; \
echo " SYMLINK $$file" ; \
fi \
done