Blame html/Makefile

d428ee
###############################################################################
d428ee
#
6cf361
#  The CentOS HTML Makefile
d428ee
#  Copyright (C) 2019  Alain Reguera Delgado
d428ee
#
d428ee
#  This program is free software: you can redistribute it and/or modify it
d428ee
#  under the terms of the GNU General Public License as published by the Free
d428ee
#  Software Foundation, either version 3 of the License, or (at your option)
d428ee
#  any later version.
d428ee
#
d428ee
#  This program is distributed in the hope that it will be useful, but WITHOUT
d428ee
#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d428ee
#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
d428ee
#  more details.
d428ee
#
d428ee
#  You should have received a copy of the GNU General Public License along with
d428ee
#  this program.  If not, see <https://www.gnu.org/licenses/>.
d428ee
#
d428ee
###############################################################################
d428ee
d428ee
#==============================================================================
d428ee
# Configuration
d428ee
#==============================================================================
6cf361
package = centos-indexhtml
6cf361
version = 8.0
fb428a
lang = en-US
d428ee
localedir = PO
6cf361
prefix = .
d428ee
d428ee
#==============================================================================
d428ee
# Requirements
d428ee
#==============================================================================
6cf361
all: $(package)/$(lang)/index.html
6cf361
3d1806
build: $(prefix)/$(package)-$(version).tar.gz
1395ad
1395ad
#==============================================================================
1395ad
# Sources
1395ad
#==============================================================================
6cf361
$(prefix)/$(package)-$(version).tar.gz: \
6cf361
	$(package)/??-??/* \
6cf361
	$(package)/index.tpl.html \
6cf361
	$(package)/index.html \
6cf361
	$(localedir)/*.po \
6cf361
	common/css/* \
6cf361
	common/images/* \
6cf361
	common/fonts/*
6cf361
	rm -r $(package)-$(version) || mkdir $(package)-$(version)
6cf361
	cp -a $(package)/??-?? $(package)-$(version)
6cf361
	cp -a $(package)/index.html $(package)-$(version)
6cf361
	cp -a common $(package)-$(version)
6cf361
	if [[ $(package) == centos-indexhtml ]];then \
6cf361
		rm -v $(package)-$(version)/common/images/pb-*.png; \
6cf361
	fi
ca15a1
	tar -czf $(prefix)/$(package)-$(version).tar.gz $(package)-$(version)
6cf361
	rm -r $(package)-$(version)
d428ee
d428ee
#======================================================================
6cf361
# Localization
d428ee
#======================================================================
6cf361
$(localedir)/$(lang).pot: centos-*/index.tpl.html
6cf361
	xml2po -l $(lang) -o /tmp/$(lang).pot centos-*/index.tpl.html
d428ee
	if [[ ! -f $(localedir)/$(lang).pot ]];then \
d428ee
		msginit -i /tmp/$(lang).pot -o $(localedir)/$(lang).pot -l $(lang) --no-translator --width=80; \
d428ee
	else \
d428ee
		msgmerge -U $(localedir)/$(lang).pot /tmp/$(lang).pot; \
d428ee
	fi
d428ee
	rm /tmp/$(lang).pot
d428ee
$(localedir)/$(lang).po: $(localedir)/$(lang).pot
d428ee
	if [[ ! -f $(localedir)/$(lang).po ]];then \
d428ee
		msginit -i $(localedir)/$(lang).pot -o $(localedir)/$(lang).po -l $(lang) --no-translator --width=80; \
d428ee
	else \
d428ee
		msgmerge -U $(localedir)/$(lang).po $(localedir)/$(lang).pot; \
d428ee
	fi
d428ee
d428ee
#======================================================================
6cf361
# Content
d428ee
#======================================================================
6cf361
$(package)/$(lang)/index.html: $(localedir)/$(lang).po $(package)/index.tpl.html
6cf361
	xmllint -noout $(package)/index.tpl.html
6cf361
	xml2po -l $(lang) -p $(localedir)/$(lang).po -o $(package)/$(lang)/index.html $(package)/index.tpl.html
6cf361
	sed -i 's/<html lang="en-US">/<html lang="$(lang)">/' $(package)/$(lang)/index.html