Browse Source

port the MinGW-w64 target to build in the chroot environment

Ashish Kulkarni 10 years ago
parent
commit
0f8e049647
2 changed files with 11 additions and 6 deletions
  1. 10 6
      scripts/build.py
  2. 1 0
      wkhtmltox.nsi

+ 10 - 6
scripts/build.py

@@ -987,9 +987,13 @@ MINGW_W64_PREFIX = {
 }
 }
 
 
 def check_mingw64_cross(config):
 def check_mingw64_cross(config):
-    shell('%s-gcc --version' % MINGW_W64_PREFIX[rchop(config, '-dbg')])
+    chroot_shell('mingw-w64', '%s-gcc --version' % MINGW_W64_PREFIX[rchop(config, '-dbg')])
 
 
 def build_mingw64_cross(config, basedir):
 def build_mingw64_cross(config, basedir):
+    os.chdir(os.path.realpath(os.path.join(basedir, '..')))
+    chroot_shell('mingw-w64', 'python scripts/build.py %s -chroot-build' % ' '.join(sys.argv[1:]))
+
+def chroot_build_mingw64_cross(config, basedir):
     version, simple_version = get_version(basedir)
     version, simple_version = get_version(basedir)
     build_deplibs(config, basedir, mingw_w64=MINGW_W64_PREFIX.get(rchop(config, '-dbg')))
     build_deplibs(config, basedir, mingw_w64=MINGW_W64_PREFIX.get(rchop(config, '-dbg')))
 
 
@@ -998,11 +1002,11 @@ def build_mingw64_cross(config, basedir):
 
 
     configure_args = qt_config('mingw-w64-cross',
     configure_args = qt_config('mingw-w64-cross',
         '--prefix=%s'   % qtdir,
         '--prefix=%s'   % qtdir,
-        '-I %s/include' % libdir,
-        '-L %s/lib'     % libdir,
+        '-I%s/include'  % libdir,
+        '-L%s/lib'      % libdir,
         '-device-option CROSS_COMPILE=%s-' % MINGW_W64_PREFIX[rchop(config, '-dbg')])
         '-device-option CROSS_COMPILE=%s-' % MINGW_W64_PREFIX[rchop(config, '-dbg')])
 
 
-    os.environ['OPENSSL_LIBS'] = '-lssl -lcrypto -L %s/lib -lws2_32 -lgdi32 -lcrypt32' % libdir
+    os.environ['OPENSSL_LIBS'] = '-lssl -lcrypto -L%s/lib -lws2_32 -lgdi32 -lcrypt32' % libdir
 
 
     mkdir_p(qtdir)
     mkdir_p(qtdir)
     os.chdir(qtdir)
     os.chdir(qtdir)
@@ -1026,12 +1030,12 @@ def build_mingw64_cross(config, basedir):
     shell('make')
     shell('make')
     shutil.copy('bin/libwkhtmltox0.a', 'bin/wkhtmltox.lib')
     shutil.copy('bin/libwkhtmltox0.a', 'bin/wkhtmltox.lib')
     shell('rm -f bin/lib*.dll')
     shell('rm -f bin/lib*.dll')
-    for dll in ['libgcc_s_sjlj-1.dll', 'libgcc_s_seh-1.dll', 'libstdc++-6.dll']:
+    for dll in ['libgcc_s_sjlj-1.dll', 'libstdc++-6.dll', 'libwinpthread-1.dll']:
         dll_path = get_output('dpkg', '-S', dll)
         dll_path = get_output('dpkg', '-S', dll)
         if dll_path:
         if dll_path:
             for line in dll_path.split('\n'):
             for line in dll_path.split('\n'):
                 loc = line[1+line.index(':'):].strip()
                 loc = line[1+line.index(':'):].strip()
-                if exists(loc) and MINGW_W64_PREFIX[rchop(config, '-dbg')] in loc and '-posix' not in loc:
+                if exists(loc) and MINGW_W64_PREFIX[rchop(config, '-dbg')] in loc:
                     shell('cp %s bin/' % loc)
                     shell('cp %s bin/' % loc)
 
 
     os.chdir(os.path.join(basedir, '..'))
     os.chdir(os.path.join(basedir, '..'))

+ 1 - 0
wkhtmltox.nsi

@@ -40,6 +40,7 @@ Function ${un}DeleteFiles
   Delete "$INSTDIR\bin\libgcc_s_sjlj-1.dll"
   Delete "$INSTDIR\bin\libgcc_s_sjlj-1.dll"
   Delete "$INSTDIR\bin\libgcc_s_seh-1.dll"
   Delete "$INSTDIR\bin\libgcc_s_seh-1.dll"
   Delete "$INSTDIR\bin\libstdc++-6.dll"
   Delete "$INSTDIR\bin\libstdc++-6.dll"
+  Delete "$INSTDIR\bin\libwinpthread-1.dll"
   Delete "$INSTDIR\bin\wkhtmltoimage.exe"
   Delete "$INSTDIR\bin\wkhtmltoimage.exe"
   Delete "$INSTDIR\bin\wkhtmltopdf.exe"
   Delete "$INSTDIR\bin\wkhtmltopdf.exe"
   Delete "$INSTDIR\bin\wkhtmltox.dll"
   Delete "$INSTDIR\bin\wkhtmltox.dll"