summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD202
1 files changed, 146 insertions, 56 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 83665f94cafa..7faee9f88355 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,12 +1,12 @@
# Maintainer: Alexei Colin <ac at alexeicolin dot com>
-# NOTE: GUI is needed to run this, because top-level installer
-# does not forward '--unattended" to the nested installers it
-# invokes, hence those installers generate a GUI box. Parent
-# installer fails if run headless.
+# NOTE: GUI is needed to run this, because top-level installer does not forward
+# '--unattended" to the nested installers it invokes, hence those installers
+# generate a GUI box. Parent installer fails if run headless.
pkgname=ti-ble-sdk
pkgver=2.02.02.25
+_pkgver=2_02_02_25
pkgrel=1
pkgdesc="Texas Instruments BLE Stack for CC2640/CC2650/CC1350"
arch=('x86_64')
@@ -14,47 +14,27 @@ url="http://www.ti.com/tool/ble-stack"
license=('custom:LPRF')
makedepends=('wine')
-depends=('python2-lxml')
+depends=('python2-lxml' 'ti-rtos-cc13xx-cc26xx')
optdepends=('ccstudio' 'ti-cgt-arm')
+install=$pkgname.install
-_bundle=ble_sdk_2_02_02_25
+_bundle=ble_sdk_${_pkgver}
_installer=${_bundle}_setup.exe
# Installer mirrored on IPFS
-#_ble_sdk_ipfs_hash=QmRqD824vXr3eEDKEUdRzefZ7UGZXrNjw2VmsSyhgRLiJm
-_ble_sdk_ipfs_hash=QmWzstCsjpLxkTvH3EtihPR2MQiFvcJohfXYVMdnz9YBjH
+_ipfs_hash=QmWzstCsjpLxkTvH3EtihPR2MQiFvcJohfXYVMdnz9YBjH
# Alternatively, to download from TI, you need a download key, which
# you can get by following the upstram link above and clicking through
# _key=KS6V9FEICJSWPWYWAYHF6X6UQ542PAFS
-# This particular version of TI-RTOS is installed by this PKGBUILD
-# because the path patch applies to both of them.
-#_tirtos_installer=tirtos_cc13xx_cc26xx_setuplinux_2_20_01_08.bin
-#_tirtos_ipfs_hash=QmYfnTW3p4Pk2EybdUaKaemG2a9xQ5keCGbDSQhM4PzFM2
-_tirtos_installer=tirtos_cc13xx_cc26xx_setuplinux_2_21_01_08.bin
-_tirtos_ipfs_hash=QmXWp5HwPfawjchpvAmsfAn5553FCZYTXVwps3H29imABN
-
-
-# NOTE: patch is compressed because of AUR's 250KB limit
-
source=(# Requires you to open webpage in browser to get download key
#"http://software-dl.ti.com/download/lprf/${_key}/${_installer}"
# Alternative source for same file that does not require key and does not 404 after updates
- #"https://gateway.ipfs.io/ipfs/${_ble_sdk_ipfs_hash}/${_installer}"
+ #"https://gateway.ipfs.io/ipfs/${_ipfs_hash}/${_installer}"
# Alternative source via a different IPFS gateway
- #"http://ipfs.alexeicolin.com:8080/ipfs/${_ble_sdk_ipfs_hash}/${_installer}"
- "http://camus:8080/ipfs/${_ble_sdk_ipfs_hash}/${_installer}"
-
- #"http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/2_20_01_08/exports/${_tirtos_installer}"
- # Alternative source for same file
- #"https://gateway.ipfs.io/ipfs/${_tirtos_ipfs_hash}/${_tirtos_installer}"
- # Alternative source via a different IPFS gateway
- #"http://ipfs.alexeicolin.com:8080/ipfs/${_tirtos_ipfs_hash}/${_tirtos_installer}"
- "http://camus:8080/ipfs/${_tirtos_ipfs_hash}/${_tirtos_installer}"
-
- "fix-paths-for-linux.patch.xz"
- "fix-example-projects-import.patch")
+ #"http://ipfs.alexeicolin.com:8080/ipfs/${_ipfs_hash}/${_installer}"
+ "http://camus:8080/ipfs/${_ipfs_hash}/${_installer}")
options=(!strip libtool staticlibs emptydirs !purge !zipman)
@@ -66,45 +46,155 @@ _destdir=opt
_installdir=installdir
_installpath=$_installdir/$_destdir/$_ccsdir
-prepare() {
- cd $srcdir
-}
-
build() {
- cd $srcdir
-
- chmod +x ./${_tirtos_installer}
- ./${_tirtos_installer} --mode unattended --prefix $srcdir/${_installpath}
+ cd $srcdir
- echo ">>> Running Windows installer via wine. When prompted, CANCEL the install"
- echo ">>> of TI RTOS. It will be installed automatically from Linux installer."
+ echo ">>> Running Windows installer via wine. When prompted:"
+ echo ">>> * CANCEL installation of Mono for .NET Framework (not needed)"
+ echo ">>> * CANCEL installation of Gecko (not needed)"
+ echo ">>> * CANCEL the install of TI RTOS (it was installed automatically as a package dependency)"
+ echo ">>> * IGNORE error about dotNetFx"
WINEPREFIX=$srcdir/$_winedir wine $srcdir/${_installer} \
--mode unattended --prefix $srcdir/${_installpath} 1> wine.log 2>&1
+}
- # Fix paths (case, etc), patch generated using, find cmd from the script:
- # https://github.com/jcormier/TI_BLE_CC2650_Linux_Convert
- #patch -p1 -d ${_installpath} < $srcdir/fix-paths-for-linux.patch
- find ${_installpath}/${_bundle} -name "board\.h" | sed -e "p;s/board.h/Board.h/" | xargs -n2 mv
+_run() {
+ echo "$@"
+ "$@"
+}
- # Patch that makes the example projects importable and buildable:
- # * fixes dependency on the XDC and TI-RTOS products
- # * fixes refs to files generated by 'stack' project from 'app' project
- # * lets the imported copy build without it attempting to modify the source copy
- # (which is owned by root).
- # TODO: currently, only cc2650lp/simple_broadcaster example is patched
- #patch -p1 -d ${_installpath}/${_bundle} < $srcdir/fix-example-projects-import.patch
+# Credit: https://github.com/jcormier/TI_BLE_CC2650_Linux_Convert
+function _replace_text_in_ble_sdk {
+ _from="$1"
+ _to="$2"
+ shift
+ shift
+ echo -e "Changing $_from to $_to in all ble_sdk source files"
+ echo grep --exclude-dir=".git" --exclude=*.a "$@" -rl "$_from" "${_installpath}" \| xargs sed -i "s#$_from#$_to#g"
+ grep --exclude-dir=".git" --exclude=*.a "$@" -rl "$_from" "${_installpath}" | xargs sed -i "s#$_from#$_to#g"
}
package() {
cd $srcdir
+ # Fix paths (case, etc). Credit: https://github.com/jcormier/TI_BLE_CC2650_Linux_Convert
+
+ # There's an invalid linked location in ${_installpath}/examples/cc2650stk/sensortag_lcd/ccs/app/.project
+ # This is a best guess at what's intended.
+ #_replace_text_in_ble_sdk "SRC_COMMON/hal/src/target/_common/board.h" "SRC_EX/target/Board.h"
+
+ # Use Board.h consistently in the ble stack instead of a mixture of board.h and Board.h.
+ # The tirtos uses Board.h consistently so we'll assume that's correct.
+ _replace_text_in_ble_sdk "\\\"board\\.h" "\\\"Board.h"
+ _replace_text_in_ble_sdk "\\/board\\.h" "\\/Board.h"
+ #_replace_text_in_ble_sdk "<board\\.h" "<Board.h"
+
+ # We have to rename some files in the ble stack for this to work.
+ echo find ${_installpath} -name "board\.h" \| sed -e "p;s/board.h/Board.h/" \| xargs -n2 mv
+ find ${_installpath} -name "board\.h" | sed -e "p;s/board.h/Board.h/" | xargs -n2 mv
+
+ # Fix a few places where the include directives or references don't match the file's case.
+ _replace_text_in_ble_sdk "DisplayUART\\.h" "DisplayUart.h"
+ _replace_text_in_ble_sdk "DisplayUART\\.c" "DisplayUart.c"
+ _replace_text_in_ble_sdk "hal_UART\\.h" "hal_uart.h"
+ _replace_text_in_ble_sdk "ICall\\.h" "icall.h"
+ _replace_text_in_ble_sdk "OSAL\\.h" "osal.h"
+ _replace_text_in_ble_sdk "OSAL_Tasks\\.h" "osal_tasks.h"
+ _replace_text_in_ble_sdk "OSAL_Memory\\.h" "osal_memory.h"
+ _replace_text_in_ble_sdk "OSAL_Timers\\.h" "osal_timers.h"
+ _replace_text_in_ble_sdk "ti/drivers/rf/rf.h" "ti/drivers/rf/RF.h"
+ _replace_text_in_ble_sdk "sensorTag\\.h" "sensortag.h"
+ _replace_text_in_ble_sdk "sensortag_Display\\.h" "sensortag_display.h"
+ _replace_text_in_ble_sdk "npi_tl_SPI\\.c" "npi_tl_spi.c"
+ _replace_text_in_ble_sdk "npi_tl_SPI\\.h" "npi_tl_spi.h"
+ _replace_text_in_ble_sdk "npi_tl_UART\\.c" "npi_tl_uart.c"
+ _replace_text_in_ble_sdk "npi_tl_UART\\.h" "npi_tl_uart.h"
+ _replace_text_in_ble_sdk "bsp_SPI\\.c" "bsp_spi.c"
+ _replace_text_in_ble_sdk "bsp_SPI\\.h" "bsp_spi.h"
+
+ # The case of driverlib needs to be fixed in both the BLE SDK and the TIRTOS sources
+ _replace_text_in_ble_sdk "driverLib/timer.h" "driverlib/timer.h"
+ #_replace_text_in_tirtos "driverLib\\/timer.h" "driverlib\\/timer.h"
+
+ # Fix absolute Windows paths set for a default wine install by using paths relative to the imported project
+ _replace_text_in_ble_sdk "file:/C:/ti" "\$\{PARENT-6-ORG_PROJ_DIR\}"
+
+ # Some references are broken. This might be caused by copying to the workspace when importing the projects.
+ #_replace_text_in_ble_sdk "PARENT-5-PROJECT_LOC/src/examples/sensortag" "SRC_EX/examples/sensortag"
+ #_replace_text_in_ble_sdk "PARENT-5-PROJECT_LOC/src/profiles/sensor_profile" "SRC_EX/profiles/sensor_profile"
+ #_replace_text_in_ble_sdk "PARENT-1-PROJECT_LOC/config/" "PARENT-2-ORG_PROJ_DIR/ccs/config/"
+
+ # Need forward slashes rather than backslashes in library paths. One is wrong, all the others look OK.
+ #_replace_text_in_ble_sdk "\\\\rom\\\\enc_lib\\\\cc26xx_ecc_rom_api.a" "/rom/enc_lib/cc26xx_ecc_rom_api.a"
+
+ # Running the Windows lib_search executable under wine generates absolute paths with a Z: prefix, so run the python
+ # source directly. Also change backslashes to forward slashes in the searchpath elements that this application uses.
+ _replace_text_in_ble_sdk "&quot;\\\${TOOLS_BLE}/lib_search/lib_search.exe" "python \\&quot;\\\${TOOLS_BLE}/lib_search/src/lib_search.py"
+ _replace_text_in_ble_sdk "\\\${TOOLS_BLE}/frontier/frontier.exe" "python \\\${TOOLS_BLE}/frontier\\/src/frontier.py"
+ _run sed -i "/searchpath/s/\\\\/\\//g" ${_installpath}/${_bundle}/tools/lib_search/params_split_cc2640.xml
+ #_run sed -i "/searchpath/s/\\\\/\\//g" ${_installpath}/${_bundle}/tools/lib_search/params_split_cc1350.xml
+
+ # Build hooks call python scripts using 'python x.py' command, but scripts are Python v2
+ _replace_text_in_ble_sdk "python " "python2 " --include ".cproject"
+
+ # Patch that makes the example projects importable and buildable:
+ # * lets the imported copy build without it attempting to modify the source copy
+ # (which is owned by root).
+ # * fixes refs to files generated by 'stack' project from 'app' project
+
+ _replace_text_in_ble_sdk "PARENT-2-ORG_PROJ_DIR/ccs/config/lib_linker.cmd" "PROJECT_LOC/lib_linker.cmd" --include ".project"
+ _replace_text_in_ble_sdk "\${ORG_PROJ_DIR}[^\" ]\+lib_linker.cmd" "\${PROJECT_LOC}/lib_linker.cmd" --include ".cproject"
+
+ # This one fixes a cryptic error from XDC:
+ # js: "/opt/ccstudio/xdctools_3_32_00_06_core/packages/xdc/template.xs",
+ # line 55: TypeError: # xdc.services.intern.xsr.Value$Obj@a9b3b0c::xdc.runtime.Error is not a function, it is object.
+ _xdcmatch='<tool id="com.ti.rtsc.buildDefinitions.XDC_[0-9.]\+.tool.[0-9]\+" name="XDCtools" superClass="com.ti.rtsc.buildDefinitions.XDC_[0-9.]\+.tool">'
+ _xdcinsert='<option id="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.JAVA_PROPERTIES.1282003423" superClass="com.ti.rtsc.buildDefinitions.XDC_3.16.tool.JAVA_PROPERTIES" valueType="stringList"> ><listOptionValue builtIn="false" value="xdc.cfg.SourceDir.outputDir=&quot;.&quot;"/> ></option>'
+ for _f in $(find ${_installpath}/${_bundle}/examples -path '*ccs/app/.cproject')
+ do
+ _run sed -i "/$_xdcmatch/a $_xdcinsert" $_f
+ done
+
+ # There is a chicken-and-egg problem: stack project link command includes
+ # the .cmd file that is generated by a post-build step of the same stack
+ # project. Second issue is that in the original examples directory these
+ # files are stored outside of either project in a "shared" config/ dir. We
+ # need to copy the files into the stack project, and also change the paths
+ # to them in the .[c]project files, so that these files are copied when the
+ # project is imported into a workspace.
+
+ _autogened="ccs_linker_defines.cmd ccs_compiler_defines.bcfg"
+
+ for _f in $_autogened
+ do
+ for _e in $(find ${_installpath}/${_bundle}/examples -path '*ccs/stack/.project')
+ do
+ _run cp $(dirname $_e)/../config/$_f $(dirname $_e)
+ done
+ done
+
+ for _f in $_autogened lib_linker.cmd
+ do
+ for _e in $(find ${_installpath}/${_bundle}/examples -path '*ccs/stack/.cproject')
+ do
+ _run sed -i "s#\${ORG_PROJ_DIR}/../../ccs/config/$_f#\${PROJECT_LOC}/$_f#g" $_e
+ done
+ for _e in $(find ${_installpath}/${_bundle}/examples -path '*ccs/stack/.project')
+ do
+ _run sed -i "s#PARENT-2-ORG_PROJ_DIR/ccs/config/$_f#PROJECT_LOC/$_f#g" $_e
+ done
+ for _e in $(find ${_installpath}/${_bundle}/examples -path '*ccs/app/.project')
+ do
+ _board="$(echo $_e | cut -d '/' -f 6)"
+ _app="$(echo $_e | cut -d '/' -f 7)"
+ _run sed -i "s#PARENT-2-ORG_PROJ_DIR/ccs/config/$_f#PARENT-1-PROJECT_LOC/${_app}_${_board}_stack/$_f#g" $_e
+ done
+ done
+
cp -al $srcdir/${_installdir}/${_destdir} $pkgdir
install -D -m0644 $srcdir/${_installpath}/${_bundle}/license.txt $pkgdir/usr/share/licenses/$pkgname/LICENSE
}
-sha256sums=('4dfc4e0b86b94ba2fd97b3774e52a10554351c5ffeb6a8fe138f25240e1322b6'
- '95f58837d98983bf24bf8717dc5e0ad1c8d132858f7a7fce1b263037f0e86872'
- '6ebae9f55918381cb15a50a892a141fdcac2e094d2f372e56153a57cc07bff73'
- '811146541ca17c0f3760a0dc405aa76d0cc67346e536aa020c415634dfd3acc3')
+sha256sums=('4dfc4e0b86b94ba2fd97b3774e52a10554351c5ffeb6a8fe138f25240e1322b6')