Browse Source

use static linkage for MinGW target

This effectively reverts cf53180802dd991fc3abef4b8c56aeb871224098,
and produces zero-dependency executables which also work on Windows
XP/2003 and above.
Ashish Kulkarni 9 years ago
parent
commit
55008f56cb
3 changed files with 3 additions and 13 deletions
  1. 2 1
      common.pri
  2. 0 8
      scripts/build.py
  3. 1 4
      wkhtmltox.nsi

+ 2 - 1
common.pri

@@ -23,7 +23,8 @@ CONFIG(static, shared|static):lessThan(QT_MAJOR_VERSION, 5) {
 INCLUDEPATH += ../../include
 RESOURCES    = $$PWD/wkhtmltopdf.qrc
 
-win32: CONFIG += console
+win32:      CONFIG += console
+win32-g++*: QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
 
 QT += webkit network xmlpatterns svg
 greaterThan(QT_MAJOR_VERSION, 4) {

+ 0 - 8
scripts/build.py

@@ -981,14 +981,6 @@ 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)
 
     if config.endswith('-dbg'):
         return

+ 1 - 4
wkhtmltox.nsi

@@ -36,11 +36,11 @@ Function ${un}DeleteFiles
   Delete "$INSTDIR\libeay32.dll"
   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\libwinpthread-1.dll"
+; remove as per current installer layout
   Delete "$INSTDIR\bin\wkhtmltoimage.exe"
   Delete "$INSTDIR\bin\wkhtmltopdf.exe"
   Delete "$INSTDIR\bin\wkhtmltox.dll"
@@ -87,9 +87,6 @@ skip_vcruntime:
   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