"Fossies" - the Fresh Open Source Software Archive

Member "LinOTP-release-2.10.5.2/linotpd/src/Makefile" (13 May 2019, 4714 Bytes) of package /linux/misc/LinOTP-release-2.10.5.2.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # -*- coding: utf-8 -*-
    2 #
    3 #    LinOTP - the open source solution for two factor authentication
    4 #    Copyright (C) 2010 - 2019 KeyIdentity GmbH
    5 #
    6 #    This file is part of LinOTP server.
    7 #
    8 #    This program is free software: you can redistribute it and/or
    9 #    modify it under the terms of the GNU Affero General Public
   10 #    License, version 3, as published by the Free Software Foundation.
   11 #
   12 #    This program is distributed in the hope that it will be useful,
   13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15 #    GNU Affero General Public License for more details.
   16 #
   17 #    You should have received a copy of the
   18 #               GNU Affero General Public License
   19 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
   20 #
   21 #
   22 #    E-mail: linotp@keyidentity.com
   23 #    Contact: www.linotp.org
   24 #    Support: www.keyidentity.com
   25 #
   26 
   27 PYTHON:=$(shell which python)
   28 DESTDIR=/
   29 BUILDDIR=$(PWD)/../build
   30 PROJECT=LinOTP
   31 LINOTP_SRC_VERSION=$(shell python setup.py --version)
   32 DEB_BUILDDIR:=$(BUILDDIR)/linotp
   33 
   34 COPYSTUFF = tools setup.* linotp config debian Makefile DESCRIPTION MANIFEST.in README.txt
   35 
   36 I18N_LANGUAGES = de fr it es zh
   37 I18N_SRC := $(CURDIR)/linotp/i18n
   38 I18N_JSON_DEST := $(CURDIR)/linotp/public/i18n
   39 I18N_PO_FILES := $(foreach lang,$(I18N_LANGUAGES),$(I18N_SRC)/$(lang)/LC_MESSAGES/linotp.po)
   40 I18N_JSON_FILES := $(foreach lang,$(I18N_LANGUAGES),$(I18N_JSON_DEST)/$(lang).json)
   41 
   42 
   43 .PHONY: all
   44 all:
   45 	@echo "make source - Create source package"
   46 	@echo "make create - Create the source packages"
   47 	@echo "make install - Install on local system"
   48 	@echo "make buildrpm - Generate a rpm package"
   49 	@echo "make builddeb - Generate a deb package"
   50 	@echo "make clean - Get rid of scratch and byte files"
   51 	@echo "make translate"
   52 
   53 
   54 .PHONY: extract
   55 extract:
   56 	python setup.py extract_messages
   57 	$(foreach lang, \
   58 		$(I18N_LANGUAGES), \
   59 		msgmerge -U $(I18N_SRC)/$(lang)/LC_MESSAGES/linotp.po $(I18N_SRC)/linotp.pot \
   60 		;\
   61 	)
   62 
   63 $(I18N_SRC)/%/LC_MESSAGES/linotp.po: extract
   64 
   65 .PHONY: translate
   66 translate:
   67 	@echo "Execute translate-LANG (e.g. translate-de)"
   68 
   69 translate-%: $(I18N_SRC)/%/LC_MESSAGES/linotp.po
   70 	gtranslator $<
   71 	$(MAKE) compile_catalog
   72 
   73 # Compile a .po file to a .json file using the `pojson` tool.
   74 $(I18N_JSON_DEST)/%.json: $(I18N_SRC)/%/LC_MESSAGES/linotp.po
   75 	mkdir -p $(I18N_JSON_DEST)
   76 	pojson -e utf-8 $< > $@
   77 
   78 # Compile all .po files to .mo files using babel. As a dependency,
   79 # the .po files are compiled to .json files. The order doesn't matter.
   80 .PHONY: compile_catalog
   81 compile_catalog: $(I18N_JSON_FILES)
   82 	python setup.py compile_catalog
   83 
   84 .PHONY: buildtranslation
   85 buildtranslation: extract compile_catalog
   86 
   87 .PHONY: source
   88 source:
   89 	mkdir -p $(BUILDDIR)
   90 	$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=$(BUILDDIR)
   91 
   92 .PHONY: create
   93 create: source
   94 
   95 .PHONY: install
   96 install:
   97 	$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
   98 
   99 .PHONY: buildrpm
  100 buildrpm:
  101 	$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
  102 
  103 .PHONY: prepare-deb-source
  104 prepare-deb-source: source
  105 	mkdir -pv $(DEB_BUILDDIR)
  106 
  107 	# Unpack clean sources to a staging directory for building from. This is to ensure
  108 	# that we have built linotp from the same source tarball contents.
  109 
  110 	# The debian packaging directory is not included in the source tarball.
  111 	# See <https://wiki.debian.org/UpstreamGuide#Pristine_Upstream_Source> for rationale
  112 
  113 	# Create tarball copy in the format expected by dpkg-source
  114 	cd $(DEB_BUILDDIR) \
  115 		&& upstream_version=$(shell dpkg-parsechangelog | grep "^Version:" |cut -d' ' -f2 | cut -d- -f1) ;\
  116 		package_name=$(shell dpkg-parsechangelog | grep "^Source:" |cut -d' ' -f2 ) ;\
  117 		orig_tar_name="../$${package_name}_$${upstream_version}.$(TAR_SUFFIX)" ;\
  118 		cp $(BUILDDIR)/$(PROJECT)-*.tar.gz $${orig_tar_name} \
  119 		&& tar --strip-components=1 -xf $${orig_tar_name}
  120 
  121 	cp -r debian $(DEB_BUILDDIR)
  122 
  123 # Ubuntu builds create source packages in linotpd/src
  124 .PHONY: ppa-preprocess
  125 ppa-preprocess: source
  126 	$(MAKE) prepare-deb-source DEB_BUILDDIR=linotp-build TAR_SUFFIX=ubuntu-temp.tar.gz
  127 	cd linotp-build && debuild -S
  128 
  129 
  130 # Debian builds create binary packages in linotpd/build
  131 .PHONY: builddeb
  132 builddeb:
  133 	$(MAKE) prepare-deb-source DEB_BUILDDIR=$(DEB_BUILDDIR) TAR_SUFFIX=orig.tar.gz
  134 	cd $(DEB_BUILDDIR); dpkg-buildpackage -i -I -rfakeroot $(DPKG_BUILDPACKAGE_ARGS)
  135 
  136 .PHONY: clean
  137 clean:
  138 	$(PYTHON) setup.py clean
  139 	rm -rf MANIFEST
  140 	find . -name '*.pyc' -delete
  141 	rm -fr ./LinOTP.egg-info/
  142 	rm -f $(I18N_JSON_FILES)
  143 	rm -rf ../build/ \
  144 		linotp-build
  145 
  146 	rm -f linotp_*.dsc \
  147 		linotp_*.build \
  148 		linotp_*.tar.gz \
  149 		linotp_*.diff.gz \
  150 		linotp_*.changes \
  151 		linotp_*.upload
  152 
  153 
  154 test:
  155 	./test.sh