Sfoglia il codice sorgente

get the version from separate file

Ashish Kulkarni 11 anni fa
parent
commit
feae35883f
8 ha cambiato i file con 15 aggiunte e 20 eliminazioni
  1. 1 0
      VERSION
  2. 3 6
      build_linux.sh
  3. 1 5
      build_msvc.cmd
  4. 10 0
      common.pri
  5. 0 1
      src/image/image.pro
  6. 0 1
      src/lib/lib.pro
  7. 0 1
      src/pdf/pdf.pro
  8. 0 6
      version.pri

+ 1 - 0
VERSION

@@ -0,0 +1 @@
+0.12.0

+ 3 - 6
build_linux.sh

@@ -87,8 +87,8 @@ if [ ! -f \$DST/qt/bin/qmake ]; then
 fi
 cd \$BLD/app
 cp \$BLD/qt/.qmake.cache .
-\$DST/qt/bin/qmake \$SRC/wkhtmltopdf.pro
-GIT_DIR=\$SRC/.git make -j${J} -q || exit 1
+GIT_DIR=\$SRC/.git \$DST/qt/bin/qmake \$SRC/wkhtmltopdf.pro
+make -j${J} || exit 1
 strip bin/wkhtmltopdf bin/wkhtmltoimage
 rm -fR \$DST/wkhtmltox
 mkdir -p \$DST/wkhtmltox \$DST/wkhtmltox/bin \$DST/wkhtmltox/lib \$DST/wkhtmltox/include/wkhtmltox
@@ -102,10 +102,7 @@ EOF
 
 function package_build() {
 	cd ${BUILD}
-	head -3 ${BASE}/version.pri > version.sh
-	. ${BUILD}/version.sh
-	rm -f . ${BUILD}/version.sh
-	RELEASE_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-`git --git-dir=$BASE/.git rev-parse --short HEAD`
+	RELEASE_VERSION=`cat $BASE/VERSION`-`git --git-dir=$BASE/.git rev-parse --short HEAD`
 	cd ${BUILD}/linux-$1/dist
 	tar -c -v --xz -f ${BUILD}/wkhtmltox-linux-$1_${RELEASE_VERSION}.tar.xz wkhtmltox/
 }

+ 1 - 5
build_msvc.cmd

@@ -134,15 +134,11 @@ copy  %~dp0include\wkhtmltox\dllend.inc   dist\include\wkhtmltox
 copy  %~dp0include\wkhtmltox\pdf.h        dist\include\wkhtmltox
 copy  %~dp0include\wkhtmltox\image.h      dist\include\wkhtmltox
 
-set MAJOR_VERSION=
-set MINOR_VERSION=
-set PATCH_VERSION=
 set WK_VERSION=
 set WK_HASH=
 
 cd /d %~dp0
-FOR /F %%v IN (version.pri) DO SET %%v
-set WK_VERSION=%MAJOR_VERSION%.%MINOR_VERSION%.%PATCH_VERSION%
+FOR /F "delims=" %%v IN ('type VERSION')               DO set WK_VERSION=%%v
 FOR /F "delims=" %%h IN ('git rev-parse --short HEAD') DO set WK_HASH=%%h
 
 if exist "%ProgramFiles%\NSIS\makensis.exe" goto build_installer

+ 10 - 0
common.pri

@@ -46,3 +46,13 @@ win32 {
 }
 
 QT += webkit network svg
+
+# version related information
+VERSION_TEXT=$$cat($$PWD/VERSION)
+FULL_VERSION=$$split(VERSION_TEXT, ".")
+MAJOR_VERSION=$$member(FULL_VERSION, 0)
+MINOR_VERSION=$$member(FULL_VERSION, 1)
+PATCH_VERSION=$$member(FULL_VERSION, 2)
+BUILD=$$system(git rev-parse HEAD)
+
+DEFINES += MAJOR_VERSION=$$MAJOR_VERSION MINOR_VERSION=$$MINOR_VERSION PATCH_VERSION=$$PATCH_VERSION BUILD=$$BUILD

+ 0 - 1
src/image/image.pro

@@ -15,7 +15,6 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with wkhtmltopdf.  If not, see <http:#www.gnu.org/licenses/>.
 
-include(../../version.pri)
 include(../../common.pri)
 
 TEMPLATE = app

+ 0 - 1
src/lib/lib.pro

@@ -18,7 +18,6 @@
 TEMPLATE = lib
 CONFIG += dll
 
-include(../../version.pri)
 include(../../common.pri)
 include(lib.pri)
 

+ 0 - 1
src/pdf/pdf.pro

@@ -15,7 +15,6 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with wkhtmltopdf.  If not, see <http:#www.gnu.org/licenses/>.
 
-include(../../version.pri)
 include(../../common.pri)
 
 TEMPLATE = app

+ 0 - 6
version.pri

@@ -1,6 +0,0 @@
-MAJOR_VERSION=0
-MINOR_VERSION=12
-PATCH_VERSION=0
-BUILD=$$system(git rev-parse HEAD)
-
-DEFINES += MAJOR_VERSION=$$MAJOR_VERSION MINOR_VERSION=$$MINOR_VERSION PATCH_VERSION=$$PATCH_VERSION BUILD=$$BUILD