Przeglądaj źródła

use compiler DLLs instead of using static linkage for MinGW

Ashish Kulkarni 11 lat temu
rodzic
commit
cf53180802
3 zmienionych plików z 16 dodań i 3 usunięć
  1. 1 2
      common.pri
  2. 9 1
      scripts/build.py
  3. 6 0
      wkhtmltox.nsi

+ 1 - 2
common.pri

@@ -39,8 +39,7 @@ contains(QMAKE_PRL_CONFIG, static): QTPLUGIN += qcncodecs qjpcodecs qkrcodecs qt
 INCLUDEPATH += ../../include
 RESOURCES    = $$PWD/wkhtmltopdf.qrc
 
-win32:      CONFIG += console
-win32-g++*: QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
+win32: CONFIG += console
 
 QT += webkit network xmlpatterns svg
 greaterThan(QT_MAJOR_VERSION, 4) {

+ 9 - 1
scripts/build.py

@@ -993,9 +993,17 @@ def build_mingw64_cross(config, basedir):
     shell('%s/bin/qmake -spec win32-g++-4.6 %s/../wkhtmltopdf.pro' % (qtdir, basedir))
     shell('make')
     shutil.copy('bin/libwkhtmltox0.a', 'bin/wkhtmltox.lib')
+    shell('rm -f bin/lib*.dll')
+    for dll in ['libgcc_s_sjlj-1.dll', 'libgcc_s_seh-1.dll', 'libstdc++-6.dll']:
+        dll_path = get_output('dpkg', '-S', dll)
+        if dll_path:
+            for line in dll_path.split('\n'):
+                loc = line[1+line.index(':'):].strip()
+                if exists(loc) and MINGW_W64_PREFIX[rchop(config, '-dbg')] in loc and '-posix' not in loc:
+                    shell('cp %s bin/' % loc)
 
     os.chdir(os.path.join(basedir, '..'))
-    shell('makensis -DVERSION=%s -DSIMPLE_VERSION=%s -DTARGET=%s wkhtmltox.nsi' % \
+    shell('makensis -DVERSION=%s -DSIMPLE_VERSION=%s -DTARGET=%s -DMINGW wkhtmltox.nsi' % \
             (version, simple_version, config))
 
 # -------------------------------------------------- Linux schroot environment

+ 6 - 0
wkhtmltox.nsi

@@ -33,6 +33,9 @@ Function ${un}DeleteFiles
   Delete "$INSTDIR\wkhtmltopdf.exe"
   Delete "$INSTDIR\wkhtmltoimage.exe"
 ; remove as per current installer layout
+  Delete "$INSTDIR\bin\libgcc_s_sjlj-1.dll"
+  Delete "$INSTDIR\bin\libgcc_s_seh-1.dll"
+  Delete "$INSTDIR\bin\libstdc++-6.dll"
   Delete "$INSTDIR\bin\wkhtmltoimage.exe"
   Delete "$INSTDIR\bin\wkhtmltopdf.exe"
   Delete "$INSTDIR\bin\wkhtmltox.dll"
@@ -61,6 +64,9 @@ Section "Install"
   File static-build\${TARGET}\app\bin\wkhtmltoimage.exe
   File static-build\${TARGET}\app\bin\wkhtmltopdf.exe
   File static-build\${TARGET}\app\bin\wkhtmltox.dll
+!ifdef MINGW
+  File static-build\${TARGET}\app\bin\lib*.dll
+!endif
 
   SetOutPath "$INSTDIR\lib"
   File static-build\${TARGET}\app\bin\wkhtmltox.lib