Commit 154f6c85 authored by Eike Ziller's avatar Eike Ziller

Add installer target.

Requires Qt Installer Framwork (IFW)

Change-Id: Id78c05f86cc104d29d4ed3ba02baefa20d49fe4f
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 14a2ff59
<?xml version="1.0"?>
<Installer>
<Name>Qt Creator</Name>
<Version>{version}</Version>
<Title>Qt Creator</Title>
<MaintenanceTitle>Qt Creator Maintenance</MaintenanceTitle>
<Publisher>Qt Project</Publisher>
<ProductUrl>http://qt-project.org</ProductUrl>
<Icon>logo.png</Icon>
<Watermark>watermark.png</Watermark>
<UninstallerName>QtCreatorUninstaller</UninstallerName>
<!-- @homeDir@ and @rootDir@ are some of the supported vars -->
<TargetDir>@homeDir@/QtCreator</TargetDir>
<AdminTargetDir>/opt/QtCreator</AdminTargetDir>
<Pages>
<Page name="LicenseAgreementPage">
<AcceptLicenseLabel>I have read and understood the terms contained in the above license agreements.</AcceptLicenseLabel>
<RejectLicenseLabel>I do not accept the terms contained in the above license agreements.</RejectLicenseLabel>
</Page>
</Pages>
</Installer>
/* This file is part of the Qt SDK
Copyright (c) 2008-2012 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
Contact: Nokia Corporation (qt-info@nokia.com)
GNU Lesser General Public License Usage
This file may be used under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation and
appearing in the file LICENSE.LGPL included in the packaging of this file.
Please review the following information to ensure the GNU Lesser General
Public License version 2.1 requirements will be met:
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
If you have questions regarding the use of this file, please contact Nokia
at qt-info@nokia.com.
*/
// constructor
function Component()
{
installer.finishButtonClicked.connect(this, Component.prototype.installationFinished);
}
Component.prototype.beginInstallation = function()
{
if ( installer.value("os") === "win" ) {
component.setStopProcessForUpdateRequest("@TargetDir@/bin/qtcreator.exe", true);
component.setStopProcessForUpdateRequest("@TargetDir@/bin/linguist.exe", true);
component.setStopProcessForUpdateRequest("@TargetDir@/bin/qmlviewer.exe", true);
}
}
registerWindowsFileTypeExtensions = function()
{
var headerExtensions = new Array("h", "hh", "hxx", "h++", "hpp", "hpp");
for (var i = 0; i < headerExtensions.length; ++i) {
component.addOperation( "RegisterFileType",
headerExtensions[i],
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"C++ Header file",
"",
"@TargetDir@\\bin\\qtcreator.exe,3");
}
var cppExtensions = new Array("cc", "cxx", "c++", "cp", "cpp");
for (var i = 0; i < cppExtensions.length; ++i) {
component.addOperation( "RegisterFileType",
cppExtensions[i],
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"C++ Source file",
"",
"@TargetDir@\\bin\\qtcreator.exe,2");
}
component.addOperation( "RegisterFileType",
"c",
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"C Source file",
"",
"@TargetDir@\\bin\\qtcreator.exe,1");
component.addOperation( "RegisterFileType",
"ui",
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"Qt UI file",
"",
"@TargetDir@\\bin\\qtcreator.exe,4");
component.addOperation( "RegisterFileType",
"pro",
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"Qt Project file",
"",
"@TargetDir@\\bin\\qtcreator.exe,5");
component.addOperation( "RegisterFileType",
"pri",
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"Qt Project Include file",
"",
"@TargetDir@\\bin\\qtcreator.exe,6");
component.addOperation( "RegisterFileType",
"qs",
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"Qt Script file",
"",
"@TargetDir@\\bin\\qtcreator.exe,0");
component.addOperation( "RegisterFileType",
"qml",
"@TargetDir@\\bin\\qtcreator.exe -client '%1'",
"Qt Quick Markup language file",
"",
"@TargetDir@\\bin\\qtcreator.exe,0");
}
Component.prototype.createOperations = function()
{
// Call the base createOperations and afterwards set some registry settings
component.createOperations();
if ( installer.value("os") == "win" )
{
component.addOperation( "SetPluginPathOnQtCore",
"@TargetDir@/bin",
"@TargetDir@/plugins");
component.addOperation( "SetImportsPathOnQtCore",
"@TargetDir@/bin",
"@TargetDir@/bin");
component.addOperation( "CreateShortcut",
"@TargetDir@\\\bin\\qtcreator.exe",
"@StartMenuDir@/Qt Creator.lnk",
"workingDirectory=@homeDir@" );
registerWindowsFileTypeExtensions();
}
if ( installer.value("os") == "x11" )
{
component.addOperation( "SetPluginPathOnQtCore",
"@TargetDir@/lib/qtcreator",
"@TargetDir@/lib/qtcreator/plugins");
component.addOperation( "SetImportsPathOnQtCore",
"@TargetDir@/lib/qtcreator",
"@TargetDir@/bin");
component.addOperation( "InstallIcons", "@TargetDir@/share/icons" );
component.addOperation( "CreateDesktopEntry",
"QtProject-qtcreator.desktop",
"Type=Application\nExec=@TargetDir@/bin/qtcreator\nPath=@TargetDir@\nName=Qt Creator\nGenericName=The IDE of choice for Qt development.\nGenericName[de]=Die IDE der Wahl zur Qt Entwicklung\nIcon=QtProject-qtcreator\nTerminal=false\nCategories=Development;IDE;Qt;\nMimeType=text/x-c++src;text/x-c++hdr;text/x-xsrc;application/x-designer;application/vnd.nokia.qt.qmakeprofile;application/vnd.nokia.xml.qt.resource;text/x-qml;"
);
}
}
Component.prototype.installationFinished = function()
{
try {
if (component.installed && installer.isInstaller() && installer.status == QInstaller.Success) {
var isLaunchQtCreatorCheckBoxChecked = component.userInterface( "LaunchQtCreatorCheckBoxForm" ).launchQtCreatorCheckBox.checked;
if (isLaunchQtCreatorCheckBoxChecked) {
var qtCreatorBinary = installer.value("TargetDir");
if (installer.value("os") == "win")
qtCreatorBinary = qtCreatorBinary + "\\bin\\qtcreator.exe";
else if (installer.value("os") == "x11")
qtCreatorBinary = qtCreatorBinary + "/bin/qtcreator";
else if (installer.value("os") == "mac")
qtCreatorBinary = "\"" + qtCreatorBinary + "/Qt Creator.app/Contents/MacOS/Qt Creator\"";
if (installer.executeDetached)
installer.executeDetached(qtCreatorBinary);
}
}
} catch(e) {
print(e);
}
}
<?xml version="1.0"?>
<Package>
<DisplayName>Qt Creator Application</DisplayName>
<Description>The IDE of choice for Qt development.</Description>
<Version>{version}</Version>
<ReleaseDate>{date}</ReleaseDate>
<Name>org.qtproject.qtcreator.application</Name>
<Script>installscript.qs</Script>
<Licenses>
<License name="Qt Creator License" file="license.txt" />
</Licenses>
<ForcedInstallation>true</ForcedInstallation>
<Default>true</Default>
<AutoDependOn>org.qtproject.qtcreator</AutoDependOn>
</Package>
<?xml version="1.0"?>
<Package>
<DisplayName>Qt Creator</DisplayName>
<Description>Installs the Qt Creator IDE.</Description>
<Version>{version}</Version>
<ReleaseDate>{date}</ReleaseDate>
<Name>org.qtproject.qtcreator</Name>
<!-- <Script>installscript.js</Script> -->
</Package>
......@@ -27,6 +27,7 @@ PATTERN = $${PLATFORM}$(INSTALL_EDITION)-$${QTCREATOR_VERSION}$(INSTALL_POSTFIX)
macx {
APPBUNDLE = "$$OUT_PWD/bin/Qt Creator.app"
BINDIST_SOURCE = "$$OUT_PWD/bin/Qt Creator.app"
BINDIST_INSTALLER_SOURCE = $$BINDIST_SOURCE
deployqt.commands = $$PWD/scripts/deployqtHelper_mac.sh \"$${APPBUNDLE}\"
codesign.commands = codesign -s \"$(SIGNING_IDENTITY)\" \"$${APPBUNDLE}\"
dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin qt-creator-$${PATTERN}.dmg
......@@ -34,6 +35,7 @@ macx {
QMAKE_EXTRA_TARGETS += codesign dmg
} else {
BINDIST_SOURCE = "$(INSTALL_ROOT)$$QTC_PREFIX"
BINDIST_INSTALLER_SOURCE = "$$BINDIST_SOURCE/*"
deployqt.commands = $$PWD/scripts/deployqt.py -i \"$(INSTALL_ROOT)$$QTC_PREFIX\"
deployqt.depends = install
win32 {
......@@ -43,13 +45,20 @@ macx {
}
}
INSTALLER_ARCHIVE = $$OUT_PWD/qt-creator-$${PATTERN}-installer-archive.7z
bindist.depends = deployqt
bindist.commands = 7z a -mx9 $$OUT_PWD/qt-creator-$${PATTERN}.7z \"$$BINDIST_SOURCE\"
bindist_installer.depends = deployqt
bindist_installer.commands = 7z a -mx9 $$OUT_PWD/qt-creator-$${PATTERN}-installer-archive.7z \"$$BINDIST_INSTALLER_SOURCE\"
installer.depends = bindist_installer
installer.commands = $$PWD/scripts/packageIfw.py -i \"$(IFW_PATH)\" -s $${QTCREATOR_VERSION} -a \"$$INSTALLER_ARCHIVE\" "qt-creator-$${PATTERN}-installer"
win32 {
deployqt.commands ~= s,/,\\\\,g
bindist.commands ~= s,/,\\\\,g
bindist_installer.commands ~= s,/,\\\\,g
installer.commands ~= s,/,\\\\,g
}
bindist.depends = deployqt
QMAKE_EXTRA_TARGETS += deployqt bindist
QMAKE_EXTRA_TARGETS += deployqt bindist bindist_installer installer
#!/usr/bin/env python
################################################################################
# Copyright (c) 2011 Nokia Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Nokia Corporation, nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
################################################################################
import os
import sys
import datetime
import getopt
import subprocess
import fnmatch
import tempfile
import shutil
import inspect
def usage():
print 'Usage: %s [-v|--version-string=versionstring] [-i|--installer-path=/path/to/installerfw] [-a|--archive=archive.7z] <outputname>' % os.path.basename(sys.argv[0])
def substitute_file(infile, outfile, substitutions):
with open(infile, 'r') as f:
template = f.read()
with open(outfile, 'w') as f:
f.write(template.format(**substitutions))
def ifw_template_dir():
script_dir = os.path.dirname(inspect.getfile(inspect.currentframe()))
source_dir = os.path.normpath(os.path.join(script_dir, '..'));
return os.path.normpath(os.path.join(source_dir, 'dist', 'installer', 'ifw'))
def main():
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hv:i:a:', ['help', 'version-string=', 'installer-path=', 'archive'])
except:
usage()
sys.exit(2)
if len(args) < 1:
usage()
sys.exit(2)
version = ''
ifw_location = ''
archive = ''
for o, a in opts:
if o in ('-h', '--help'):
usage()
sys.exit(0)
if o in ('-v', '--version-string'):
version = a
if o in ('-i', '--installer-path'):
ifw_location = a
if o in ('-a', '--archive'):
archive = a
if (version == ''):
raise Exception('Version not specified (--version-string)!')
if (ifw_location == ''):
raise Exception('Installer framework location not specified (--installer-path)!')
if (archive == ''):
raise Exception('Archive not specified (--archive)!')
installer_name = args[0]
if sys.platform == 'darwin':
installer_name = installer_name + '.dmg'
try:
temp_dir = tempfile.mkdtemp()
except:
raise Exception('Failed to create a temporary directory!')
try:
substs = {}
substs['version'] = version
substs['date'] = datetime.date.today().isoformat()
template_dir = ifw_template_dir()
out_config_dir = os.path.join(temp_dir,'config')
out_packages_dir = os.path.join(temp_dir, 'packages')
shutil.copytree(os.path.join(template_dir, 'packages'), os.path.join(temp_dir, 'packages'))
shutil.copytree(os.path.join(template_dir, 'config'), os.path.join(temp_dir, 'config'))
for root, dirnames, filenames in os.walk(out_packages_dir):
for template in fnmatch.filter(filenames, '*.in'):
substitute_file(os.path.join(root, template), os.path.join(root, template[:-3]), substs)
os.remove(os.path.join(root, template))
for root, dirnames, filenames in os.walk(out_config_dir):
for template in fnmatch.filter(filenames, '*.in'):
substitute_file(os.path.join(root, template), os.path.join(root, template[:-3]), substs)
os.remove(os.path.join(root, template))
data_path = os.path.join(out_packages_dir, 'org.qtproject.qtcreator.application', 'data')
if not os.path.exists(data_path):
os.makedirs(data_path)
shutil.copy(archive, data_path)
ifw_call = [os.path.join(ifw_location, 'bin', 'binarycreator'), '-c', os.path.join(out_config_dir, 'config.xml'), '-p', out_packages_dir, installer_name, '--offline-only' ]
subprocess.check_call(ifw_call, stderr=subprocess.STDOUT)
finally:
print 'Cleaning up...'
shutil.rmtree(temp_dir)
print 'Done.'
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment