]> _ Git - cubeextranet.git/commitdiff
wip #819 @3
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 8 Mar 2018 14:46:17 +0000 (14:46 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 8 Mar 2018 14:46:17 +0000 (14:46 +0000)
fluidbook/compile/_exehtml/exeshortcut/fluidbook.cpp [new file with mode: 0644]
fluidbook/compile/_exehtml/exeshortcut/fluidbook.rc [new file with mode: 0644]
inc/ws/Util/packager/class.ws.packager.win.exe.html.php

diff --git a/fluidbook/compile/_exehtml/exeshortcut/fluidbook.cpp b/fluidbook/compile/_exehtml/exeshortcut/fluidbook.cpp
new file mode 100644 (file)
index 0000000..69ffed8
--- /dev/null
@@ -0,0 +1,31 @@
+#include <windows.h>\r
+\r
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,\r
+                  LPSTR szCmdLine, int iCmdShow) {\r
+   // additional information\r
+   STARTUPINFO si;\r
+   PROCESS_INFORMATION pi;\r
+\r
+   // set the size of the structures\r
+   ZeroMemory( &si, sizeof(si) );\r
+   si.cb = sizeof(si);\r
+   ZeroMemory( &pi, sizeof(pi) );\r
+\r
+  // start the program up\r
+  CreateProcess( "$platform\\$exename.exe",   // the path\r
+    __argv[1],        // Command line\r
+    NULL,           // Process handle not inheritable\r
+    NULL,           // Thread handle not inheritable\r
+    FALSE,          // Set handle inheritance to FALSE\r
+    0,              // No creation flags\r
+    NULL,           // Use parent's environment block\r
+    NULL,           // Use parent's starting directory\r
+    &si,            // Pointer to STARTUPINFO structure\r
+    &pi             // Pointer to PROCESS_INFORMATION structure (removed extra parentheses)\r
+    );\r
+    // Close process and thread handles.\r
+    CloseHandle( pi.hProcess );\r
+    CloseHandle( pi.hThread );\r
+\r
+    return 0;\r
+}
\ No newline at end of file
diff --git a/fluidbook/compile/_exehtml/exeshortcut/fluidbook.rc b/fluidbook/compile/_exehtml/exeshortcut/fluidbook.rc
new file mode 100644 (file)
index 0000000..2d004d9
--- /dev/null
@@ -0,0 +1,18 @@
+1 ICON "$icofile"\r
+1 VERSIONINFO\r
+FILEVERSION     1,0,0,0\r
+PRODUCTVERSION  1,0,0,0\r
+BEGIN\r
+  BLOCK "StringFileInfo"\r
+  BEGIN\r
+    BLOCK "080904E4"\r
+    BEGIN\r
+      VALUE "FileDescription", "$appname"\r
+      VALUE "FileVersion", "$appversion"\r
+      VALUE "InternalName", "$exename"\r
+      VALUE "OriginalFilename", "$exename.exe"\r
+      VALUE "ProductName", "$appname"\r
+      VALUE "ProductVersion", "$appversion"\r
+    END\r
+  END\r
+END
\ No newline at end of file
index 09cd6e676a462ea7b74dba992096b92ef26fdc17..65327c563c0ac56b8516b79ef50c90bacf4e529a 100644 (file)
@@ -7,12 +7,14 @@ class wsPackagerWinEXEHTML extends wsPackager {
        protected $buildPath;\r
        protected $nwplatform = 'windows-x32';\r
        protected $nwversion = '0.29.0';\r
+       protected $appversion = '';\r
 \r
        public function __construct($book_id) {\r
                parent::__construct($book_id, null, true, true);\r
                $this->version = 'win-exe-html';\r
                $this->book->parametres->alwaysHTML5 = true;\r
                $this->appName = '';\r
+               $this->appversion = '1.0.' . time();\r
                $this->_clean = false;\r
 \r
                if ($this->book->parametres->offlineTitle == "") {\r
@@ -31,7 +33,7 @@ class wsPackagerWinEXEHTML extends wsPackager {
 \r
                $this->buildPath = WS_PACKAGER . '/nwbuild/' . $this->version . '/' . $this->book_id;\r
                if (!file_exists($this->buildPath)) {\r
-                       mkdir($this->buildPath, 0777, true);\r
+                       mkdir($this->buildPath . '/win32/', 0777, true);\r
                }\r
 \r
                $cl = new CubeIT_CommandLine('/usr/local/web2exe/web2exe-linux');\r
@@ -39,7 +41,6 @@ class wsPackagerWinEXEHTML extends wsPackager {
                $cl->setEnv('TMPDIR', '/home/extranetfiles/tmp');\r
                $cl->setLongArgumentSeparator(' ');\r
                $cl->setArg('export-to', $this->nwplatform);\r
-\r
                $cl->setArg('uncompressed-folder');\r
                $cl->setArg('title', $this->appName);\r
                $cl->setArg('output-dir', $this->buildPath);\r
@@ -53,21 +54,51 @@ class wsPackagerWinEXEHTML extends wsPackager {
                $cl->setArg('width', 1024);\r
                $cl->setArg('height', 768);\r
                $cl->setArg('app-name', $this->exeName);\r
-               $cl->setArg('version', '1.0.' . time());\r
+               $cl->setArg('version', $this->appversion);\r
                $cl->setArg('id', 'com.fluidbook.' . $this->book_id);\r
                $cl->setArg('verbose');\r
                $cl->setArg(null, $this->vdir);\r
                $cl->execute();\r
 \r
-               //              $cl = new CubeIT_CommandLine('/data/extranet/node_modules/nw-builder/bin/nwbuild');\r
-               //              $cl->setPath(CONVERTER_PATH);\r
-               //              $cl->setArg('p', $this->nwplatform);\r
-               //              $cl->setArg('o', $this->buildPath);\r
-               //              $cl->setArg('winIco', $this->vdir . '/icon.ico');\r
-               //              $cl->setArg('macIcns', $this->vdir . '/icon.icns');\r
-               //              $cl->setArg(null, $this->vdir);\r
-               //              $cl->execute();\r
-               //              $cl->debug();\r
+               $this->compileShortcut();\r
+\r
+       }\r
+\r
+       function compileShortcut() {\r
+               $tmp = CubeIT_Files::tmpdir();\r
+\r
+               $files = array('fluidbook.cpp', 'fluidbook.rc');\r
+               $vars = array('icofile' => $this->vdir . '/icon.ico',\r
+                             'exename' => $this->exeName,\r
+                             'platform' => $this->nwplatform,\r
+                             'appversion' => $this->appversion,\r
+                             'appname' => $this->appName);\r
+               foreach ($files as $file) {\r
+                       $c = file_get_contents(WS_COMPILE_ASSETS . '/_exehtml/exeshortcut/' . $file);\r
+                       foreach ($vars as $k => $v) {\r
+                               $c = str_replace('$' . $k, $v, $c);\r
+                       }\r
+                       file_put_contents($tmp . '/' . $file, $c);\r
+               }\r
+\r
+               $cl = new CubeIT_CommandLine('i686-w64-mingw32-windres');\r
+               $cl->setPath(CONVERTER_PATH);\r
+               $cl->setArg(null, $tmp . '/fluidbook.rc');\r
+               $cl->setArg('O', 'coff');\r
+               $cl->setArg('o', $tmp . '/fluidbook.res');\r
+               $cl->execute();\r
+               $cl->debug();\r
+\r
+               //i686-w64-mingw32-g++ -lmingw32 -o fluidbook.exe /home/extranet/www/fluidbook/compile/_exehtml/fluidbook.cpp\r
+               $cl = new CubeIT_CommandLine('i686-w64-mingw32-g++');\r
+               $cl->setPath(CONVERTER_PATH);\r
+               $cl->setManualArg('-lmingw32');\r
+               $cl->setManualArg('-mwindows');\r
+               $cl->setArg('o', $this->buildPath . '/' . $this->exeName . '/' . $this->exeName . '.exe');\r
+               $cl->setArg(null, $tmp . '/fluidbook.cpp');\r
+               $cl->setArg(null, $tmp . '/fluidbook.res');\r
+               $cl->execute();\r
+               $cl->debug();\r
        }\r
 \r
        function makeJSON() {\r
@@ -100,7 +131,7 @@ class wsPackagerWinEXEHTML extends wsPackager {
        }\r
 \r
        public function getFinalPackageDir() {\r
-               return $this->buildPath . '/' . $this->exeName . '/' . $this->nwplatform;\r
+               return $this->buildPath . '/' . $this->exeName . '/';\r
        }\r
 \r
        protected function compile() {\r