aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Carr2016-01-25 16:58:13 -0800
committerDonald Carr2016-01-25 19:02:42 -0800
commit21746b5b43bc5cf58bb8c9ff9c14cf0f9ca720c8 (patch)
treed393ca5f53d6a9ed88e810fb3b43ff4ac836a041
parent82fc4ab3145422692fc5cb021f052a6d72f030a8 (diff)
downloadaur-21746b5b43bc5cf58bb8c9ff9c14cf0f9ca720c8.tar.gz
Move hard coded vars out of qpi.install and into PKGBUILD
-rw-r--r--PKGBUILD24
-rw-r--r--_qpi.install114
-rw-r--r--qpi.install114
3 files changed, 139 insertions, 113 deletions
diff --git a/PKGBUILD b/PKGBUILD
index c53d1956fbef..c80873e745b1 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -46,9 +46,15 @@ makedepends=("git" "pkgconfig" "gcc")
source=("git://github.com/sirspudd/mkspecs.git" "https://download.qt.io/development_releases/qt/5.6/${_pkgver}/single/${_pipkgname}.tar.gz")
sha256sums=("SKIP" "d69103ec34b3775edfa47581b14ee9a20789d4b0d7d26220fb92f2cd32eb06f9")
options=('!strip')
-install=qpi.install
+_install_script=qpi.install
+_fully_qualified_install_script="${startdir}/${_install_script}"
_device_configure_flags=""
+# Work around the fact we are injecting information into the install script which packaging
+if [[ -n "${startdir}" ]]; then
+ touch ${_fully_qualified_install_script}
+fi
+install=${_install_script}
if $_build_web_engine && [[ ${_piver} = "1" ]]; then
_device_configure_flags="-skip qtwebengine"
@@ -134,10 +140,26 @@ build() {
make
}
+create_install_script()
+{
+ local _fully_qualified_install_script_template="${startdir}/_${_install_script}"
+
+ rm ${_fully_qualified_install_script}
+
+ # populate vars
+ echo "piver=\"${_piver}\"" >> ${_fully_qualified_install_script}
+ echo "_qmakepath=\"${_installprefix}/bin/qmake\"" >> ${_fully_qualified_install_script}
+ echo "_sysroot=\"${_sysroot}\"" >> ${_fully_qualified_install_script}
+
+ cat ${_fully_qualified_install_script_template} >> ${_fully_qualified_install_script}
+}
+
package() {
local _srcdir="${srcdir}/${_pipkgname}"
local _bindir="${_srcdir}-build"
+ create_install_script
+
# cleanup
rm -Rf ${pkgdir}
mkdir -p ${pkgdir}
diff --git a/_qpi.install b/_qpi.install
new file mode 100644
index 000000000000..be6aff9347e4
--- /dev/null
+++ b/_qpi.install
@@ -0,0 +1,114 @@
+# will be injected by toplevel PKGBUILD
+#_piver="1"
+#_qmakepath="/opt/qt-5.6.0-beta-rpi${_piver}/bin/qmake"
+#_sysroot="/mnt/pi"
+
+_sdktool="/usr/libexec/qtcreator/sdktool"
+_devicefamily="raspberrypi"
+_devicename="${_devicefamily}${_piver}"
+_familytext="Raspberry Pi"
+_devicetext="${_familytext} ${_piver}"
+
+setup_toolchain() {
+${_sdktool} addTC \
+ --id "ProjectExplorer.ToolChain.Gcc:${_devicefamily}" \
+ --name "${_familytext} toolchain" \
+ --path /opt/arm-sirspuddarch-linux-gnueabihf/bin/arm-sirspuddarch-linux-gnueabihf-gcc \
+ --abi arm-linux-generic-elf-32bit \
+ --supportedAbis arm-linux-generic-elf-32bit
+
+${_sdktool} addDebugger \
+ --id "${_devicefamily}_gdb" \
+ --name "${_familytext} gdb" \
+ --binary /opt/arm-sirspuddarch-linux-gnueabihf/bin/arm-sirspuddarch-linux-gnueabihf-gdb \
+ --abis arm-linux-generic-elf-32bit \
+ --engine 1
+}
+
+remove_toolchain() {
+#TODO: Don't remove if the other pi package is present
+#Not used at present
+${_sdktool} rmTC \
+ --id "ProjectExplorer.ToolChain.Gcc:${_devicefamily}"
+
+${_sdktool} rmDebugger \
+ --id "${_devicefamily}_gdb"
+}
+
+remove_kit() {
+${_sdktool} rmQt \
+ --id "${_devicename}_qt"
+
+${_sdktool} rmKit \
+ --id "${_devicename}_kit"
+
+${_sdktool} rmDev \
+ --id "${_devicename}_device"
+}
+
+setup_kit() {
+ remove_kit
+ setup_toolchain
+
+${_sdktool} addDev \
+ --id "${_devicename}_device" \
+ --name "${_devicetext}" \
+ --host "qpi${_piver}.local" \
+ --uname "root" \
+ --password "root" \
+ --osType "GenericLinuxOsType" \
+ --type 0 \
+ --sshPort 22 \
+ --freePorts "10000-10100"
+
+${_sdktool} addQt \
+ --id "${_devicename}_qt" \
+ --name "${_devicetext} Qt" \
+ --qmake ${_qmakepath} \
+ --type RemoteLinux.EmbeddedLinuxQt
+
+${_sdktool} addKit \
+ --id "${_devicename}_kit" \
+ --name "${_devicetext} Kit" \
+ --debugger "${_devicefamily}_gdb" \
+ --devicetype GenericLinuxOsType \
+ --device "${_devicename}_device" \
+ --sysroot ${_sysroot} \
+ --toolchain "ProjectExplorer.ToolChain.Gcc:${_devicefamily}" \
+ --qt "${_devicename}_qt" \
+ --mkspec "devices/linux-rpi${_piver}-g++"
+}
+
+## arg 1: the new package version
+pre_install() {
+ echo ""
+}
+
+## arg 1: the new package version
+post_install() {
+ setup_kit
+}
+#post_install
+
+## arg 1: the new package version
+## arg 2: the old package version
+pre_upgrade() {
+ echo ""
+}
+
+## arg 1: the new package version
+## arg 2: the old package version
+post_upgrade() {
+ setup_kit
+}
+
+## arg 1: the old package version
+pre_remove() {
+ echo ""
+}
+#pre_remove
+
+## arg 1: the old package version
+post_remove() {
+ remove_kit
+}
diff --git a/qpi.install b/qpi.install
index e10af3298c8f..b78a688b70ed 100644
--- a/qpi.install
+++ b/qpi.install
@@ -1,112 +1,2 @@
-_piver="1"
-_sdktool="/usr/libexec/qtcreator/sdktool"
-_devicefamily="raspberrypi"
-_devicename="${_devicefamily}${_piver}"
-_familytext="Raspberry Pi"
-_devicetext="${_familytext} ${_piver}"
-_qmakepath="/opt/qt-5.6.0-beta-rpi${_piver}/bin/qmake"
-_sysroot="/mnt/pi"
-
-setup_toolchain() {
-${_sdktool} addTC \
- --id "ProjectExplorer.ToolChain.Gcc:${_devicefamily}" \
- --name "${_familytext} toolchain" \
- --path /opt/arm-sirspuddarch-linux-gnueabihf/bin/arm-sirspuddarch-linux-gnueabihf-gcc \
- --abi arm-linux-generic-elf-32bit \
- --supportedAbis arm-linux-generic-elf-32bit
-
-${_sdktool} addDebugger \
- --id "${_devicefamily}_gdb" \
- --name "${_familytext} gdb" \
- --binary /opt/arm-sirspuddarch-linux-gnueabihf/bin/arm-sirspuddarch-linux-gnueabihf-gdb \
- --abis arm-linux-generic-elf-32bit \
- --engine 1
-}
-
-remove_toolchain() {
-#TODO: Don't remove if the other pi package is present
-#Not used at present
-${_sdktool} rmTC \
- --id "ProjectExplorer.ToolChain.Gcc:${_devicefamily}"
-
-${_sdktool} rmDebugger \
- --id "${_devicefamily}_gdb"
-}
-
-remove_kit() {
-${_sdktool} rmQt \
- --id "${_devicename}_qt"
-
-${_sdktool} rmKit \
- --id "${_devicename}_kit"
-
-${_sdktool} rmDev \
- --id "${_devicename}_device"
-}
-
-setup_kit() {
- remove_kit
- setup_toolchain
-
-${_sdktool} addDev \
- --id "${_devicename}_device" \
- --name "${_devicetext}" \
- --host "qpi${_piver}.local" \
- --uname "root" \
- --password "root" \
- --osType "GenericLinuxOsType" \
- --type 0 \
- --sshPort 22 \
- --freePorts "10000-10100"
-
-${_sdktool} addQt \
- --id "${_devicename}_qt" \
- --name "${_devicetext} Qt" \
- --qmake ${_qmakepath} \
- --type RemoteLinux.EmbeddedLinuxQt
-
-${_sdktool} addKit \
- --id "${_devicename}_kit" \
- --name "${_devicetext} Kit" \
- --debugger "${_devicefamily}_gdb" \
- --devicetype GenericLinuxOsType \
- --device "${_devicename}_device" \
- --sysroot ${_sysroot} \
- --toolchain "ProjectExplorer.ToolChain.Gcc:${_devicefamily}" \
- --qt "${_devicename}_qt" \
- --mkspec "devices/linux-rpi${_piver}-g++"
-}
-
-## arg 1: the new package version
-pre_install() {
- echo ""
-}
-
-## arg 1: the new package version
-post_install() {
- setup_kit
-}
-#post_install
-
-## arg 1: the new package version
-## arg 2: the old package version
-pre_upgrade() {
- echo ""
-}
-
-## arg 1: the new package version
-## arg 2: the old package version
-post_upgrade() {
- setup_kit
-}
-
-## arg 1: the old package version
-pre_remove() {
- echo ""
-}
-#pre_remove
-
-## arg 1: the old package version
-post_remove() {
- remove_kit
-}
+# This is a dummy file; pkgman insists on its existence
+# despite the fact I want it to contain variables defined once, in the PKGBUILD