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:
|
2023-03-24 18:56:19 -05:00
|
|
|
runs-on: [ubuntu-20.04]
|
2020-06-02 16:03:18 -05:00
|
|
|
env:
|
|
|
|
DL_DIR: ../downloads
|
|
|
|
BUILD_DIR: ../build
|
|
|
|
steps:
|
|
|
|
- name: Install needed packages
|
2021-07-23 00:29:56 -05:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install autotools-dev autoconf automake libtool pkg-config cmake texinfo texlive g++-mingw-w64-i686
|
2021-03-24 15:33:36 -05:00
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v1
|
2020-06-02 16:03:18 -05:00
|
|
|
- run: ./bootstrap
|
|
|
|
- name: Prepare libusb1
|
|
|
|
env:
|
2022-05-23 07:57:16 -05:00
|
|
|
LIBUSB1_VER: 1.0.26
|
2020-06-02 16:03:18 -05:00
|
|
|
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:
|
2023-03-24 18:56:19 -05:00
|
|
|
HIDAPI_VER: 0.13.1
|
2020-06-02 16:03:18 -05:00
|
|
|
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
|
2022-05-30 08:48:06 -05:00
|
|
|
- name: Prepare libftdi
|
|
|
|
env:
|
|
|
|
LIBFTDI_VER: 1.5
|
|
|
|
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 "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
|
2023-03-24 19:00:51 -05:00
|
|
|
- name: Prepare libjaylink
|
|
|
|
env:
|
|
|
|
LIBJAYLINK_VER: 0.3.1
|
|
|
|
run: |
|
|
|
|
mkdir -p $DL_DIR && cd $DL_DIR
|
|
|
|
wget https://gitlab.zapb.de/libjaylink/libjaylink/-/archive/${LIBJAYLINK_VER}/libjaylink-${LIBJAYLINK_VER}.tar.gz
|
|
|
|
tar -xzf libjaylink-${LIBJAYLINK_VER}.tar.gz
|
|
|
|
cd libjaylink-${LIBJAYLINK_VER}
|
|
|
|
./autogen.sh
|
|
|
|
echo "LIBJAYLINK_SRC=$PWD" >> $GITHUB_ENV
|
2020-06-02 16:03:18 -05:00
|
|
|
- name: Package OpenOCD for windows
|
|
|
|
env:
|
|
|
|
MAKE_JOBS: 2
|
|
|
|
HOST: i686-w64-mingw32
|
2021-07-28 04:48:59 -05:00
|
|
|
LIBUSB1_CONFIG: --enable-shared --disable-static
|
2020-06-02 16:03:18 -05:00
|
|
|
HIDAPI_CONFIG: --enable-shared --disable-static --disable-testgui
|
2022-05-30 08:48:06 -05:00
|
|
|
LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
|
2020-11-02 05:58:15 -06:00
|
|
|
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no"
|
2023-03-24 19:00:51 -05:00
|
|
|
LIBJAYLINK_CONFIG: --enable-shared --disable-static
|
2020-06-02 16:03:18 -05:00
|
|
|
run: |
|
2021-03-24 15:33:36 -05:00
|
|
|
# check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG
|
2020-06-02 16:03:18 -05:00
|
|
|
OPENOCD_TAG="`git tag --points-at HEAD`"
|
|
|
|
[ -z $OPENOCD_TAG ] && OPENOCD_TAG="`git rev-parse --short HEAD`"
|
2021-03-24 15:33:36 -05:00
|
|
|
# check if there is tag pointing at HEAD, if so the release will have the same name as the tag,
|
|
|
|
# otherwise it will be named 'latest'
|
|
|
|
RELEASE_NAME="`git tag --points-at HEAD`"
|
|
|
|
[ -z $RELEASE_NAME ] && RELEASE_NAME="latest"
|
|
|
|
[[ $RELEASE_NAME = "latest" ]] && IS_PRE_RELEASE="true" || IS_PRE_RELEASE="false"
|
2020-06-02 16:03:18 -05:00
|
|
|
# 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/
|
2023-03-24 18:56:19 -05:00
|
|
|
# required by libftdi1.dll. For the gcc-mingw-10.3.x or later "libgcc_s_dw2-1.dll" will need to be copied.
|
2020-06-02 16:03:18 -05:00
|
|
|
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 *
|
2021-03-24 15:33:36 -05:00
|
|
|
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
|
|
|
|
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV
|
2020-11-02 09:31:27 -06:00
|
|
|
echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV
|
2020-06-02 16:03:18 -05:00
|
|
|
- name: Publish OpenOCD packaged for windows
|
2023-03-24 18:56:19 -05:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-06-02 16:03:18 -05:00
|
|
|
with:
|
|
|
|
path: ${{ env.ARTIFACT_PATH }}
|
2021-03-24 15:33:36 -05:00
|
|
|
- name: Delete 'latest' Release
|
2023-03-24 18:56:19 -05:00
|
|
|
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
2021-01-31 17:18:14 -06:00
|
|
|
with:
|
2021-03-24 15:33:36 -05:00
|
|
|
delete_release: true
|
|
|
|
tag_name: ${{ env.RELEASE_NAME }}
|
2020-06-02 16:03:18 -05:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-03-24 15:33:36 -05:00
|
|
|
- name: Create Release
|
|
|
|
uses: ncipollo/release-action@v1
|
2020-06-02 16:03:18 -05:00
|
|
|
with:
|
2021-03-24 15:33:36 -05:00
|
|
|
tag: ${{ env.RELEASE_NAME }}
|
|
|
|
commit: ${{ github.sha }}
|
|
|
|
draft: false
|
|
|
|
artifacts: ${{ env.ARTIFACT_PATH }}
|
|
|
|
prerelease: ${{ env.IS_PRE_RELEASE }}
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|