From e08a5ff6d7c1cfc2f21ff737e7787ba242b21edf Mon Sep 17 00:00:00 2001 From: Anirudha Bose Date: Thu, 10 Jul 2014 08:14:24 +0530 Subject: [PATCH] Remove old Bash implementation from tree --- tools/packaging/{windows => }/LLVM.ico | Bin tools/packaging/cpt.py | 2 +- tools/packaging/cpt.sh | 284 ------------------ tools/packaging/debian/debianize.sh | 221 -------------- tools/packaging/indep.sh | 381 ------------------------- tools/packaging/windows/windows_dep.sh | 287 ------------------- 6 files changed, 1 insertion(+), 1174 deletions(-) rename tools/packaging/{windows => }/LLVM.ico (100%) delete mode 100755 tools/packaging/cpt.sh delete mode 100755 tools/packaging/debian/debianize.sh delete mode 100755 tools/packaging/indep.sh delete mode 100755 tools/packaging/windows/windows_dep.sh diff --git a/tools/packaging/windows/LLVM.ico b/tools/packaging/LLVM.ico similarity index 100% rename from tools/packaging/windows/LLVM.ico rename to tools/packaging/LLVM.ico diff --git a/tools/packaging/cpt.py b/tools/packaging/cpt.py index 3036be91..d5108cbf 100644 --- a/tools/packaging/cpt.py +++ b/tools/packaging/cpt.py @@ -810,7 +810,7 @@ InstallDir "C:\\Cling\\cling-${VERSION}" !define MUI_HEADERIMAGE ; Theme -!define MUI_ICON "%s\\tools\\packaging\\windows\\LLVM.ico" +!define MUI_ICON "%s\\tools\\packaging\\LLVM.ico" !define MUI_UNICON "%s\\Contrib\\Graphics\\Icons\\orange-uninstall.ico" !insertmacro MUI_PAGE_WELCOME diff --git a/tools/packaging/cpt.sh b/tools/packaging/cpt.sh deleted file mode 100755 index a7459fa5..00000000 --- a/tools/packaging/cpt.sh +++ /dev/null @@ -1,284 +0,0 @@ -#! /bin/bash - -############################################################################### -# -# The Cling Interpreter -# -# Cling Packaging Tool (CPT) -# -# tools/packaging/cpt.sh: Main script which calls other helper scripts to -# compile and package Cling for multiple platforms. -# -# TODO: Add documentation here, or provide link to documentation -# -# Author: Anirudha Bose -# -# This file is dual-licensed: you can choose to license it under the University -# of Illinois Open Source License or the GNU Lesser General Public License. See -# LICENSE.TXT for details. -# -############################################################################### - -# Uncomment the following line to trace the execution of the shell commands -# set -o xtrace - -# ${workdir} can be overridden. More information in README.md. -workdir=${workdir:-~/ec/build} - -srcdir=${workdir}/cling-src -TMP_PREFIX="/var/tmp/cling_obj" -CLING_SRC_DIR=${srcdir}/tools/cling -HOST_CLING_SRC_DIR=$(dirname $(readlink -f ${0})) - -# Import helper scripts here -source ${HOST_CLING_SRC_DIR}/indep.sh -source ${HOST_CLING_SRC_DIR}/debian/debianize.sh -source ${HOST_CLING_SRC_DIR}/windows/windows_dep.sh - -# Trap exceptions, call function "cleanup" and exit -trap cleanup EXIT HUP INT QUIT TERM ERR - -function usage { - cat <<- EOT - Cling Packaging Tool - - Usage: ${0##/*/} [options] - - Options: - -h|--help Display this message and exit - -c|--check-requirements Check if packages required by the script are installed - --current-dev={pkg-format} Compile the latest development snapshot and produce a package in the given format - --last-stable={pkg-format} Compile the last stable snapshot and produce a package in the given format - --tarball-tag={tag} Compile the snapshot of a given tag and produce a tarball - --deb-tag={tag} Compile the snapshot of a given tag and produce a Debian package - --nsis-tag={tag} Compile the snapshot of a given tag and produce an NSIS installer - - Supported values of "pkg-format": tar | deb | nsis - Supported values of "tag": Any Git tag in Cling's repository. Example, v0.1 -EOT - # Reset trap on SIGEXIT. Nothing to cleanup here. - trap - EXIT - exit - -} - -while true; do - if [ "${1}" = "" ]; then - echo "Error: No arguments passed" - usage - fi - - if [ "${#}" != "1" ]; then - echo "Error: cannot handle multiple switches" - usage - fi - - echo "Cling Packaging Tool (CPT)" - echo "Arguments passed: ${@}" - box_draw_header - echo "Operating System: ${OS}" - echo "Distribution: ${DIST}" - echo "Distro Based On: ${DistroBasedOn}" - echo "Pseudo Name: ${PSEUDONAME}" - echo "Revision: ${REV}" - echo -e "Architecture: $(uname -m)\n" - - PARAM=$(echo ${1} | awk -F= '{print $1}') - VALUE=$(echo ${1} | awk -F= '{print $2}') - - # Cannot cross-compile for Windows from any other OS - if [ "${OS}" != "Cygwin" -a "${VALUE}" = "nsis" ] || [ "${OS}" != "Cygwin" -a "${PARAM}" = "--nsis-tag" ]; then - echo "Error: Cross-compilation for Windows not supported (yet)" - # Reset trap on SIGEXIT. Nothing to cleanup here. - trap - EXIT - exit - fi - - case ${PARAM} in - -h | --help) - usage - ;; - -c | --check-requirements) - box_draw "Check if required softwares are available on this system" - if [ "${DIST}" = "Ubuntu" ]; then - check_ubuntu git - check_ubuntu wget - check_ubuntu debhelper - check_ubuntu devscripts - check_ubuntu gnupg - check_ubuntu python - echo -e "\nCPT will now attempt to update/install the requisite packages automatically. Do you want to continue?" - select yn in "Yes" "No"; do - case $yn in - Yes) - sudo apt-get update - sudo apt-get install git wget debhelper devscripts gnupg python - break - ;; - No) - cat <<- EOT -Install/update the required packages by: - sudo apt-get update - sudo apt-get install git wget debhelper devscripts gnupg python -EOT - break - ;; - esac - done - # Reset trap on SIGEXIT. Nothing to cleanup here. - trap - EXIT - exit - elif [ "${OS}" = "Cygwin" ]; then - check_cygwin cygwin # Doesn't make much sense. This is for the appeasement of users. - check_cygwin cmake - check_cygwin git - check_cygwin python - check_cygwin wget - # Check Windows registry for keys that prove an MS Visual Studio 11.0 installation - check_cygwin msvc - cat <<- EOT -Refer to the documentation of CPT for information on setting up your Windows environment. -[tools/packaging/README.md] - -EOT - fi - ;; - --current-dev) - if [ "${VALUE}" = "" ]; then - echo "Error: Expected a value" - usage - fi - fetch_llvm - fetch_clang - fetch_cling master - set_version - if [ "${VALUE}" = "tar" ]; then - if [ "${OS}" = "Cygwin" ]; then - compile ${workdir}/cling-$(get_DIST)$(get_BIT)-${VERSION} - else - compile ${workdir}/cling-$(get_DIST)-$(get_REVISION)-$(get_BIT)bit-${VERSION} - fi - install_prefix - test_cling - tarball - cleanup - elif [ "${VALUE}" = "deb" ]; then - compile ${workdir}/cling-${VERSION} - install_prefix - test_cling - tarball_deb - debianize - cleanup - elif [ "${VALUE}" = "nsis" ]; then - compile ${workdir}/cling-$(get_DIST)$(get_BIT)-${VERSION} - install_prefix - test_cling - get_nsis - make_nsi - build_nsis - cleanup - fi - ;; - --last-stable) - if [ "${VALUE}" = "" ]; then - echo "Error: Expected a value" - usage - fi - fetch_llvm - fetch_clang - fetch_cling last-stable - - if [ ${VALUE} = "tar" ]; then - set_version - if [ "${OS}" = "Cygwin" ]; then - compile ${workdir}/cling-$(get_DIST)$(get_BIT)-${VERSION} - else - compile ${workdir}/cling-$(get_DIST)-$(get_REVISION)-$(get_BIT)bit-${VERSION} - fi - install_prefix - test_cling - tarball - cleanup - elif [ ${VALUE} = "deb" ]; then - set_version - compile ${workdir}/cling-${VERSION} - install_prefix - test_cling - tarball_deb - debianize - cleanup - elif [ "${VALUE}" = "nsis" ]; then - compile ${workdir}/cling-$(get_DIST)$(get_BIT)-${VERSION} - install_prefix - test_cling - get_nsis - make_nsi - build_nsis - cleanup - fi - ;; - --tarball-tag) - if [ "${VALUE}" = "" ]; then - echo "Error: Expected a value" - usage - fi - fetch_llvm - fetch_clang - fetch_cling ${VALUE} - set_version - compile ${workdir}/cling-$(get_DIST)-$(get_REVISION)-$(get_BIT)bit-${VERSION} - install_prefix - test_cling - tarball - cleanup - ;; - --deb-tag) - if [ "${VALUE}" = "" ]; then - echo "Error: Expected a value" - usage - fi - fetch_llvm - fetch_clang - fetch_cling ${VALUE} - set_version - compile ${workdir}/cling-${VERSION} - install_prefix - test_cling - tarball_deb - debianize - cleanup - ;; - --nsis-tag) - if [ "${VALUE}" = "" ]; then - echo "Error: Expected a value" - usage - fi - fetch_llvm - fetch_clang - fetch_cling ${VALUE} - set_version - compile ${workdir}/cling-$(get_DIST)$(get_BIT)-${VERSION} - install_prefix - test_cling - get_nsis - make_nsi - build_nsis - cleanup - ;; - --make-proper) - # This is an internal option in CPT, meant to be integrated into - # Cling's build system. - - prefix=$(grep "LLVM_PREFIX=" ${LLVM_OBJ_ROOT}/config.log | sed -e "s|LLVM_PREFIX=||g" -e "s|'||g") - set_version - install_prefix - # Cleanup - rm -Rf ${TMP_PREFIX} - ;; - *) - echo "Error: unknown parameter \"${PARAM}\"" - usage - ;; - esac - shift -done diff --git a/tools/packaging/debian/debianize.sh b/tools/packaging/debian/debianize.sh deleted file mode 100755 index aa3ebe5d..00000000 --- a/tools/packaging/debian/debianize.sh +++ /dev/null @@ -1,221 +0,0 @@ -#! /bin/bash - -############################################################################### -# -# The Cling Interpreter -# -# Cling Packaging Tool (CPT) -# -# tools/packaging/debian/debianize.sh: Helper script to produce Debian packages -# for Ubuntu/Debian platforms. -# -# Author: Anirudha Bose -# -# This file is dual-licensed: you can choose to license it under the University -# of Illinois Open Source License or the GNU Lesser General Public License. See -# LICENSE.TXT for details. -# -############################################################################### - -# Uncomment the following line to trace the execution of the shell commands -# set -o xtrace - -SIGNING_USER=$(gpg --fingerprint | grep uid | sed s/"uid *"//g | tr -s " ") - -function tarball_deb { - box_draw "Compressing compiled binaries to produce a bzip2 tarball" - cd ${workdir} - tar -cjvf cling_${VERSION}.orig.tar.bz2 -C . $(basename ${prefix}) -} - -function debianize { - box_draw "Set up the debian directory" - cd ${prefix} - echo "Create directory: debian" - mkdir -p debian - - mkdir -p debian/source - echo "Create file: debian/source/format" - echo "3.0 (quilt)" > debian/source/format - - echo "Create file: debian/source/lintian-overrides" - cat >> debian/source/lintian-overrides << EOF -cling source: source-is-missing -EOF - -: ' -# This section is no longer valid. I have kept it as a reference if we plan to -# distribute libcling.so or any other library with the package. - echo "Create file: debian/postinst" - cat >> debian/postinst << EOF -#! /bin/sh -e -# postinst script for cling -# -# see: dh_installdeb(1) - -set -e - -# Call ldconfig on libclang.so -ldconfig -l /usr/lib/libclang.so - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 -EOF -' - - echo "Create file: debian/cling.install" - cat >> debian/cling.install << EOF -bin/* /usr/bin -docs/* /usr/share/doc -include/* /usr/include -lib/* /usr/lib -share/* /usr/share -EOF - - echo "Create file: debian/compact" - # Optimize binary compression - echo "7" > debian/compact - - echo "Create file: debian/compat" - echo "9" > debian/compat - - echo "Create file: debian/control" - cat >> debian/control << EOF -Source: cling -Section: devel -Priority: optional -Maintainer: Cling Developer Team -Uploaders: Anirudha Bose -Build-Depends: debhelper (>= 9.0.0) -Standards-Version: 3.9.5 -Homepage: http://cling.web.cern.ch/ -Vcs-Git: http://root.cern.ch/git/cling.git -Vcs-Browser: http://root.cern.ch/gitweb?p=cling.git;a=summary - -Package: cling -Priority: optional -Architecture: any -Depends: \${shlibs:Depends}, \${misc:Depends} -Description: interactive C++ interpreter - Cling is a new and interactive C++11 standard compliant interpreter built - on the top of Clang and LLVM compiler infrastructure. Its advantages over - the standard interpreters are that it has command line prompt and uses - Just In Time (JIT) compiler for compilation. Many of the developers - (e.g. Mono in their project called CSharpRepl) of such kind of software - applications name them interactive compilers. - . - One of Cling's main goals is to provide contemporary, high-performance - alternative of the current C++ interpreter in the ROOT project - CINT. Cling - serves as a core component of the ROOT system for storing and analyzing the - data of the Large Hadron Collider (LHC) experiments. The - backward-compatibility with CINT is major priority during the development. -EOF - - echo "Create file: debian/copyright" - cat >> debian/copyright << EOF -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: cling -Source: http://root.cern.ch/gitweb?p=cling.git;a=summary - -Files: * -Copyright: 2007-2014 by the Authors -License: LGPL-2.0+ -Comment: Developed by The ROOT Team; CERN and Fermilab - -Files: debian/* -Copyright: 2014 Anirudha Bose -License: LGPL-2.0+ - -License: LGPL-2.0+ - This package is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - . - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - . - You should have received a copy of the GNU General Public License - along with this program. If not, see . - . - On Debian systems, the complete text of the GNU Lesser General - Public License can be found in "/usr/share/common-licenses/LGPL-2". -Comment: Cling can also be licensed under University of Illinois/NCSA - Open Source License (UI/NCSAOSL). - . - More information here: http://root.cern.ch/gitweb?p=cling.git;a=blob_plain;f=LICENSE.TXT;hb=HEAD -EOF - - echo "Create file: debian/rules" - cat >> debian/rules << EOF -#!/usr/bin/make -f -# -*- makefile -*- - -%: - dh \$@ - -override_dh_auto_build: - -override_dh_auto_install: -EOF - - echo "Create file: debian/changelog" - - cat >> ${prefix}/debian/changelog << EOF -cling (${VERSION}-1) unstable; urgency=low - - * [Debian] Upload to unstable for version: ${VERSION} -EOF - cd ${CLING_SRC_DIR} - echo "${VERSION}" | grep -qE "dev" - if [ "${?}" = 0 ]; then - TAG_A=${VERSION/~*/} - TAG=$(echo "${TAG_A/v/} 0.1" | awk '{printf "%.1f", $1 - $2}') - git log v${TAG}...HEAD --format=" * %s" | fmt -s >> ${prefix}/debian/changelog - echo -e "\n -- ${SIGNING_USER} $(date --rfc-2822)\n" >> ${prefix}/debian/changelog - else - TAG=${VERSION/v/} - if [ ${TAG} = "0.1" ]; then - echo -e "\n -- ${SIGNING_USER} $(date --rfc-2822)\n" >> ${prefix}/debian/changelog - fi - STABLE_FLAG="1" - fi - - while [ "${TAG}" != "0.1" ]; do - CMP=$TAG - TAG=$(echo "${TAG} 0.1" | awk '{printf "%.1f", $1 - $2}') - if [ STABLE_FLAG != "1" ]; then - echo -e "cling (${TAG/v/}-1) unstable; urgency=low\n" >> ${prefix}/debian/changelog - STABLE_FLAG="1" - fi - git log v${CMP}...v${TAG} --format=" * %s" | fmt -s >> ${prefix}/debian/changelog - echo -e "\n -- ${SIGNING_USER} $(date --rfc-2822)\n" >> ${prefix}/debian/changelog - done - - # Changelog entries from first commit to v0.1 - echo "Old Changelog:" >> ${prefix}/debian/changelog - git log v0.1 --format=" * %s%n -- %an <%ae> %cD%n" >> ${prefix}/debian/changelog - cd - - - box_draw "Run debuild to create Debian package" - debuild -} - -function check_ubuntu { - if [ $(dpkg-query -W -f='${Status}' ${1} 2>/dev/null | grep -c "ok installed") -eq 0 ]; - then - printf "%-10s\t\t[NOT INSTALLED]\n" "${1}" - else - if [ ${1} = "gnupg" -a "${SIGNING_USER}" = "" ]; then - printf "%-10s\t\t[INSTALLED - NOT SETUP]\n" "${1}" - else - printf "%-10s\t\t[OK]\n" "${1}" - fi - fi -} diff --git a/tools/packaging/indep.sh b/tools/packaging/indep.sh deleted file mode 100755 index b9d809d1..00000000 --- a/tools/packaging/indep.sh +++ /dev/null @@ -1,381 +0,0 @@ -#! /bin/bash - -############################################################################### -# -# The Cling Interpreter -# -# Cling Packaging Tool (CPT) -# -# tools/packaging/indep.sh: Platform independent script with helper functions -# for CPT. -# -# Author: Anirudha Bose -# -# This file is dual-licensed: you can choose to license it under the University -# of Illinois Open Source License or the GNU Lesser General Public License. See -# LICENSE.TXT for details. -# -############################################################################### - -# Uncomment the following line to trace the execution of the shell commands -# set -o xtrace - -function platform_init { - OS=$(uname -o) - - if [ "${OS}" = "Cygwin" ]; then - DIST="Win" - SHLIBEXT=".dll" - EXEEXT=".exe" - - elif [ "{$OS}" = "Darwin" ]; then - OS="Mac OS" - - elif [ "${OS}" = "GNU/Linux" ] ; then - if [ -f /etc/redhat-release ] ; then - DistroBasedOn='RedHat' - DIST=$(cat /etc/redhat-release |sed s/\ release.*//) - PSEUDONAME=$(cat /etc/redhat-release | sed s/.*\(// | sed s/\)//) - REV=$(cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//) - elif [ -f /etc/debian_version ] ; then - DistroBasedOn='Debian' - DIST=$(cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }') - PSEUDONAME=$(cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }') - REV=$(cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }') - fi - fi - - if [ "${DIST}" = "" ]; then - DIST="N/A" - fi - - if [ "${DistroBasedOn}" = "" ]; then - DistroBasedOn="N/A" - fi - - if [ "${PSEUDONAME}" = "" ]; then - PSEUDONAME="N/A" - fi - - if [ "${REV}" = "" ]; then - REV="N/A" - fi -} - -function get_OS { - printf "%s" "${OS}" -} - -function get_DIST { - printf "%s" "${DIST}" -} - -function get_DistroBasedOn { - printf "%s" "${DistroBasedOn}" -} -function get_PSEUDONAME { - printf "%s" "${PSEUDONAME}" -} -function get_REVISION { - printf "%s" "${REV}" -} - -function get_BIT { - printf "%s" "$(getconf LONG_BIT)" -} - -# Helper functions to prettify text like that in Debian Build logs -function box_draw_header { - msg="cling ($(uname -m))$(date --rfc-2822)" - spaces_no=$(echo "80 $(echo ${msg} | wc -m)" | awk '{printf "%d", $1 - $2 - 3}') - spacer=$(head -c ${spaces_no} < /dev/zero | tr '\0' ' ') - msg="cling ($(uname -m))${spacer}$(date --rfc-2822)" - echo "\ -╔══════════════════════════════════════════════════════════════════════════════╗ -║ ${msg} ║ -╚══════════════════════════════════════════════════════════════════════════════╝" -} - -function box_draw { - msg=${1} - spaces_no=$(echo "80 $(echo ${msg} | wc -m)" | awk '{printf "%d", $1 - $2 - 3}') - spacer=$(head -c ${spaces_no} < /dev/zero | tr '\0' ' ') - echo "\ -┌──────────────────────────────────────────────────────────────────────────────┐ -│ ${msg}${spacer} │ -└──────────────────────────────────────────────────────────────────────────────┘" -} - -# Fetch the sources for the vendor clone of LLVM -function fetch_llvm { - box_draw "Fetch source files" - # TODO: Change the URL to use the actual Git repo of Cling, rather than Github. - # Use "git archive --remote= ..." or similar to remove "wget" as dependency. - LLVMRevision=$(wget -q -O- https://raw.githubusercontent.com/ani07nov/cling/master/LastKnownGoodLLVMSVNRevision.txt) - echo "Last known good LLVM revision is: ${LLVMRevision}" - - function get_fresh_llvm { - # ${LLVM_GIT_URL} can be overridden. More information in README.md. - LLVM_GIT_URL=${LLVM_GIT_URL:-"http://root.cern.ch/git/llvm.git"} - git clone ${LLVM_GIT_URL} ${srcdir} - cd ${srcdir} - git checkout ROOT-patches-r${LLVMRevision} - } - - function update_old_llvm { - git clean -f -x -d - git fetch --tags - git checkout ROOT-patches-r${LLVMRevision} - git pull origin refs/tags/ROOT-patches-r${LLVMRevision} - } - - if [ -d ${srcdir} ]; then - cd ${srcdir} - if [ ! -z ${LLVM_GIT_URL} ]; then - grep -q ${LLVM_GIT_URL} ${srcdir}/.git/config - if [ ${?} = 0 ]; then - update_old_llvm - else - cd ${workdir} - rm -Rf ${srcdir} - get_fresh_llvm - fi - else - update_old_llvm - fi - else - get_fresh_llvm - fi -} - -# Fetch the sources for the vendor clone of Clang -function fetch_clang { - function get_fresh_clang { - # ${CLANG_GIT_URL} can be overridden. More information in README.md. - CLANG_GIT_URL=${CLANG_GIT_URL:-"http://root.cern.ch/git/clang.git"} - git clone ${CLANG_GIT_URL} ${srcdir}/tools/clang - cd ${srcdir}/tools/clang - git checkout ROOT-patches-r${LLVMRevision} - } - - function update_old_clang { - git clean -f -x -d - git fetch --tags - git checkout ROOT-patches-r${LLVMRevision} - git pull origin refs/tags/ROOT-patches-r${LLVMRevision} - } - - if [ -d ${srcdir}/tools/clang ]; then - cd ${srcdir}/tools/clang - if [ ! -z ${CLANG_GIT_URL} ]; then - grep -q ${CLANG_GIT_URL} ${srcdir}/tools/clang/.git/config - if [ ${?} = 0 ]; then - update_old_clang - else - cd ${srcdir}/tools - rm -Rf ${srcdir}/tools/clang - get_fresh_clang - fi - else - update_old_clang - fi - else - get_fresh_clang - fi -} - -# Fetch the sources for Cling -function fetch_cling { - - function get_fresh_cling { - # ${CLING_GIT_URL} can be overridden. More information in README.md. - CLING_GIT_URL=${CLING_GIT_URL:-"http://root.cern.ch/git/cling.git"} - git clone ${CLING_GIT_URL} ${CLING_SRC_DIR} - cd ${CLING_SRC_DIR} - - if [ ${1} = "last-stable" ]; then - checkout_branch=$(git describe --match v* --abbrev=0 --tags | head -n 1) - elif [ ${1} = "master" ]; then - checkout_branch="master" - else - checkout_branch="${1}" - fi - - git checkout ${checkout_branch} - } - - function update_old_cling { - git clean -f -x -d - git fetch --tags - - if [ ${1} = "last-stable" ]; then - checkout_branch=$(git describe --match v* --abbrev=0 --tags | head -n 1) - elif [ ${1} = "master" ]; then - checkout_branch="master" - else - checkout_branch="${1}" - fi - - git checkout ${checkout_branch} - git pull origin ${checkout_branch} - } - - if [ -d ${CLING_SRC_DIR} ]; then - cd ${CLING_SRC_DIR} - if [ ! -z ${CLING_GIT_URL} ]; then - grep -q ${CLING_GIT_URL} ${CLING_SRC_DIR}/.git/config - if [ ${?} = 0 ]; then - update_old_cling ${1} - else - cd ${srcdir} - rm -Rf ${CLING_SRC_DIR} - get_fresh_cling ${1} - fi - else - update_old_cling ${1} - fi - else - get_fresh_cling ${1} - fi -} - -function set_version { - box_draw "Set Cling version" - cd ${CLING_SRC_DIR} - VERSION=$(cat ${CLING_SRC_DIR}/VERSION) - - # If development release, then add revision to the version - REVISION=$(git log -n 1 --pretty=format:"%H") - echo "${VERSION}" | grep -qE "dev" - if [ "${?}" = 0 ]; then - VERSION="${VERSION}"-"$(echo ${REVISION} | cut -c1-7)" - fi - echo "Version: ${VERSION}" - if [ ${REVISION} != "" ]; then - echo "Revision: ${REVISION}" - fi -} - -function set_ext { - box_draw "Set binary/library extensions" - if [ "${LLVM_OBJ_ROOT}" = "" ]; then - LLVM_OBJ_ROOT=${workdir}/builddir - fi - - if [ ! -f ${LLVM_OBJ_ROOT}/test/lit.site.cfg ]; then - make -C ${LLVM_OBJ_ROOT}/test lit.site.cfg - fi - - SHLIBEXT=$(grep "^config.llvm_shlib_ext = " ${LLVM_OBJ_ROOT}/test/lit.site.cfg | sed -e "s|config.llvm_shlib_ext = ||g" -e 's|"||g') - EXEEXT=$(grep "^config.llvm_exe_ext = " ${LLVM_OBJ_ROOT}/test/lit.site.cfg | sed -e "s|config.llvm_exe_ext = ||g" -e 's|"||g') - - echo "EXEEXT: ${EXEEXT}" - echo "SHLIBEXT: ${SHLIBEXT}" -} - -function compile { - prefix=${1} - python=$(type -p python) - # TODO: "nproc" program is a part of GNU Coreutils and may not be available on all systems. Use a better solution if needed. - cores=$(nproc) - - # Cleanup previous installation directory if any - rm -Rf ${prefix} - mkdir -p ${workdir}/builddir - cd ${workdir}/builddir - - if [ "${OS}" = "Cygwin" ]; then - box_draw "Configuring Cling with CMake and generating Visual Studio 11 project files" - cmake -G "Visual Studio 11" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(cygpath --windows --absolute ${TMP_PREFIX}) ../$(basename ${srcdir}) - - box_draw "Building Cling (using ${cores} cores)" - cmake --build . --target clang --config Release - cmake --build . --target cling --config Release - - box_draw "Install compiled binaries to prefix (using ${cores} cores)" - cmake --build . --target INSTALL --config Release - else - box_draw "Configuring Cling for compilation" - ${srcdir}/configure --disable-compiler-version-checks --with-python=${python} --enable-targets=host --prefix=${TMP_PREFIX} --enable-optimized=yes --enable-cxx11 - - box_draw "Building Cling (using ${cores} cores)" - make -j${cores} - - box_draw "Install compiled binaries to prefix (using ${cores} cores)" - make install -j${cores} prefix=${TMP_PREFIX} - fi -} - -function install_prefix { - - set_ext - box_draw "Filtering Cling's libraries and binaries" - echo "This is going to take a while. Please wait." - sed -i "s|@EXEEXT@|${EXEEXT}|g" ${HOST_CLING_SRC_DIR}/dist-files.mk - sed -i "s|@SHLIBEXT@|${SHLIBEXT}|g" ${HOST_CLING_SRC_DIR}/dist-files.mk - - for f in $(find ${TMP_PREFIX} -type f -printf "%P\n"); do - grep -q $(echo $f | sed "s|${TMP_PREFIX}||g")[[:space:]] ${HOST_CLING_SRC_DIR}/dist-files.mk - if [ ${?} = 0 ]; then - mkdir -p ${prefix}/$(dirname $f) - cp ${TMP_PREFIX}/$f ${prefix}/$f - fi - done -} - -function test_cling { - box_draw "Run Cling test suite" - if [ ${OS} != "Cygwin" ]; then - cd ${workdir}/builddir/tools/cling - make test - fi -} - -function tarball { - box_draw "Compressing binaries to produce a bzip2 tarball" - cd ${workdir} - tar -cjvf $(basename ${prefix}).tar.bz2 -C . $(basename ${prefix}) -} - -function cleanup { - # Newline is required to align boxes prooperly when SIGINT is encountered - echo "" - box_draw "Clean up" - echo "Remove directory: ${workdir}/builddir" - rm -Rf ${workdir}/builddir - - if [ -d "${prefix}" ]; then - echo "Remove directory: ${prefix}" - rm -Rf ${prefix} - fi - - echo "Remove directory: ${TMP_PREFIX}" - rm -Rf ${TMP_PREFIX} - - if [ "${VALUE}" = "deb" -o "${PARAM}" = "--deb-tag" ]; then - echo "Create output directory: ${workdir}/cling-${VERSION}-1" - mkdir -p ${workdir}/cling-${VERSION}-1 - - if [ "$(ls -A ${workdir}/cling_${VERSION}* 2> /dev/null)" != "" ]; then - echo "Moving Debian package files to ${workdir}/cling-${VERSION}-1" - mv -v ${workdir}/cling_${VERSION}* ${workdir}/cling-${VERSION}-1 - fi - - if [ "$(ls -A ${workdir}/cling-${VERSION}-1 2> /dev/null)" = "" ]; then - echo "Removing empty directory: ${workdir}/cling-${VERSION}-1" - rm -Rf ${workdir}/cling-${VERSION}-1 - fi - fi - - if [ -f "${workdir}/cling.nsi" ]; then - echo "Remove file: cling.nsi" - rm -Rf ${workdir}/cling.nsi - fi - - # Reset trap on SIGEXIT, or else function "cleanup" will be executed twice. - trap - EXIT - exit -} - -# Initialize variables with details of the platform and Operating System -platform_init diff --git a/tools/packaging/windows/windows_dep.sh b/tools/packaging/windows/windows_dep.sh deleted file mode 100755 index 4afbfb30..00000000 --- a/tools/packaging/windows/windows_dep.sh +++ /dev/null @@ -1,287 +0,0 @@ -#! /bin/bash - -############################################################################### -# -# The Cling Interpreter -# -# Cling Packaging Tool (CPT) -# -# tools/packaging/windows/windows_dep.sh: Script with helper functions for -# Windows (Cygwin) platform. -# -# Author: Anirudha Bose -# -# This file is dual-licensed: you can choose to license it under the University -# of Illinois Open Source License or the GNU Lesser General Public License. See -# LICENSE.TXT for details. -# -############################################################################### - -# Uncomment the following line to trace the execution of the shell commands -# set -o xtrace - -function check_cygwin { - # Check for Cygwin - if [ "${1}" = "cygwin" ]; then - printf "%-10s\t\t[OK]\n" "${1}" - - # Check for Microsoft Visual Studio 11.0 - elif [ "${1}" = "msvc" ]; then - cmd.exe /C REG QUERY "HKEY_CLASSES_ROOT\VisualStudio.DTE.11.0" | grep -qE "ERROR" - if [ "${?}" = 0 ]; then - printf "%-10s\t\t[NOT INSTALLED]\n" "${1}" - else - printf "%-10s\t\t[OK]\n" "${1}" - fi - - # Check for other tools - elif [ "$(command -v ${1})" = "" ]; then - printf "%-10s\t\t[NOT INSTALLED]\n" "${1}" - else - printf "%-10s\t\t[OK]\n" "${1}" - fi -} - -function get_nsis { - box_draw "Check SourceForge project page of NSIS" - NSIS_VERSION=$(wget -q -O- 'http://sourceforge.net/p/nsis/code/HEAD/tree/NSIS/tags/' | \ - grep ' ${workdir}/cling.nsi - # installer settings - cat >> ${workdir}/cling.nsi << EOF -!define APP_NAME "Cling" -!define COMP_NAME "CERN" -!define WEB_SITE "http://cling.web.cern.ch/" -!define VERSION "${VERSION}" -!define COPYRIGHT "Copyright © 2007-2014 by the Authors; Developed by The ROOT Team, CERN and Fermilab" -!define DESCRIPTION "Interactive C++ interpreter" -!define INSTALLER_NAME "$(basename ${prefix})-setup.exe" -!define MAIN_APP_EXE "cling.exe" -!define INSTALL_TYPE "SetShellVarContext current" -!define PRODUCT_ROOT_KEY "HKLM" -!define PRODUCT_KEY "Software\Cling" - -############################################################################### - -VIProductVersion "${VIProductVersion/v/}.0.0" -VIAddVersionKey "ProductName" "\${APP_NAME}" -VIAddVersionKey "CompanyName" "\${COMP_NAME}" -VIAddVersionKey "LegalCopyright" "\${COPYRIGHT}" -VIAddVersionKey "FileDescription" "\${DESCRIPTION}" -VIAddVersionKey "FileVersion" "\${VERSION}" - -############################################################################### - -SetCompressor /SOLID Lzma -Name "\${APP_NAME}" -Caption "\${APP_NAME}" -OutFile "\${INSTALLER_NAME}" -BrandingText "\${APP_NAME}" -XPStyle on -InstallDir "C:\\Cling\\cling-\${VERSION}" - -############################################################################### -; MUI settings -!include "MUI.nsh" - -!define MUI_ABORTWARNING -!define MUI_UNABORTWARNING -!define MUI_HEADERIMAGE - -; Theme -!define MUI_ICON "$(cygpath -wa ${CLING_SRC_DIR}/tools/packaging/windows/LLVM.ico)" -!define MUI_UNICON "$(cygpath -wa ${TMP_PREFIX}/nsis/nsis-${NSIS_VERSION}/Contrib/Graphics/Icons/orange-uninstall.ico)" - -!insertmacro MUI_PAGE_WELCOME - -!define MUI_LICENSEPAGE_TEXT_BOTTOM "The source code for Cling is freely redistributable under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation." -!define MUI_LICENSEPAGE_BUTTON "Next >" -!insertmacro MUI_PAGE_LICENSE "$(cygpath --windows --absolute ${CLING_SRC_DIR}/LICENSE.TXT)" - -!insertmacro MUI_PAGE_DIRECTORY - -!insertmacro MUI_PAGE_INSTFILES - -!define MUI_FINISHPAGE_RUN "\$INSTDIR\bin\\\${MAIN_APP_EXE}" -!insertmacro MUI_PAGE_FINISH - -!insertmacro MUI_UNPAGE_CONFIRM - -!insertmacro MUI_UNPAGE_INSTFILES - -!insertmacro MUI_UNPAGE_FINISH - -!insertmacro MUI_LANGUAGE "English" - -############################################################################### - -Function .onInit - Call DetectWinVer - Call CheckPrevVersion -FunctionEnd - -; file section -Section "MainFiles" -EOF - - # Insert the files to be installed - IFS=$'\n' - for f in $(find ${prefix} -type d -printf "%P\n"); do - winf=$(echo $f | sed 's,/,\\\\,g') - echo " CreateDirectory \"\$INSTDIR\\$winf\"" >> ${workdir}/cling.nsi - echo " SetOutPath \"\$INSTDIR\\$winf\"" >> ${workdir}/cling.nsi - for p in $(find "${prefix}/$f" -maxdepth 1 -type f); do - echo " File \"$(cygpath --windows --absolute $p)\"" >> ${workdir}/cling.nsi - done - done - - cat >> ${workdir}/cling.nsi << EOF - -SectionEnd - -Section make_uninstaller - ; Write the uninstall keys for Windows - SetOutPath "\$INSTDIR" - WriteRegStr HKLM "Software\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Cling" "DisplayName" "Cling" - WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Cling" "UninstallString" "\$INSTDIR\uninstall.exe" - WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Cling" "NoModify" 1 - WriteRegDWORD HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Cling" "NoRepair" 1 - WriteUninstaller "uninstall.exe" -SectionEnd - -; start menu -# TODO: This is currently hardcoded. -Section "Shortcuts" - - CreateDirectory "\$SMPROGRAMS\\Cling" - CreateShortCut "\$SMPROGRAMS\\Cling\\Uninstall.lnk" "\$INSTDIR\\uninstall.exe" "" "\$INSTDIR\\uninstall.exe" 0 - CreateShortCut "\$SMPROGRAMS\Cling\\Cling.lnk" "\$INSTDIR\\bin\\cling.exe" "" "\$INSTDIR\\$ICON" 0 - CreateDirectory "\$SMPROGRAMS\\Cling\\Documentation" - CreateShortCut "\$SMPROGRAMS\\Cling\\Documentation\\Cling (PS).lnk" "\$INSTDIR\\docs\\llvm\\ps\\cling.ps" "" "" 0 - CreateShortCut "\$SMPROGRAMS\\Cling\\Documentation\\Cling (HTML).lnk" "\$INSTDIR\\docs\\llvm\\html\\cling\\cling.html" "" "" 0 - -SectionEnd - -Section "Uninstall" - - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cling" - DeleteRegKey HKLM "Software\Cling" - - ; Remove shortcuts - Delete "\$SMPROGRAMS\Cling\*.*" - Delete "\$SMPROGRAMS\Cling\Documentation\*.*" - Delete "\$SMPROGRAMS\Cling\Documentation" - RMDir "\$SMPROGRAMS\Cling" - -EOF - -# insert dir list (backwards order) for uninstall files - for f in $(find ${prefix} -depth -type d -printf "%P\n"); do - winf=$(echo $f | sed 's,/,\\\\,g') - echo " Delete \"\$INSTDIR\\$winf\\*.*\"" >> ${workdir}/cling.nsi - echo " RmDir \"\$INSTDIR\\$winf\"" >> ${workdir}/cling.nsi - done - -# last bit of the uninstaller - cat >> ${workdir}/cling.nsi << EOF - Delete "\$INSTDIR\*.*" - RmDir "\$INSTDIR" -SectionEnd - -; Function to detect Windows version and abort if Cling is unsupported in the current platform -Function DetectWinVer - Push \$0 - Push \$1 - ReadRegStr \$0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - IfErrors is_error is_winnt -is_winnt: - StrCpy \$1 \$0 1 - StrCmp \$1 4 is_error ; Aborting installation for Windows versions older than Windows 2000 - StrCmp \$0 "5.0" is_error ; Removing Windows 2000 as supported Windows version - StrCmp \$0 "5.1" is_winnt_XP - StrCmp \$0 "5.2" is_winnt_2003 - StrCmp \$0 "6.0" is_winnt_vista - StrCmp \$0 "6.1" is_winnt_7 - StrCmp \$0 "6.2" is_winnt_8 - StrCmp \$1 6 is_winnt_8 ; Checking for future versions of Windows 8 - Goto is_error - -is_winnt_XP: -is_winnt_2003: -is_winnt_vista: -is_winnt_7: -is_winnt_8: - Goto done -is_error: - StrCpy \$1 \$0 - ReadRegStr \$0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" ProductName - IfErrors 0 +4 - ReadRegStr \$0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" Version - IfErrors 0 +2 - StrCpy \$0 "Unknown" - MessageBox MB_ICONSTOP|MB_OK "This version of Cling cannot be installed on this system. Cling is supported only on Windows NT systems. Current system: \$0 (version: \$1)" - Abort -done: - Pop \$1 - Pop \$0 -FunctionEnd - -; Function to check any previously installed version of Cling in the system -Function CheckPrevVersion - Push \$0 - Push \$1 - Push \$2 - IfFileExists "\$INSTDIR\bin\cling.exe" 0 otherver - MessageBox MB_OK|MB_ICONSTOP "Another Cling installation (with the same version) has been detected. Please uninstall it first." - Abort -otherver: - StrCpy \$0 0 - StrCpy \$2 "" -loop: - EnumRegKey \$1 \${PRODUCT_ROOT_KEY} "\${PRODUCT_KEY}" \$0 - StrCmp \$1 "" loopend - IntOp \$0 \$0 + 1 - StrCmp \$2 "" 0 +2 - StrCpy \$2 "\$1" - StrCpy \$2 "\$2, \$1" - Goto loop -loopend: - ReadRegStr \$1 \${PRODUCT_ROOT_KEY} "\${PRODUCT_KEY}" "Version" - IfErrors finalcheck - StrCmp \$2 "" 0 +2 - StrCpy \$2 "\$1" - StrCpy \$2 "\$2, \$1" -finalcheck: - StrCmp \$2 "" done - MessageBox MB_YESNO|MB_ICONEXCLAMATION "Another Cling installation (version \$2) has been detected. It is recommended to uninstall it if you intend to use the same installation directory. Do you want to proceed with the installation anyway?" IDYES done IDNO 0 - Abort -done: - ClearErrors - Pop \$2 - Pop \$1 - Pop \$0 -FunctionEnd -EOF -} - -function build_nsis { - box_draw "Building NSIS executable from cling.nsi" - ${TMP_PREFIX}/nsis-${NSIS_VERSION}/nsis/makensis.exe -V3 $(cygpath --windows --absolute ${workdir}/cling.nsi) -}