LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File debian.rules of Package talys10 (Project home:maxiotis:talys)

#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

CFLAGS = -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif

name = $(shell dpkg-parsechangelog | sed -n -e 's/^Source: //p')
mname = talys
version = $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
mversion = $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p' | sed "s/\.//g")
structure_data_path = /opt/$(mname)/$(name)/structure/
inst_bin_path = /usr/src/packages/BUILD/debian/$(name)/usr/local/bin
inst_data_path = /usr/src/packages/BUILD/debian/$(name)-data/opt/$(mname)/$(name)

#build: build-arch build-indep
#build-indep: build-stamp
#build-arch: build-stamp
build-arch:
	dh_testdir

	# Add here commands to compile the package.
	cd source ; sed -i "s|path='.*'|path='$(structure_data_path)'|g" machine.f ; gfortran -c *.f ; gfortran *.o -o $(mname)-$(version)
	# --- end custom part for compiling

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	# Add here commands to clean up after the build process.
	#make clean || true
	# --- end custom part for cleaning up

	#dh_clean

install-indep: 
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Add here commands to install the package
	# The DESTDIR Has To Be Exactly  /usr/src/packages/BUILD/debian/<nameOfPackage>
	cd source ; sed -i "s|path='.*'|path='$(structure_data_path)'|g" machine.f
	mkdir -p $(inst_data_path)
	#cp -r /opt/$(mname)/* $(inst_data_path)/..
	#work_dir=$$(pwd) ; echo $$work_dir ; for dir in `ls $(inst_data_path)/..` ; do cd $(inst_data_path)/../$$dir ; rm -rf `ls | grep -v structure` ; done ; cd $$work_dir
	mv structure $(inst_data_path)/
	echo '#!/bin/bash' > fdup.script
	echo 'target="" ; declare -a sources ; fdupes -q -n -r $(inst_data_path)/.. | while read line ; do if [ "$$line" == "" ] ; then if [ ! "$$target" == "" ] || [ ! $${sources[0]} == "" ] ; then if [ "$$target" == "" ] ; then target="$${sources[0]}" ; unset sources[0] ; fi ; for sourc in $${sources[@]} ; do rm -rf $$sourc ; ln -s -r $$target $$sourc ; done ; target="" ; unset sources ; fi ; else if echo "$$line" | grep -v "$(name).structure" ; then target="$$line" ; else sources+=("$$line") ; fi  ; fi ; done' >> fdup.script
	cat fdup.script
	chmod 777 fdup.script
	./fdup.script
	rm -rf fdup.script
	work_dir=$$(pwd) ; cd $(inst_data_path)/.. ; for dir in `ls | grep -v $(name)` ; do rm -rf $$dir ; done ; cd $$work_dir
	rm -rf `ls $(inst_data_path)/.. | grep -v $(mname)$(mversion)`
	mv `ls | grep -v debian` $(inst_data_path)/
	cp -r $(inst_data_path)/source ./
	# --- end custom part for installing

install-arch: build-arch
	dh_testdir
	dh_testroot
	#dh_clean -k
	dh_prep
	dh_installdirs

	# Add here commands to install the package
	# The DESTDIR Has To Be Exactly  /usr/src/packages/BUILD/debian/<nameOfPackage>
	mkdir -p $(inst_bin_path)
	cd source ; gfortran -c *.f ; gfortran *.o -o $(name)
	mv source/$(name) $(inst_bin_path)/
	# --- end custom part for installing

# Build architecture-independent files here.
binary-indep: install-indep
	dh_testdir
	dh_testroot
#	dh_installdebconf
#	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
	dh_installman
	dh_installinfo
#	dh_undocumented
#	dh_installchangelogs
	dh_link
#	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
#	dh_installdeb
#	dh_perl
#	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb -i
	# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build-arch install-arch
	dh_testdir
	dh_testroot
#	dh_installdebconf
#	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
	dh_installman
	dh_installinfo
#	dh_undocumented
#	dh_installchangelogs
	dh_link
#	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
#	dh_installdeb
#	dh_perl
#	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install