GitHub: add workflow to provide an openocd snapshot binaries for win32
This change could be used within OpenOCD GitHub forks. Once workflow actions are enabled in the GitHub project, this workflow will be run automatically on each push into OpenOCD. This workflow will provide a neutral build of openocd for win32, then the package will be available for download in Actions section. Note: the artifact will be deleted after 90 day (actual GitHub rules) If the push is a tag, the generated package will be uploaded to release pane under the corresponding release, and it will resides forever. The built openocd enables libusb1, hidapi and libftdi adapters, and could be extended to cover more adapters and Oses PS: ./contrib/cross-build.sh updated to build libftdi from source like libusb1 and hidapi. Change-Id: I290c8aa14a12548e2dcb6a0eee456430ea44ab9f Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5594 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
parent
3934483429
commit
c20f65b632
|
@ -0,0 +1,92 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# Copyright (C) 2020 by Tarek BOUCHKATI <tarek.bouchkati@gmail.com>
|
||||
|
||||
on: push
|
||||
|
||||
name: OpenOCD Snapshot
|
||||
|
||||
jobs:
|
||||
package:
|
||||
runs-on: [ubuntu-18.04]
|
||||
env:
|
||||
DL_DIR: ../downloads
|
||||
BUILD_DIR: ../build
|
||||
steps:
|
||||
- name: Install needed packages
|
||||
run: sudo apt-get install autotools-dev autoconf automake libtool pkg-config cmake texinfo texlive g++-mingw-w64-i686
|
||||
- uses: actions/checkout@v1
|
||||
- run: ./bootstrap
|
||||
- name: Prepare libusb1
|
||||
env:
|
||||
LIBUSB1_VER: 1.0.23
|
||||
run: |
|
||||
mkdir -p $DL_DIR && cd $DL_DIR
|
||||
wget "https://github.com/libusb/libusb/releases/download/v${LIBUSB1_VER}/libusb-${LIBUSB1_VER}.tar.bz2"
|
||||
tar -xjf libusb-${LIBUSB1_VER}.tar.bz2
|
||||
echo "::set-env name=LIBUSB1_SRC::$PWD/libusb-${LIBUSB1_VER}"
|
||||
- name: Prepare hidapi
|
||||
env:
|
||||
HIDAPI_VER: 0.9.0
|
||||
run: |
|
||||
mkdir -p $DL_DIR && cd $DL_DIR
|
||||
wget "https://github.com/libusb/hidapi/archive/hidapi-${HIDAPI_VER}.tar.gz"
|
||||
tar -xzf hidapi-${HIDAPI_VER}.tar.gz
|
||||
cd hidapi-hidapi-${HIDAPI_VER}
|
||||
./bootstrap
|
||||
echo "::set-env name=HIDAPI_SRC::$PWD"
|
||||
- name: Prepare libftdi
|
||||
env:
|
||||
LIBFTDI_VER: 1.4
|
||||
run: |
|
||||
mkdir -p $DL_DIR && cd $DL_DIR
|
||||
wget "http://www.intra2net.com/en/developer/libftdi/download/libftdi1-${LIBFTDI_VER}.tar.bz2"
|
||||
tar -xjf libftdi1-${LIBFTDI_VER}.tar.bz2
|
||||
echo "::set-env name=LIBFTDI_SRC::$PWD/libftdi1-${LIBFTDI_VER}"
|
||||
- name: Package OpenOCD for windows
|
||||
env:
|
||||
MAKE_JOBS: 2
|
||||
HOST: i686-w64-mingw32
|
||||
LIBUSB1_CONFIG: --enable-shared --enable-static
|
||||
HIDAPI_CONFIG: --enable-shared --disable-static --disable-testgui
|
||||
LIBFTDI_CONFIG: "-DCMAKE_TOOLCHAIN_FILE='${{ env.LIBFTDI_SRC }}/cmake/Toolchain-i686-w64-mingw32.cmake' -DBUILD_TESTS:BOOL=off -DFTDIPP:BOOL=off -DPYTHON_BINDINGS:BOOL=off -DEXAMPLES:BOOL=off -DDOCUMENTATION:BOOL=off -DFTDI_EEPROM:BOOL=off"
|
||||
run: |
|
||||
# set snapshot tag
|
||||
OPENOCD_TAG="`git tag --points-at HEAD`"
|
||||
[ -z $OPENOCD_TAG ] && OPENOCD_TAG="`git rev-parse --short HEAD`"
|
||||
# set env and call cross-build.sh
|
||||
export OPENOCD_TAG=$OPENOCD_TAG
|
||||
export OPENOCD_SRC=$PWD
|
||||
export OPENOCD_CONFIG=""
|
||||
mkdir -p $BUILD_DIR && cd $BUILD_DIR
|
||||
bash $OPENOCD_SRC/contrib/cross-build.sh $HOST
|
||||
# add missing dlls
|
||||
cd $HOST-root/usr
|
||||
cp `$HOST-gcc --print-file-name=libwinpthread-1.dll` ./bin/
|
||||
cp `$HOST-gcc --print-file-name=libgcc_s_sjlj-1.dll` ./bin/
|
||||
# prepare the artifact
|
||||
ARTIFACT="openocd-${OPENOCD_TAG}-${HOST}.tar.gz"
|
||||
tar -czf $ARTIFACT *
|
||||
echo "::set-env name=ARTIFACT_NAME::$ARTIFACT"
|
||||
echo "::set-env name=ARTIFACT_PATH::$PWD/$ARTIFACT"
|
||||
- name: Publish OpenOCD packaged for windows
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: ${{ env.ARTIFACT_PATH }}
|
||||
- name: Get the upload URL for a release
|
||||
id: get_release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: bruceadams/get-release@v1.2.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
- name: Release OpenOCD packaged for windows
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ${{ env.ARTIFACT_PATH }}
|
||||
asset_name: ${{ env.ARTIFACT_NAME }}
|
||||
asset_content_type: application/gzip
|
|
@ -15,8 +15,8 @@
|
|||
#
|
||||
# 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 from source, but the script can be extended to build other
|
||||
# prerequisites in a similar manner.
|
||||
# builds libusb-1.0, hidapi and libftdi from source, but the script can be
|
||||
# extended to build other prerequisites in a similar manner.
|
||||
#
|
||||
# Usage:
|
||||
# export LIBUSB1_SRC=/path/to/libusb-1.0
|
||||
|
@ -36,17 +36,20 @@ WORK_DIR=$PWD
|
|||
|
||||
## Source code paths, customize as necessary
|
||||
: ${OPENOCD_SRC:="`dirname "$0"`/.."}
|
||||
: ${LIBUSB1_SRC:=/path/to/libusb}
|
||||
: ${LIBUSB1_SRC:=/path/to/libusb1}
|
||||
: ${HIDAPI_SRC:=/path/to/hidapi}
|
||||
: ${LIBFTDI_SRC:=/path/to/libftdi}
|
||||
|
||||
OPENOCD_SRC=`readlink -m $OPENOCD_SRC`
|
||||
LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC`
|
||||
HIDAPI_SRC=`readlink -m $HIDAPI_SRC`
|
||||
LIBFTDI_SRC=`readlink -m $LIBFTDI_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
|
||||
OPENOCD_BUILD_DIR=$BUILD_DIR/openocd
|
||||
|
||||
## Root of host file tree
|
||||
|
@ -55,8 +58,12 @@ SYSROOT=$WORK_DIR/$HOST_TRIPLET-root
|
|||
## Install location within host file tree
|
||||
: ${PREFIX=/usr}
|
||||
|
||||
## Make parallel jobs
|
||||
: ${MAKE_JOBS:=1}
|
||||
|
||||
## OpenOCD-only install dir for packaging
|
||||
PACKAGE_DIR=$WORK_DIR/openocd_`git --git-dir=$OPENOCD_SRC/.git describe`_$HOST_TRIPLET
|
||||
: ${OPENOCD_TAG:=`git --git-dir=$OPENOCD_SRC/.git describe --tags`}
|
||||
PACKAGE_DIR=$WORK_DIR/openocd_${OPENOCD_TAG}_${HOST_TRIPLET}
|
||||
|
||||
#######
|
||||
|
||||
|
@ -86,13 +93,15 @@ rm -rf $SYSROOT $BUILD_DIR
|
|||
mkdir -p $SYSROOT
|
||||
|
||||
# libusb-1.0 build & install into sysroot
|
||||
mkdir -p $LIBUSB1_BUILD_DIR
|
||||
cd $LIBUSB1_BUILD_DIR
|
||||
$LIBUSB1_SRC/configure --build=`$LIBUSB1_SRC/config.guess` --host=$HOST_TRIPLET \
|
||||
--with-sysroot=$SYSROOT --prefix=$PREFIX \
|
||||
$LIBUSB1_CONFIG
|
||||
make
|
||||
make install DESTDIR=$SYSROOT
|
||||
if [ -d $LIBUSB1_SRC ] ; then
|
||||
mkdir -p $LIBUSB1_BUILD_DIR
|
||||
cd $LIBUSB1_BUILD_DIR
|
||||
$LIBUSB1_SRC/configure --build=`$LIBUSB1_SRC/config.guess` --host=$HOST_TRIPLET \
|
||||
--with-sysroot=$SYSROOT --prefix=$PREFIX \
|
||||
$LIBUSB1_CONFIG
|
||||
make -j $MAKE_JOBS
|
||||
make install DESTDIR=$SYSROOT
|
||||
fi
|
||||
|
||||
# hidapi build & install into sysroot
|
||||
if [ -d $HIDAPI_SRC ] ; then
|
||||
|
@ -101,7 +110,22 @@ if [ -d $HIDAPI_SRC ] ; then
|
|||
$HIDAPI_SRC/configure --build=`$HIDAPI_SRC/config.guess` --host=$HOST_TRIPLET \
|
||||
--with-sysroot=$SYSROOT --prefix=$PREFIX \
|
||||
$HIDAPI_CONFIG
|
||||
make
|
||||
make -j $MAKE_JOBS
|
||||
make install DESTDIR=$SYSROOT
|
||||
fi
|
||||
|
||||
# libftdi build & install into sysroot
|
||||
if [ -d $LIBFTDI_SRC ] ; then
|
||||
mkdir -p $LIBFTDI_BUILD_DIR
|
||||
cd $LIBFTDI_BUILD_DIR
|
||||
# libftdi requires libusb1 static libraries, granted by:
|
||||
# export LIBUSB1_CONFIG="--enable-static ..."
|
||||
cmake $LIBFTDI_CONFIG \
|
||||
-DLIBUSB_INCLUDE_DIR=${SYSROOT}${PREFIX}/include/libusb-1.0 \
|
||||
-DLIBUSB_LIBRARIES=${SYSROOT}${PREFIX}/lib/libusb-1.0.a \
|
||||
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
|
||||
-DPKG_CONFIG_EXECUTABLE=`which pkg-config` \
|
||||
$LIBFTDI_SRC
|
||||
make install DESTDIR=$SYSROOT
|
||||
fi
|
||||
|
||||
|
@ -111,9 +135,10 @@ cd $OPENOCD_BUILD_DIR
|
|||
$OPENOCD_SRC/configure --build=`$OPENOCD_SRC/config.guess` --host=$HOST_TRIPLET \
|
||||
--with-sysroot=$SYSROOT --prefix=$PREFIX \
|
||||
$OPENOCD_CONFIG
|
||||
make
|
||||
make install DESTDIR=$SYSROOT
|
||||
make -j $MAKE_JOBS
|
||||
make install-strip DESTDIR=$SYSROOT
|
||||
|
||||
# Separate OpenOCD install w/o dependencies. OpenOCD will have to be linked
|
||||
# statically or have dependencies packaged/installed separately.
|
||||
make install DESTDIR=$PACKAGE_DIR
|
||||
make install-strip DESTDIR=$PACKAGE_DIR
|
||||
|
||||
|
|
Loading…
Reference in New Issue