mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Change version info scripts to use git instead of SubWCRev svn utility
This commit is contained in:
parent
f0bfffda09
commit
af8e7c38f8
86
ground/openpilotgcs/packaging/winx86/make_header.cmd
Normal file
86
ground/openpilotgcs/packaging/winx86/make_header.cmd
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
@echo off
|
||||||
|
rem
|
||||||
|
rem make_header - a workaround to build NSIS version info header from
|
||||||
|
rem Makefile using different environments (Windows cmd or Unix-like sh)
|
||||||
|
rem still being more or less portable.
|
||||||
|
rem
|
||||||
|
rem This script tries to find any git command line utility on the system.
|
||||||
|
rem First, it looks at the predefined location of git.exe installed by
|
||||||
|
rem msysgit package available at http://code.google.com/p/msysgit/
|
||||||
|
rem If not found, it searches for git executables in the system PATH.
|
||||||
|
rem If also not found, then it gives up and no commit info will be available.
|
||||||
|
rem
|
||||||
|
rem Expected parameters:
|
||||||
|
rem %1: repository source path
|
||||||
|
rem %2: header file full path and name
|
||||||
|
rem
|
||||||
|
|
||||||
|
rem FIXME: we should have product version info somewhere else
|
||||||
|
set OUT_FILE=OpenPilotGCS-%%%%ad-%%%%h-install.exe
|
||||||
|
set PRODUCT_VERSION=0.0.0.0
|
||||||
|
set FILE_VERSION=%%%%ad %%BRANCH%%:%%%%h
|
||||||
|
set BUILD_DESCRIPTION=Built using %%ORIGIN%% as origin, branch %%BRANCH%%, commit %%%%H, committed %%%%ci
|
||||||
|
|
||||||
|
set REPO=%1
|
||||||
|
set HEADER=%2
|
||||||
|
if "%REPO%" == "" goto NoRepo
|
||||||
|
if "%HEADER%" == "" goto NoHeader
|
||||||
|
goto OK
|
||||||
|
|
||||||
|
:NoRepo
|
||||||
|
:NoHeader
|
||||||
|
echo This script should be called from Makefile only
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:Ok
|
||||||
|
rem Looking for git command line utility at the predefined msysgit location
|
||||||
|
rem first, and in the PATH last. Also note that we use call command which is
|
||||||
|
rem required if we execute a .cmd or .bat file instead of .exe
|
||||||
|
|
||||||
|
set GIT=%ProgramFiles%\Git\bin\git.exe
|
||||||
|
if exist "%GIT%" goto Found
|
||||||
|
|
||||||
|
for %%G in (git.exe) do set GIT=%%~$PATH:G
|
||||||
|
if exist "%GIT%" goto Found
|
||||||
|
|
||||||
|
for %%G in (git.cmd) do set GIT=%%~$PATH:G
|
||||||
|
if exist "%GIT%" goto Found
|
||||||
|
|
||||||
|
for %%G in (git.bat) do set GIT=%%~$PATH:G
|
||||||
|
if exist "%GIT%" goto Found
|
||||||
|
|
||||||
|
:NotFound
|
||||||
|
echo git not found, no version info available
|
||||||
|
goto :eof
|
||||||
|
|
||||||
|
:Found
|
||||||
|
echo Using "%GIT%" to extract version info from "%REPO%"...
|
||||||
|
|
||||||
|
rem Getting remote origin name
|
||||||
|
for /F "usebackq tokens=1-3" %%G in (`call "%GIT%" remote -v`) do (
|
||||||
|
if "%%G" == "origin" if "%%I" == "(fetch)" set ORIGIN=%%H
|
||||||
|
)
|
||||||
|
|
||||||
|
rem Getting branch name
|
||||||
|
for /F "usebackq tokens=1,2" %%G in (`call "%GIT%" branch --no-color`) do (
|
||||||
|
if "%%G" == "*" set BRANCH=%%H
|
||||||
|
)
|
||||||
|
|
||||||
|
rem Getting commit info
|
||||||
|
set OPTS=-1 --no-color --date=short
|
||||||
|
set OPTS=%OPTS% "--format=format:
|
||||||
|
set OPTS=%OPTS%;%%%%n
|
||||||
|
set OPTS=%OPTS%; AUTOGENERATED HEADER FILE%%%%n
|
||||||
|
set OPTS=%OPTS%;%%%%n
|
||||||
|
set OPTS=%OPTS%%%%%n
|
||||||
|
set OPTS=%OPTS%; Installer file name%%%%n
|
||||||
|
set OPTS=%OPTS%!define OUT_FILE \"%OUT_FILE%\"%%%%n
|
||||||
|
set OPTS=%OPTS%%%%%n
|
||||||
|
set OPTS=%OPTS%; Installer version info%%%%n
|
||||||
|
set OPTS=%OPTS%!define PRODUCT_VERSION \"%PRODUCT_VERSION%\"%%%%n
|
||||||
|
set OPTS=%OPTS%!define FILE_VERSION \"%FILE_VERSION%\"%%%%n
|
||||||
|
set OPTS=%OPTS%!define BUILD_DESCRIPTION \"%BUILD_DESCRIPTION%\"%%%%n"
|
||||||
|
|
||||||
|
pushd "%REPO%"
|
||||||
|
call "%GIT%" log %OPTS% >%HEADER%
|
||||||
|
popd
|
@ -1,16 +1,11 @@
|
|||||||
@echo off
|
@echo off
|
||||||
rem
|
rem
|
||||||
rem Project: OpenPilot
|
|
||||||
rem NSIS installer script file for OpenPilot GCS
|
rem NSIS installer script file for OpenPilot GCS
|
||||||
rem The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2010-2011.
|
rem The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2010-2011.
|
||||||
rem
|
rem
|
||||||
rem This script requires Unicode NSIS 2.46 or higher:
|
rem This script requires Unicode NSIS 2.46 or higher:
|
||||||
rem http://www.scratchpaper.com/
|
rem http://www.scratchpaper.com/
|
||||||
rem
|
rem
|
||||||
rem Optional SVN utility to get currently used SVN revision is SubWCRev.exe,
|
|
||||||
rem it is a part of TortoiseSVN package or is available separately:
|
|
||||||
rem http://sourceforge.net/projects/tortoisesvn/files/Tools/1.6.7/SubWCRev-1.6.7.18415.msi/download
|
|
||||||
rem
|
|
||||||
|
|
||||||
rem Set path to NSIS compiler
|
rem Set path to NSIS compiler
|
||||||
set NSIS=%ProgramFiles%/NSIS/Unicode
|
set NSIS=%ProgramFiles%/NSIS/Unicode
|
@ -1,11 +1,11 @@
|
|||||||
#
|
#
|
||||||
# SubWCRev not found, default values used instead.
|
# git not found, default values used instead.
|
||||||
#
|
#
|
||||||
|
|
||||||
; Installer file name
|
; Installer file name
|
||||||
!define OUT_FILE "OpenPilotGCS-XXXX-install.exe"
|
!define OUT_FILE "OpenPilotGCS-unreleased-install.exe"
|
||||||
|
|
||||||
; Installer version info
|
; Installer version info
|
||||||
!define PRODUCT_VERSION "0.0.0.0"
|
!define PRODUCT_VERSION "0.0.0.0"
|
||||||
!define FILE_VERSION "0.0.0.0"
|
!define FILE_VERSION "0.0.0.0"
|
||||||
!define BUILD_DESCRIPTION "Unknown revision."
|
!define BUILD_DESCRIPTION "Unreleased version."
|
||||||
|
@ -20,16 +20,9 @@
|
|||||||
|
|
||||||
# This script requires Unicode NSIS 2.46 or higher:
|
# This script requires Unicode NSIS 2.46 or higher:
|
||||||
# http://www.scratchpaper.com/
|
# http://www.scratchpaper.com/
|
||||||
#
|
|
||||||
# Optionally used SubWCRev utility to extract SVN info from working copy.
|
|
||||||
# SubWCRev is a part of TortoiseSVN client distribution:
|
|
||||||
# http://tortoisesvn.net/
|
|
||||||
# SubWCRev is also available separately:
|
|
||||||
# http://sourceforge.net/projects/tortoisesvn/files/Tools/1.6.7/SubWCRev-1.6.7.18415.msi/download
|
|
||||||
|
|
||||||
# Features:
|
# Features:
|
||||||
# - Installs to the user local appdata path, no admin rights required.
|
# - Installs to the user local appdata path, no admin rights required.
|
||||||
# - Multilingual, needs translations for custom installer strings.
|
|
||||||
#
|
#
|
||||||
# TODO:
|
# TODO:
|
||||||
# - optionally install for all users (to Program Files with admin rights on Vista/7).
|
# - optionally install for all users (to Program Files with admin rights on Vista/7).
|
||||||
@ -69,7 +62,7 @@
|
|||||||
|
|
||||||
VIProductVersion ${PRODUCT_VERSION}
|
VIProductVersion ${PRODUCT_VERSION}
|
||||||
VIAddVersionKey "ProductName" "${INSTALLER_NAME}"
|
VIAddVersionKey "ProductName" "${INSTALLER_NAME}"
|
||||||
VIAddVersionKey "FileVersion" ${FILE_VERSION}
|
VIAddVersionKey "FileVersion" "${FILE_VERSION}"
|
||||||
VIAddVersionKey "Comments" "${INSTALLER_NAME}. ${BUILD_DESCRIPTION}"
|
VIAddVersionKey "Comments" "${INSTALLER_NAME}. ${BUILD_DESCRIPTION}"
|
||||||
VIAddVersionKey "CompanyName" "The OpenPilot Team, http://www.openpilot.org"
|
VIAddVersionKey "CompanyName" "The OpenPilot Team, http://www.openpilot.org"
|
||||||
VIAddVersionKey "LegalTrademarks" "${PRODUCT_NAME} is a trademark of The OpenPilot Team"
|
VIAddVersionKey "LegalTrademarks" "${PRODUCT_NAME} is a trademark of The OpenPilot Team"
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#
|
|
||||||
# SubWCRev autogenerated file, do not modify.
|
|
||||||
# Generated using nsis.tpl template.
|
|
||||||
#
|
|
||||||
|
|
||||||
; Installer file name
|
|
||||||
!define OUT_FILE "OpenPilotGCS-$WCREV$-install.exe"
|
|
||||||
|
|
||||||
; Installer version info
|
|
||||||
!define PRODUCT_VERSION "0.0.0.$WCREV$"
|
|
||||||
!define FILE_VERSION "0.0.0.$WCREV$"
|
|
||||||
!define BUILD_DESCRIPTION "Last committed revision $WCREV$ ($WCDATE$) using$WCMIXED? mixed:$ SVN revision range $WCRANGE$$WCMODS? (locally modified):$. Built from $WCURL$ ($WCNOW$)."
|
|
@ -1,37 +0,0 @@
|
|||||||
#
|
|
||||||
# SubWCRev not found, default values used instead.
|
|
||||||
# Generated using svninfo.tpl template.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Highest committed revision number
|
|
||||||
WCREV = NA
|
|
||||||
|
|
||||||
# Date of highest committed revision
|
|
||||||
WCDATE = NA
|
|
||||||
|
|
||||||
# Mixed update revision state and revision range
|
|
||||||
WCMIXED = 0
|
|
||||||
WCMIXED_TXT = NA
|
|
||||||
WCRANGE = NA
|
|
||||||
|
|
||||||
# Repository URL of the working copy
|
|
||||||
WCURL = NA
|
|
||||||
|
|
||||||
# Current system date & time
|
|
||||||
WCNOW = NA
|
|
||||||
|
|
||||||
# Lock status, date, owner, and comment for this item
|
|
||||||
WCISLOCKED = 0
|
|
||||||
WCLOCKDATE = NA
|
|
||||||
WCLOCKOWNER = NA
|
|
||||||
WCLOCKCOMMENT = NA
|
|
||||||
|
|
||||||
# True if local modifications found
|
|
||||||
WCMODS = 0
|
|
||||||
WCMODS_TXT = NA
|
|
||||||
|
|
||||||
# True if the item is versioned
|
|
||||||
WCINSVN = 0
|
|
||||||
|
|
||||||
# True if the svn:needs-lock property is set
|
|
||||||
WCNEEDSLOCK = 0
|
|
@ -1,37 +0,0 @@
|
|||||||
#
|
|
||||||
# SubWCRev autogenerated file, do not modify.
|
|
||||||
# Generated using svninfo.tpl template.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Highest committed revision number
|
|
||||||
WCREV = $WCREV$
|
|
||||||
|
|
||||||
# Date of highest committed revision
|
|
||||||
WCDATE = $WCDATE=%Y/%m/%d %H:%M:%S$
|
|
||||||
|
|
||||||
# Mixed update revision state and revision range
|
|
||||||
WCMIXED = $WCMIXED?1:0$
|
|
||||||
WCMIXED_TXT = $WCMIXED?(mixed):$
|
|
||||||
WCRANGE = $WCRANGE$
|
|
||||||
|
|
||||||
# Repository URL of the working copy
|
|
||||||
WCURL = $WCURL$
|
|
||||||
|
|
||||||
# Current system date & time
|
|
||||||
WCNOW = $WCNOW=%Y/%m/%d %H:%M:%S$
|
|
||||||
|
|
||||||
# Lock status, date, owner, and comment for this item
|
|
||||||
WCISLOCKED = $WCISLOCKED?1:0$
|
|
||||||
WCLOCKDATE = $WCLOCKDATE=%Y/%m/%d %H:%M:%S$
|
|
||||||
WCLOCKOWNER = $WCLOCKOWNER$
|
|
||||||
WCLOCKCOMMENT = $WCLOCKCOMMENT$
|
|
||||||
|
|
||||||
# True if local modifications found
|
|
||||||
WCMODS = $WCMODS?1:0$
|
|
||||||
WCMODS_TXT = $WCMODS?(modified):$
|
|
||||||
|
|
||||||
# True if the item is versioned
|
|
||||||
WCINSVN = $WCINSVN?1:0$
|
|
||||||
|
|
||||||
# True if the svn:needs-lock property is set
|
|
||||||
WCNEEDSLOCK = $WCNEEDSLOCK?1:0$
|
|
@ -5,67 +5,46 @@ TEMPLATE = subdirs
|
|||||||
# Some Windows packaging magic (for release build only)
|
# Some Windows packaging magic (for release build only)
|
||||||
equals(copydata, 1):win32:CONFIG(release, debug|release) {
|
equals(copydata, 1):win32:CONFIG(release, debug|release) {
|
||||||
|
|
||||||
WINX86_PATH = packaging/winx86
|
# We need this Windows macro since building under Unix-like shell the top level
|
||||||
SVN_INFO_TEMPLATE = svninfo.tpl
|
# targetPath macro will use forward slashes which don't work for such Windows
|
||||||
SVN_INFO_MAKEFILE = svninfo.mk
|
# commands like pushd, etc. But note that we still use targetPath for $(COPY_FILE)
|
||||||
NSIS_TEMPLATE = openpilotgcs.tpl
|
# parameters because this command is different under native Windows and Unix-like
|
||||||
NSIS_HEADER = openpilotgcs.nsh
|
# build environments.
|
||||||
|
defineReplace(winTargetPath) {
|
||||||
# Check for SubWCRev.exe executable required to get some useful SVN repository info.
|
return($$replace(1, /, \\))
|
||||||
# For example, currently checked out SVN revision (highest for the working copy).
|
|
||||||
# SubWCRev is a part of TortoiseSVN client distribution:
|
|
||||||
# http://tortoisesvn.net/
|
|
||||||
# SubWCRev is also available separately:
|
|
||||||
# http://sourceforge.net/projects/tortoisesvn/files/Tools/1.6.7/SubWCRev-1.6.7.18415.msi/download
|
|
||||||
|
|
||||||
# Default location is TortoiseSVN bin folder.
|
|
||||||
# FIXME: it should try to find in the PATH first, and use hardcoded reference last
|
|
||||||
SUBWCREV_EXE = $$targetPath(\"$$(ProgramFiles)/TortoiseSVN/bin/SubWCRev.exe\")
|
|
||||||
|
|
||||||
exists($$SUBWCREV_EXE) {
|
|
||||||
message("SubWCRev found: $${SUBWCREV_EXE}")
|
|
||||||
svninfo.commands += @echo Copying stubs... $$addNewline()
|
|
||||||
svninfo.commands += $(COPY_FILE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE)
|
|
||||||
svninfo.commands += $$addNewline()
|
|
||||||
svninfo.commands += $(COPY_FILE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
|
||||||
svninfo.commands += $$addNewline()
|
|
||||||
svninfo.commands += @echo Executing $${SUBWCREV_EXE} $$SVN_INFO_TEMPLATE $$SVN_INFO_MAKEFILE $$addNewline()
|
|
||||||
svninfo.commands += -@$$SUBWCREV_EXE $$targetPath($$GCS_SOURCE_TREE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$SVN_INFO_TEMPLATE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE)
|
|
||||||
svninfo.commands += $$addNewline()
|
|
||||||
svninfo.commands += @echo Executing $${SUBWCREV_EXE} $$NSIS_TEMPLATE $$NSIS_HEADER $$addNewline()
|
|
||||||
svninfo.commands += -@$$SUBWCREV_EXE $$targetPath($$GCS_SOURCE_TREE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_TEMPLATE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
|
||||||
svninfo.commands += $$addNewline()
|
|
||||||
} else {
|
|
||||||
message("SubWCRev not found, SVN info is not available")
|
|
||||||
svninfo.commands += $(COPY_FILE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$SVN_INFO_MAKEFILE)
|
|
||||||
svninfo.commands += $$addNewline()
|
|
||||||
svninfo.commands += $(COPY_FILE)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
|
||||||
svninfo.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
|
||||||
svninfo.commands += $$addNewline()
|
|
||||||
}
|
}
|
||||||
svninfo.target = svninfo.dummy
|
|
||||||
QMAKE_EXTRA_TARGETS += svninfo
|
# Some file locations
|
||||||
force.depends += svninfo
|
WINX86_PATH = packaging/winx86
|
||||||
|
NSIS_HEADER = openpilotgcs.nsh
|
||||||
|
HEADER_MAKER = make_header.cmd
|
||||||
|
INSTALLER_MAKER = make_installer.cmd
|
||||||
|
|
||||||
|
# copy defaults first (will be used if no git available)
|
||||||
|
git.commands += @echo Copying default version info... $$addNewline()
|
||||||
|
git.commands += $(COPY_FILE)
|
||||||
|
git.commands += $$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
||||||
|
git.commands += $$targetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
||||||
|
git.commands += $$addNewline()
|
||||||
|
|
||||||
|
# extract repository info if command line git is available
|
||||||
|
git.commands += $$winTargetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$HEADER_MAKER)
|
||||||
|
git.commands += $$winTargetPath($$GCS_SOURCE_TREE)
|
||||||
|
git.commands += $$winTargetPath($$GCS_BUILD_TREE/$$WINX86_PATH/$$NSIS_HEADER)
|
||||||
|
git.commands += $$addNewline()
|
||||||
|
|
||||||
|
git.target = git.dummy
|
||||||
|
QMAKE_EXTRA_TARGETS += git
|
||||||
|
force.depends += git
|
||||||
|
|
||||||
# Redefine FORCE target to collect data every time
|
# Redefine FORCE target to collect data every time
|
||||||
force.target = FORCE
|
force.target = FORCE
|
||||||
QMAKE_EXTRA_TARGETS += force
|
QMAKE_EXTRA_TARGETS += force
|
||||||
|
|
||||||
# Create installer build target - this WILL NOT run during build, run it by hand
|
# Create installer build target - this WILL NOT run during build, run it by hand
|
||||||
message("Run \"make installer\" in $$GCS_BUILD_TREE/$$WINX86_PATH to build Windows installer (Unicode NSIS 2.46+ required)")
|
message("Run \"make gcs_installer\" in $$GCS_BUILD_TREE/$$WINX86_PATH to build Windows installer (Unicode NSIS 2.46+ required)")
|
||||||
nsis.target = installer
|
nsis.target = gcs_installer
|
||||||
nsis.depends = svninfo
|
nsis.depends = git
|
||||||
nsis.commands += @$$targetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/Makefile.cmd)
|
nsis.commands += @$$winTargetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$INSTALLER_MAKER)
|
||||||
QMAKE_EXTRA_TARGETS += nsis
|
QMAKE_EXTRA_TARGETS += nsis
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user