File debian.rules of Package cfg2html

#!/usr/bin/make -f

# @(#) $Id: rules,v 6.20 2020/06/17 19:56:53 ralph Exp $
# -------------------------------------------------------------------------
# vim:ts=8:sw=4:sts=4 
# -*- coding: utf-8 -*- http://rose.rult.at/ - Ralph Roth

# 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

# This is the debhelper compatibility version to use.
# five or nine????
# export DH_COMPAT=9

# dh_installdeb: Compatibility levels before 4 are deprecated.

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

configure: configure-stamp
configure-stamp:
	dh_testdir
	# Add here commands to configure the package.

	touch configure-stamp


build: build-stamp

build-stamp: configure-stamp
	dh_testdir

	# Add here commands to compile the package.
	# comment the make doc stuff for OBS (asciidoc is not present)
	#$(MAKE) -C linux/doc
	#/usr/bin/docbook-to-man debian/cfg2html-linux.sgml > cfg2html-linux.1

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	#-$(MAKE) clean

	## <c/m/a>  08.01.2009 - Ralph Roth
	dh_clean

# Build architecture-independent files here.
binary-indep: build
	dh_testdir
	dh_testroot
	#dh_clean -k
	dh_prep
	dh_installdirs tmp

	#  The DESTDIR Has To Be Exactly debian/cfg2html
	mkdir -vp -m0755 \
		debian/cfg2html/etc/cfg2html/ \
		debian/cfg2html/etc/cron.d/ \
		debian/cfg2html/usr/sbin/ \
		debian/cfg2html/usr/share/cfg2html/etc/cfg2html \
		debian/cfg2html/var/log/cfg2html/


	if [ $$(basename $$(pwd)) = "BUILD" ]; then \
		cd linux ; \
		ln -s ../debian . ; \
		ls -l ; \
		ls -lR etc/ ; cd .. ; \
	fi
                # cd ..       ## maybe a bug for issue #35? break the build, rr, 30.01.2018

	# copy cfg2html components into directories
	pwd
       # This triggers issue #35 on the SUSE OBS environment ....
       # [   77s] cp -av etc/default.conf debian/cfg2html/usr/share/cfg2html/etc/cfg2html/
       # [   77s] cp: cannot stat `etc/default.conf': No such file or directory
       # This still appears to be broken, as on Ubuntu systems, it should go into # modified on 20201114 by edrulrd
       # /usr/share/cfg2html/etc when installed and not into /usr/share/cfg2html/etc/cfg2html
       # If SUSE needs it where it was, we can put it in both places
	#cp -av etc/default.conf debian/cfg2html/usr/share/cfg2html/etc/cfg2html
	cp -av linux/etc/default.conf debian/cfg2html/usr/share/cfg2html/etc/
	cp -av etc/local.conf debian/cfg2html/etc/cfg2html/
	cp -av ../cfg2html debian/cfg2html/usr/sbin/
	cp -av cfg2html-linux.sh debian/cfg2html/usr/share/cfg2html/
	cp -avLr lib debian/cfg2html/usr/share/cfg2html/
	cp -av plugins debian/cfg2html/usr/share/cfg2html/
	cp -avr contrib debian/cfg2html/usr/share/cfg2html/

	#find debian/cfg2html/usr/share/cfg2html -name '.gitignore' -exec rm -rf {} \;

	# patch cfg2html main script with correct locations for cfg2html components
	sed -i \
		-e 's#^CONFIG_DIR=.*#CONFIG_DIR="/etc/cfg2html"#' \
		-e 's#^SHARE_DIR=.*#SHARE_DIR="/usr/share/cfg2html"#' \
		-e 's#^VAR_DIR=.*#VAR_DIR="/var/log/cfg2html"#' \
		debian/cfg2html/usr/sbin/cfg2html

	# update man page with correct locations
	install -Dp -m0644 doc/cfg2html.8 debian/cfg2html/usr/share/man/man8/cfg2html.8
	sed -i \
		-e 's#/usr/share/doc/packages#/usr/share/doc#' \
		debian/cfg2html/usr/share/man/man8/cfg2html.8

	# --- end custom part for installing
	#

#	dh_installdebconf
	dh_installdocs
#	dh_installexamples
#	dh_installmenu
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installcron
	install -Dp -m0644 ../cfg2html.cron debian/cfg2html/etc/cron.d/cfg2html
#	dh_installman
#	dh_installinfo
#	dh_undocumented
	dh_installchangelogs ## Changelog upstream
	find debian/cfg2html -name ".git*" -exec rm {} \;
	dh_link
#	dh_strip
	dh_compress
	dh_fixperms
#	dh_makeshlibs
#	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build


binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary configure
openSUSE Build Service is sponsored by