From: vincent@cubedesigners.com Date: Mon, 13 Jan 2020 14:47:53 +0000 (+0000) Subject: wip #3327 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1e1808a16dfd5a244cf93d84af0955b16a193862;p=cubeextranet.git wip #3327 @2 --- diff --git a/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php b/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php index efe323542..698795670 100644 --- a/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php +++ b/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php @@ -2,139 +2,129 @@ class wsPackagerMacEXEHTML extends wsPackagerWinEXEHTML { - protected $nwplatform = 'osx64'; - protected $nwversion = '0.29.0'; - protected $node_platform = 'mac'; - protected $exenameMaxlength = 28; - - public function __construct($book_id) - { - parent::__construct($book_id); - $this->version = 'mac-exe-html'; - - } - - public function makePackage($zip) - { - $this->preparePackage(); - $toDelete = ['chromedriver', 'credits.html', 'minidump_stackwalk', 'nwjc', 'payload', 'v8_context_snapshot.bin', 'natives_blob.bin']; - foreach ($toDelete as $item) { - $p = $this->getFinalPackageDir() . '/' . $item; - `rm -rf "$p"`; - } - if ($zip) { - $res = $this->zip(null); - } else { - $res = $this->getFinalPackageDir(); - } - $this->postPackage(); - return $res; - } - - public function getAppPath() - { - return $this->getFinalPackageDir() . '/' . $this->exeName . '.app'; - } - - public function getFinalPackageDir() - { - $res = parent::getFinalPackageDir(); - return $res; - } - - protected function preparePackage() - { - $this->initTempDir(); - $this->copyFluidbookFiles(); - $this->makeJSON(); - - $this->buildPath = WS_PACKAGER . '/nwbuild/' . $this->version . '/' . $this->book_id; - if (!file_exists($this->buildPath)) { - mkdir($this->buildPath, 0777, true); - } - - $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('v', $this->nwversion); - $cl->setArg('winIco', $this->vdir . '/icon.ico'); - $cl->setArg('macIcns', $this->vdir . '/icon.icns'); - $cl->setArg(null, $this->vdir); - $cl->execute(); - $cl->debug(); - - $this->replaceFFMpeg(); - - $this->signApp(); - } - - function replaceFFMpeg() - { - $v = $this->getAppPath() . '/Contents/Versions/'; - $dr = opendir($v); - while ($f = readdir($dr)) { - if ($f == '.' || $f == '..') { - continue; - } - $path = $v . '/' . $f; - if (is_dir($path)) { - copy(WS_COMPILE_ASSETS . '/_exehtml/_ffmpeg/libffmpeg.dylib', $path . '/libffmpeg.dylib'); - } - } - } - - protected function signApp() - { - $local_root = '/Sign/'; - $dist_root = '/mnt/sshfs/macparis' . $local_root; - - $f = 'tmp_' . md5(rand(0, 1000000)) . ".app"; - $path = $dist_root . $f; - - // Copy app to mac - $cp = new CubeIT_CommandLine('cp'); - $cp->setArg('r'); - $cp->setArg(null, $this->getAppPath()); - $cp->setArg(null, $path); - $cp->execute(); - $cp->debug(); - - // Sign app - $cl = new CubeIT_CommandLine('/Sign/sign'); - $cl->setSSH('paris.cubedesigners.com', 'vincent', 'atacama', 22022); - $cl->setArg(null, $local_root . $f); - $cl->execute(); - $cl->debug(); - - // Copy back signed - $cp = new CubeIT_CommandLine('rsync'); - $cp->setArg('r'); - $cp->setArg('l'); - $cp->setArg('p'); - $cp->setArg('D'); - $cp->setArg('v'); - $cp->setArg(null, $path . '/'); - $cp->setArg(null, $this->getAppPath() . '/'); - $cp->setArg('delete'); - $cp->execute(); - $cp->debug(); - - `rm -rf $path`; - - -// $cert = WS_COMPILE_ASSETS . '/_exehtml/certificats/developer_id_application/'; -// -// $cl = new CubeIT_CommandLine('/usr/local/bin/isign'); -// $cl->setArg('k', $cert . 'vincent@cubedesigners.com.key'); -// $cl->setArg('c', $cert . 'developerID_application.pem'); -// $cl->setArg('o', $this->getSignedAppPath()); -// $cl->setArg(null, $this->getAppPath()); -// $cl->execute(); -// $cl->debug(); -// -// echo $cl->commande; -// echo $cl->output; -// exit; - } + protected $nwplatform = 'osx64'; + protected $nwversion = '0.29.0'; + protected $node_platform = 'mac'; + protected $exenameMaxlength = 28; + + public function __construct($book_id) + { + parent::__construct($book_id); + $this->version = 'mac-exe-html'; + + } + + public function makePackage($zip) + { + $this->preparePackage(); + $toDelete = ['chromedriver', 'credits.html', 'minidump_stackwalk', 'nwjc', 'payload', 'v8_context_snapshot.bin', 'natives_blob.bin']; + foreach ($toDelete as $item) { + $p = $this->getFinalPackageDir() . '/' . $item; + `rm -rf "$p"`; + } + if ($zip) { + $res = $this->zip(null); + } else { + $res = $this->getFinalPackageDir(); + } + $this->postPackage(); + return $res; + } + + public function getAppPath() + { + return $this->getFinalPackageDir() . '/' . $this->exeName . '.app'; + } + + public function getFinalPackageDir() + { + $res = parent::getFinalPackageDir(); + return $res; + } + + protected function preparePackage() + { + $this->initTempDir(); + $this->copyFluidbookFiles(); + $this->makeJSON(); + + $this->buildPath = WS_PACKAGER . '/nwbuild/' . $this->version . '/' . $this->book_id; + if (!file_exists($this->buildPath)) { + mkdir($this->buildPath, 0777, true); + } + + $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('v', $this->nwversion); + $cl->setArg('winIco', $this->vdir . '/icon.ico'); + $cl->setArg('macIcns', $this->vdir . '/icon.icns'); + $cl->setArg(null, $this->vdir); + $cl->execute(); + $cl->debug(); + + $this->replaceFFMpeg(); + + $this->signApp(); + } + + function replaceFFMpeg() + { + $v = $this->getAppPath() . '/Contents/Versions/'; + $dr = opendir($v); + while ($f = readdir($dr)) { + if ($f == '.' || $f == '..') { + continue; + } + $path = $v . '/' . $f; + if (is_dir($path)) { + copy(WS_COMPILE_ASSETS . '/_exehtml/_ffmpeg/libffmpeg.dylib', $path . '/libffmpeg.dylib'); + } + } + } + + protected function signApp() + { + self::_signApp($this->getAppPath()); + } + + public static function _signApp($appPath) + { + $local_root = '/Users/vincent/Sign/'; + $dist_root = '/mnt/sshfs/macparis' . $local_root; + + $f = 'tmp_' . md5(rand(0, 1000000)) . ".app"; + $path = $dist_root . $f; + + // Copy app to mac + $cp = new CubeIT_CommandLine('cp'); + $cp->setArg('r'); + $cp->setArg(null, $appPath); + $cp->setArg(null, $path); + $cp->execute(); + $cp->debug(); + + // Sign app + $cl = new CubeIT_CommandLine($local_root . 'sign'); + $cl->setSSH('paris.cubedesigners.com', 'vincent', 'atacama', 22022); + $cl->setArg(null, $local_root . $f); + $cl->execute(); + $cl->debug(); + + // Copy back signed + $cp = new CubeIT_CommandLine('rsync'); + $cp->setArg('r'); + $cp->setArg('l'); + $cp->setArg('p'); + $cp->setArg('D'); + $cp->setArg('v'); + $cp->setArg(null, $path . '/'); + $cp->setArg(null, $appPath . '/'); + $cp->setArg('delete'); + $cp->execute(); + $cp->debug(); + + `rm -rf $path`; + } } diff --git a/inc/ws/Util/packager/class.ws.packager.mac.exe.php b/inc/ws/Util/packager/class.ws.packager.mac.exe.php index 4da84c196..4c08e5efb 100644 --- a/inc/ws/Util/packager/class.ws.packager.mac.exe.php +++ b/inc/ws/Util/packager/class.ws.packager.mac.exe.php @@ -1,29 +1,43 @@ version = 'mac-exe'; - $this->book->parametres->alwaysHTML5 = false; - - $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30)); - } - - protected function preparePackage() { - parent::preparePackage(); - - $this->copyFluidbookFiles(); - $this->copyOtherFiles(array('Fluidbook.app.zip')); - } - - public function makePackage($zip) { - parent::makePackage($zip); - $res = $this->zip($this->vdir . 'Fluidbook.app.zip'); - $this->postPackage(); - return $res; - } -} +class wsPackagerMacEXE extends wsPackager +{ + protected $exeName; + + public function __construct($book_id) + { + parent::__construct($book_id); + $this->version = 'mac-exe'; + $this->book->parametres->alwaysHTML5 = false; + + $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30)); + } + + protected function preparePackage() + { + parent::preparePackage(); + + $this->copyFluidbookFiles(); + $this->copyOtherFiles(array('Fluidbook.app.zip')); -?> \ No newline at end of file + $this->signApp(); + } + + public function makePackage($zip) + { + parent::makePackage($zip); + $res = $this->zip($this->vdir . 'Fluidbook.app.zip'); + $this->postPackage(); + return $res; + } + + public function getAppPath() + { + return $this->getFinalPackageDir() . '/Fluidbook.app'; + } + + protected function signApp() + { + wsPackagerMacEXEHTML::_signApp($this->getAppPath()); + } +}