From 9ca99a4db82042a46cd2cd61b3378edab06d6ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Tue, 25 May 2021 19:41:40 +0200 Subject: [PATCH] DEB tde-i18n: Use top-level CMake rules to build package. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit d79b34324d6a74604fb196616fa814f16208f9a2) --- debian/_base/core/tde-i18n/debian/rules | 29 +++++++++++++++++++++++++ dilos/core/tde-i18n/debian/rules | 29 +++++++++++++++++++++++++ ubuntu/_base/core/tde-i18n/debian/rules | 29 +++++++++++++++++++++++++ 3 files changed, 87 insertions(+) diff --git a/debian/_base/core/tde-i18n/debian/rules b/debian/_base/core/tde-i18n/debian/rules index 3a352bb27..31b7b28fc 100755 --- a/debian/_base/core/tde-i18n/debian/rules +++ b/debian/_base/core/tde-i18n/debian/rules @@ -10,6 +10,7 @@ I18N_DIRS := $(wildcard $(I18N_DIR_PREFIX)-*) # Stamps and support variables cur_lang = $(word 2,$(subst __, ,$@)) +cur_lang_target = $(subst @,_,$(cur_lang)) cur_lang_dir = $(patsubst %,$(I18N_DIR_PREFIX)-%,$(cur_lang)) cur_pkg_lang = $(subst _,,$(subst @,,$(subst @latn,latin,$(shell echo $(cur_lang) | tr '[:upper:]' '[:lower:]')))) cur_pkg = $(I18N_DEST_PREFIX)-$(cur_pkg_lang)-trinity @@ -56,6 +57,20 @@ build:: dh_testdir dh_prep +ifneq "$(wildcard /usr/bin/ninja)" "" + +build:: debian/stamp__build + +debian/stamp__build: + [ -d build ] || \ + mkdir build + cd build && \ + cmake .. $(DEB_CMAKE_NORMAL_ARGS) $(DEB_CMAKE_EXTRA_FLAGS) && \ + $(MAKE) $(DEB_MAKE_PARALLEL) + touch $@ + +else + build:: $(STAMP_BUILD) $(STAMP_BUILD): @@ -69,6 +84,7 @@ $(STAMP_BUILD): $(MAKE) $(DEB_MAKE_PARALLEL) touch $@ +endif install:: dh_testdir @@ -77,9 +93,19 @@ install:: install:: $(I18N_INSTALL) $(I18N_INSTALL): build +ifneq "$(wildcard /usr/bin/ninja)" "" + [ ! -e $(cur_lang_dir)/CMakeLists.txt ] || \ + DESTDIR=$(CURDIR)/debian/$(cur_pkg) $(MAKE) -C build install-$(cur_lang_target) +else cd $(cur_lang_dir)/build && \ DESTDIR=$(CURDIR)/debian/$(cur_pkg) $(MAKE) install $(DEB_MAKE_PARALLEL) +endif + +ifneq "$(wildcard /usr/bin/ninja)" "" + +clean: debian-clean +else clean: $(I18N_CLEAN) debian-clean @@ -87,8 +113,11 @@ $(I18N_CLEAN): dh_testdir rm -rf $(cur_lang_dir)/build +endif + debian-clean: dh_testdir + rm -rf build rm -rf debian/$(I18N_DEST_PREFIX)-* rm -f debian/stamp__* dh_clean diff --git a/dilos/core/tde-i18n/debian/rules b/dilos/core/tde-i18n/debian/rules index 719b4ba23..bba9817f3 100755 --- a/dilos/core/tde-i18n/debian/rules +++ b/dilos/core/tde-i18n/debian/rules @@ -10,6 +10,7 @@ I18N_DIRS := $(wildcard $(I18N_DIR_PREFIX)-*) # Stamps and support variables cur_lang = $(word 2,$(subst __, ,$@)) +cur_lang_target = $(subst @,_,$(cur_lang)) cur_lang_dir = $(patsubst %,$(I18N_DIR_PREFIX)-%,$(cur_lang)) cur_pkg_lang = $(subst _,,$(subst @,,$(subst @latn,latin,$(shell echo $(cur_lang) | tr '[:upper:]' '[:lower:]')))) cur_pkg = $(I18N_DEST_PREFIX)-$(cur_pkg_lang)-trinity @@ -55,6 +56,20 @@ build:: dh_testdir dh_prep +ifneq "$(wildcard /usr/bin/ninja)" "" + +build:: debian/stamp__build + +debian/stamp__build: + [ -d build ] || \ + mkdir build + cd build && \ + cmake .. $(DEB_CMAKE_NORMAL_ARGS) $(DEB_CMAKE_EXTRA_FLAGS) && \ + $(MAKE) $(DEB_MAKE_PARALLEL) + touch $@ + +else + build:: $(STAMP_BUILD) $(STAMP_BUILD): @@ -68,6 +83,7 @@ $(STAMP_BUILD): $(MAKE) $(DEB_MAKE_PARALLEL) touch $@ +endif install:: dh_testdir @@ -76,9 +92,19 @@ install:: install:: $(I18N_INSTALL) $(I18N_INSTALL): build +ifneq "$(wildcard /usr/bin/ninja)" "" + [ ! -e $(cur_lang_dir)/CMakeLists.txt ] || \ + DESTDIR=$(CURDIR)/debian/$(cur_pkg) $(MAKE) -C build install-$(cur_lang_target) +else cd $(cur_lang_dir)/build && \ DESTDIR=$(CURDIR)/debian/$(cur_pkg) $(MAKE) install $(DEB_MAKE_PARALLEL) +endif + +ifneq "$(wildcard /usr/bin/ninja)" "" + +clean: debian-clean +else clean: $(I18N_CLEAN) debian-clean @@ -86,8 +112,11 @@ $(I18N_CLEAN): dh_testdir rm -rf $(cur_lang_dir)/build +endif + debian-clean: dh_testdir + rm -rf build rm -rf debian/$(I18N_DEST_PREFIX)-* rm -f debian/stamp__* dh_clean diff --git a/ubuntu/_base/core/tde-i18n/debian/rules b/ubuntu/_base/core/tde-i18n/debian/rules index 3a352bb27..31b7b28fc 100755 --- a/ubuntu/_base/core/tde-i18n/debian/rules +++ b/ubuntu/_base/core/tde-i18n/debian/rules @@ -10,6 +10,7 @@ I18N_DIRS := $(wildcard $(I18N_DIR_PREFIX)-*) # Stamps and support variables cur_lang = $(word 2,$(subst __, ,$@)) +cur_lang_target = $(subst @,_,$(cur_lang)) cur_lang_dir = $(patsubst %,$(I18N_DIR_PREFIX)-%,$(cur_lang)) cur_pkg_lang = $(subst _,,$(subst @,,$(subst @latn,latin,$(shell echo $(cur_lang) | tr '[:upper:]' '[:lower:]')))) cur_pkg = $(I18N_DEST_PREFIX)-$(cur_pkg_lang)-trinity @@ -56,6 +57,20 @@ build:: dh_testdir dh_prep +ifneq "$(wildcard /usr/bin/ninja)" "" + +build:: debian/stamp__build + +debian/stamp__build: + [ -d build ] || \ + mkdir build + cd build && \ + cmake .. $(DEB_CMAKE_NORMAL_ARGS) $(DEB_CMAKE_EXTRA_FLAGS) && \ + $(MAKE) $(DEB_MAKE_PARALLEL) + touch $@ + +else + build:: $(STAMP_BUILD) $(STAMP_BUILD): @@ -69,6 +84,7 @@ $(STAMP_BUILD): $(MAKE) $(DEB_MAKE_PARALLEL) touch $@ +endif install:: dh_testdir @@ -77,9 +93,19 @@ install:: install:: $(I18N_INSTALL) $(I18N_INSTALL): build +ifneq "$(wildcard /usr/bin/ninja)" "" + [ ! -e $(cur_lang_dir)/CMakeLists.txt ] || \ + DESTDIR=$(CURDIR)/debian/$(cur_pkg) $(MAKE) -C build install-$(cur_lang_target) +else cd $(cur_lang_dir)/build && \ DESTDIR=$(CURDIR)/debian/$(cur_pkg) $(MAKE) install $(DEB_MAKE_PARALLEL) +endif + +ifneq "$(wildcard /usr/bin/ninja)" "" + +clean: debian-clean +else clean: $(I18N_CLEAN) debian-clean @@ -87,8 +113,11 @@ $(I18N_CLEAN): dh_testdir rm -rf $(cur_lang_dir)/build +endif + debian-clean: dh_testdir + rm -rf build rm -rf debian/$(I18N_DEST_PREFIX)-* rm -f debian/stamp__* dh_clean