diff options
Diffstat (limited to 'meta-boot2qt/classes/qbsp.bbclass')
-rw-r--r-- | meta-boot2qt/classes/qbsp.bbclass | 174 |
1 files changed, 174 insertions, 0 deletions
diff --git a/meta-boot2qt/classes/qbsp.bbclass b/meta-boot2qt/classes/qbsp.bbclass new file mode 100644 index 0000000..da790bf --- /dev/null +++ b/meta-boot2qt/classes/qbsp.bbclass | |||
@@ -0,0 +1,174 @@ | |||
1 | ############################################################################ | ||
2 | ## | ||
3 | ## Copyright (C) 2016 The Qt Company Ltd. | ||
4 | ## Contact: https://www.qt.io/licensing/ | ||
5 | ## | ||
6 | ## This file is part of the Boot to Qt meta layer. | ||
7 | ## | ||
8 | ## $QT_BEGIN_LICENSE:GPL$ | ||
9 | ## Commercial License Usage | ||
10 | ## Licensees holding valid commercial Qt licenses may use this file in | ||
11 | ## accordance with the commercial license agreement provided with the | ||
12 | ## Software or, alternatively, in accordance with the terms contained in | ||
13 | ## a written agreement between you and The Qt Company. For licensing terms | ||
14 | ## and conditions see https://www.qt.io/terms-conditions. For further | ||
15 | ## information use the contact form at https://www.qt.io/contact-us. | ||
16 | ## | ||
17 | ## GNU General Public License Usage | ||
18 | ## Alternatively, this file may be used under the terms of the GNU | ||
19 | ## General Public License version 3 or (at your option) any later version | ||
20 | ## approved by the KDE Free Qt Foundation. The licenses are as published by | ||
21 | ## the Free Software Foundation and appearing in the file LICENSE.GPL3 | ||
22 | ## included in the packaging of this file. Please review the following | ||
23 | ## information to ensure the GNU General Public License requirements will | ||
24 | ## be met: https://www.gnu.org/licenses/gpl-3.0.html. | ||
25 | ## | ||
26 | ## $QT_END_LICENSE$ | ||
27 | ## | ||
28 | ############################################################################ | ||
29 | |||
30 | inherit meta nopackages abi-arch | ||
31 | |||
32 | FILESEXTRAPATHS_prepend := "${B2QTBASE}/files/qbsp:" | ||
33 | |||
34 | SRC_URI = "\ | ||
35 | file://base_package.xml \ | ||
36 | file://image_package.xml \ | ||
37 | file://toolchain_package.xml \ | ||
38 | file://toolchain_installscript.qs \ | ||
39 | file://license_package.xml \ | ||
40 | file://NXP-EULA \ | ||
41 | " | ||
42 | |||
43 | INHIBIT_DEFAULT_DEPS = "1" | ||
44 | do_qbsp[depends] += "\ | ||
45 | p7zip-native:do_populate_sysroot \ | ||
46 | installer-framework-native:do_populate_sysroot \ | ||
47 | ${QBSP_SDK_TASK}:do_populate_sdk \ | ||
48 | ${QBSP_IMAGE_TASK}:do_image_complete \ | ||
49 | " | ||
50 | |||
51 | QBSP_VERSION ?= "${PV}${VERSION_AUTO_INCREMENT}" | ||
52 | QBSP_INSTALLER_COMPONENT ?= "${@d.getVar('MACHINE', True).replace('-','')}" | ||
53 | QBSP_INSTALL_PATH ?= "/Extras/${MACHINE}" | ||
54 | |||
55 | QBSP_LICENSE_FILE ?= "" | ||
56 | QBSP_LICENSE_NAME ?= "" | ||
57 | QBSP_LICENSE_FILE_imx = "NXP-EULA" | ||
58 | QBSP_LICENSE_NAME_imx = "NXP Semiconductors Software License Agreement" | ||
59 | |||
60 | VERSION_AUTO_INCREMENT = "-${DATETIME}" | ||
61 | VERSION_AUTO_INCREMENT[vardepsexclude] = "DATETIME" | ||
62 | |||
63 | DEPLOY_CONF_NAME ?= "${MACHINE}" | ||
64 | RELEASEDATE = "${@time.strftime('%Y-%m-%d',time.gmtime())}" | ||
65 | |||
66 | IMAGE_PACKAGE = "${QBSP_IMAGE_TASK}-${MACHINE}.7z" | ||
67 | SDK_NAME = "${DISTRO}-${SDK_MACHINE}-${QBSP_SDK_TASK}-${MACHINE}.${SDK_POSTFIX}" | ||
68 | SDK_POSTFIX = "sh" | ||
69 | SDK_POSTFIX_sdkmingw32 = "7z" | ||
70 | REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}" | ||
71 | SDK_MACHINE = "${@d.getVar('SDKMACHINE', True) or '${SDK_ARCH}'}" | ||
72 | |||
73 | B = "${WORKDIR}/build" | ||
74 | |||
75 | patch_installer_files() { | ||
76 | LICENSE_DEPENDENCY="" | ||
77 | if [ -n "${QBSP_LICENSE_FILE}" ]; then | ||
78 | LICENSE_DEPENDENCY="${QBSP_INSTALLER_COMPONENT}.license" | ||
79 | fi | ||
80 | |||
81 | sed -e "s#@NAME@#${QBSP_NAME}#" \ | ||
82 | -e "s#@TARGET@#${DEPLOY_CONF_NAME}#" \ | ||
83 | -e "s#@VERSION@#${QBSP_VERSION}#" \ | ||
84 | -e "s#@RELEASEDATE@#${RELEASEDATE}#" \ | ||
85 | -e "s#@MACHINE@#${MACHINE}#" \ | ||
86 | -e "s#@SYSROOT@#${REAL_MULTIMACH_TARGET_SYS}#" \ | ||
87 | -e "s#@TARGET_SYS@#${TARGET_SYS}#" \ | ||
88 | -e "s#@ABI@#${ABI}#" \ | ||
89 | -e "s#@INSTALLPATH@#${QBSP_INSTALL_PATH}#" \ | ||
90 | -e "s#@SDKPATH@#${SDKPATH}#" \ | ||
91 | -e "s#@SDKFILE@#${SDK_NAME}#" \ | ||
92 | -e "s#@LICENSEDEPENDENCY@#${LICENSE_DEPENDENCY}#" \ | ||
93 | -e "s#@LICENSEFILE@#${QBSP_LICENSE_FILE}#" \ | ||
94 | -e "s#@LICENSENAME@#${QBSP_LICENSE_NAME}#" \ | ||
95 | -i ${1}/* | ||
96 | } | ||
97 | |||
98 | prepare_qbsp() { | ||
99 | # Toolchain component | ||
100 | COMPONENT_PATH="${B}/pkg/${QBSP_INSTALLER_COMPONENT}.toolchain" | ||
101 | mkdir -p ${COMPONENT_PATH}/meta | ||
102 | mkdir -p ${COMPONENT_PATH}/data | ||
103 | |||
104 | cp ${WORKDIR}/toolchain_package.xml ${COMPONENT_PATH}/meta/package.xml | ||
105 | cp ${WORKDIR}/toolchain_installscript.qs ${COMPONENT_PATH}/meta/installscript.qs | ||
106 | patch_installer_files ${COMPONENT_PATH}/meta | ||
107 | |||
108 | mkdir -p ${B}/toolchain/${QBSP_INSTALL_PATH}/toolchain | ||
109 | if [ "${SDK_POSTFIX}" = "7z" ]; then | ||
110 | 7zr x ${DEPLOY_DIR}/sdk/${SDK_NAME} -o${B}/toolchain/${QBSP_INSTALL_PATH}/toolchain/ | ||
111 | else | ||
112 | cp ${DEPLOY_DIR}/sdk/${SDK_NAME} ${B}/toolchain/${QBSP_INSTALL_PATH}/toolchain/ | ||
113 | fi | ||
114 | |||
115 | cd ${B}/toolchain | ||
116 | 7zr a ${COMPONENT_PATH}/data/toolchain.7z * | ||
117 | |||
118 | # Image component | ||
119 | COMPONENT_PATH="${B}/pkg/${QBSP_INSTALLER_COMPONENT}.system" | ||
120 | mkdir -p ${COMPONENT_PATH}/meta | ||
121 | mkdir -p ${COMPONENT_PATH}/data | ||
122 | |||
123 | cp ${WORKDIR}/image_package.xml ${COMPONENT_PATH}/meta/package.xml | ||
124 | patch_installer_files ${COMPONENT_PATH}/meta | ||
125 | |||
126 | mkdir -p ${B}/images/${QBSP_INSTALL_PATH}/images | ||
127 | 7zr x ${DEPLOY_DIR_IMAGE}/${IMAGE_PACKAGE} -o${B}/images/${QBSP_INSTALL_PATH}/images/ | ||
128 | |||
129 | cd ${B}/images | ||
130 | 7zr a ${COMPONENT_PATH}/data/image.7z * | ||
131 | |||
132 | # License component | ||
133 | if [ -n "${QBSP_LICENSE_FILE}" ]; then | ||
134 | COMPONENT_PATH="${B}/pkg/${QBSP_INSTALLER_COMPONENT}.license" | ||
135 | mkdir -p ${COMPONENT_PATH}/meta | ||
136 | |||
137 | cp ${WORKDIR}/license_package.xml ${COMPONENT_PATH}/meta/package.xml | ||
138 | cp ${WORKDIR}/${QBSP_LICENSE_FILE} ${COMPONENT_PATH}/meta/ | ||
139 | patch_installer_files ${COMPONENT_PATH}/meta | ||
140 | fi | ||
141 | |||
142 | # Base component | ||
143 | COMPONENT_PATH="${B}/pkg/${QBSP_INSTALLER_COMPONENT}" | ||
144 | mkdir -p ${COMPONENT_PATH}/meta | ||
145 | |||
146 | cp ${WORKDIR}/base_package.xml ${COMPONENT_PATH}/meta/package.xml | ||
147 | patch_installer_files ${COMPONENT_PATH}/meta | ||
148 | } | ||
149 | |||
150 | create_qbsp() { | ||
151 | prepare_qbsp | ||
152 | |||
153 | # Repository creation | ||
154 | repogen -p ${B}/pkg ${B}/repository | ||
155 | |||
156 | mkdir -p ${DEPLOY_DIR}/qbsp | ||
157 | rm -f ${DEPLOY_DIR}/qbsp/${PN}-${SDK_MACHINE}-${MACHINE}.qbsp | ||
158 | |||
159 | cd ${B}/repository | ||
160 | 7zr a ${DEPLOY_DIR}/qbsp/${PN}-${SDK_MACHINE}-${MACHINE}.qbsp * | ||
161 | } | ||
162 | |||
163 | python do_qbsp() { | ||
164 | bb.build.exec_func('create_qbsp', d) | ||
165 | } | ||
166 | |||
167 | addtask qbsp after do_unpack before do_build | ||
168 | |||
169 | do_qbsp[cleandirs] += "${B}" | ||
170 | |||
171 | do_configure[noexec] = "1" | ||
172 | do_compile[noexec] = "1" | ||
173 | do_populate_sysroot[noexec] = "1" | ||
174 | do_populate_lic[noexec] = "1" | ||