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

Re: How to deal with configs in non-standard locations



Thanks Jakub,
This will be very useful the next time I need to do an override.

On Tuesday, May 19, 2015 12:17:27 Jakub Wilk wrote:
> * Shawn Sörbom <shawn@sorbom.com>, 2015-05-18, 13:54:
> >I am playing with the Snes9x source code, and I can't get it to compile
> >via debhelper. Snes9x has its config files in a subfolder of the
> >sources called "unix".
> >What is the proper way of overriding dh_auto_install and dh_auto_build
> >to point debhelper to the correct location?
> >
> >I have tried placing these overrides in my debian/rules file, but they
> >don't seem to work:
> >
> >override_dh_auto_configure:
> >	DESTDIR=$(shell pwd)/debian/snes9x
> >	cd $(shell pwd)/unix
> >	autoreconf -i
> >	configure --prefix=$(DESTDIR)
> >
> >override_dh_auto_build:
> >	 cd $(shell pwd)/unix
> >	 make
> 
> Vincent's answer is correct, but let me explain why your d/rules didn't
> work:
> 
> “When it is time to execute recipes to update a target, they are
> executed by invoking a new sub-shell for each line of the recipe, […]
> Please note: this implies that setting shell variables and invoking
> shell commands such as 'cd' that set a context local to each process
> will not affect the following lines in the recipe. If you want to use
> 'cd' to affect the next statement, put both statements in a single
> recipe line. Then 'make' will invoke one shell to run the entire line,
> and the shell will execute the statements in sequence.” [0]
> 
> Your makefile had also two minor buglets:
> 
> It's better to use $(CURDIR) instead of $(shell pwd); or use relative
> paths where possible.
> 
> “Recursive 'make' commands should always use the variable 'MAKE', not
> the explicit command name 'make'” [1]
> 
> [0] https://www.gnu.org/software/make/manual/html_node/Execution.html
> [1] https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html


Reply to: