File debian.rules of Package geant4-data-template

#!/usr/bin/make -f

export DH_VERBOSE=1

debname = $(shell dpkg-parsechangelog | sed -n -e 's/^Source: //p')
debversion = $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')

name = $(debname)-%%DEB_G4DATA%%

g4DataName = %%CURRENT_BUILDING_G4DATA%%
g4DataVersion = %%CURRENT_G4DATA_VERSION%%
g4DataPreviousVersion = %%PREVIOUS_G4DATA_VERSION%%

ifeq ($(g4DataPreviousVersion),initial)
with_MultiVersionBuild = 0
else
with_MultiVersionBuild = 1
endif

g4Name = geant4
g4NameData = $(g4Name)-data
g4InstallRoot = /opt/$(g4Name)
g4DataPath = $(g4InstallRoot)/$(g4NameData)


buildroot = /usr/src/packages/BUILD/debian/$(name)-$(g4DataVersion)
buildroot-multi = /usr/src/packages/BUILD/debian/$(name)-$(g4DataVersion)-multi-version
_sourcedir = /usr/src/packages/SOURCES
_bindir = /usr/bin
_docdir = /usr/share/doc
_datadir = /usr/share

%:
	dh $@

override_dh_auto_install:
	if [ "$(with_MultiVersionBuild)" = "1" ] ; then \
	if [ ! -d $(buildroot-multi)$(g4DataPath)/$(g4DataName)$(g4DataVersion) ] ; then \
	install -d $(buildroot-multi)$(g4DataPath)/$(g4DataName)$(g4DataVersion) ; \
	fi ; \
	tar --strip-components=1 -xzf $(_sourcedir)/*.tar.gz -C $(buildroot-multi)$(g4DataPath)/$(g4DataName)$(g4DataVersion)/ ; \
	cp -r $(g4DataPath)/$(g4DataName)$(g4DataPreviousVersion) $(buildroot-multi)$(g4DataPath)/ ; \
	cp $(_sourcedir)/my-fdupes.sh ./ ; \
	chmod +x my-fdupes.sh ; \
	bash -c './my-fdupes.sh  "$(buildroot-multi)$(g4DataPath)" "$(g4DataName)$(g4DataVersion)"' ; \
	rm -rf $(buildroot-multi)$(g4DataPath)/$(g4DataName)$(g4DataPreviousVersion) ; \
	find $(buildroot-multi)$(g4DataPath) -name ".DS_Store" -delete -print ; \
	find $(buildroot-multi)$(g4DataPath) -name "*.swp" -delete -print ; \
	fi
	if [ ! -d $(buildroot)$(g4DataPath)/$(g4DataName)$(g4DataVersion) ] ; then install -d $(buildroot)$(g4DataPath)/$(g4DataName)$(g4DataVersion) ; fi
	tar --strip-components=1 -xzf $(_sourcedir)/*.tar.gz -C $(buildroot)$(g4DataPath)/$(g4DataName)$(g4DataVersion)/
	find $(buildroot)$(g4DataPath) -name ".DS_Store" -delete -print
	find $(buildroot)$(g4DataPath) -name "*.swp" -delete -print

override_dh_auto_build:

openSUSE Build Service is sponsored by