Skip to content

Commit

Permalink
make the Windows MSVC target functional
Browse files Browse the repository at this point in the history
As Cygwin is required for building ICU, it is now a dependency for
the Windows MSVC build.
  • Loading branch information
ashkulz committed Jul 25, 2015
1 parent a806eb8 commit e5ed92a
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 34 deletions.
2 changes: 2 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Windows
* Do "Windows Update" to ensure that VC/SDK security patches are up-to-date
* Install the latest [ActivePerl](http://www.activestate.com/activeperl/downloads) release
* Install the latest [Python 2.7](http://www.python.org/downloads/windows/) release
* Install the latest [Ruby](http://rubyinstaller.org/downloads/) release
* Install [Cygwin](https://cygwin.com/install.html) (ensure that you install the `make` package).
* Install [NSIS 2.46](http://nsis.sourceforge.net/Download)
* Make sure that you can run "git". If not, add it to the PATH or reinstall
with option "Run Git from the Windows Command Prompt".
Expand Down
100 changes: 66 additions & 34 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,55 +61,41 @@
'common' : [
'-opensource',
'-confirm-license',
'-fast',
'-release',
'-static',
'-graphicssystem raster',
'-webkit',
'-exceptions', # required by XmlPatterns
'-xmlpatterns', # required for TOC support
'-system-zlib',
'-system-libpng',
'-system-libjpeg',
'-no-libmng',
'-no-libtiff',
'-icu',
'-no-accessibility',
'-no-stl',
'-no-qt3support',
'-no-phonon',
'-no-phonon-backend',
'-no-opengl',
'-no-declarative',
'-no-script',
'-no-scripttools',
'-no-sql-ibase',
'-no-sql-mysql',
'-no-sql-oci',
'-no-sql-tds',
'-no-sql-db2',
'-no-sql-odbc',
'-no-sql-psql',
'-no-sql-sqlite',
'-no-sql-sqlite2',
'-no-mmx',
'-no-3dnow',
'-no-sse',
'-no-sse2',
'-no-multimedia',
'-nomake demos',
'-nomake docs',
'-no-qml-debug',
'-no-dbus',
'-nomake examples',
'-nomake tools',
'-nomake tests',
'-nomake translations'
'-D QT_NO_GRAPHICSVIEW',
'-D QT_NO_GRAPHICSEFFECT',
'-D QT_NO_STYLESHEET',
'-D QT_NO_STYLE_CDE',
'-D QT_NO_STYLE_CLEANLOOKS',
'-D QT_NO_STYLE_MOTIF',
'-D QT_NO_STYLE_PLASTIQUE',
'-D QT_NO_PRINTPREVIEWDIALOG'
],

'msvc': [
'-mp',
'-qt-style-windows',
'-qt-style-cleanlooks',
'-no-style-windowsxp',
'-no-style-windowsvista',
'-no-style-plastique',
'-no-style-motif',
'-no-style-cde',
'-no-angle',
'-openssl-linked' # static linkage for OpenSSL
],

Expand Down Expand Up @@ -435,6 +421,29 @@
'make -C src/liblzma', 'make -C src/xz', 'make install-strip']
}
}
},

'icu4c': {
'order' : 6,
'url' : 'http://download.icu-project.org/files/icu4c/55.1/icu4c-55_1-src.tgz',
'sha1': '3bb301c11be0e239c653e8aa2925c53f6f4dc88d',
'build' : {
'msvc*': {
'result': ['include/unicode/ucnv.h', 'include/unicode/ustring.h', ('lib/sicuin.lib', 'lib/sicuind.lib'), ('lib/sicudt.lib', 'lib/sicudtd.lib')],
'commands': [
'bash source/runConfigureICU %(icu_dbg)s Cygwin/MSVC --enable-static --disable-shared --disable-tests --disable-samples --prefix=%(cygdest)s',
'make', 'make install'
]
},
'mingw-w64-cross-win*': {
'result': ['include/unicode/ucnv.h', 'include/unicode/ustring.h', 'lib/libsicuin.a', 'lib/libsicuuc.a', 'lib/libsicudt.a'],
'commands': [
'cp -R source source.host',
'cd source.host; ./configure; make',
'source/configure --host=%(mingw_w64)s --enable-release --disable-debug --enable-static --disable-shared --disable-tests --disable-samples --prefix=%(destdir)s --with-cross-build=`pwd`/source.host',
'make install']
}
}
}
}

Expand Down Expand Up @@ -880,10 +889,18 @@ def check_msvc(config):
if not perl or 'perl5' not in perl:
error("perl does not seem to be installed.")

ruby = get_output('ruby', '--version')
if not ruby or 'ruby' not in ruby:
error("ruby does not seem to be installed.")

nsis = get_registry_value(r'SOFTWARE\NSIS')
if not nsis or not exists(os.path.join(nsis, 'makensis.exe')):
error("NSIS does not seem to be installed.")

cygwin = get_registry_value(r'SOFTWARE\Cygwin\setup', 'rootdir')
if not cygwin or not exists(os.path.join(cygwin, 'bin', 'bash.exe')):
error("Cygwin does not seem to be installed.")

def build_msvc(config, basedir):
msvc, arch = rchop(config, '-dbg').split('-')
vcdir = os.path.join(os.environ[MSVC_LOCATION[msvc]], '..', '..', 'VC')
Expand All @@ -905,13 +922,21 @@ def build_msvc(config, basedir):
os.environ.update(eval(stdout.strip()))

version, simple_version = get_version(basedir)
libdir = os.path.join(basedir, config, 'deplibs')
path = rchop(os.environ['PATH'], ';')

cygwin = get_registry_value(r'SOFTWARE\Cygwin\setup', 'rootdir')
cygdest = get_output(os.path.join(cygwin, 'bin', 'cygpath.exe'), '-ua', libdir)
cflags = config.endswith('-dbg') and '/MDd /Zi' or '/MD'
build_deplibs(config, basedir, cflags=cflags)
icu_dbg = config.endswith('-dbg') and '--enable-debug --disable-release' or ''
os.environ['PATH'] = r'%s;%s\bin' % (path, cygwin)
build_deplibs(config, basedir, cygwin=cygwin, cygdest=cygdest, cflags=cflags, icu_dbg=icu_dbg)

os.environ['PATH'] = r'%s;%s\..\qt\gnuwin32\bin' % (path, basedir)
os.environ['SQLITE3SRCDIR'] = r'%s\..\qt\qtbase\src\3rdparty\sqlite' % basedir
sha1, url = MSVC_RUNTIME[rchop(config, '-dbg')]
shutil.copy(download_file(url, sha1, basedir), os.path.join(basedir, config, 'vcredist.exe'))

libdir = os.path.join(basedir, config, 'deplibs')
qtdir = os.path.join(basedir, config, 'qt')
mkdir_p(qtdir)

Expand All @@ -920,7 +945,14 @@ def build_msvc(config, basedir):
'-L %s\\lib' % libdir,
'OPENSSL_LIBS="-L%s\\\\lib -lssleay32 -llibeay32 -lUser32 -lAdvapi32 -lGdi32 -lCrypt32"' % libdir.replace('\\', '\\\\'))

build_qt(qtdir, 'nmake', '%s\\..\\qt\\configure.exe %s' % (basedir, configure_args))
build_qtmodule(qtdir, 'qtbase', 'nmake',
r'%s\..\qt\qtbase\configure.bat %s' % (basedir, configure_args))
build_qtmodule(qtdir, 'qtsvg', 'nmake',
r'%s\qtbase\bin\qmake.exe %s\..\qt\qtsvg\qtsvg.pro' % (qtdir, basedir))
build_qtmodule(qtdir, 'qtxmlpatterns', 'nmake',
r'%s\qtbase\bin\qmake.exe %s\..\qt\qtxmlpatterns\qtxmlpatterns.pro' % (qtdir, basedir))
build_qtmodule(qtdir, 'qtwebkit', 'nmake',
r'%s\qtbase\bin\qmake.exe %s\..\qt\qtwebkit\WebKit.pro WEBKIT_CONFIG-=build_webkit2' % (qtdir, basedir))

appdir = os.path.join(basedir, config, 'app')
mkdir_p(appdir)
Expand All @@ -930,7 +962,7 @@ def build_msvc(config, basedir):

os.environ['WKHTMLTOX_VERSION'] = version

shell('%s\\bin\\qmake %s\\..\\wkhtmltopdf.pro' % (qtdir, basedir))
shell('%s\\qtbase\\bin\\qmake %s\\..\\wkhtmltopdf.pro' % (qtdir, basedir))
shell('nmake')

makensis = os.path.join(get_registry_value(r'SOFTWARE\NSIS'), 'makensis.exe')
Expand Down Expand Up @@ -1249,7 +1281,7 @@ def main():
final_config = config
if '-debug' in sys.argv[2:]:
final_config += '-dbg'
QT_CONFIG['common'].extend(['remove:-release', 'remove:-webkit', '-debug', '-webkit-debug'])
QT_CONFIG['common'].extend(['remove:-release', '-debug'])

if '-clean' in sys.argv[2:]:
rmdir(os.path.join(basedir, final_config))
Expand Down

0 comments on commit e5ed92a

Please sign in to comment.