backporting some build system fixes and pas2c tweaks 0.9.21
authorsheepluva
Tue, 06 Jan 2015 17:07:34 +0100
branch0.9.21
changeset 10747 07ade56c3b4a
parent 10745 fab746a3597e
child 10750 31c744824dab
backporting some build system fixes and pas2c tweaks
CMakeLists.txt
QTfrontend/res/html/about.html
cmake_modules/FindLua.cmake
hedgewars/CMakeLists.txt
hedgewars/config.inc.in
hedgewars/uRender.pas
project_files/hwc/CMakeLists.txt
tools/pas2c/Pas2C.hs
tools/pas2c/PascalParser.hs
tools/pas2c/PascalUnitSyntaxTree.hs
--- a/CMakeLists.txt	Sun Jan 04 14:04:17 2015 -0500
+++ b/CMakeLists.txt	Tue Jan 06 17:07:34 2015 +0100
@@ -232,7 +232,7 @@
 
 enable_testing()
 
-add_custom_target(test         COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random)
+add_custom_target(test_normal  COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random)
 add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random -V)
 
 set(LUATESTS_DIR "${CMAKE_SOURCE_DIR}/tests/lua")
--- a/QTfrontend/res/html/about.html	Sun Jan 04 14:04:17 2015 -0500
+++ b/QTfrontend/res/html/about.html	Tue Jan 06 17:07:34 2015 +0100
@@ -76,7 +76,7 @@
             French: Antoine Turmel &lt;<a href="mailto:geekshadow@gmail.com">geekshadow@gmail.com</a>&gt;, Clement Woitrain &lt;<a href="mailto:sphrixclement@gmail.com">sphrixclement@gmail.com</a>&gt;, Matisumi<br>
             German: Peter Hüwe &lt;<a href="mailto:PeterHuewe@gmx.de">PeterHuewe@gmx.de</a>&gt;, Mario Liebisch &lt;<a href="mailto:mario.liebisch@gmail.com">mario.liebisch@gmail.com</a>&gt;, Richard Karolyi &lt;<a href="mailto:sheepluva@ercatec.net">sheepluva@ercatec.net</a>&gt;, Wuzzy &lt;<a href="mailto:almikes@aol.com">almikes@aol.com</a>&gt;<br>
             Greek: &lt;<a href="mailto:talos_kriti@yahoo.gr">talos_kriti@yahoo.gr</a>&gt;<br>
-            Italian: Luca Bonora &lt;<a href="mailto:bonora.luca@gmail.com">bonora.luca@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;<br>
+            Italian: Luca Bonora &lt;<a href="mailto:bonora.luca@gmail.com">bonora.luca@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;, Gianfranco Costamagna &lt;<a href="mailto:costamagnagianfranco@yahoo.it">costamagnagianfranco@yahoo.it</a>&gt;<br>
             Japanese: ADAM Etienne &lt;<a href="mailto:etienne.adam@gmail.com">etienne.adam@gmail.com</a>&gt;, Marco Bresciani &lt;<a href="mailto:m.bresciani@email.it">m.bresciani@email.it</a>&gt;<br>
             Korean: Anthony Bellew &lt;<a href="mailto:anthonyreflected@gmail.com">anthonyreflected@gmail.com</a>&gt;<br>
             Lithuanian: Lukas Urbonas &lt;<a href="mailto:lukasu08@gmail.com">lukasu08@gmail.com</a>&gt;<br>
--- a/cmake_modules/FindLua.cmake	Sun Jan 04 14:04:17 2015 -0500
+++ b/cmake_modules/FindLua.cmake	Tue Jan 06 17:07:34 2015 +0100
@@ -17,7 +17,7 @@
 
 find_path(LUA_INCLUDE_DIR lua.h
                           PATHS /usr/include /usr/local/include /usr/pkg/include
-                          PATH_SUFFIXES lua5.1 lua51)
+                          PATH_SUFFIXES lua5.1 lua51 lua-5.1)
 find_library(LUA_LIBRARY NAMES lua51 lua5.1 lua-5.1 lua
                          PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib)
 
--- a/hedgewars/CMakeLists.txt	Sun Jan 04 14:04:17 2015 -0500
+++ b/hedgewars/CMakeLists.txt	Tue Jan 06 17:07:34 2015 +0100
@@ -21,12 +21,16 @@
 endif(UNIX)
 
 # convert list into pascal array
-list(LENGTH FONTS_DIRS ndirs)
-set(FONTS_DIRS_ARRAY "array [0..${ndirs}] of PChar = (")
-foreach(fontdir ${FONTS_DIRS})
-    set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\n'${fontdir}',")
-endforeach(fontdir)
-set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\nnil);\n")
+if(FONTS_DIRS)
+  list(LENGTH FONTS_DIRS ndirs)
+  set(FONTS_DIRS_ARRAY "array [0..${ndirs}] of PChar = (")
+  foreach(fontdir ${FONTS_DIRS})
+      set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\n_P'${fontdir}',")
+  endforeach(fontdir)
+  set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\nnil);\n")
+else(FONTS_DIRS)
+  set(FONTS_DIRS_ARRAY "array [0..1] of PChar = (nil, nil);")
+endif(FONTS_DIRS)
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
--- a/hedgewars/config.inc.in	Sun Jan 04 14:04:17 2015 -0500
+++ b/hedgewars/config.inc.in	Tue Jan 06 17:07:34 2015 +0100
@@ -26,8 +26,4 @@
       cRevisionString = '${HEDGEWARS_REVISION}';
       cHashString = '${HEDGEWARS_HASH}';
       cDefaultPathPrefix = '${HEDGEWARS_FULL_DATADIR}/Data';
-{$IFDEF PAS2C}
-      cFontsPaths: array[0..1] of PChar = (nil, nil);
-{$ELSE}
       cFontsPaths: ${FONTS_DIRS_ARRAY}
-{$ENDIF}
--- a/hedgewars/uRender.pas	Sun Jan 04 14:04:17 2015 -0500
+++ b/hedgewars/uRender.pas	Tue Jan 06 17:07:34 2015 +0100
@@ -535,11 +535,14 @@
 end;
 
 procedure openglRotatef(RotX, RotY, RotZ: GLfloat; dir: LongInt); inline;
+{ workaround for pascal bug http://bugs.freepascal.org/view.php?id=27222 }
+var tmpdir: LongInt;
 begin
+tmpdir:=dir;
 {$IFDEF GL2}
-    hglRotatef(RotX, RotY, RotZ, dir);
+    hglRotatef(RotX, RotY, RotZ, tmpdir);
 {$ELSE}
-    glRotatef(RotX, RotY, RotZ, dir);
+    glRotatef(RotX, RotY, RotZ, tmpdir);
 {$ENDIF}
 end;
 
--- a/project_files/hwc/CMakeLists.txt	Sun Jan 04 14:04:17 2015 -0500
+++ b/project_files/hwc/CMakeLists.txt	Tue Jan 06 17:07:34 2015 +0100
@@ -16,6 +16,18 @@
 include_directories(${SDL_INCLUDE_DIR})
 add_subdirectory(rtl)
 
+# convert list into pascal array
+if(FONTS_DIRS)
+  list(LENGTH FONTS_DIRS ndirs)
+  set(FONTS_DIRS_ARRAY "array [0..${ndirs}] of PChar = (")
+  foreach(fontdir ${FONTS_DIRS})
+      set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\n_P'${fontdir}',")
+  endforeach(fontdir)
+  set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\nnil);\n")
+else(FONTS_DIRS)
+  set(FONTS_DIRS_ARRAY "array [0..1] of PChar = (nil, nil);")
+endif(FONTS_DIRS)
+
 configure_file(${CMAKE_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
 
 #get the list of pas files that are going to be converted and compiled
--- a/tools/pas2c/Pas2C.hs	Sun Jan 04 14:04:17 2015 -0500
+++ b/tools/pas2c/Pas2C.hs	Tue Jan 06 17:07:34 2015 +0100
@@ -668,6 +668,7 @@
 initExpr2C' (InitHexNumber s) = return $ text "0x" <> (text . map toLower $ s)
 initExpr2C' (InitString [a]) = return . quotes $ text [a]
 initExpr2C' (InitString s) = return $ strInit s
+initExpr2C' (InitPChar s) = return $ doubleQuotes (text $ escapeStr s)
 initExpr2C' (InitChar a) = return $ text "0x" <> text (showHex (read a) "")
 initExpr2C' (InitReference i) = id2C IOLookup i
 initExpr2C' (InitRecord fields) = do
--- a/tools/pas2c/PascalParser.hs	Sun Jan 04 14:04:17 2015 -0500
+++ b/tools/pas2c/PascalParser.hs	Tue Jan 06 17:07:34 2015 +0100
@@ -629,6 +629,8 @@
         , try $ integer pas >>= \i -> notFollowedBy (char' '.') >> (return . InitNumber . show) i
         , try $ float pas >>= return . InitFloat . show
         , try $ integer pas >>= return . InitNumber . show
+        , try (string' "_S" >> stringLiteral pas) >>= return . InitString
+        , try (string' "_P" >> stringLiteral pas) >>= return . InitPChar
         , stringLiteral pas >>= return . InitString
         , char' '#' >> many digit >>= \c -> comments >> return (InitChar c)
         , char' '$' >> many hexDigit >>= \h -> comments >> return (InitHexNumber h)
--- a/tools/pas2c/PascalUnitSyntaxTree.hs	Sun Jan 04 14:04:17 2015 -0500
+++ b/tools/pas2c/PascalUnitSyntaxTree.hs	Tue Jan 06 17:07:34 2015 +0100
@@ -89,6 +89,7 @@
     | InitNumber String
     | InitHexNumber String
     | InitString String
+    | InitPChar String
     | InitChar String
     | BuiltInFunction String [InitExpression]
     | InitSet [InitExpression]