Bug#813119: ngspice: FTBFS with nonexistant $HOME

Johann Klammer klammerj at a1.net
Thu Apr 7 20:40:45 UTC 2016


Try this debian/rules file.

-------------- next part --------------
#!/usr/bin/make -f
# -*- makefile -*-

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

export CPPFLAGS=$(shell dpkg-buildflags --get CPPFLAGS)
export CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
export CXXFLAGS=$(shell dpkg-buildflags --get CXXFLAGS)
export LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif

CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)

config.status: config.status-stamp configure
config.status-stamp:
	dh_testdir
	# Make build dir for ngspice
	mkdir -p build/ngspice
	cp -Rl `ls . |grep -v build|grep -v debian` build/ngspice
	cp -f /usr/share/misc/config.sub build/ngspice/config.sub
	cp -f /usr/share/misc/config.guess build/ngspice/config.guess
	#cp -f /usr/share/misc/config.sub build/ngspice/doc/config.sub
	#cp -f /usr/share/misc/config.guess build/ngspice/doc/config.guess
	cp -a manual build/
	# Make build dir for tclspice
	mkdir -p build/tclspice
	cp -Rl `ls . |grep -v build|grep -v debian` build/tclspice
	cp -f /usr/share/misc/config.sub build/tclspice/config.sub
	cp -f /usr/share/misc/config.guess build/tclspice/config.guess
	# Configure ngspice
	(cd build/ngspice;\
	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
	./configure $(CROSS) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--enable-maintainer-mode \
		--with-editline=yes \
		--enable-xspice \
		--enable-cider \
		--disable-debug)
	# Configure tclspice
	(cd build/tclspice;\
	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS) -lBLT -ltcl8.6" \
	./configure $(CROSS) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--libdir=/usr/lib/tcltk \
		--enable-shared=yes \
		--enable-maintainer-mode \
		--with-editline=no \
		--enable-xspice \
		--enable-cider \
		--disable-debug \
		--disable-x \
		--with-tcl=/usr/lib/tcl8.6)
	touch $@

build: build-arch build-indep

build-arch: config.status 
	dh_testdir
	cd build/ngspice && $(MAKE)
	cd build/tclspice && $(MAKE)
	touch $@

build-indep: config.status
	# Build documentation
	dh_testdir
	#cd build/manual && lyx --export ps manual.lyx 
	cd build/manual ; mkdir "./.lyx" ; lyx -userdir "./.lyx" -batch --export pdf2 manual.lyx ; rm -rf "./.lyx"
	cd build/manual ; mkdir "./.lyx" ; lyx -userdir "./.lyx" -batch --export html manual.lyx ; rm -rf "./.lyx"
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp 
	rm -f config.status-stamp
	rm -rf build
	rm -f src/frontend/parse-bison.c
	rm -f src/frontend/parse-bison.h
	rm -f config.guess
	rm -f config.sub
	rm -f *-indep *-arch
	dh_clean 

install-arch: build-arch
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Make ngspice and tclspice
	# tclspice must be installed prior to ngspice. Some files will be overwritten by ngspice
	# but the ngspice are the correct ones.
	cd build/tclspice && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install 
	cd build/ngspice && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
	# The code mode were stripped but change since version 25
	#ifneq ("nostrip","$(findstring nostrip,$(DEB_BUILD_OPTIONS))")
	#strip $(CURDIR)/debian/tmp/usr/lib/ngspice/*.cm
	#strip $(CURDIR)/debian/tmp/usr/lib/tcltk/ngspice/*.cm
	#endif

	# Remove empty dirs:
	find $(CURDIR)/debian/tclspice -type d -empty -delete
	touch $@

install-indep: build-indep
	# Documentation for ngspice, the same as for tclspice
	mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/ngspice-doc/html
	cp -a $(CURDIR)/build/manual/manual.html.LyXconv/* \
		$(CURDIR)/debian/tmp/usr/share/doc/ngspice-doc/html
	#install -o root -g root -m 644 build/manual/manual.ps \
	#	$(CURDIR)/debian/tmp/usr/share/doc/ngspice-doc/ngspice.ps
	install -o root -g root -m 644 build/manual/manual.pdf \
		$(CURDIR)/debian/tmp/usr/share/doc/ngspice-doc/ngspice.pdf
	# Removing /usr/share/info directory
	rm -rf $(CURDIR)/debian/tmp/usr/share/info
	chmod a-x $(CURDIR)/build/tclspice/examples/tclspice/*/*.tcl
	chmod a+x $(CURDIR)/build/tclspice/examples/tclspice/tcl-testbench*/tcl-testbench*.tcl \
		$(CURDIR)/build/tclspice/examples/tclspice/tcl/test_vectoblt.tcl
	mkdir -p build/ngspice/examples/xspice1/
	cp -a src/xspice/examples/* build/ngspice/examples/xspice1/
	find build/ngspice/examples/xspice1/ -name Makefile -exec rm -f {} \;
	find build/ngspice/examples/xspice1/ -type f -exec chmod a-x {} \;
	touch $@

# Build architecture-independent files here.
binary-indep: install-indep
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_install -i --sourcedir=debian/tmp
	dh_installman -i
	dh_installexamples -i -pngspice-doc build/ngspice/examples/* -Xtclspice
	dh_installchangelogs ChangeLog -i
	dh_compress -i --exclude=.tcl --exclude=.cir
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: install-arch
	dh_testdir -a
	dh_testroot -a
	dh_installchangelogs ChangeLog -a
	dh_installdocs -pngspice contrib -XCOPYING -a
	dh_installdocs
	dh_installexamples -ptclspice build/tclspice/examples/tclspice/* -a
	dh_install --sourcedir=debian/tmp -a
	sed -i "/dependency_libs/ s/'.*'/''/" \
		"$(CURDIR)/debian/tclspice/usr/lib/tcltk/libspice.la"
	dh_installman -a
	dh_link -a
	dh_strip -a --exlude=.cm
	dh_compress -a --exclude=.tcl --exclude=.cir
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

#DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog | grep '^Version:' | sed -e 's/Version: \(.*\)-\(.*\)\.*/\1/')
get-orig-source:
	VER=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-+~]+).*,\1,p'); \
	set -e;\
	wget -q http://sourceforge.net/projects/ngspice/files/ng-spice-rework/$$VER/ngspice-$$VER.tar.gz; \
	tar xzf ngspice-$$VER.tar.gz --exclude=CVS --exclude=xgraph; \
	rm -f ngspice-$$VER/config.sub ;\
	rm -f ngspice-$$VER/config.guess ;\
	rm -rf ngspice-$$VER/examples/TransImpedanceAmp ;\
	rm -rf ngspice-$$VER/examples/tclspice\tcl-testbench3 ;\
	tar czf ngspice_$$VER.orig.tar.gz ngspice-$$VER; \
	rm -f ngspice-$$VER.tar.gz; \
	rm -rf ngspice-$$VER; \
	wget -q http://sourceforge.net/projects/ngspice/files/ng-spice-rework/$$VER/ngspice-doc-$$VER.tar.gz; \
	tar xzf ngspice-doc-$$VER.tar.gz --exclude=\*.pdf; \
	mv ngspice-doc-$$VER ngspice-$$VER; \
	tar czf ngspice_$$VER.orig-manual.tar.gz ngspice-$$VER; \
	rm -f ngspice-doc-$$VER.tar.gz; \
	rm -rf ngspice-$$VER
# 	find ${DIRNAME} -name .cvsignore -exec rm -f {} \; ;\

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


More information about the debian-science-maintainers mailing list