From 2698595238945f37caa5668447bbee1d7be42bb3 Mon Sep 17 00:00:00 2001 From: Nicolas Bouquet Date: Mon, 27 Feb 2017 12:02:07 +0100 Subject: [PATCH] [export] pack all compiled and run files into a single one [lua] use a single code base --- gdrexport/ExportCommon.cpp | 472 ++++++++++++++++++++----------------- gdrexport/gdrexport.pro | 61 ++--- lua/etc/all_lua.c | 3 +- lua/etc/all_lua.cpp | 4 +- lua/src/loslib.c | 4 + scripts/GidQtMac.mk | 17 +- scripts/GidQtWin.mk | 17 +- 7 files changed, 306 insertions(+), 272 deletions(-) diff --git a/gdrexport/ExportCommon.cpp b/gdrexport/ExportCommon.cpp index 026962293..c74f6ff88 100644 --- a/gdrexport/ExportCommon.cpp +++ b/gdrexport/ExportCommon.cpp @@ -65,7 +65,7 @@ void ExportCommon::copyTemplate(QString templatePath, QString templateDest, } void ExportCommon::resizeImage(QImage *image, int width, int height, - QString output, int quality,bool withAlpha, QColor fill, int mode) { + QString output, int quality, bool withAlpha, QColor fill, int mode) { int iwidth = image->width(); //image width int iheight = image->height(); //image height int rwidth = width; //resampled width @@ -76,63 +76,63 @@ void ExportCommon::resizeImage(QImage *image, int width, int height, int dst_x = 0; int dst_y = 0; bool redraw = false; - int sx = 0; - int sy = 0; - int sw = -1; - int sh = -1; - - if (mode == 0){ //show all - //use smallest - if (k_h < k_w) { - rwidth = round((iwidth * height) / iheight); - } else { - rheight = round((iheight * width) / iwidth); - } - - //new width is bigger than existing - if (width > rwidth) { - dst_x = (width - rwidth) / 2; - redraw = true; - } - - //new height is bigger than existing - if (height > rheight) { - dst_y = (height - rheight) / 2; - redraw = true; - } - }else if(mode == 1){ //crop - if (k_h < k_w) { - rheight = round((iheight * width) / iwidth); - } else { - rwidth = round((iwidth * height) / iheight); - } - - if (width < rwidth) { - sx = (rwidth - width) / 2; - sw = width; - redraw = true; - } - - if (height < rheight) { - sy = (rheight - height) / 2; - sh = height; - redraw = true; - } - } - - QImage xform=image->scaled(rwidth, rheight, Qt::KeepAspectRatio, + int sx = 0; + int sy = 0; + int sw = -1; + int sh = -1; + + if (mode == 0) { //show all + //use smallest + if (k_h < k_w) { + rwidth = round((iwidth * height) / iheight); + } else { + rheight = round((iheight * width) / iwidth); + } + + //new width is bigger than existing + if (width > rwidth) { + dst_x = (width - rwidth) / 2; + redraw = true; + } + + //new height is bigger than existing + if (height > rheight) { + dst_y = (height - rheight) / 2; + redraw = true; + } + } else if (mode == 1) { //crop + if (k_h < k_w) { + rheight = round((iheight * width) / iwidth); + } else { + rwidth = round((iwidth * height) / iheight); + } + + if (width < rwidth) { + sx = (rwidth - width) / 2; + sw = width; + redraw = true; + } + + if (height < rheight) { + sy = (rheight - height) / 2; + sh = height; + redraw = true; + } + } + + QImage xform = image->scaled(rwidth, rheight, Qt::KeepAspectRatio, Qt::SmoothTransformation); if (redraw) //(dst_x || dst_y) { - QImage larger(width,height,QImage::Format_ARGB32); + QImage larger(width, height, QImage::Format_ARGB32); larger.fill(fill); QPainter painter(&larger); - painter.drawImage(dst_x,dst_y, xform, sx, sy, sw, sh); + painter.drawImage(dst_x, dst_y, xform, sx, sy, sw, sh); painter.end(); - xform=larger; + xform = larger; } if (!withAlpha) - xform=xform.convertToFormat(QImage::Format_RGB888); + xform = xform.convertToFormat(QImage::Format_RGB888); xform.save(output, "png", -1); //Use default compression for PNG, not quality } @@ -218,11 +218,13 @@ bool ExportCommon::splashHImage(ExportContext *ctx, int width, int height, if (ctx->splash_h_image->isNull()) return false; - int mode = ctx->properties.splashScaleMode; - exportInfo("Generating splash horizontal (%dx%d) scale mode (%d)\n", width, height, mode); + int mode = ctx->properties.splashScaleMode; + exportInfo("Generating splash horizontal (%dx%d) scale mode (%d)\n", width, + height, mode); resizeImage(ctx->splash_h_image, width, height, - ctx->outputDir.absoluteFilePath(output), -1, withAlpha,QColor(ctx->properties.backgroundColor), mode); + ctx->outputDir.absoluteFilePath(output), -1, withAlpha, + QColor(ctx->properties.backgroundColor), mode); return true; } @@ -249,17 +251,16 @@ bool ExportCommon::splashVImage(ExportContext *ctx, int width, int height, } if (ctx->splash_v_image->isNull()) return false; - int mode = ctx->properties.splashScaleMode; - exportInfo("Generating splash vertical (%dx%d) scale mode (%d)\n", width, height, mode); + int mode = ctx->properties.splashScaleMode; + exportInfo("Generating splash vertical (%dx%d) scale mode (%d)\n", width, + height, mode); resizeImage(ctx->splash_v_image, width, height, - ctx->outputDir.absoluteFilePath(output), -1, withAlpha,QColor(ctx->properties.backgroundColor), mode); + ctx->outputDir.absoluteFilePath(output), -1, withAlpha, + QColor(ctx->properties.backgroundColor), mode); return true; } void ExportCommon::exportAssets(ExportContext *ctx, bool compileLua) { - QStringList allluafiles; - QStringList allluafiles_abs; - if ((ctx->fileQueue.size() == 0) || (ctx->player)) //No assets -> Player return; @@ -293,57 +294,95 @@ void ExportCommon::exportAssets(ExportContext *ctx, bool compileLua) { isJet = true; } - ctx->allfiles.push_back(s1); - ctx->allfiles_abs.push_back(dst); - QFile::remove(dst); bool copied = false; if (QFileInfo(src).suffix().toLower() == "lua") { - allluafiles.push_back(s1); - allluafiles_abs.push_back(dst); - if (std::find(ctx->topologicalSort.begin(), ctx->topologicalSort.end(), std::make_pair(s2, true)) == ctx->topologicalSort.end()) { ctx->luafiles.push_back(s1); ctx->luafiles_abs.push_back(dst); - } - // compile lua files (with luac) - if (compileLua) { - QDir toolsDir = QDir(QCoreApplication::applicationDirPath()); + if (!compileLua) + { + ctx->allfiles.push_back(s1); + ctx->allfiles_abs.push_back(dst); + } + } else // compile independant lua files (with luac) + { + ctx->allfiles.push_back(s1); + ctx->allfiles_abs.push_back(dst); + if (compileLua) { + QDir toolsDir = QDir( + QCoreApplication::applicationDirPath()); #if defined(Q_OS_WIN) - QString luac = toolsDir.filePath("luac.exe"); + QString luac = toolsDir.filePath("luac.exe"); #else - QString luac = toolsDir.filePath("luac"); + QString luac = toolsDir.filePath("luac"); #endif - QDir old = QDir::current(); - QDir::setCurrent(ctx->outputDir.path()); - QString dfile = "\"" + dst + "\""; - QString sfile = "\"" + rdst + "\""; - QFile::copy(src, rdst); - QProcess::execute(quote(luac) + " -o " + dfile + " " + sfile); - if (isJet) - QFile::remove(rdst); - copied = true; - QDir::setCurrent(old.path()); + QDir old = QDir::current(); + QDir::setCurrent(ctx->outputDir.path()); + QString dfile = "\"" + dst + "\""; + QString sfile = "\"" + rdst + "\""; + QFile::copy(src, rdst); + QProcess::execute( + quote(luac) + " -o " + dfile + " " + sfile); + if (isJet) + QFile::remove(rdst); + QDir::setCurrent(old.path()); + } else { + } } } + else + { + ctx->allfiles.push_back(s1); + ctx->allfiles_abs.push_back(dst); + } if (!copied) QFile::copy(src, dst); } -#if 0 - // compile lua files - if (false) - { - compileThread_ = new CompileThread(ctx->luafiles_abs, false, "", QString(), this); - compileThread_->start(); - compileThread_->wait(); - delete compileThread_; - } + // compile building lua files + if (compileLua) { + QDir toolsDir = QDir(QCoreApplication::applicationDirPath()); +#if defined(Q_OS_WIN) + QString luac = toolsDir.filePath("luac.exe"); +#else + QString luac = toolsDir.filePath("luac"); #endif + QDir old = QDir::current(); + QDir::setCurrent(ctx->outputDir.path()); + + QString dfile = ""; + QString difile = ""; + QString sfile = ""; + for (int i = 0; i < ctx->luafiles_abs.size(); ++i) { + dfile = ctx->luafiles_abs[i]; + difile=ctx->luafiles[i]; + QString rdst = QDir::cleanPath( + ctx->outputDir.relativeFilePath(difile)); + sfile = sfile + " \"" + rdst + "\""; + QFile::copy(difile, rdst); + } + QFileInfo di(dfile); + QProcess::execute(quote(luac) + " -o \"" + dfile + "\" " + sfile); + for (int i = 0; i < ctx->luafiles_abs.size(); ++i) { + QString rdst = QDir::cleanPath( + ctx->outputDir.relativeFilePath(ctx->luafiles[i])); + QFileInfo ri(rdst); + if (ri != di) + QFile::remove(rdst); + } + ctx->luafiles.clear(); + ctx->luafiles_abs.clear(); + ctx->luafiles.push_back(difile); + ctx->luafiles_abs.push_back(dfile); + ctx->allfiles.push_back(difile); + ctx->allfiles_abs.push_back(dfile); + QDir::setCurrent(old.path()); + } // encrypt lua, png, jpg, jpeg and wav files if (true) { @@ -358,7 +397,7 @@ void ExportCommon::exportAssets(ExportContext *ctx, bool compileLua) { (ext == "lua") ? ctx->encryptCode : ctx->encryptAssets; if (!encrypt) continue; - exportInfo("Encrypting %s [%s]\n",filename.toUtf8().constData(), + exportInfo("Encrypting %s [%s]\n", filename.toUtf8().constData(), ext.toUtf8().constData()); if (ext != "lua" && ext != "png" && ext != "jpeg" && ext != "jpg" && ext != "wav") @@ -514,45 +553,43 @@ bool ExportCommon::download(ExportContext *ctx, QString url, QString to) { exportInfo("Checking %s\n", url.toStdString().c_str()); QUrl imageUrl(url); - quint64 size=0; - { - FileDownloader *m_pImgCtrl = new FileDownloader(imageUrl,true); - - QEventLoop loop; - loop.connect(m_pImgCtrl, SIGNAL(downloaded()), &loop, SLOT(quit())); - loop.exec(); - - size= m_pImgCtrl->fileSize(); - - delete m_pImgCtrl; - } - - if (file.exists()) + quint64 size = 0; { - if (size==0) - { - exportInfo("Couldn't check file size for %s, assuming valid\n", url.toStdString().c_str()); + FileDownloader *m_pImgCtrl = new FileDownloader(imageUrl, true); + + QEventLoop loop; + loop.connect(m_pImgCtrl, SIGNAL(downloaded()), &loop, SLOT(quit())); + loop.exec(); + + size = m_pImgCtrl->fileSize(); + + delete m_pImgCtrl; + } + + if (file.exists()) { + if (size == 0) { + exportInfo("Couldn't check file size for %s, assuming valid\n", + url.toStdString().c_str()); return true; //Same file as far as we can tell } - if (size==file.size()) { + if (size == file.size()) { exportInfo("File %s already in cache\n", url.toStdString().c_str()); return true; //Same file as far as we can tell } + } else { + if (size == 0) { + exportError("Failed to determine file size for %s, aborting\n", + url.toStdString().c_str()); + return false; + } } - else - { - if (size==0) - { - exportError("Failed to determine file size for %s, aborting\n", url.toStdString().c_str()); - return false; - } - } if (file.open(QIODevice::WriteOnly)) { - exportInfo("Downloading %s (%lld bytes)\n", url.toStdString().c_str(),size); + exportInfo("Downloading %s (%lld bytes)\n", url.toStdString().c_str(), + size); - FileDownloader *m_pImgCtrl = new FileDownloader(imageUrl,false,size); + FileDownloader *m_pImgCtrl = new FileDownloader(imageUrl, false, size); QEventLoop loop; loop.connect(m_pImgCtrl, SIGNAL(downloaded()), &loop, SLOT(quit())); @@ -572,104 +609,101 @@ bool ExportCommon::download(ExportContext *ctx, QString url, QString to) { return false; } - #define GZIP_CHUNK_SIZE 32 * 1024 -static bool gzInflate(QByteArray input, QByteArray &output) -{ - // Prepare output - output.clear(); - - // Is there something to do? - if(input.length() > 0) - { - // Prepare inflater status - z_stream strm; - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - - // Initialize inflater - int ret = inflateInit2(&strm, -15); - - if (ret != Z_OK) - return(false); - - // Extract pointer to input data - char *input_data = input.data(); - int input_data_left = input.length(); - - // Decompress data until available - do { - // Determine current chunk size - int chunk_size = qMin(GZIP_CHUNK_SIZE, input_data_left); - - // Check for termination - if(chunk_size <= 0) - break; - - // Set inflater references - strm.next_in = (unsigned char*)input_data; - strm.avail_in = chunk_size; - - // Update interval variables - input_data += chunk_size; - input_data_left -= chunk_size; - - // Inflate chunk and cumulate output - do { - - // Declare vars - char out[GZIP_CHUNK_SIZE]; - - // Set inflater references - strm.next_out = (unsigned char*)out; - strm.avail_out = GZIP_CHUNK_SIZE; - - // Try to inflate chunk - ret = inflate(&strm, Z_NO_FLUSH); - - switch (ret) { - case Z_NEED_DICT: - ret = Z_DATA_ERROR; - case Z_DATA_ERROR: - case Z_MEM_ERROR: - case Z_STREAM_ERROR: - // Clean-up - inflateEnd(&strm); - - // Return - return(false); - } - - // Determine decompressed size - int have = (GZIP_CHUNK_SIZE - strm.avail_out); - - // Cumulate result - if(have > 0) - output.append((char*)out, have); - - } while (strm.avail_out == 0); - - } while (ret != Z_STREAM_END); - - // Clean-up - inflateEnd(&strm); - - // Return - return (ret == Z_STREAM_END); - } - else - return(true); +static bool gzInflate(QByteArray input, QByteArray &output) { + // Prepare output + output.clear(); + + // Is there something to do? + if (input.length() > 0) { + // Prepare inflater status + z_stream strm; + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + strm.avail_in = 0; + strm.next_in = Z_NULL; + + // Initialize inflater + int ret = inflateInit2(&strm, -15); + + if (ret != Z_OK) + return (false); + + // Extract pointer to input data + char *input_data = input.data(); + int input_data_left = input.length(); + + // Decompress data until available + do { + // Determine current chunk size + int chunk_size = qMin(GZIP_CHUNK_SIZE, input_data_left); + + // Check for termination + if (chunk_size <= 0) + break; + + // Set inflater references + strm.next_in = (unsigned char*) input_data; + strm.avail_in = chunk_size; + + // Update interval variables + input_data += chunk_size; + input_data_left -= chunk_size; + + // Inflate chunk and cumulate output + do { + + // Declare vars + char out[GZIP_CHUNK_SIZE]; + + // Set inflater references + strm.next_out = (unsigned char*) out; + strm.avail_out = GZIP_CHUNK_SIZE; + + // Try to inflate chunk + ret = inflate(&strm, Z_NO_FLUSH); + + switch (ret) { + case Z_NEED_DICT: + ret = Z_DATA_ERROR; + case Z_DATA_ERROR: + case Z_MEM_ERROR: + case Z_STREAM_ERROR: + // Clean-up + inflateEnd(&strm); + + // Return + return (false); + } + + // Determine decompressed size + int have = (GZIP_CHUNK_SIZE - strm.avail_out); + + // Cumulate result + if (have > 0) + output.append((char*) out, have); + + } while (strm.avail_out == 0); + + } while (ret != Z_STREAM_END); + + // Clean-up + inflateEnd(&strm); + + // Return + return (ret == Z_STREAM_END); + } else + return (true); } #define PACKED __attribute__((packed)) bool ExportCommon::unzip(ExportContext *ctx, QString file, QString dest) { QDir toPath(ctx->outputDir); toPath.cd(dest); - exportInfo("Unzip %s to %s\n",file.toStdString().c_str(),toPath.absolutePath().toStdString().c_str()); + exportInfo("Unzip %s to %s\n", file.toStdString().c_str(), + toPath.absolutePath().toStdString().c_str()); QFile zfile(file); if (!zfile.open(QIODevice::ReadOnly)) { exportError("Can't open file %s\n", file.toStdString().c_str()); @@ -679,7 +713,7 @@ bool ExportCommon::unzip(ExportContext *ctx, QString file, QString dest) { while (true) { #pragma pack(push,1) struct _ZipHdr { - quint32 Signature;// local file header signature 4 bytes (0x04034b50) + quint32 Signature; // local file header signature 4 bytes (0x04034b50) #define ZIPHDR_SIG 0x04034b50 quint16 Version; // version needed to extract 2 bytes quint16 Flags; // general purpose bit flag 2 bytes @@ -690,7 +724,7 @@ bool ExportCommon::unzip(ExportContext *ctx, QString file, QString dest) { quint32 CompSize; // compressed size 4 bytes quint32 OrigSize; // uncompressed size 4 bytes quint16 NameLen; // file name length 2 bytes - quint16 ExtraLen;// extra field length 2 bytes + quint16 ExtraLen; // extra field length 2 bytes }PACKED Hdr; #pragma pack(pop) if (zfile.read((char *) &Hdr, sizeof(Hdr)) != sizeof(Hdr)) @@ -715,13 +749,13 @@ bool ExportCommon::unzip(ExportContext *ctx, QString file, QString dest) { QByteArray fname = zfile.read(_letohs(Hdr.NameLen)); QString lname = QString(fname); zfile.read(_letohs(Hdr.ExtraLen)); - exportInfo("Extracting %s\n",lname.toStdString().c_str()); + exportInfo("Extracting %s\n", lname.toStdString().c_str()); QByteArray fcont = zfile.read( - Hdr.Compression ? _letohl(Hdr.CompSize) : _letohl(Hdr.OrigSize)); + Hdr.Compression ? + _letohl(Hdr.CompSize) : _letohl(Hdr.OrigSize)); if (Hdr.Compression) { QByteArray decomp; - if (!gzInflate(fcont,decomp)) - { + if (!gzInflate(fcont, decomp)) { exportError("Failed to uncompress %s\n", lname.toStdString().c_str()); break; @@ -732,12 +766,10 @@ bool ExportCommon::unzip(ExportContext *ctx, QString file, QString dest) { toPath.mkpath(lname); else { QFile ofile(toPath.absoluteFilePath(lname)); - if (ofile.open(QIODevice::WriteOnly)) - { + if (ofile.open(QIODevice::WriteOnly)) { ofile.write(fcont); ofile.close(); - } - else { + } else { exportError("Can't open file %s\n", lname.toStdString().c_str()); break; @@ -779,7 +811,7 @@ void ExportCommon::progressStep(const char *title) { char *ExportCommon::askString(const char *title, const char *question, const char *def, bool key) { - exportInfo("?:?%c%s|%s|%s\n", key?'K':'S',title, question, def); + exportInfo("?:?%c%s|%s|%s\n", key ? 'K' : 'S', title, question, def); char str[512]; fgets(str, 511, stdin); int i = strlen(str) - 1; diff --git a/gdrexport/gdrexport.pro b/gdrexport/gdrexport.pro index 77cbee04a..385ba929c 100644 --- a/gdrexport/gdrexport.pro +++ b/gdrexport/gdrexport.pro @@ -33,37 +33,38 @@ SOURCES += \ ../ui/dependencygraph.cpp \ ../libnetwork/bytebuffer.cpp -INCLUDEPATH += ../lua514u/src +DEFINES += DESKTOP_TOOLS +INCLUDEPATH += ../lua/src SOURCES += \ - ../lua514u/src/lapi.c \ - ../lua514u/src/lauxlib.c \ - ../lua514u/src/lcode.c \ - ../lua514u/src/ldebug.c \ - ../lua514u/src/ldo.c \ - ../lua514u/src/ldump.c \ - ../lua514u/src/lfunc.c \ - ../lua514u/src/llex.c \ - ../lua514u/src/lmem.c \ - ../lua514u/src/lobject.c \ - ../lua514u/src/lopcodes.c \ - ../lua514u/src/lparser.c \ - ../lua514u/src/lstate.c \ - ../lua514u/src/lstring.c \ - ../lua514u/src/ltable.c \ - ../lua514u/src/ltm.c \ - ../lua514u/src/lundump.c \ - ../lua514u/src/lvm.c \ - ../lua514u/src/lzio.c \ - ../lua514u/src/lgc.c \ - ../lua514u/src/linit.c \ - ../lua514u/src/lbaselib.c \ - ../lua514u/src/ldblib.c \ - ../lua514u/src/liolib.c \ - ../lua514u/src/lmathlib.c \ - ../lua514u/src/loslib.c \ - ../lua514u/src/ltablib.c \ - ../lua514u/src/lstrlib.c \ - ../lua514u/src/loadlib.c + ../lua/src/lapi.c \ + ../lua/src/lauxlib.c \ + ../lua/src/lcode.c \ + ../lua/src/ldebug.c \ + ../lua/src/ldo.c \ + ../lua/src/ldump.c \ + ../lua/src/lfunc.c \ + ../lua/src/llex.c \ + ../lua/src/lmem.c \ + ../lua/src/lobject.c \ + ../lua/src/lopcodes.c \ + ../lua/src/lparser.c \ + ../lua/src/lstate.c \ + ../lua/src/lstring.c \ + ../lua/src/ltable.c \ + ../lua/src/ltm.c \ + ../lua/src/lundump.c \ + ../lua/src/lvm.c \ + ../lua/src/lzio.c \ + ../lua/src/lgc.c \ + ../lua/src/linit.c \ + ../lua/src/lbaselib.c \ + ../lua/src/ldblib.c \ + ../lua/src/liolib.c \ + ../lua/src/lmathlib.c \ + ../lua/src/loslib.c \ + ../lua/src/ltablib.c \ + ../lua/src/lstrlib.c \ + ../lua/src/loadlib.c INCLUDEPATH += ./luaext SOURCES += \ diff --git a/lua/etc/all_lua.c b/lua/etc/all_lua.c index ab2000bd9..2f42aa6d7 100644 --- a/lua/etc/all_lua.c +++ b/lua/etc/all_lua.c @@ -4,7 +4,7 @@ #define luaall_c - +#ifndef DESKTOP_TOOLS #include #undef stdin @@ -38,6 +38,7 @@ #define ftell g_ftell #define setvbuf g_setvbuf #define fflush g_fflush +#endif #include "lapi.c" #include "lcode.c" diff --git a/lua/etc/all_lua.cpp b/lua/etc/all_lua.cpp index 30e5363ec..ae741e8fd 100644 --- a/lua/etc/all_lua.cpp +++ b/lua/etc/all_lua.cpp @@ -4,7 +4,7 @@ #define luaall_c - +#ifndef DESKTOP_TOOLS #include #undef stdin @@ -38,7 +38,7 @@ #define ftell g_ftell #define setvbuf g_setvbuf #define fflush g_fflush - +#endif extern "C" { diff --git a/lua/src/loslib.c b/lua/src/loslib.c index 166877aaa..6741b2065 100644 --- a/lua/src/loslib.c +++ b/lua/src/loslib.c @@ -19,7 +19,11 @@ #include "lauxlib.h" #include "lualib.h" +#ifndef DESKTOP_TOOLS #include +#else +#define gpath_transform(p) p +#endif static int os_pushresult (lua_State *L, int i, const char *filename) { int en = errno; /* calls to Lua API may change this value */ diff --git a/scripts/GidQtMac.mk b/scripts/GidQtMac.mk index 0b13ae0ca..136589576 100644 --- a/scripts/GidQtMac.mk +++ b/scripts/GidQtMac.mk @@ -50,7 +50,7 @@ buildqt: $(addsuffix .qmake.rel,texturepacker fontcreator ui) player.qmake5.rel qt.clean: $(addsuffix .qmake.clean,texturepacker fontcreator ui player gdrdeamon gdrbridge gdrexport desktop) QSCINTILLA_LIBVER=$(word 2,$(subst ., ,$(filter libqscintilla%,$(subst /, ,$(shell otool -L $(ROOT)/ui/Gideros\ Studio.app/Contents/MacOS/Gideros\ Studio | grep libqscintilla))))) -qt.install: buildqt qt.player +qt.install: buildqt qt.player tools #STUDIO rm -rf $(RELEASE)/Gideros\ Studio.app cp -R $(ROOT)/ui/Gideros\ Studio.app $(RELEASE) @@ -58,7 +58,9 @@ qt.install: buildqt qt.player cp $(QT)/lib/libqscintilla2.$(QSCINTILLA_LIBVER).dylib $(RELEASE)/Gideros\ Studio.app/Contents/Frameworks/ install_name_tool -change libqscintilla2.$(QSCINTILLA_LIBVER).dylib @rpath/libqscintilla2.$(QSCINTILLA_LIBVER).dylib $(RELEASE)/Gideros\ Studio.app/Contents/MacOS/Gideros\ Studio cp -R $(ROOT)/ui/Resources $(RELEASE)/Gideros\ Studio.app/Contents/ - cp -R $(ROOT)/ui/Tools $(RELEASE)/Gideros\ Studio.app/Contents/Tools + cp -R $(ROOT)/ui/Tools $(RELEASE)/Gideros\ Studio.app/Contents/Tools + cp $(ROOT)/lua/src/lua $(RELEASE)/Gideros\ Studio.app/Contents/Tools + cp $(ROOT)/lua/src/luac $(RELEASE)/Gideros\ Studio.app/Contents/Tools for t in gdrdeamon gdrbridge gdrexport; do \ install_name_tool -add_rpath @executable_path/../Frameworks $(ROOT)/$$t/$$t;\ cp $(ROOT)/$$t/$$t $(RELEASE)/Gideros\ Studio.app/Contents/Tools; done @@ -142,15 +144,10 @@ qtplugins.install: buildqtplugins $(addsuffix .qtplugin.install,$(PLUGINS_WIN)) cd $(ROOT)/$*; $(MAKE) tools: - cd $(ROOT)/lua514u/src; gcc -o luac $(addsuffix .c,print lapi lauxlib lcode ldebug ldo ldump\ - lfunc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio luac lgc) - #cd $(ROOT)/lua514u/src; gcc -shared -o lua51.dll -Wl,--out-implib,lua51.a $(addsuffix .c,lapi lauxlib lcode ldebug ldo ldump\ - lfunc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lgc\ - linit lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib) - #cd $(ROOT)/lua514u/src; gcc -o lua lua.c lua51.a - cd $(ROOT)/lua514u/src; gcc -o lua $(addsuffix .c,lapi lauxlib lcode ldebug ldo ldump\ + cd $(ROOT)/lua/src; gcc -I. -DDESKTOP_TOOLS -o luac luac.c + cd $(ROOT)/lua/src; gcc -I. -DDESKTOP_TOOLS -o lua $(addsuffix .c,lapi lauxlib lcode ldebug ldo ldump\ lfunc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lua lgc\ - linit lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib) + linit lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib lutf8lib lint64) bundle: rm -rf $(RELEASE).Tmp diff --git a/scripts/GidQtWin.mk b/scripts/GidQtWin.mk index 814fc9ecd..d4110c63b 100644 --- a/scripts/GidQtWin.mk +++ b/scripts/GidQtWin.mk @@ -50,13 +50,16 @@ buildqt: $(addsuffix .qmake.rel,texturepacker fontcreator ui) player.qmake5.rel qt.clean: $(addsuffix .qmake.clean,texturepacker fontcreator ui player gdrdeamon gdrbridge gdrexport desktop) -qt.install: buildqt qt5.install qt.player +qt.install: buildqt qt5.install qt.player tools cp $(ROOT)/ui/release/GiderosStudio.exe $(RELEASE) cp $(ROOT)/player/release/GiderosPlayer.exe $(RELEASE) cp $(ROOT)/texturepacker/release/GiderosTexturePacker.exe $(RELEASE) cp $(ROOT)/fontcreator/release/GiderosFontCreator.exe $(RELEASE) cp -R $(ROOT)/ui/Resources $(RELEASE) cd $(ROOT)/ui/;tar cf - --exclude=Tools/lua --exclude Tools/luac --exclude Tools/make Tools | (cd ../$(RELEASE) && tar xvf - ) + cp $(ROOT)/lua/src/lua.exe $(RELEASE)/Tools + cp $(ROOT)/lua/src/luac.exe $(RELEASE)/Tools + cp $(ROOT)/lua/src/lua51.dll $(RELEASE)/Tools mkdir -p $(RELEASE)/Templates #Other templates cp -R $(ROOT)/ui/Templates/*.gexport $(RELEASE)/Templates @@ -135,15 +138,11 @@ qtplugins.install: buildqtplugins $(addsuffix .qtplugin.install,$(PLUGINS_WIN)) cd $(ROOT)/$*; $(MINGWMAKE) debug tools: - cd $(ROOT)/lua514u/src; gcc -o luac $(addsuffix .c,print lapi lauxlib lcode ldebug ldo ldump\ - lfunc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio luac lgc) - cd $(ROOT)/lua514u/src; gcc -shared -o lua51.dll -Wl,--out-implib,lua51.a $(addsuffix .c,lapi lauxlib lcode ldebug ldo ldump\ + cd $(ROOT)/lua/src; gcc -I. -DDESKTOP_TOOLS -o luac luac.c + cd $(ROOT)/lua/src; gcc -I. -DDESKTOP_TOOLS -shared -o lua51.dll -Wl,--out-implib,lua51.a $(addsuffix .c,lapi lauxlib lcode ldebug ldo ldump\ lfunc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lgc\ - linit lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib) - cd $(ROOT)/lua514u/src; gcc -o lua lua.c lua51.a - #cd $(ROOT)/lua514u/src; gcc -o lua $(addsuffix .c,lapi lauxlib lcode ldebug ldo ldump\ - lfunc llex lmem lobject lopcodes lparser lstate lstring ltable ltm lundump lvm lzio lua lgc\ - linit lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib) + linit lbaselib ldblib liolib lmathlib loslib ltablib lstrlib loadlib lutf8lib lint64) + cd $(ROOT)/lua/src; gcc -I. -DDESKTOP_TOOLS -o lua lua.c lua51.a bundle: rm -rf $(RELEASE).Tmp