forked from openocd-org/openocd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: Ied8f970bc6bacc6793d242667db3349f2f3c50a5
- Loading branch information
1 parent
c3fa02f
commit d81eb72
Showing
2 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
# Copyright (C) 2020 by Tarek BOUCHKATI <[email protected]> | ||
|
||
on: | ||
push: | ||
branches: | ||
- obfl-wip | ||
tags-ignore: | ||
- '**' | ||
|
||
name: OpenOCD Release | ||
|
||
jobs: | ||
package: | ||
runs-on: [ubuntu-latest] | ||
env: | ||
DL_DIR: ../downloads | ||
BUILD_DIR: ../build | ||
strategy: | ||
matrix: | ||
include: | ||
- platform: linux | ||
- platform: windows | ||
steps: | ||
- name: Install needed packages | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install autotools-dev autoconf automake libtool pkg-config cmake texinfo texlive g++-mingw-w64-i686 gcc g++ | ||
- name: Checkout Code | ||
uses: actions/checkout@v1 | ||
- run: ./bootstrap | ||
- name: Prepare libusb1 | ||
env: | ||
LIBUSB1_VER: 1.0.26 | ||
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 "LIBUSB1_SRC=$PWD/libusb-${LIBUSB1_VER}" >> $GITHUB_ENV | ||
- name: Prepare hidapi | ||
env: | ||
HIDAPI_VER: 0.11.2 | ||
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 "HIDAPI_SRC=$PWD" >> $GITHUB_ENV | ||
- 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 | ||
- 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 | ||
- name: Package OpenOCD for Windows | ||
if: matrix.platform == 'windows' | ||
env: | ||
MAKE_JOBS: 2 | ||
HOST: i686-w64-mingw32 | ||
LIBUSB1_CONFIG: --enable-shared --disable-static | ||
HIDAPI_CONFIG: --enable-shared --disable-static --disable-testgui | ||
LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF | ||
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no" | ||
run: | | ||
# check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG | ||
OPENOCD_TAG="`git tag --points-at HEAD`" | ||
[ -z $OPENOCD_TAG ] && OPENOCD_TAG="`git rev-parse --short HEAD`" | ||
# 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" | ||
# 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_dw2-1.dll` ./bin/ | ||
# prepare the artifact | ||
ARTIFACT="openocd-${OPENOCD_TAG}-${HOST}.tar.gz" | ||
tar -czf $ARTIFACT * | ||
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV | ||
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV | ||
echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV | ||
- name: Package OpenOCD for Linux | ||
if: matrix.platform == 'linux' | ||
env: | ||
LIBUSB1_CONFIG: --enable-shared --disable-static | ||
HIDAPI_CONFIG: --enable-shared --disable-static --disable-testgui | ||
LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF | ||
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no" | ||
HOST: x86_64-linux | ||
run: | | ||
# check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG | ||
OPENOCD_TAG="`git tag --points-at HEAD`" | ||
[ -z $OPENOCD_TAG ] && OPENOCD_TAG="`git rev-parse --short HEAD`" | ||
# 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" | ||
# set env and call cross-build.sh | ||
export OPENOCD_TAG=$OPENOCD_TAG | ||
export OPENOCD_SRC=$PWD | ||
export OPENOCD_CONFIG="" | ||
mkdir -p BUILD_DIR | ||
./configure --prefix $(realpath "$BUILD_DIR") | ||
make -j2 | ||
make install | ||
# prepare the artifact | ||
ARTIFACT="openocd-${OPENOCD_TAG}-${HOST}.tar.gz" | ||
cd $BUILD_DIR | ||
tar -czf $ARTIFACT * | ||
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV | ||
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV | ||
echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV | ||
- name: Publish packaged OpenOCD | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifact | ||
path: ${{ env.ARTIFACT_PATH }} | ||
|
||
release: | ||
runs-on: [ubuntu-latest] | ||
if: github.ref == 'refs/heads/obfl-wip' | ||
needs: [package] | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build-artifact | ||
- name: Make release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
token: ${{ secrets.REPO_ACCESS_TOKEN }} | ||
name: "OpenBouffalo build of OpenOCD #${{ github.run_number }}" | ||
tag_name: "build-number-${{ github.run_number }}" | ||
target_commitish: ${{ github.sha }} | ||
files: ./* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters