forked from ArteryTek/openocd
-
Notifications
You must be signed in to change notification settings - Fork 0
282 lines (249 loc) · 10.9 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# Author: Benedikt Kleiner, Amo Xu
name: Build OpenOCD Mac & Linux & Windows
on: push
jobs:
build-mac:
runs-on: macos-11
env:
BUILD_DIR: build
steps:
- uses: actions/checkout@v2
- name: install deps
run: brew install libtool automake texinfo coreutils pkg-config cmake gnu-sed
- name: build
env:
MAKE_JOBS: 2
run: |
export PATH=/usr/local/bin:$PATH
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
export CFLAGS=-mmacosx-version-min=10.9
export LDFLAGS="-F/System/Library/Frameworks -framework Foundation -framework AppKit -framework IOKit -framework Security"
export PREFIX="$(realpath $BUILD_DIR)/opt"
export BUILD_FOLD="$(realpath $BUILD_DIR)/libs"
mkdir -p $PREFIX $BUILD_FOLD
#LIBUSB1
export LIBUSB1_VER=1.0.26
git clone https://github.com/libusb/libusb && cd libusb && git checkout tags/v$LIBUSB1_VER -b v$LIBUSB1_VER && ./bootstrap.sh
./configure --prefix="$PREFIX" --disable-shared
make install
#HIDAPI
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export HIDAPI_VER=0.11.2
cd $BUILD_FOLD && git clone https://github.com/libusb/hidapi && cd hidapi && git checkout tags/hidapi-$HIDAPI_VER -b $HIDAPI_VER && ./bootstrap
cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" -DBUILD_SHARED_LIBS=false -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
make install
#LIBFTDI
export LIBFTDI_VER=1.5
cd $BUILD_FOLD && git clone git://developer.intra2net.com/libftdi && cd libftdi && git checkout tags/v$LIBFTDI_VER -b v$LIBFTDI_VER
sed -i "24,39s/^/# /" ./src/CMakeLists.txt
cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" -DSTATICLIBS=ON -DEXAMPLES=OFF -DFTDI_EEPROM=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 ./
make install
#CAPSTONE
export CAPSTONE_VER=4.0.2
cd $BUILD_FOLD && git clone https://github.com/capstone-engine/capstone.git && cd capstone && git checkout tags/$CAPSTONE_VER -b $CAPSTONE_VER
make install PREFIX="$PREFIX" CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no CAPSTONE_ARCHS="arm"
cd $PREFIX/../..
./bootstrap
./configure --prefix="$PREFIX/openocd" --disable-werror --disable-doxygen-html --with-capstone
make
make install-strip
echo "ARTIFACT_PATH=$PREFIX/openocd" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: openocd-mac
path: ${{ env.ARTIFACT_PATH }}/*
build-linux:
runs-on: ubuntu-20.04
env:
BUILD_DIR: build
steps:
- uses: actions/checkout@v2
- name: install deps
run: sudo apt-get install git libtool pkg-config autoconf automake libudev-dev build-essential cmake
- name: build
env:
MAKE_JOBS: 2
run: |
export PREFIX="$(realpath $BUILD_DIR)/opt"
export BUILD_FOLD="$(realpath $BUILD_DIR)/libs"
mkdir -p $PREFIX $BUILD_FOLD
#LIBUSB1
export LIBUSB1_VER=1.0.26
cd $BUILD_FOLD && git clone https://github.com/libusb/libusb && cd libusb && git checkout tags/v$LIBUSB1_VER -b v$LIBUSB1_VER && ./bootstrap.sh
./configure --prefix="$PREFIX" --disable-shared
make install
#HIDAPI
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export HIDAPI_VER=0.11.2
cd $BUILD_FOLD && git clone https://github.com/libusb/hidapi && cd hidapi && git checkout tags/hidapi-$HIDAPI_VER -b $HIDAPI_VER && ./bootstrap
cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" -DBUILD_SHARED_LIBS=false
make install
#LIBFTDI
export LIBFTDI_VER=1.5
cd $BUILD_FOLD && git clone git://developer.intra2net.com/libftdi && cd libftdi && git checkout tags/v$LIBFTDI_VER -b v$LIBFTDI_VER
sed -i "24,39s/^/# /" ./src/CMakeLists.txt
cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" -DSTATICLIBS=ON -DEXAMPLES=OFF -DFTDI_EEPROM=OFF ./
make install
#CAPSTONE
export CAPSTONE_VER=4.0.2
cd $BUILD_FOLD && git clone https://github.com/capstone-engine/capstone.git && cd capstone && git checkout tags/$CAPSTONE_VER -b $CAPSTONE_VER
make install PREFIX="$PREFIX" CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no CAPSTONE_ARCHS="arm"
cd $PREFIX/../..
./bootstrap
./configure --prefix="$PREFIX/openocd" --disable-werror --disable-doxygen-html --with-capstone
make
make install-strip
echo "ARTIFACT_PATH=$PREFIX/openocd" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: openocd-linux
path: ${{ env.ARTIFACT_PATH }}/*
build-windows-x86:
runs-on: ubuntu-20.04
env:
BUILD_DIR: build
steps:
- uses: actions/checkout@v2
- name: install deps
run: sudo apt-get install git autoconf automake libtool-bin build-essential cmake libudev-dev pkg-config autotools-dev gcc-mingw-w64-i686
- name: Bootstrap
run: ./bootstrap
- name: Prepare libusb1
env:
LIBUSB1_VER: 1.0.26
run: |
git clone https://github.com/libusb/libusb && cd libusb && git checkout tags/v$LIBUSB1_VER -b v$LIBUSB1_VER && ./bootstrap.sh
echo "LIBUSB1_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare hidapi
env:
HIDAPI_VER: 0.11.2
run: |
git clone https://github.com/libusb/hidapi && cd hidapi && git checkout tags/hidapi-$HIDAPI_VER -b $HIDAPI_VER && ./bootstrap
echo "HIDAPI_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare libftdi
env:
LIBFTDI_VER: 1.5
run: |
git clone git://developer.intra2net.com/libftdi && cd libftdi && git checkout tags/v$LIBFTDI_VER -b v$LIBFTDI_VER
sed -i "24,39s/^/# /" ./src/CMakeLists.txt
echo "LIBFTDI_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare capstone
env:
CAPSTONE_VER: 4.0.2
run: |
git clone https://github.com/capstone-engine/capstone.git && cd capstone && git checkout tags/$CAPSTONE_VER -b $CAPSTONE_VER
echo "CAPSTONE_SRC=$PWD" >> $GITHUB_ENV
- name: Package OpenOCD for windows
env:
MAKE_JOBS: 2
HOST: i686-w64-mingw32
LIBUSB1_CONFIG: '--disable-shared --enable-static'
HIDAPI_CONFIG: '--disable-shared --enable-static --disable-testgui'
LIBFTDI_CONFIG: '-DSTATICLIBS=ON -DEXAMPLES=OFF -DFTDI_EEPROM=OFF'
CAPSTONE_CONFIG: 'CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no CAPSTONE_ARCHS="arm"'
run: |
# set env and call cross-build.sh
export OPENOCD_TAG="`git rev-parse --short HEAD`"
export OPENOCD_SRC=$PWD
export OPENOCD_CONFIG="--disable-werror --disable-doxygen-html --with-capstone"
sed -i "150,157s/^/# /" $OPENOCD_SRC/contrib/cross-build.sh
mkdir -p $BUILD_DIR && cd $BUILD_DIR
bash $OPENOCD_SRC/contrib/cross-build.sh $HOST
cd $HOST-root/usr
echo "ARTIFACT_PATH=$PWD" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: openocd-windows-x86
path: ${{ env.ARTIFACT_PATH }}/*
build-windows-x64:
runs-on: ubuntu-20.04
env:
BUILD_DIR: build
steps:
- uses: actions/checkout@v2
- name: install deps
run: sudo apt-get install git autoconf automake libtool-bin build-essential cmake libudev-dev pkg-config autotools-dev gcc-mingw-w64-x86-64
- name: Bootstrap
run: ./bootstrap
- name: Prepare libusb1
env:
LIBUSB1_VER: 1.0.26
run: |
git clone https://github.com/libusb/libusb && cd libusb && git checkout tags/v$LIBUSB1_VER -b v$LIBUSB1_VER && ./bootstrap.sh
echo "LIBUSB1_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare hidapi
env:
HIDAPI_VER: 0.11.2
run: |
git clone https://github.com/libusb/hidapi && cd hidapi && git checkout tags/hidapi-$HIDAPI_VER -b $HIDAPI_VER && ./bootstrap
echo "HIDAPI_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare libftdi
env:
LIBFTDI_VER: 1.5
run: |
git clone git://developer.intra2net.com/libftdi && cd libftdi && git checkout tags/v$LIBFTDI_VER -b v$LIBFTDI_VER
sed -i "24,39s/^/# /" ./src/CMakeLists.txt
echo "LIBFTDI_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare capstone
env:
CAPSTONE_VER: 4.0.2
run: |
git clone https://github.com/capstone-engine/capstone.git && cd capstone && git checkout tags/$CAPSTONE_VER -b $CAPSTONE_VER
echo "CAPSTONE_SRC=$PWD" >> $GITHUB_ENV
- name: Package OpenOCD for windows
env:
MAKE_JOBS: 2
HOST: x86_64-w64-mingw32
LIBUSB1_CONFIG: '--disable-shared --enable-static'
HIDAPI_CONFIG: '--disable-shared --enable-static --disable-testgui'
LIBFTDI_CONFIG: '-DSTATICLIBS=ON -DEXAMPLES=OFF -DFTDI_EEPROM=OFF'
CAPSTONE_CONFIG: 'CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no CAPSTONE_ARCHS="arm"'
run: |
# set env and call cross-build.sh
export OPENOCD_TAG="`git rev-parse --short HEAD`"
export OPENOCD_SRC=$PWD
export OPENOCD_CONFIG="--disable-werror --disable-doxygen-html --with-capstone"
sed -i "150,157s/^/# /" $OPENOCD_SRC/contrib/cross-build.sh
mkdir -p $BUILD_DIR && cd $BUILD_DIR
bash $OPENOCD_SRC/contrib/cross-build.sh $HOST
cd $HOST-root/usr
echo "ARTIFACT_PATH=$PWD" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: openocd-windows-x64
path: ${{ env.ARTIFACT_PATH }}/*
pack:
runs-on: ubuntu-latest
needs:
- build-mac
- build-linux
- build-windows-x86
- build-windows-x64
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: build
- name: Generate xpack
run: |
mkdir output && cd output
echo "$PWD"
mkdir bin-darwin_x86_64
cp -rv ../build/openocd-mac/bin/* bin-darwin_x86_64
mkdir bin-windows_amd64
cp -rv ../build/openocd-windows-x64/bin/*.exe bin-windows_amd64
mkdir bin-windows_x86
cp -rv ../build/openocd-windows-x86/bin/*.exe bin-windows_x86
mkdir bin-linux_x86_64
cp -rv ../build/openocd-linux/bin/* bin-linux_x86_64
cp -rv ../build/openocd-linux/share/openocd/contrib contrib
cp -rv ../build/openocd-linux/share/openocd/scripts scripts
- name: Upload xpack
uses: actions/upload-artifact@v3
with:
name: xpack
path: output/*