FS#5881 - Allow separate compilation (objdir != srcdir)

Attached to Project: OpenTTD
Opened by Dylan Simon (dylex) - Tuesday, 28 January 2014, 02:26 GMT
Type Patch
Category Build system
Status New
Assigned To No-one
Operating System UNIX
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


The configure/build system as it stands mostly allows separate compliation, when you run configure from a different directory, but fails in subtle ways. In particular, cpu-type detection and bundling fail. This small patch fixes the various issues. It also removes some related excess quoting that ended up un-quoting paths instead of quoting them (""/path/"").

Obviously it is up to you whether you actually want to support this, but if you don't, it would be nice if it did a check during configure and complained if $PWD != $ROOT_DIR.
This task depends upon

Comment by frosch (frosch) - Tuesday, 28 January 2014, 19:24 GMT
Hmm, it's not that easy with these four:
+ $(Q)cp "$(ROOT_DIR)/bin/baseset/"*.grf "$(BASESET_DIR)/"
+ $(Q)cp "$(ROOT_DIR)/bin/baseset/"*.obg "$(BASESET_DIR)/"
+ $(Q)cp "$(ROOT_DIR)/bin/baseset/"*.obs "$(BASESET_DIR)/"
+ $(Q)cp "$(ROOT_DIR)/bin/baseset/"*.obm "$(BASESET_DIR)/"

Depending on whether GRFcodec is installed or not, they are build from (real) sources or taken as it from the repository.
Comment by Dylan Simon (dylex) - Wednesday, 29 January 2014, 02:50 GMT
The readme claims that using grfcodec will "leave the repository in a modified state" and "modify the base file set." One solution then would be to update to make this actually true, and put the files in $ROOT_DIR/bin rather than $BIN_DIR. Alternatively, bundle could copy from $ROOT_DIR and then copy any addition files from $BIN_DIR if they exist, overwriting the originals.