Mercurial > forge
changeset 3641:7a2096f330ea octave-forge
Include Makefile/configure in packages to allow 'configure; make all; make install' work
author | adb014 |
---|---|
date | Thu, 12 Jul 2007 18:34:21 +0000 |
parents | f435d7406d79 |
children | 5b8ff6bccb37 |
files | Makeconf.base packages/package_Makefile.in packages/package_configure.in |
diffstat | 3 files changed, 86 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Makeconf.base Thu Jul 12 14:12:16 2007 +0000 +++ b/Makeconf.base Thu Jul 12 18:34:21 2007 +0000 @@ -118,6 +118,8 @@ fi; \ tar -cf - $(REAL_PKG_FILES) | (cd ../$(PKGDIR)/$$name-$$ver; tar -xf -); \ cd ../$(PKGDIR); \ + cp ../package_configure.in $$name-$$ver/configure; \ + cp ../package_Makefile.in $$name-$$ver/Makefile; \ tar -zcf $$name-$$ver.tar.gz $$name-$$ver; \ rm -fr $$name-$$ver; \ fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/packages/package_Makefile.in Thu Jul 12 18:34:21 2007 +0000 @@ -0,0 +1,77 @@ +## Generic Makefile to allow the octave-forge packages to be build and +## installed using "configure; make all; make install". This Makefile +## includes the capability to install to a temporary location, and install +## an on_uninstall.m file that prevents the user removing this package +## with Octave's package manager. This is useful for for the distribution's +## various package managers and is forced by defining DESTDIR and DISTPKG. + +PKGDIR := $(shell pwd | sed -e 's|^.*/||') +TMPDIR ?= /tmp +PACKAGE := $(TMPDIR)/$(PKGDIR).tar.gz +PKG := $(shell echo $(PKGDIR) | sed -e 's|^\(.*\)-.*|\1|') + +all: build package + +build: + @if [ -e src/Makefile ]; then \ + make -C src all; \ + fi + +package: + @if [ -d src ]; then \ + cd src; \ + if [ -e FILES ]; then \ + files=`cat FILES`; \ + else \ + files=`ls *.mex *.oct 2> /dev/null`; \ + fi; \ + if [ ! -d ../inst ]; then \ + mkdir ../inst; \ + fi; \ + cp -rf $$files ../inst; \ + cd ../; \ + fi; \ + cd ../; \ + tar --exclude='$(PKGDIR)/src' -czf $(PACKAGE) $(PKGDIR); + +install: + @cd ../; \ + if [ "X${DISTPKG}X" != "XX" ]; then \ + stripcmd="unlink(pkg('local_list'));unlink(pkg('global_list'));"; \ + fi; \ + if [ "X$(DESTDIR)X" = "XX" ]; then \ + pkgdir=`octave -H -q --no-site-file --eval "warning('off','all');pkg('install','$(PACKAGE)');l=pkg('list');disp(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)}.dir);$$stripcmd;"`; \ + else \ + shareprefix=$(DESTDIR)/`octave -H -q --no-site-file --eval "disp(fullfile(OCTAVE_HOME(),'share','octave'));"`; \ + octprefix=$$shareprefix/packages; \ + if [ ! -e $$octprefix ]; then \ + mkdir -p $$octprefix; \ + fi; \ + pkgdir=`octave -H -q --no-site-file --eval "warning('off','all');pkg('prefix','$$octprefix');pkg('global_list',fullfile('$$shareprefix','octave_packages'));pkg('local_list',fullfile('$$shareprefix','octave_packages'));pkg('install','$(PACKAGE)');l=pkg('list');disp(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)}.dir);$$stripcmd;"`; \ + fi; \ + if [ "X${DISTPKG}X" != "XX" ]; then \ + if [ -e $$pkgdir/packinfo/on_uninstall.m ]; then \ + mv $$pkgdir/packinfo/on_uninstall.m \ + $$pkgdir/packinfo/on_uninstall.m.orig; \ + fi; \ + echo "function on_uninstall (desc)" > $$pkgdir/packinfo/on_uninstall.m; \ + echo " error ('Can not uninstall %s installed by the $(DISTPKG) package manager', desc.name);" >> $$pkgdir/packinfo/on_uninstall.m; \ + echo "endfunction" >> $$pkgdir/packinfo/on_uninstall.m; \ + echo "#! /bin/sh -f" > $$pkgdir/packinfo/dist_admin; \ + echo "if [ \"\$$1\" == \"install\" ]; then" >> $$pkgdir/packinfo/dist_admin; \ + echo " octave -H -q --no-site-file --eval \"pkg('rebuild');\"" >> $$pkgdir/packinfo/dist_admin; \ + echo "else" >> $$pkgdir/packinfo/dist_admin; \ + echo " pkgdir=\`octave -H -q --no-site-file --eval \"pkg('rebuild');l=pkg('list');disp(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)}.dir);\"\`" >> $$pkgdir/packinfo/dist_admin; \ + echo " rm \$$pkgdir/packinfo/on_uninstall.m" >> $$pkgdir/packinfo/dist_admin; \ + echo " if [ -e \$$pkgdir/packinfo/on_uninstall.m.orig ]; then" >> $$pkgdir/packinfo/dist_admin; \ + echo " mv \$$pkgdir/packinfo/on_uninstall.m.orig \$$pkgdir/packinfo/on_uninstall.m" >> $$pkgdir/packinfo/dist_admin; \ + echo " cd \$$pkgdir/packinfo" >> $$pkgdir/packinfo/dist_admin; \ + echo " octave -q -H --no-site-file --eval \"l=pkg('list');on_uninstall(l{cellfun(@(x)strcmp(x.name,'$(PKG)'),l)});\"" >> $$pkgdir/packinfo/dist_admin; \ + echo " fi" >> $$pkgdir/packinfo/dist_admin; \ + echo "fi" >> $$pkgdir/packinfo/dist_admin; \ + chmod a+x $$pkgdir/packinfo/dist_admin; \ + fi; + +clean: + rm $(PACKAGE) + make -C src clean