1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-483: add Windows installer target to 'make release'

This commit is contained in:
Oleg Semyonov 2011-05-19 01:05:12 +03:00
parent 5b1e45a8df
commit 285c429589
9 changed files with 44 additions and 173 deletions

View File

@ -279,6 +279,7 @@ dependent targets.
TAG_OR_HASH8 = r.tag(r.hash(8, 'untagged')),
UNIXTIME = r.time(),
DATE = r.time('%Y%m%d'),
DATETIME = r.time('%Y%m%d %H:%M'),
BOARD_TYPE = args.type,
BOARD_REVISION = args.revision,
SHA1 = sha1(args.image),

View File

@ -13,7 +13,7 @@ ROOT_DIR := $(realpath $(WHEREAMI)/../)
# Set up some macros
BUILD_DIR := $(ROOT_DIR)/build
VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path=$(ROOT_DIR)
VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)"
RELEASE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8})
RELEASE_DIR := $(BUILD_DIR)/release-$(RELEASE_LBL)
FW_DIR := $(RELEASE_DIR)/firmware-$(RELEASE_LBL)

View File

@ -2,9 +2,23 @@
# Windows-specific packaging
#
NSIS_CMD := makensis.exe
NSIS_OPTS := /V3
NSIS_DIR := $(ROOT_DIR)/release/winx86
NSIS_SCRIPT := $(NSIS_DIR)/openpilotgcs.nsi
NSIS_TEMPLATE := $(NSIS_DIR)/openpilotgcs.tpl
NSIS_HEADER := $(BUILD_DIR)/ground/openpilotgcs/packaging/openpilotgcs.nsh
$(NSIS_HEADER): $(NSIS_TEMPLATE)
$(V0) @echo " PY $@"
$(V1) $(VERSION_CMD) --template="$<" --outfile="$@"
nsis: $(NSIS_HEADER) gcs
$(NSIS_CMD) $(NSIS_OPTS) $(NSIS_SCRIPT)
gcs: uavobjects
$(V1) $(MAKE) -C $(ROOT_DIR) GCS_BUILD_CONF=release $@
ground_package: | gcs
ground_package: | nsis
.PHONY: gcs ground_package
.PHONY: nsis gcs ground_package

View File

@ -1,86 +0,0 @@
@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

View File

@ -1,19 +0,0 @@
@echo off
rem
rem NSIS installer script file for OpenPilot GCS
rem The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2010-2011.
rem
rem This script requires Unicode NSIS 2.46 or higher:
rem http://www.scratchpaper.com/
rem
rem Set path to NSIS compiler
set NSIS=%ProgramFiles%/NSIS/Unicode
set NSISC=%NSIS%/makensis.exe
rem Input script file (in the same directory as this batch file)
for %%D in (%0) do set NSI=%%~dD%%~pD\openpilotgcs.nsi
rem Build installer
echo Generating Windows installer...
"%NSISC%" /V3 %NSI%

View File

@ -1,11 +0,0 @@
#
# git not found, default values used instead.
#
; Installer file name
!define OUT_FILE "OpenPilotGCS-unreleased-install.exe"
; Installer version info
!define PRODUCT_VERSION "0.0.0.0"
!define FILE_VERSION "0.0.0.0"
!define BUILD_DESCRIPTION "Unreleased version."

View File

@ -34,8 +34,8 @@
; Tree root locations (relative to this script location)
!define NSIS_DATA_TREE "."
!define GCS_BUILD_TREE "..\..\..\..\build\ground\openpilotgcs"
!define WINX86_PATH "packaging\winx86"
!define GCS_BUILD_TREE "..\..\build\ground\openpilotgcs"
!define GCS_PKG_TREE "${GCS_BUILD_TREE}\packaging"
; Default installation folder
InstallDir "$LOCALAPPDATA\OpenPilot"
@ -55,10 +55,10 @@
; !define PRODUCT_VERSION "0.0.0.0"
; !define FILE_VERSION "0.0.0.0"
; !define BUILD_DESCRIPTION "Unknown revision."
!include "${GCS_BUILD_TREE}\${WINX86_PATH}\openpilotgcs.nsh"
!include "${GCS_PKG_TREE}\openpilotgcs.nsh"
Name "${PRODUCT_NAME}"
OutFile "${GCS_BUILD_TREE}\${WINX86_PATH}\${OUT_FILE}"
OutFile "${RELEASE_DIR}\${OUT_FILE}"
VIProductVersion ${PRODUCT_VERSION}
VIAddVersionKey "ProductName" "${INSTALLER_NAME}"

View File

@ -0,0 +1,22 @@
#
# *****************************************************************************
#
# @file ${OUTFILENAME}
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
# @brief Autogenerated NSIS header file, built using template
# ${TEMPLATE}
#
# @see The GNU Public License (GPL) Version 3
#
# *****************************************************************************
#
; Some names, paths and constants
!define RELEASE_LBL "${DATE}-${TAG_OR_HASH8}"
!define RELEASE_DIR "..\..\build\release-$${RELEASE_LBL}"
!define OUT_FILE "OpenPilotGCS-$${RELEASE_LBL}-install.exe"
; Installer version info
!define PRODUCT_VERSION "0.0.0.0"
!define FILE_VERSION "${TAG_OR_BRANCH}:${HASH8} ${DATETIME}"
!define BUILD_DESCRIPTION "${TAG_OR_BRANCH}:${HASH8} built using ${ORIGIN} as origin, committed ${DATETIME} as ${HASH}"

View File

@ -1,50 +0,0 @@
include(../../openpilotgcs.pri)
TEMPLATE = subdirs
# Some Windows packaging magic (for release build only)
equals(copydata, 1):win32:CONFIG(release, debug|release) {
# We need this Windows macro since building under Unix-like shell the top level
# targetPath macro will use forward slashes which don't work for such Windows
# commands like pushd, etc. But note that we still use targetPath for $(COPY_FILE)
# parameters because this command is different under native Windows and Unix-like
# build environments.
defineReplace(winTargetPath) {
return($$replace(1, /, \\))
}
# Some file locations
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
force.target = FORCE
QMAKE_EXTRA_TARGETS += force
# Create installer build target - this WILL NOT run during build, run it by hand
message("Run \"make gcs_installer\" in $$GCS_BUILD_TREE/$$WINX86_PATH to build Windows installer (Unicode NSIS 2.46+ required)")
nsis.target = gcs_installer
nsis.depends = git
nsis.commands += @$$winTargetPath($$GCS_SOURCE_TREE/$$WINX86_PATH/$$INSTALLER_MAKER)
QMAKE_EXTRA_TARGETS += nsis
}