Hi, > Date: Sat, 19 Jun 1999 11:45:26 BST > To: debian-mentors@lists.debian.org > From: John Travers <[EMAIL PROTECTED]> > Subject: install script... > > Right, I'm getting there.. > > anyway, I use a configure script and do > > ./configure --with-datadir=/usr/lib > > in my rules file, (under commands to compile the package ) and have: > > $(MAKE) install prefix='pwd'/debian/tmp/usr > > (under commands to install the package) but when I run dpkg-buildpackage, > the script installs them in my real system, not in debian/tmp/usr. > > how do I solve this? > > (The configure script must have the real data dir names as it is hardcoded in > the programs, so I can't fo --with-datadir='pwd'/debian/tmp/usr/lib)
I'll explain this as well as I can here; it will be more general, so you will need to figure some things out and experiment with others. You can also see http://www.debian.org/doc/maint-guide/ch-modify.html So... I might as well license this, so it can be used in places like tutorials: # Copyright (c) 1999 by Jim Lynch. # This document comes with NO WARRANTY WHATSOEVER. # # This document is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 dated June, 1991, or, at your # option, any LATER version. # # This document is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details, which is included # here by reference. your makefile install target has to have a DESTDIR variable (well, I don't think the name is so important, however debhelper I think does use this name for this concept). should be something like this... #edited for debian DESTDIR = (debhelper will override this variable to point at debian/temp or somewhere like that; if you have to add things to the debhelper-generated debian/rules file, you will have to look in there to find out how it passes DESTDIR.) : : install: myBinary cp myBinary $(DESTDIR)/usr/bin/myBinary chmod +whatever $(DESTDIR)/usr/bin/myBinary cp myBinary.4 $(DESTDIR)/usr/man/man4/myBinary.4 mkdir -p $(DESTDIR)/var/lib/myPackageName/theData So you have to alter your makefile's "install" target to add implementation for this concept. If you see that a path is told to the compilation process through a define passed in the makefile, note that this becomes a "hard-wired path" in the compiled output, and should NOT, therefore, have the DESTDIR variable in it. If it does, then it will expect to find the binary INSTALLED in the -source- dir, in debian/tmp somewhere, and this is not where the installed files will ultimately be found. Example: If myBinary is a c program that refers to a text file which it prints, its code might look like this... void main(void) { int result = 0; /* optimistic attitude */ FILE *theFileP = fopen(INTRO_BANNER_PATH, "r"); if(theFileP) { /* read the file and do something with it, like print it */ fclose(theFileP); } : : return result; } If the banner file is in the tarball in the same dir as is the debian/ dir, you would install it like this maybe: BANNERPATH = /var/lib/myPackageName/banner.txt : : install: : : cp banner.txt $(DESTDIR)$(BANNERPATH) : : which would copy the file into the package's temporary place. The target that compiles myBinary.c into myBinary.o would NOT have DESTDIR: myBinary.o: myBinary.c $(CC) -DINTRO_BANNER_PATH=\"$(BANNERPATH)\" -c myBinary.c because myBinary should refer to the -installed- version of the file, !not! the one in the tarball, and certainly not the one in debian/tmp. To summarize: if one variable isn't general enough to do the job, introduce another :) -Jim