File debian.rules of Package talys-1.97

#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
DH_VERBOSE = 1

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

mname = talys
name = $(shell dpkg-parsechangelog | sed -n -e 's/^Source: //p')
version = $(shell dpkg-parsechangelog | sed -n -e "s/^Version:\ \+\(.*\)[-\ ].*/\1/p")
sources_path = /usr/src/packages/SOURCES/
SOURCE1 = $(sources_path)$(mname)-samples-$(version).tar.gz
SOURCE2 = $(sources_path)$(mname).patch
dataVersion = 2.0
dname = $(mname)-$(dataVersion)

buildroot = /usr/src/packages/BUILD/debian/$(name)
_bindir = /usr/bin
_docdir = /usr/share/doc
_datadir = /usr/share

%:
	dh $@

override_dh_auto_build:
	sed -i "s|  codedir.*|  codedir = '$(_datadir)/$(dname)/'|" source/machine.f
	cd source ;\
	ls *.o > /dev/null 2>&1 && rm -rf *.o ;\
	ls *.mod > /dev/null 2>&1   && rm -rf *.mod ;\
	ls *.f* > /dev/null 2>&1 && gfortran -w -c *.f* ;\
	gfortran *.o -o $(name) ;\
	ls *.o > /dev/null 2>&1 && rm -rf *.o ;\
	ls *.mod > /dev/null 2>&1   && rm -rf *.mod ;\
	sed -i "s|\(beta2(.[^)]*)\)|abs(\1)|" foldalpha.f* ;\
	grep beta2 foldalpha.f* ;\
	ls *.f* > /dev/null 2>&1 && gfortran -w -c *.f* ;\
	gfortran *.o -o $(name)a ;\
	ls *.o > /dev/null 2>&1 && rm -rf *.o ;\
	ls *.mod > /dev/null 2>&1   && rm -rf *.mod ;\
	patch -p2 -b $(SOURCE2) ;\
	ls *.f* > /dev/null 2>&1 && gfortran -w -c *.f* ;\
	gfortran *.o -o $(name)pa ;\
	ls *.o > /dev/null 2>&1 && rm -rf *.o ;\
	ls *.mod > /dev/null 2>&1   && rm -rf *.mod ;\
	exit 0

override_dh_auto_install:
	install -d                             $(buildroot)$(_bindir)
	install -m755 source/$(name)           $(buildroot)$(_bindir)/
	install -m755 source/$(name)a          $(buildroot)$(_bindir)/
	install -m755 source/$(name)pa         $(buildroot)$(_bindir)/
	rm -rf source/$(name)
	rm -rf source/$(name)a
	rm -rf source/$(name)pa
	install -m755 misc/tplot               $(buildroot)$(_bindir)/tplot-$(version)
	install -d                             $(buildroot)-doc$(_docdir)/$(name)
	install -m644 README.md                $(buildroot)-doc$(_docdir)/$(name)/
	install -m644 doc/*                    $(buildroot)-doc$(_docdir)/$(name)/
	install -d                             $(buildroot)-devel$(_datadir)/$(name)/source
	install -m644 source/*                 $(buildroot)-devel$(_datadir)/$(name)/source/
	install -m755 code_build path_change   $(buildroot)-devel$(_datadir)/$(name)
#	install -d                             $(buildroot)-samples$(_datadir)/$(name)/samples
#	tar -zxf $(SOURCE1) --strip-components=1 --exclude=".git*" -C $(buildroot)-samples$(_datadir)/$(name)/samples/
#	for file in `find $(buildroot)-samples$(_datadir)/$(name)/samples/ -executable -type f -iname plot -exec grep -vHl '#!' {} \;` ; do sed -i '1s|^|#!/bin/csh -f \n|' $${file} ; done
	install -d                             $(buildroot)-as-default$(_bindir)
	cd $(buildroot)-as-default$(_bindir) ;\
	ln -s $(name) ./$(mname)
openSUSE Build Service is sponsored by