[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Overwriting paths in binary files



David Welton wrote:
> After packaging ircii epic (hopefully I will upload when things have
> settled down at my new job), I have become curious about the possibility
> of 'stomping out' paths in binary files.  Ie, instead of doing a make,
> doing a make install directly to debian/tmp, and then replacing the bad
> paths in the binaries.
> 
> I would be interested to hear others opinions on this...  it is sort of an
> ugly thing to do, but I think having to manually copy all the files is
> ugly as well, and introduces the possibility for error.  
> 
> So is there some obvious reason this should not be done?  Maybe it is not
> very portable?

I'm not sure I understand. What kind of makefile does the package(es) have? 
Are you talking about doing a ./configure --prefix=debian/tmp and then you 
can just do "make ; make install" and everything ends up in debian/tmp
and then you have to binary edit the debian/tmp out of the paths in the
binaries? 

Ugly, and it's not going to work all the time. Suppose (just for the sake of
argument) that the makefile takes the --prefix setting, and rot-13's it, and
feeds it into the binary as a #define. Then, you wouldn't find it in the
binary with a straightforward search and replace.

What I tend to do is modify the install: rule of the makefile, and insert
$(PREFIX) before all paths, then I do "make PREFIX=debian/tmp install" to
install into debian/tmp.

For example, if my packages Makefile has:

install:
	install -d /usr/bin
	install -s foo usr/bin

I change it to:

install:
	install -d $(PREFIX)/usr/bin
	install -s foo $(PREFIX)/usr/bin

This has the advantage of being a change that you might be able to get the
upstream author to adopt, as it doesn't modify the behavior of make install
unless PREFIX is set. Another advantage is that if a new upstream version
adds or moves a file, you quickly find out about it. The disadvantage is
that when the upstream maintainer reorganizes the install rule, your patches
don't apply cleanly, and you have to re-edit the makefile.

-- 
see shy jo


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: