ioquake / ioq3

The ioquake3 community effort to continue supporting/developing id's Quake III Arena
https://www.ioquake3.org/
GNU General Public License v2.0
2.34k stars 523 forks source link

Fix building QVMs on Linux with Windows line endings #628

Closed zturtleman closed 6 months ago

zturtleman commented 6 months ago

On non-Windows, compiling QVM tools failed if dagcheck.md had CRLF line endings and compiling QVMs failed if game source had CRLF line endings.

Also made Windows open the files as binary (no automatic CRLF to LF) so it behaves the same as on non-Windows.


If code/tools/lcc/src/dagcheck.md has CRLF line endings, fails to compile QVM tools.

LBURG code/tools/lcc/src/dagcheck.md
line 1: invalid character `%'
line 1: invalid character `{'
line 1: invalid character `\015'
line 2: invalid character `#'
line 2: syntax error
line 2: invalid character `\015'
line 3: syntax error
line 3: invalid character `;'
line 3: invalid character `\015'
...

If QVM tools compiled but game source has CRLF line endings, it fails to compile.

CGAME_Q3LCC code/cgame/cg_main.c
cpp: code/cgame/cg_main.c:24 Syntax error in #include
cpp: code/cgame/cg_main.c:26 Syntax error in #ifdef/#ifndef
cpp: code/cgame/cg_main.c:68 Syntax error in #ifdef/#ifndef
cpp: code/cgame/cg_main.c:161 Syntax error in #ifdef/#ifndef
cpp: code/cgame/cg_main.c:178 Syntax error in #ifdef/#ifndef
cpp: code/cgame/cg_main.c:189 Syntax error in #ifdef/#ifndef
cpp: code/cgame/cg_main.c:269 Syntax error in #ifdef/#ifndef
cpp: code/cgame/cg_main.c:271 Syntax error in #else
cpp: code/cgame/cg_main.c:273 Syntax error in #endif
...