Преглед изворни кода

use the version passed from the build script in the qmake configuration

If it is not available, we fallback to reading the VERSION file.
Ashish Kulkarni пре 11 година
родитељ
комит
e8880cb6d7
2 измењених фајлова са 9 додато и 5 уклоњено
  1. 2 2
      common.pri
  2. 7 3
      scripts/build.py

+ 2 - 2
common.pri

@@ -43,7 +43,8 @@ win32-g++*: QMAKE_LFLAGS += -static-libgcc -static-libstdc++
 QT += webkit network xmlpatterns svg
 QT += webkit network xmlpatterns svg
 
 
 # version related information
 # version related information
-VERSION_TEXT=$$cat($$PWD/VERSION)
+VERSION_TEXT=$$(WKHTMLTOX_VERSION)
+isEmpty(VERSION_TEXT): $$cat($$PWD/VERSION)
 VERSION_LIST=$$split(VERSION_TEXT, "-")
 VERSION_LIST=$$split(VERSION_TEXT, "-")
 count(VERSION_LIST, 1) {
 count(VERSION_LIST, 1) {
     VERSION=$$VERSION_TEXT
     VERSION=$$VERSION_TEXT
@@ -51,7 +52,6 @@ count(VERSION_LIST, 1) {
 } else {
 } else {
     VERSION=$$member(VERSION_LIST, 0)
     VERSION=$$member(VERSION_LIST, 0)
     BUILD=$$member(VERSION_LIST, 1)
     BUILD=$$member(VERSION_LIST, 1)
-    system(git rev-parse HEAD):BUILD=$$system(git rev-parse HEAD)
     FULL_VERSION=$$VERSION-$$BUILD
     FULL_VERSION=$$VERSION-$$BUILD
 }
 }
 
 

+ 7 - 3
scripts/build.py

@@ -346,6 +346,7 @@ def build_msvc_winsdk71(config, basedir, clean, debug):
     if clean:
     if clean:
         rmdir(os.path.join(basedir, config))
         rmdir(os.path.join(basedir, config))
 
 
+    version, simple_version = get_version(basedir)
     ssl_libs = build_openssl(config, basedir)
     ssl_libs = build_openssl(config, basedir)
 
 
     ssldir = os.path.join(basedir, config, 'openssl')
     ssldir = os.path.join(basedir, config, 'openssl')
@@ -372,6 +373,8 @@ def build_msvc_winsdk71(config, basedir, clean, debug):
     rmdir('bin')
     rmdir('bin')
     mkdir_p('bin')
     mkdir_p('bin')
 
 
+    os.environ['WKHTMLTOX_VERSION'] = version
+
     shell('%s\\bin\\qmake %s\\..\\wkhtmltopdf.pro' % (qtdir, basedir))
     shell('%s\\bin\\qmake %s\\..\\wkhtmltopdf.pro' % (qtdir, basedir))
     shell('nmake')
     shell('nmake')
 
 
@@ -381,7 +384,6 @@ def build_msvc_winsdk71(config, basedir, clean, debug):
             continue
             continue
         found = True
         found = True
 
 
-        version, simple_version = get_version(basedir)
         makensis = os.path.join(os.environ[pfile], 'NSIS', 'makensis.exe')
         makensis = os.path.join(os.environ[pfile], 'NSIS', 'makensis.exe')
         os.chdir(os.path.join(basedir, '..'))
         os.chdir(os.path.join(basedir, '..'))
         shell('"%s" /DVERSION=%s /DSIMPLE_VERSION=%s /DTARGET=%s wkhtmltox.nsi' % \
         shell('"%s" /DVERSION=%s /DSIMPLE_VERSION=%s /DTARGET=%s wkhtmltox.nsi' % \
@@ -404,6 +406,7 @@ def build_mingw64_cross(config, basedir, clean):
     if clean:
     if clean:
         rmdir(os.path.join(basedir, config))
         rmdir(os.path.join(basedir, config))
 
 
+    version, simple_version = get_version(basedir)
     ssl_libs = build_openssl(config, basedir)
     ssl_libs = build_openssl(config, basedir)
 
 
     ssldir = os.path.join(basedir, config, 'openssl')
     ssldir = os.path.join(basedir, config, 'openssl')
@@ -436,12 +439,12 @@ def build_mingw64_cross(config, basedir, clean):
 
 
     # set up cross compiling prefix correctly (isn't set by make install)
     # set up cross compiling prefix correctly (isn't set by make install)
     os.environ['QTDIR'] = qtdir
     os.environ['QTDIR'] = qtdir
+    os.environ['WKHTMLTOX_VERSION'] = version
     shell('%s/bin/qmake -set CROSS_COMPILE %s-' % (qtdir, MINGW_W64_PREFIX[config]))
     shell('%s/bin/qmake -set CROSS_COMPILE %s-' % (qtdir, MINGW_W64_PREFIX[config]))
     shell('%s/bin/qmake -spec win32-g++-4.6 %s/../wkhtmltopdf.pro' % (qtdir, basedir))
     shell('%s/bin/qmake -spec win32-g++-4.6 %s/../wkhtmltopdf.pro' % (qtdir, basedir))
     shell('make')
     shell('make')
     shutil.copy('bin/libwkhtmltox0.a', 'bin/wkhtmltox.lib')
     shutil.copy('bin/libwkhtmltox0.a', 'bin/wkhtmltox.lib')
 
 
-    version, simple_version = get_version(basedir)
     os.chdir(os.path.join(basedir, '..'))
     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 wkhtmltox.nsi' % \
             (version, simple_version, config))
             (version, simple_version, config))
@@ -489,7 +492,8 @@ def build_linux_schroot(config, basedir, clean):
     lines.append('make install || exit 1')
     lines.append('make install || exit 1')
     lines.append('cd ../app')
     lines.append('cd ../app')
     lines.append('rm -f bin/*')
     lines.append('rm -f bin/*')
-    lines.append('GIT_DIR=../../../.git ../qt/bin/qmake ../../../wkhtmltopdf.pro')
+    lines.append('export WKHTMLTOX_VERSION=%s' % version)
+    lines.append('../qt/bin/qmake ../../../wkhtmltopdf.pro')
     lines.append('make -j%d || exit 1' % CPU_COUNT)
     lines.append('make -j%d || exit 1' % CPU_COUNT)
     lines.append('strip bin/wkhtmltopdf bin/wkhtmltoimage')
     lines.append('strip bin/wkhtmltopdf bin/wkhtmltoimage')
     lines.append('cp bin/wkhtmlto* ../wkhtmltox-%s/bin' % version)
     lines.append('cp bin/wkhtmlto* ../wkhtmltox-%s/bin' % version)