-
Notifications
You must be signed in to change notification settings - Fork 6
230 lines (227 loc) · 9.95 KB
/
cross-compilation.yml
File metadata and controls
230 lines (227 loc) · 9.95 KB
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
name: CrossCompilation
on:
push:
branches:
- master
- release/*
pull_request:
branches:
- master
- trunk/*
- release/*
jobs:
ubuntu_x86_64-w64-mingw32:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flags: [
"-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
-DCMAKE_SYSTEM_NAME=Windows -DTESTING=OFF \
-DCMAKE_SYSTEM_PROCESSOR=x86_64 \
-DFIND_ZLIB=OFF"
]
steps:
- uses: actions/checkout@v1
name: checkout
with:
submodules: recursive
clean: true
- name: Prepare ccache timestamp
id: cache_timestamp
run: |
current_date=`date +%Y%m%d_%H%M%SZ`
echo "::set-output name=timestamp::${current_date}"
- name: ccache cache files
uses: actions/cache@v1.1.0
with:
path: ~/.ccache
key: mingw-ccache-${{ steps.cache_timestamp.outputs.timestamp }}
restore-keys: |
mingw-ccache-
- name: install build requirements
run: sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64 libz-mingw-w64-dev ccache
- uses: actions/checkout@v2
with:
repository: 'protocolbuffers/protobuf'
ref: 'v3.19.3'
path: 'protobuf'
- name: install host protobuf
env:
CC: gcc
CXX: g++
run: |
mkdir /tmp/protobuild
# run cmake
cmake protobuf/cmake -B/tmp/protobuild \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_WITH_ZLIB_DEFAULT=OFF \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_BUILD_LIBPROTOC=OFF \
-Dprotobuf_BUILD_EXAMPLES=OFF \
-Dprotobuf_BUILD_CONFORMANCE=OFF \
-Dprotobuf_BUILD_PROTOC_BINARIES=ON \
-Dprotobuf_DISABLE_RTTI=ON
# build
cmake --build /tmp/protobuild --parallel 2
# install
sudo cmake --install /tmp/protobuild
- name: set the default mingw32 g++ compiler option to posix
run: sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- name: cmake
run: cmake . -Bbuild ${{ matrix.flags }}
- name: build
run: cmake --build build -- -j2
# TODO(warchant): fix build. fails during linking:
# ld: warning: ignoring file ../../../_deps/protobuf-build/libprotobuf.a, file was built for archive which is not the architecture being linked (x86_64): ../../../_deps/protobuf-build/libprotobuf.a
# ubuntu_x86_64-apple-darwin16:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# flags: [
# "-DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_C_COMPILER=${GITHUB_WORKSPACE}/cctools/toolchain/bin/clang \
# -DCMAKE_CXX_COMPILER=${GITHUB_WORKSPACE}/cctools/toolchain/bin/clang++ \
# -DCMAKE_OSX_ARCHITECTURES=x86_64 \
# -DCMAKE_SYSTEM_NAME=Darwin \
# -DCMAKE_SYSTEM_PROCESSOR=x86_64 \
# -DCMAKE_C_COMPILER_TARGET=x86_64-apple-darwin16 \
# -DCMAKE_CXX_COMPILER_TARGET=x86_64-apple-darwin16 \
# -DCMAKE_OSX_SYSROOT=${GITHUB_WORKSPACE}/SDKs/MacOSX10.14.sdk \
# -DTESTING=OFF"
# ]
# env:
# PKG_CLANG_VERSION: 6.0.1
# CTEST_OUTPUT_ON_FAILURE: 1
# CC: clang
# CXX: clang++
# steps:
# - uses: actions/checkout@v1
# name: checkout
# with:
# submodules: recursive
# clean: true
# - name: Prepare ccache timestamp
# id: cache_timestamp
# run: |
# current_date=`date +%Y%m%d_%H%M%SZ`
# echo "::set-output name=timestamp::${current_date}"
# - name: ccache cache files
# uses: actions/cache@v1.1.0
# with:
# path: ~/.ccache
# key: darwin-ccache-${{ steps.cache_timestamp.outputs.timestamp }}
# restore-keys: |
# darwin-ccache-
# - name: toolchain cache files
# id: toolchain-cache
# uses: actions/cache@v1.1.0
# with:
# path: cctools
# key: toolchain-full-cache
# - name: sdk cache files
# id: sdk-cache
# uses: actions/cache@v1.1.0
# with:
# path: SDKs
# key: sdk-cache
# - name: clone native_cctools
# if: steps.toolchain-cache.outputs.cache-hit != 'true'
# uses: actions/checkout@master
# with:
# repository: tpoechtrager/cctools-port
# ref: 3764b223c011574971ee3ae09ce968ba5dc2f00f
# path: cctools/toolchain
# - name: clone apple-libtapi
# if: steps.toolchain-cache.outputs.cache-hit != 'true'
# uses: actions/checkout@master
# with:
# repository: tpoechtrager/apple-libtapi
# ref: 3efb201881e7a76a21e0554906cf306432539cef
# path: cctools/libtapi
# - name: fetch clang+llvm
# if: steps.toolchain-cache.outputs.cache-hit != 'true'
# run: |
# wget https://mirror2.veriblock.org/vbtc-sources/clang+llvm-${PKG_CLANG_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz
# - name: extract clang+llvm
# if: steps.toolchain-cache.outputs.cache-hit != 'true'
# run: |
# mkdir -p cctools && \
# mkdir -p toolchain/bin toolchain/lib/clang/${PKG_CLANG_VERSION}/include && \
# mkdir -p libtapi && \
# mkdir -p cctools/clang && \
# rm -f toolchain/lib/libc++abi.so*
# tar --no-same-owner --strip-components=1 -C cctools/clang -xf clang+llvm-${PKG_CLANG_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz
# rm -f clang+llvm-${PKG_CLANG_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz
# - name: install clang+llvm, cctools & libtapi
# if: steps.toolchain-cache.outputs.cache-hit != 'true'
# run: |
# cd ${GITHUB_WORKSPACE}/cctools/libtapi
# CC=${GITHUB_WORKSPACE}/cctools/clang/bin/clang CXX=${GITHUB_WORKSPACE}/cctools/clang/bin/clang++ INSTALLPREFIX=${GITHUB_WORKSPACE}/cctools ./build.sh && \
# CC=${GITHUB_WORKSPACE}/cctools/clang/bin/clang CXX=${GITHUB_WORKSPACE}/cctools/clang/bin/clang++ INSTALLPREFIX=${GITHUB_WORKSPACE}/cctools ./install.sh && \
# mkdir -p ${GITHUB_WORKSPACE}/cctools/clang/lib/ && \
# cp ${GITHUB_WORKSPACE}/cctools/lib/libtapi.so.6 ${GITHUB_WORKSPACE}/cctools/clang/lib/
# cd ${GITHUB_WORKSPACE}/cctools/toolchain/cctools
# CC=${GITHUB_WORKSPACE}/cctools/clang/bin/clang CXX=${GITHUB_WORKSPACE}/cctools/clang/bin/clang++ && ./configure \
# --prefix=${GITHUB_WORKSPACE}/cctools/toolchain \
# --with-libtapi=${GITHUB_WORKSPACE}/cctools \
# --target=x86_64-apple-darwin16
# make install
# cd ${GITHUB_WORKSPACE}/cctools/clang && \
# mkdir -p ${GITHUB_WORKSPACE}/cctools/toolchain/lib/clang/${PKG_CLANG_VERSION}/include && \
# mkdir -p ${GITHUB_WORKSPACE}/cctools/toolchain/bin ${GITHUB_WORKSPACE}/cctools/toolchain/include && \
# cp bin/clang ${GITHUB_WORKSPACE}/cctools/toolchain/bin/ && \
# cp -P bin/clang++ ${GITHUB_WORKSPACE}/cctools/toolchain/bin/ && \
# cp lib/libtapi.so.6 ${GITHUB_WORKSPACE}/cctools/toolchain/lib/ && \
# cp lib/libLTO.so ${GITHUB_WORKSPACE}/cctools/toolchain/lib/ && \
# cp -rf lib/clang/${PKG_CLANG_VERSION}/include/* ${GITHUB_WORKSPACE}/cctools/toolchain/lib/clang/${PKG_CLANG_VERSION}/include/ && \
# cp bin/llvm-dsymutil ${GITHUB_WORKSPACE}/cctools/toolchain/bin/x86_64-apple-darwin16-dsymutil && \
# if `test -d include/c++/`; then cp -rf include/c++/ ${GITHUB_WORKSPACE}/cctools/toolchain/include/; fi && \
# if `test -d lib/c++/`; then cp -rf lib/c++/ ${GITHUB_WORKSPACE}/cctools/toolchain/lib/; fi
# - name: download and extract macos sdk
# if: steps.sdk-cache.outputs.cache-hit != 'true'
# run: |
# wget -P ${GITHUB_WORKSPACE}/sdk-sources https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.14.sdk.tar.xz
# mkdir -p ${GITHUB_WORKSPACE}/SDKs
# tar -xf ${GITHUB_WORKSPACE}/sdk-sources/MacOSX10.14.sdk.tar.xz -C ${GITHUB_WORKSPACE}/SDKs
# - name: run apt update
# run: sudo apt-get update
# - name: install tools
# run: sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python3-setuptools libtinfo5 ccache
# - uses: actions/checkout@v2
# with:
# repository: 'protocolbuffers/protobuf'
# ref: 'v3.19.3'
# path: 'protobuf'
# - name: install host protobuf
# env:
# CC: gcc
# CXX: g++
# run: |
# mkdir /tmp/protobuild
# # run cmake
# cmake protobuf/cmake -B/tmp/protobuild \
# -DCMAKE_BUILD_TYPE=Release \
# -Dprotobuf_WITH_ZLIB_DEFAULT=OFF \
# -Dprotobuf_BUILD_TESTS=OFF \
# -Dprotobuf_BUILD_LIBPROTOC=OFF \
# -Dprotobuf_BUILD_EXAMPLES=OFF \
# -Dprotobuf_BUILD_CONFORMANCE=OFF \
# -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
# -Dprotobuf_DISABLE_RTTI=ON
# # build
# cmake --build /tmp/protobuild --parallel 2
# # install
# sudo cmake --install /tmp/protobuild
# - name: cmake
# run: cmake . -Bbuild ${{ matrix.flags }} -DCMAKE_BUILD_TYPE=Release
# - name: build
# run: cmake --build build -- -j1
# - name: check architectures
# run: |
# OSX_ARCH=$(${GITHUB_WORKSPACE}/cctools/toolchain/bin/x86_64-apple-darwin16-lipo -info ${GITHUB_WORKSPACE}/build/lib/libveriblock-pop-cpp.a) && \
# echo $OSX_ARCH && \
# [[ $OSX_ARCH == "Non-fat file: ${GITHUB_WORKSPACE}/build/lib/libveriblock-pop-cpp.a is architecture: x86_64" ]] && exit 0