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