-
Notifications
You must be signed in to change notification settings - Fork 649
157 lines (157 loc) · 6.25 KB
/
build-and-test.win.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
name: Windows MinGW64
on: [ push, pull_request ]
env:
CCACHE_COMPRESS: exists means true
CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime,time_macros
# The following are for windows cross-build only:
BOOST_VERSION: 1_69_0
BOOST_DOTTED_VERSION: 1.69.0
CURL_VERSION: 8.4.0
OPENSSL_VERSION: 1.1.1w
ZLIB_VERSION: 1.3.1
jobs:
prepare-mingw64-libs:
name: Build required 3rd-party libraries
runs-on: ubuntu-latest
steps:
# Get OS version to be used in cache key - see https://github.com/actions/cache/issues/543
- run: |
echo "OS_VERSION=`lsb_release -sr`" >> $GITHUB_ENV
- name: Load Cache
id: cache-libs
uses: actions/cache@v3
with:
path: libs
key: mingw64-libs-${{ env.OS_VERSION }}-${{ env.BOOST_VERSION }}_${{ env.CURL_VERSION }}_${{ env.OPENSSL_VERSION }}_${{ env.ZLIB_VERSION }}
- name: Install dependencies
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y \
g++-mingw-w64-x86-64 \
mingw-w64-tools
- name: Download library sources
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
curl -LO https://boostorg.jfrog.io/artifactory/main/release/${{ env.BOOST_DOTTED_VERSION }}/source/boost_${{ env.BOOST_VERSION }}.tar.bz2
curl -LO https://curl.haxx.se/download/curl-${{ env.CURL_VERSION }}.tar.bz2
curl -LO https://www.openssl.org/source/openssl-${{ env.OPENSSL_VERSION }}.tar.gz
curl -LO https://zlib.net/zlib-${{ env.ZLIB_VERSION }}.tar.gz
- name: Build zlib
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
LIBS="`pwd`/libs"
ZLIB="`echo zlib-*`"
tar xfz "$ZLIB"
pushd "${ZLIB%.tar.gz}"
CROSS_PREFIX=x86_64-w64-mingw32- ./configure --prefix="$LIBS" --static --64
make install
- name: Build openssl
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
LIBS="`pwd`/libs"
OPENSSL="`echo openssl-*`"
tar xfz "$OPENSSL"
pushd "${OPENSSL%.tar.gz}"
./Configure --prefix="$LIBS" --cross-compile-prefix=x86_64-w64-mingw32- \
no-shared zlib threads \
mingw64
make CPPFLAGS="-I$LIBS/include" LDFLAGS="-L$LIBS/lib" build_libs
make -j 2 install_dev
- name: Build curl
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
LIBS="`pwd`/libs"
CURL="`echo curl-*`"
tar xfj "$CURL"
pushd "${CURL%.tar.bz2}"
sed -i 's=-lgdi32=-lcrypt32 \0=' configure
PKG_CONFIG_PATH="$LIBS/lib/pkgconfig" ./configure --host=x86_64-w64-mingw32 \
--prefix="$LIBS" \
--disable-shared \
--disable-tftpf \
--disable-ldap \
--with-zlib \
--without-ssl --with-winssl \
--disable-tftp \
--disable-ldap
make -j 2 install
- name: Build boost
if: steps.cache-libs.outputs.cache-hit != 'true'
run: |
LIBS="`pwd`/libs"
BOOST="`echo boost_*`"
tar xfj "$BOOST"
pushd "${BOOST%.tar.bz2}"
# See https://github.com/boostorg/context/issues/101
sed -i '/os.\(name\|platform\)/d;/local tmp = /s=elf=pe=;/local tmp = /s=sysv=ms=' libs/context/build/Jamfile.v2
./bootstrap.sh --prefix=$LIBS
echo "using gcc : mingw32 : x86_64-w64-mingw32-g++ ;" > user-config.jam
./b2 --user-config=user-config.jam \
--without-python \
toolset=gcc-mingw32 \
target-os=windows \
variant=release \
link=static \
threading=multi \
runtime-link=static \
address-model=64 \
abi=ms \
install
build-mingw64:
name: Cross-build for windows using mingw
runs-on: ubuntu-latest
needs: prepare-mingw64-libs
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
ccache \
g++-mingw-w64-x86-64 \
mingw-w64-tools
sudo apt-get auto-remove -y
sudo apt-get clean -y
df -h
- uses: actions/checkout@v3
with:
submodules: recursive
- run: |
echo "OS_VERSION=`lsb_release -sr`" >> $GITHUB_ENV
- name: Load external libraries
uses: actions/cache@v3
with:
path: libs
key: mingw64-libs-${{ env.OS_VERSION }}-${{ env.BOOST_VERSION }}_${{ env.CURL_VERSION }}_${{ env.OPENSSL_VERSION }}_${{ env.ZLIB_VERSION }}
- name: Configure
run: |
LIBS="`pwd`/libs"
mkdir -p _build
pushd _build
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc-posix \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D CMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++-posix \
-D CMAKE_CXX_FLAGS=-Wa,-mbig-obj \
-D CMAKE_SYSTEM_NAME=Windows \
-D CURL_STATICLIB=ON \
-D CMAKE_EXE_LINKER_FLAGS=--static \
-D CMAKE_FIND_ROOT_PATH="/usr/lib/gcc/x86_64-w64-mingw32/7.3-win32/;$LIBS" \
-D CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-D CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-D CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-D GRAPHENE_DISABLE_UNITY_BUILD=ON \
..
- name: Load Cache
uses: actions/cache@v3
with:
path: ccache
key: ccache-mingw64-${{ env.OS_VERSION }}-${{ github.ref }}-${{ github.sha }}
restore-keys: |
ccache-mingw64-${{ env.OS_VERSION }}-${{ github.ref }}-
ccache-mingw64-${{ env.OS_VERSION }}-
- name: Build
run: |
export CCACHE_DIR="$GITHUB_WORKSPACE/ccache"
mkdir -p "$CCACHE_DIR"
make VERBOSE=1 -j 2 -C _build witness_node cli_wallet