1
mirror of https://github.com/monero-project/monero-gui synced 2024-12-23 02:52:58 +01:00

docker: Windows static build (cross-compilation from Linux)

This commit is contained in:
xiphon 2020-09-20 07:28:06 +00:00
parent d313c2de37
commit 2d464a1266
4 changed files with 100 additions and 2 deletions

71
Dockerfile.windows Normal file
View File

@ -0,0 +1,71 @@
FROM ubuntu:20.04
ARG THREADS=1
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y build-essential cmake g++-mingw-w64 gettext git libtool pkg-config \
python && \
rm -rf /var/lib/apt/lists/*
RUN update-alternatives --set x86_64-w64-mingw32-g++ $(which x86_64-w64-mingw32-g++-posix) && \
update-alternatives --set x86_64-w64-mingw32-gcc $(which x86_64-w64-mingw32-gcc-posix)
RUN git clone -b v0.17.0.0 --depth 1 https://github.com/monero-project/monero && \
cd monero && \
git reset --hard d27d4526fe89b7cdeb4b296280c4a6cf7efe21f8 && \
cp -a contrib/depends / && \
cd .. && \
rm -rf monero
RUN make -j$THREADS -C /depends HOST=x86_64-w64-mingw32 NO_QT=1
RUN curl -LO https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz && \
echo "5ce285209290a157d7f42ec8eb22bf3f1d76f2e03a95fc0b99b553391be01642 qt-everywhere-opensource-src-5.9.9.tar.xz" > hashsum.txt && \
sha256sum -c hashsum.txt && \
tar -xf qt-everywhere-opensource-src-5.9.9.tar.xz && \
rm qt-everywhere-opensource-src-5.9.9.tar.xz && \
cd qt-everywhere-opensource-src-5.9.9 && \
./configure --prefix=/depends/x86_64-w64-mingw32 -xplatform win32-g++ \
-device-option CROSS_COMPILE=/usr/bin/x86_64-w64-mingw32- \
-I $(pwd)/qtbase/src/3rdparty/angle/include \
-opensource -confirm-license -release -static -static-runtime -opengl dynamic -no-angle \
-no-avx -no-openssl -no-sql-sqlite \
-qt-freetype -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \
-skip gamepad -skip location -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcanvas3d -skip qtcharts \
-skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras \
-skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtscript -skip qtscxml -skip qtsensors \
-skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools -skip qtvirtualkeyboard -skip qtwayland \
-skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras -skip qtx11extras \
-skip serialbus -skip webengine \
-nomake examples -nomake tests -nomake tools && \
make QMAKE="$(pwd)/qtbase/bin/qmake CONFIG-='debug debug_and_release'" -j$THREADS && \
make -j$THREADS install && \
cd qttools/src/linguist/lrelease && \
../../../../qtbase/bin/qmake && \
make -j$THREADS && \
make -j$THREADS install && \
cd ../../../.. && \
rm -rf $(pwd)
RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git && \
cd libgpg-error && \
git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 && \
./autogen.sh && \
./configure --disable-shared --enable-static --disable-doc --disable-tests \
--host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 && \
make -j$THREADS && \
make -j$THREADS install && \
cd .. && \
rm -rf libgpg-error
RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git && \
cd libgcrypt && \
git reset --hard 56606331bc2a80536db9fc11ad53695126007298 && \
./autogen.sh && \
./configure --disable-shared --enable-static --disable-doc \
--host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 \
--with-gpg-error-prefix=/depends/x86_64-w64-mingw32 && \
make -j$THREADS && \
make -j$THREADS install && \
cd .. && \
rm -rf libgcrypt

View File

@ -21,6 +21,11 @@ default:
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
debug:
mkdir -p build && cd build && cmake -D DEV_MODE=$(or ${DEV_MODE},ON) .. && $(MAKE) VERBOSE=1
depends:
mkdir -p build/$(target)/release
cd build/$(target)/release && cmake -D STATIC=ON -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE)
devmode:
mkdir -p build && cd build && cmake -D ARCH="x86-64" -D DEV_MODE=$(or ${DEV_MODE},ON) -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release .. && $(MAKE)
clean:

View File

@ -82,6 +82,28 @@ Packaging for your favorite distribution would be a welcome contribution!
*Note*: Qt 5.9.7 is the minimum version required to build the GUI.
### Building Windows static binaries with Docker (any OS)
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
2. Clone the repository
```
git clone --recursive https://github.com/monero-project/monero-gui.git
```
3. Prepare build environment
```
cd monero-gui
docker build --tag monero:build-env-windows --build-arg THREADS=4 --file Dockerfile.windows .
```
\* `4` - number of CPU threads to use
4. Build
```
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-windows sh -c 'make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j4'
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
\* `4` - number of CPU threads to use
5. Monero GUI Windows static binaries will be placed in `monero-gui/build/x86_64-w64-mingw32/release/bin` directory
### Building Linux static binaries with Docker (any OS)
1. Install Docker [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
@ -92,13 +114,13 @@ Packaging for your favorite distribution would be a welcome contribution!
3. Prepare build environment
```
cd monero-gui
docker build --tag monero:build-env-gui --build-arg THREADS=4 .
docker build --tag monero:build-env-linux --build-arg THREADS=4 --file Dockerfile.linux .
```
\* `4` - number of CPU threads to use
4. Build
```
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-gui sh -c 'USE_SINGLE_BUILDDIR=ON DEV_MODE=ON make release-static -j4'
docker run --rm -it -v <MONERO_GUI_DIR_FULL_PATH>:/monero-gui -w /monero-gui monero:build-env-linux sh -c 'USE_SINGLE_BUILDDIR=ON make release-static -j4'
```
\* `<MONERO_GUI_DIR_FULL_PATH>` - absolute path to `monero-gui` directory
\* `4` - number of CPU threads to use