From: LRN <lr...@gm...> - 2011-12-25 10:03:19
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 25.12.2011 13:47, Eli Zaretskii wrote: > One such issue is that not all absolute file names are translated > from the MSYS /d/foo/bar form to the d:/foo/bar form required by > MinGW executables. Here's an example from Groff, a fragment from > Groff's src/include/Makefile.sub that generates the header file > defs.h: > > defs.h: FORCE @$(SHELL) $(top_srcdir)/gendef.sh defs.h \ > "PROG_PREFIX=\"$(g)\"" \ "DEVICE=\"$(DEVICE)\"" \ > "INSTALLPATH=\"$(prefix)\"" \ "BINPATH=\"$(bindir)\"" \ > "FONTPATH=\"$(fontpath)\"" \ "MACROPATH=\"$(tmacpath)\"" \ > "INDEX_SUFFIX=\"$(indexext)\"" \ > "COMMON_WORDS_FILE=\"$(common_words_file)\"" \ > "DEFAULT_INDEX_DIR=\"$(indexdir)\"" \ > "DEFAULT_INDEX_NAME=\"$(indexname)\"" \ > "DEFAULT_INDEX=\"$(indexdir)/$(indexname)\"" > > This produces defs.h that defines the various default directory > lists (BINPATH, FONTPATH, etc.) in the MSYS /d/foo/bar form, which > then don't work in the compiled MinGW executables. To have them in > the MinGW form, I hacked Makefile.sub to edit the result with a > trivial Sed script. > > Is such hacking inevitable, or do people have some "tricks of the > trade" to share for this kind of problems? > Hardcoding absolute paths is bad. You can hardcode a relative path (which might be "/"-separated just as well) and then construct the full path from it and some prefix (usually - executable module directory, with some clever detection of the fact that it might be in /bin subdirectory). To your original question: yes, it's inevitable. MSys uses hacky heuristics to decide whether it should convert paths or not. Running shell scripts is one of the cases when these heuristics tell MSys to NOT to convert paths. You will fare better if you build a binary W32 alternative to gendef.sh, in which case MSys MIGHT convert paths you pass to it as arguments (see [1]), depending on some other conditions. [1] http://www.mingw.org/wiki/Posix_path_conversion -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJO9vTdAAoJEOs4Jb6SI2CwEokH/A5BnZsqZ/0Tq7TwG0W6454v joCrjSHHprHeKwNIzMJ+i/uxG2u0EQ3cn/gl61404DfzPWBw3Eh1Zw0eCF0GHRpC 775lvzN2+wBqTBU7WwNVDiN8sJRDyNd+AVdxcH1RtuRwpdLtsAUddVLyz5pc8XT/ +sK3PJ98NwNffBFpIfdjcumkMvHsWcHRs0sh1/hMEhWDykbag3alRp4pd+jawQKZ vF/VCVlh3BVrfmD82qCdLZHNSIUPpSLPf/zX+aU8y0pnrb63MeBhqVamjIsHpGS0 g4CUeopbBuxsH0qVg9TBW9dENfiUUzfn/Z7Pj7eXCVLXikWosXlfmkWgv+5oRB4= =5F7r -----END PGP SIGNATURE----- |