зеркало из https://github.com/microsoft/openocd.git
Add workflow for static Linux build
These changes modify the OpenOCD Snapshot workflow to produce statically linked Linux binaries in addition to the Windows binaries. The release stage of the workflow has been split out into a separate job that aggregates the artifacts produced in Linux and Windows builds and adds them to a new release if a git tag exists.
This commit is contained in:
Родитель
f342aac084
Коммит
13e32e7824
|
@ -7,8 +7,10 @@ on: push
|
|||
name: OpenOCD Snapshot
|
||||
|
||||
jobs:
|
||||
package:
|
||||
runs-on: [ubuntu-18.04]
|
||||
package-windows:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
artifact-name: ${{ env.ARTIFACT_NAME }}
|
||||
env:
|
||||
DL_DIR: ../downloads
|
||||
BUILD_DIR: ../build
|
||||
|
@ -85,9 +87,27 @@ jobs:
|
|||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: ${{ env.ARTIFACT_PATH }}
|
||||
package-linux:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
artifact-name: ${{ steps.package-linux.outputs.artifact-name }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Package OpenOCD for Linux
|
||||
id: package-linux
|
||||
uses: ./microsoft/static-linux-build
|
||||
- name: Publish OpenOCD packaged for Linux
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{ steps.package-linux.outputs.artifact-name }}
|
||||
path: ${{ steps.package-linux.outputs.artifact-name }}
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
needs: [package-windows, package-linux]
|
||||
steps:
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: actions/create-release@v1.1.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -96,13 +116,29 @@ jobs:
|
|||
release_name: ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
- name: Release OpenOCD packaged for windows
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
- name: Download OpenOCD packaged for Windows
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ${{ needs.package-windows.outputs.artifact-name }}
|
||||
- name: Download OpenOCD packaged for Linux
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: ${{ needs.package-linux.outputs.artifact-name }}
|
||||
- name: Release OpenOCD packaged for Linux
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ env.ARTIFACT_PATH }}
|
||||
asset_name: ${{ env.ARTIFACT_NAME }}
|
||||
asset_path: ${{ needs.package-linux.outputs.artifact-name }}
|
||||
asset_name: ${{ needs.package-linux.outputs.artifact-name }}
|
||||
asset_content_type: application/gzip
|
||||
- name: Release OpenOCD packaged for Windows
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ needs.package-windows.outputs.artifact-name }}
|
||||
asset_name: ${{ needs.package-windows.outputs.artifact-name }}
|
||||
asset_content_type: application/gzip
|
||||
|
|
|
@ -257,6 +257,10 @@ AC_ARG_ADAPTERS([
|
|||
LIBJAYLINK_ADAPTERS
|
||||
],[auto])
|
||||
|
||||
AC_ARG_ENABLE([all_static],
|
||||
AS_HELP_STRING([--enable-all-static], [Enable building executables with static linking.]),
|
||||
[build_all_static=$enableval], [build_all_static=no])
|
||||
|
||||
AC_ARG_ENABLE([parport],
|
||||
AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
|
||||
[build_parport=$enableval], [build_parport=no])
|
||||
|
@ -761,6 +765,7 @@ AS_IF([test "x$enable_presto" != "xno"], [
|
|||
build_bitq=yes
|
||||
])
|
||||
|
||||
AM_CONDITIONAL([ALL_STATIC], [test "x$build_all_static" = "xyes"])
|
||||
AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
|
||||
AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
|
||||
AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
|
||||
|
|
|
@ -41,8 +41,10 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
|
|||
[ -w . ] && git update-index --refresh --unmerged > /dev/null
|
||||
|
||||
# Check for uncommitted changes
|
||||
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
|
||||
| read dummy; then
|
||||
# If jimtcl bootstraps during configuration it can leave untracked files.
|
||||
if git diff-index --name-only --ignore-submodules=untracked HEAD \
|
||||
| grep -v "^scripts/package" \
|
||||
| read dummy; then
|
||||
printf '%s' -dirty
|
||||
fi
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
FROM alpine:3.13
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
@ -0,0 +1,3 @@
|
|||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
set -o xtrace
|
||||
|
||||
fetch_library() {
|
||||
local url_base="${1}"
|
||||
local filename="${2}"
|
||||
local expected_sha="${3}"
|
||||
|
||||
wget "${url_base}${filename}"
|
||||
echo "${expected_sha} ${filename}" | sha256sum -cw
|
||||
if [[ "${filename}" == *.tar.bz2 ]]
|
||||
then
|
||||
tar -xjf "${filename}"
|
||||
elif [[ "${filename}" == *.tar.gz ]]
|
||||
then
|
||||
tar -xzf "${filename}"
|
||||
else
|
||||
echo "Unknown archive format." >&2
|
||||
return 1
|
||||
fi
|
||||
rm "${filename}"
|
||||
}
|
||||
|
||||
readonly workspace_dir="${PWD}"
|
||||
readonly downloads_dir=/downloads
|
||||
readonly install_dir=/install
|
||||
|
||||
apk --no-cache add git gcc g++ patch make libtool pkgconf autoconf automake \
|
||||
autoconf-archive linux-headers eudev-dev libftdi1-dev libftdi1-static \
|
||||
libusb-compat-dev capstone-dev capstone-static
|
||||
|
||||
mkdir -p "${downloads_dir}"
|
||||
cd "${downloads_dir}"
|
||||
|
||||
fetch_library "https://github.com/libusb/libusb/releases/download/v1.0.24/" \
|
||||
"libusb-1.0.24.tar.bz2" \
|
||||
"7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a"
|
||||
|
||||
fetch_library "https://github.com/libusb/hidapi/archive/refs/tags/" \
|
||||
"hidapi-0.10.1.tar.gz" \
|
||||
"f71dd8a1f46979c17ee521bc2117573872bbf040f8a4750e492271fc141f2644"
|
||||
|
||||
fetch_library "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/" \
|
||||
"libgpiod-1.6.3.tar.gz" \
|
||||
"eb446070be1444fd7d32d32bbca53c2f3bbb0a21193db86198cf6050b7a28441"
|
||||
|
||||
cd "${downloads_dir}/libusb-1.0.24"
|
||||
./configure --enable-static --disable-shared
|
||||
make
|
||||
make install-strip
|
||||
|
||||
cd "${downloads_dir}/hidapi-hidapi-0.10.1"
|
||||
./bootstrap
|
||||
./configure --enable-static --disable-shared
|
||||
make
|
||||
make install-strip
|
||||
|
||||
cd "${downloads_dir}/libgpiod-1.6.3"
|
||||
./autogen.sh --enable-static --disable-shared
|
||||
make
|
||||
make install-strip
|
||||
|
||||
cd "${workspace_dir}"
|
||||
openocd_tag="`git tag --points-at HEAD`"
|
||||
[ -z "${openocd_tag}" ] && openocd_tag="`git rev-parse --short HEAD`"
|
||||
readonly openocd_name="openocd-${openocd_tag}-linux"
|
||||
./bootstrap
|
||||
./configure --build="$(${workspace_dir}/config.guess)" \
|
||||
--prefix="${install_dir}/${openocd_name}" \
|
||||
--enable-static --enable-all-static --disable-shared
|
||||
make
|
||||
make install-strip
|
||||
tar -C "${install_dir}" -czf "${workspace_dir}/${openocd_name}.tar.gz" "${openocd_name}"
|
||||
echo "::set-output name=artifact-name::${openocd_name}.tar.gz"
|
|
@ -18,6 +18,10 @@ else
|
|||
%C%_openocd_LDADD += -ljim
|
||||
endif
|
||||
|
||||
if ALL_STATIC
|
||||
%C%_openocd_LDFLAGS = -all-static
|
||||
endif
|
||||
|
||||
%C%_libopenocd_la_CPPFLAGS =
|
||||
|
||||
# banner output includes RELSTR appended to $VERSION from the configure script
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
#ifdef PKGBLDDATE
|
||||
#define OPENOCD_VERSION \
|
||||
"Open On-Chip Debugger " VERSION RELSTR " (" PKGBLDDATE ")"
|
||||
"Open On-Chip Debugger " VERSION RELSTR " (" PKGBLDDATE ") [https://github.com/microsoft/openocd]"
|
||||
#else
|
||||
#define OPENOCD_VERSION \
|
||||
"Open On-Chip Debugger " VERSION RELSTR
|
||||
|
|
Загрузка…
Ссылка в новой задаче