Compiling under MinGW/MSYS
Currently FIRS will not compile under MinGW/MSYS. I have identified the following issues:
- Windows versions of Mercurial use windows path style by default. This will result in an empty list of source files. This can be solved either by adding slash=true to [ui] options at .hgrc/mercurial.ini, using "hg --config "ui.slash=1"..." or by modifying the following line at scripts/Makefile.def (this modificacion does not seem to affect compilation under Linux):
-REPO_FILES_CMD := $(HG) st -A | grep -v "^I" | grep -v "^?" | grep -v "^R" | grep -v "^\!" | cut -d\ -f2
+REPO_FILES_CMD := $(HG) st -A | grep -v "^I" | grep -v "^?" | grep -v "^R" | grep -v "^\!" | cut -d\ -f2 | sed -e "s/\\\/\\//g"
- $(CC) and $(NFORENUM) are not set correctly. CC will use "cc" as value instead of gcc, and NFORenum will use nforenum instead of renum. I solved this by using export to set the correct values before compiling FIRS, but of course it is not a good solution.
- MSYS current version of unix2dos (0.1.3) does not have a -q option. Removing -q from UNIX2DOS_FLAGS allows make bundle to complete.
- make install will fail when used under windows 7 (probably under vista too) because the correct INSTALL_DIR in these versions is C:\Users\USER_NAME\Documents\OpenTTD\data.
Change #1449: Use a working dir separator also under cygwin and msys (Terkhen)
Change #1449: Some unix2dos don't know how to be quiet. Let them babble but not complain (Terkhen)
#1 Updated by planetmaker almost 9 years ago
<Terkhen> strange thing is, CC seems to be empty before calling make, but make test returns "cc"
<Terkhen> so... something is modifying cc after calling make but before checking CC
MinGW seems to define an empty CC variable or it gets emptied on the way. Possibly check explicitly for it being empty and then override it with the default, if empty.
#2 Updated by Ammler almost 9 years ago
nforenum and grfcodec built (grfdiff didn't build)
then I was able to build firs r1355
+ nmlc swisstowns.nml Traceback (most recent call last): File "C:/mingw/local/bin/nmlc", line 4, in <module> from nml import main ImportError: No module named nml
#3 Updated by Terkhen almost 9 years ago
- File hg_backslash.diff added
I'm attaching a diff to fix the first issue, using the second option. I agree that it is better than forcing the user to edit the hgrc, and looks cleaner than using sed.
$(NFORENUM) is set correctly: the name of the win32 binary of nforenum was wrong.
Talking about $(CC) in IRC it was concluded that $(CC) should be set by msys to a working value, but it isn't. If not set, make uses the default implicit value, which is 'cc' (see http://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html). I think that, if set, $CC should be tested to check if it really exists (probably using which, as done with UNIX2DOS).
#6 Updated by Terkhen almost 9 years ago
- File check_default_cc.diff added
This diff fixes the problem with $(CC). If $(CC) has been set by make to the default implicit value ('cc'), it will check if 'cc' exists using which. Otherwise CC will be set to gcc, which is a better value to use by default. This check can't use $(CC) directly since make won't allow a variable to reference itself when being defined.
#8 Updated by Ammler almost 9 years ago
using shared location would be similar to use /usr/local in unix, which isn't the case, the "default" location is meant to be for developing testing, so the preferred should be $HOME...
for consistency we should either change unix to /usr/local too, or keep windows also at home.
#10 Updated by Terkhen almost 9 years ago
From the original list of issues (besides NML ones), only the problem with undefined CC is missing. There is a minor issue with output during install ([INSTALL] docs to C:UsersPublicDocumentsOpenTTDdataopengfx). Also, make install failed once because it could not erase existing files (I'm guessing problems with permissions) but I can't reproduce this problem.
#13 Updated by planetmaker almost 9 years ago
The town names do differ... How does that relate to the build system?
If that's from the very same repo version, please attach a verbose build log and possibly the whole project (bundle_src) or give the repo revision; the Swiss town name grf I know doesn't use the makefile.