hugs makefiles and Debian

Isaac Jones ijones@syntaxpolice.org
04 Feb 2003 11:09:46 -0500


--=-=-=

Greetings,

I'm working on updating Hugs for the Debian GNU/Linux system, and have
run into the following problem.  With Debian, a package installs its
binaries into a temporary directory (known as DESTDIR in Debian
Makefiles) and then builds an archive.  When the package is installed,
it unpacks that archive into the real directory structure.

Now I've altered parts of the hugs makefiles to use DESTDIR, so that
they install into the correct subdirectories for later packing (and
I've attached a patch for that), but I run into the following problem:
the program ffihugs is expecting to use the prelude already installed
on the system.  That is fine when installing from upstream, but since
Debian uses this temporary directory, the new Prelude is not installed
at this point in the installation process, and so ffihugs dies like
this:

----------
/bin/cp ../include/GreenCard.h
/home/ijones/usr/src/hugs/hugs98-Nov2002/debian/tmp/hugs/usr/share/hugs98/include
/bin/cp HsFFI.h
/home/ijones/usr/src/hugs/hugs98-Nov2002/debian/tmp/hugs/usr/share/hugs98/include
./ffihugs -N +G -W +L"../lib/exts/Storable_aux.c" HugsStorable
runhugs: Error occurred
Reading file "/usr/share/hugs98/lib/Prelude.hs":
ERROR "/usr/share/hugs98/lib/Prelude.hs" - Prelude does not define
standard type "Int8"
 
 
make[1]: *** [install_libexts_ffi] Error 1
make[1]: Leaving directory `/home/ijones/usr/src/hugs/hugs98-Nov2002/src'
make: *** [debian/binary-arch.stamp] Error 2
debuild: fatal error at line 456:
dpkg-buildpackage failed!
----------

Is there a way you or I can alter the build system so ffihugs looks at
the right place at the right time? (It looks at $DESTDIR during
installation and in the correct place afterward).

peace,

isaac



--=-=-=
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=destDirDiff

Only in hugs98-Nov2002/debian: build.stamp
diff -ru hugs98-Nov2002.good/hugs98-Nov2002/debian/rules hugs98-Nov2002/debian/rules
--- hugs98-Nov2002.good/hugs98-Nov2002/debian/rules	2003-01-29 21:25:22.000000000 -0500
+++ hugs98-Nov2002/debian/rules	2003-01-29 21:43:55.000000000 -0500
@@ -64,7 +64,7 @@
 	$(install_nonex) debian/menu \
 	  $(rootdir)/usr/lib/menu/$(package)
 #	Install the system.
-	cd src && $(MAKE) DESTDIR=$(rootdir) install
+	cd src && $(MAKE) DESTDIR=$(rootdir) HUGSDIR=/usr/share/hugs98 hugsdir=/usr/share/hugs98 install
 	chmod -R 644 $(sharedir)/hugs98
 	chmod -R a+X $(sharedir)/hugs98
 	strip -R .comment -R .note --strip-all $(rootdir)/usr/bin/*
diff -ru hugs98-Nov2002.good/hugs98-Nov2002/src/MkInstal.in hugs98-Nov2002/src/MkInstal.in
--- hugs98-Nov2002.good/hugs98-Nov2002/src/MkInstal.in	2002-10-22 10:19:25.000000000 -0400
+++ hugs98-Nov2002/src/MkInstal.in	2003-01-29 21:36:02.000000000 -0500
@@ -29,47 +29,47 @@
 install_ffi	:: install_libraries_ffi              # for hierarchical libs
 
 install_bin	:: hugs$(EXE) runhugs$(EXE) ffihugs$(EXE)
-		$(INSTALL) -d $(bindir)
-		$(INSTALL) -c hugs$(EXE) $(bindir)
-		$(INSTALL) -c runhugs$(EXE) $(bindir)
-		$(INSTALL) -c ffihugs$(EXE) $(bindir)
+		$(INSTALL) -d $(DESTDIR)$(bindir)
+		$(INSTALL) -c hugs$(EXE) $(DESTDIR)$(bindir)
+		$(INSTALL) -c runhugs$(EXE) $(DESTDIR)$(bindir)
+		$(INSTALL) -c ffihugs$(EXE) $(DESTDIR)$(bindir)
 
 install_lib	::
-		$(INSTALL) -d $(hugsdir)/lib
-		$(INSTALL_DATA) ../lib/*.* $(hugsdir)/lib
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/lib
+		$(INSTALL_DATA) ../lib/*.* $(DESTDIR)$(hugsdir)/lib
 
 install_libhugs	:: install_lib
-		$(INSTALL) -d $(hugsdir)/lib/hugs
-		$(INSTALL_DATA) ../lib/hugs/*.*    $(hugsdir)/lib/hugs
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/lib/hugs
+		$(INSTALL_DATA) ../lib/hugs/*.*    $(DESTDIR)$(hugsdir)/lib/hugs
 
 install_demos	:: install_libhugs
-		$(INSTALL) -d $(hugsdir)/demos
-		$(INSTALL) -d $(hugsdir)/demos/prolog
-		$(INSTALL_DATA) ../demos/*.*            $(hugsdir)/demos
-		$(INSTALL_DATA) ../demos/prolog/*.*     $(hugsdir)/demos/prolog
-		$(INSTALL_DATA) ../demos/prolog/readme  $(hugsdir)/demos/prolog
-		$(INSTALL_DATA) ../demos/prolog/stdlib  $(hugsdir)/demos/prolog
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/demos
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/demos/prolog
+		$(INSTALL_DATA) ../demos/*.*            $(DESTDIR)$(hugsdir)/demos
+		$(INSTALL_DATA) ../demos/prolog/*.*     $(DESTDIR)$(hugsdir)/demos/prolog
+		$(INSTALL_DATA) ../demos/prolog/readme  $(DESTDIR)$(hugsdir)/demos/prolog
+		$(INSTALL_DATA) ../demos/prolog/stdlib  $(DESTDIR)$(hugsdir)/demos/prolog
 
 install_libexts	:: $(LIBRARIES)
-		$(INSTALL) -d $(hugsdir)/lib/exts
-		$(INSTALL_DATA) ../lib/exts/*.*     $(hugsdir)/lib/exts
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/lib/exts
+		$(INSTALL_DATA) ../lib/exts/*.*     $(DESTDIR)$(hugsdir)/lib/exts
 
 install_man	::
-		$(INSTALL) -d $(mandir)/man1
-		$(INSTALL_DATA) ../docs/hugs.1 $(mandir)/man1
+		$(INSTALL) -d $(DESTDIR)$(mandir)/man1
+		$(INSTALL_DATA) ../docs/hugs.1 $(DESTDIR)$(mandir)/man1
 
 install_include	::
-		$(INSTALL) -d $(hugsdir)/include
-		$(INSTALL_DATA) ../include/GreenCard.h  $(hugsdir)/include
-		$(INSTALL_DATA) HsFFI.h  $(hugsdir)/include
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/include
+		$(INSTALL_DATA) ../include/GreenCard.h  $(DESTDIR)$(hugsdir)/include
+		$(INSTALL_DATA) HsFFI.h  $(DESTDIR)$(hugsdir)/include
 
 install_notes	::
-		$(INSTALL) -d $(hugsdir)/docs
-		$(INSTALL_DATA) ../docs/*.txt  $(hugsdir)/docs
-		$(INSTALL_DATA) ../docs/server.*  $(hugsdir)/docs
-		$(INSTALL_DATA) ../Readme  $(hugsdir)
-		$(INSTALL_DATA) ../License $(hugsdir)
-		$(INSTALL_DATA) ../Credits $(hugsdir)
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/docs
+		$(INSTALL_DATA) ../docs/*.txt  $(DESTDIR)$(hugsdir)/docs
+		$(INSTALL_DATA) ../docs/server.*  $(DESTDIR)$(hugsdir)/docs
+		$(INSTALL_DATA) ../Readme  $(DESTDIR)$(hugsdir)
+		$(INSTALL_DATA) ../License $(DESTDIR)$(hugsdir)
+		$(INSTALL_DATA) ../Credits $(DESTDIR)$(hugsdir)
 
 BUILD_FFI_OLD = ./ffihugs -N +G -W
 
@@ -79,12 +79,12 @@
 		$(BUILD_FFI_OLD) MarshalUtils
 
 install_libraries :: $(LIBRARIES)
-		$(INSTALL) -d $(hugsdir)
-		$(INSTALL_DATA) -R ../libraries $(hugsdir)
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)
+		$(INSTALL_DATA) -R ../libraries $(DESTDIR)$(hugsdir)
 
 install_oldlib :: $(LIBRARIES)
-		$(INSTALL) -d $(hugsdir)/oldlib
-		$(INSTALL_DATA) ../oldlib/*.* $(hugsdir)/oldlib
+		$(INSTALL) -d $(DESTDIR)$(hugsdir)/oldlib
+		$(INSTALL_DATA) ../oldlib/*.* $(DESTDIR)$(hugsdir)/oldlib
 
 BUILD_FFI_NEW = ./ffihugs +N +G -W
 
@@ -94,6 +94,6 @@
 		$(BUILD_FFI_NEW) Foreign.Marshal.Utils 
 		$(BUILD_FFI_NEW) +L"../libraries/Foreign/C/errno.c" Foreign.C.Error  
 		$(BUILD_FFI_NEW) Text.Regex.Posix
-		$(RM) $(hugsdir)/libraries/Hugs/*.[ch]
-		$(RM) $(hugsdir)/libraries/Foreign/*/*.[ch]
-		$(RM) $(hugsdir)/libraries/Text/Regex/*.[ch]
+		$(RM) $(DESTDIR)$(hugsdir)/libraries/Hugs/*.[ch]
+		$(RM) $(DESTDIR)$(hugsdir)/libraries/Foreign/*/*.[ch]
+		$(RM) $(DESTDIR)$(hugsdir)/libraries/Text/Regex/*.[ch]

--=-=-=--