diff options
author | Tarek BOCHKATI <tarek.bouchkati@gmail.com> | 2020-11-02 16:12:11 +0100 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2020-11-07 20:51:18 +0000 |
commit | 25e1c0f4c054eef25d1b9ad2507ee33faa05b345 (patch) | |
tree | e209028a903e393ba93edb37a624e99f98667308 | |
parent | 990a01b70203a512b120e562dd991c29ee9201b2 (diff) | |
download | riscv-openocd-25e1c0f4c054eef25d1b9ad2507ee33faa05b345.zip riscv-openocd-25e1c0f4c054eef25d1b9ad2507ee33faa05b345.tar.gz riscv-openocd-25e1c0f4c054eef25d1b9ad2507ee33faa05b345.tar.bz2 |
contrib/cross-build.sh: build capstone from source
tested with capstone 4.0.2, with the following options
CAPSTONE_CONFIG="CAPSTONE_ARCHS=arm,aarch64
CAPSTONE_BUILD_CORE_ONLY=yes
CAPSTONE_STATIC=yes
CAPSTONE_SHARED=no"
Change-Id: I40297772664e85c3d0f9358c85bfd901b5eba8b1
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5914
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
-rwxr-xr-x | contrib/cross-build.sh | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/contrib/cross-build.sh b/contrib/cross-build.sh index 821d48e..8b31a3f 100755 --- a/contrib/cross-build.sh +++ b/contrib/cross-build.sh @@ -14,8 +14,8 @@ # paths refer to the build file system. # # This script is probably more useful as a reference than as a complete build -# tool but for some configurations it may be usable as-is. It only cross- -# builds libusb-1.0, hidapi and libftdi from source, but the script can be +# tool but for some configurations it may be usable as-is. It only cross-builds +# libusb-1.0, hidapi, libftdi and capstone from source, but the script can be # extended to build other prerequisites in a similar manner. # # Usage: @@ -39,17 +39,20 @@ WORK_DIR=$PWD : ${LIBUSB1_SRC:=/path/to/libusb1} : ${HIDAPI_SRC:=/path/to/hidapi} : ${LIBFTDI_SRC:=/path/to/libftdi} +: ${CAPSTONE_SRC:=/path/to/capstone} OPENOCD_SRC=`readlink -m $OPENOCD_SRC` LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC` HIDAPI_SRC=`readlink -m $HIDAPI_SRC` LIBFTDI_SRC=`readlink -m $LIBFTDI_SRC` +CAPSTONE_SRC=`readlink -m $CAPSTONE_SRC` HOST_TRIPLET=$1 BUILD_DIR=$WORK_DIR/$HOST_TRIPLET-build LIBUSB1_BUILD_DIR=$BUILD_DIR/libusb1 HIDAPI_BUILD_DIR=$BUILD_DIR/hidapi LIBFTDI_BUILD_DIR=$BUILD_DIR/libftdi +CAPSTONE_BUILD_DIR=$BUILD_DIR/capstone OPENOCD_BUILD_DIR=$BUILD_DIR/openocd ## Root of host file tree @@ -129,6 +132,26 @@ if [ -d $LIBFTDI_SRC ] ; then make install DESTDIR=$SYSROOT fi +# capstone build & install into sysroot +if [ -d $CAPSTONE_SRC ] ; then + mkdir -p $CAPSTONE_BUILD_DIR + cd $CAPSTONE_BUILD_DIR + cp -r $CAPSTONE_SRC/* . + make install DESTDIR=$SYSROOT PREFIX=$PREFIX \ + CROSS="${HOST_TRIPLET}-" \ + $CAPSTONE_CONFIG + # fix the generated capstone.pc + CAPSTONE_PC_FILE=${SYSROOT}${PREFIX}/lib/pkgconfig/capstone.pc + sed -i '/^libdir=/d' $CAPSTONE_PC_FILE + sed -i '/^includedir=/d' $CAPSTONE_PC_FILE + sed -i '/^archive=/d' $CAPSTONE_PC_FILE + sed -i '1s;^;prefix=/usr \ +exec_prefix=${prefix} \ +libdir=${exec_prefix}/lib \ +includedir=${prefix}/include\n\n;' $CAPSTONE_PC_FILE +fi + + # OpenOCD build & install into sysroot mkdir -p $OPENOCD_BUILD_DIR cd $OPENOCD_BUILD_DIR |