2020-06-02 16:03:18 -05:00
|
|
|
# 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
|
2020-11-02 09:31:27 -06:00
|
|
|
echo "LIBUSB1_SRC=$PWD/libusb-${LIBUSB1_VER}" >> $GITHUB_ENV
|
2020-06-02 16:03:18 -05:00
|
|
|
- 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
|
2020-11-02 09:31:27 -06:00
|
|
|
echo "HIDAPI_SRC=$PWD" >> $GITHUB_ENV
|
2020-06-02 16:03:18 -05:00
|
|
|
- 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
|
2020-11-02 09:31:27 -06:00
|
|
|
echo "LIBFTDI_SRC=$PWD/libftdi1-${LIBFTDI_VER}" >> $GITHUB_ENV
|
2020-11-02 05:58:15 -06:00
|
|
|
- name: Prepare capstone
|
|
|
|
env:
|
|
|
|
CAPSTONE_VER: 4.0.2
|
|
|
|
run: |
|
|
|
|
mkdir -p $DL_DIR && cd $DL_DIR
|
|
|
|
CAPSTONE_NAME=${CAPSTONE_VER}
|
|
|
|
CAPSTONE_FOLDER=capstone-${CAPSTONE_VER}
|
|
|
|
wget "https://github.com/aquynh/capstone/archive/${CAPSTONE_VER}.tar.gz"
|
|
|
|
tar -xzf ${CAPSTONE_VER}.tar.gz
|
|
|
|
echo "CAPSTONE_SRC=$PWD/capstone-${CAPSTONE_VER}" >> $GITHUB_ENV
|
2020-06-02 16:03:18 -05:00
|
|
|
- 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"
|
2020-11-02 05:58:15 -06:00
|
|
|
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no"
|
2020-06-02 16:03:18 -05:00
|
|
|
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 *
|
2020-11-02 09:31:27 -06:00
|
|
|
echo "ARTIFACT_NAME=$ARTIFACT" >> $GITHUB_ENV
|
|
|
|
echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV
|
2020-06-02 16:03:18 -05:00
|
|
|
- name: Publish OpenOCD packaged for windows
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: ${{ env.ARTIFACT_NAME }}
|
|
|
|
path: ${{ env.ARTIFACT_PATH }}
|
2021-01-31 17:18:14 -06:00
|
|
|
- name: Create Release
|
|
|
|
id: create_release
|
2020-06-02 16:03:18 -05:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2021-01-31 17:18:14 -06:00
|
|
|
uses: actions/create-release@v1.1.4
|
2020-06-02 16:03:18 -05:00
|
|
|
env:
|
2021-01-31 17:18:14 -06:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
tag_name: ${{ github.ref }}
|
|
|
|
release_name: ${{ github.ref }}
|
|
|
|
draft: false
|
|
|
|
prerelease: false
|
2020-06-02 16:03:18 -05:00
|
|
|
- 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:
|
2021-01-31 17:18:14 -06:00
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2020-06-02 16:03:18 -05:00
|
|
|
asset_path: ${{ env.ARTIFACT_PATH }}
|
|
|
|
asset_name: ${{ env.ARTIFACT_NAME }}
|
|
|
|
asset_content_type: application/gzip
|