#!/bin/sh ############################################################################## ## ## Copyright (C) 2016 The Qt Company Ltd. ## Contact: http://www.qt.io/licensing/ ## ## This file is part of the Boot to Qt meta layer. ## ## $QT_BEGIN_LICENSE:COMM$ ## ## Commercial License Usage ## Licensees holding valid commercial Qt licenses may use this file in ## accordance with the commercial license agreement provided with the ## Software or, alternatively, in accordance with the terms contained in ## a written agreement between you and The Qt Company. For licensing terms ## and conditions see http://www.qt.io/terms-conditions. For further ## information use the contact form at http://www.qt.io/contact-us. ## ## $QT_END_LICENSE$ ## ############################################################################## set -e usage() { echo "Usage: $(basename $0) COMMAND [ARGS]" echo echo "Initialize build environment:" echo " $(basename $0) init --device [--reference ]" echo "Initialize local mirror:" echo " $(basename $0) mirror" echo "List available devices:" echo " $(basename $0) list-devices" } while test -n "$1"; do case "$1" in "help" | "--help" | "-h") usage exit 0 ;; "--reference" | "-r") shift REFERENCE=$1 ;; "--device" | "-d") shift DEVICE=$1 ;; "--repo-url") shift REPO_URL="--repo-url $1" ;; *) if [ -n "$COMMAND" ]; then echo "Unknown argument: $1" usage exit 1 fi COMMAND=$1 ;; esac shift done if [ -z "${COMMAND}" ]; then usage exit 1 fi DIR=$(readlink -f $(dirname $0)) if [ -n "${REFERENCE}" ]; then REFERENCE="--reference $(readlink -f ${REFERENCE})" fi if [ -z "${REPO_URL}" ]; then REPO_URL="--repo-url git://github.com/theqtcompany/git-repo" fi get_repo() { REPO="./repo" if [ -n "$(command -v repo)" ]; then REPO="repo" elif [ ! -x "./repo" ]; then curl -s https://storage.googleapis.com/git-repo-downloads/repo > "./repo" chmod +x ./repo fi } get_groups() { case ${DEVICE} in all) PROJECT_GROUPS="all" ;; apalis-imx6|colibri-imx6|colibri-vf) PROJECT_GROUPS="toradex" ;; imx53qsb|imx6qsabresd|imx6dlsabresd|nitrogen6x|smarc-samx6i) PROJECT_GROUPS="fsl" ;; tibidabo) PROJECT_GROUPS="architech" ;; beagleboard|am335x-evm) PROJECT_GROUPS="ti" ;; beaglebone) PROJECT_GROUPS="bbb" ;; raspberrypi|raspberrypi2) PROJECT_GROUPS="rpi" ;; nuc) PROJECT_GROUPS="nuc" ;; nvidia-logan) PROJECT_GROUPS="nvidia-logan" ;; emulator) PROJECT_GROUPS="emulator" ;; *) echo "Unknown device configuration, including all meta layers" PROJECT_GROUPS="all" ;; esac PROJECT_GROUPS="${PROJECT_GROUPS} default" } list_devices() { echo "Available device configurations:" for device in $(ls $DIR/conf/distro/include/*.conf); do echo " $(basename ${device%%.conf})" done } mirror() { mkdir -p .repo/manifests cp ${DIR}/scripts/manifest.xml .repo/manifests/ MANIFEST="manifest.xml" ${REPO} init ${REPO_URL} -u ${PWD}/.repo/repo -b default -m ${MANIFEST} -g all --mirror ${REPO} sync } init() { if [ -z "${DEVICE}" ]; then echo "device not defined" usage exit 1 fi get_groups mkdir -p .repo/manifests rm -f .repo/manifests/manifest*.xml cp ${DIR}/scripts/manifest*.xml .repo/manifests if [ -f .repo/manifests/manifest_${DEVICE}.xml ]; then MANIFEST="manifest_${DEVICE}.xml" else MANIFEST="manifest.xml" fi ${REPO} init ${REPO_URL} -u ${PWD}/.repo/repo -b default -m ${MANIFEST} -g "${PROJECT_GROUPS}" ${REFERENCE} ${REPO} sync if [ ! -e "sources/meta-b2qt" ]; then ln -s ${DIR} sources/meta-b2qt fi if [ ! -e "sources/meta-qt5" ] && [ -e "${DIR}/../meta-qt5" ]; then ln -s $(readlink -f ${DIR}/../meta-qt5) sources/meta-qt5 fi cp ${DIR}/scripts/setup-environment.sh . } get_repo case "$COMMAND" in "init") init ;; "mirror") mirror ;; "list-devices") list_devices ;; *) echo "Unknown command" usage exit 1 ;; esac