mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
build/macos: support osxcross docker container
This commit is contained in:
parent
a34aa88d62
commit
eaa6cf4494
14
README.md
14
README.md
@ -232,6 +232,20 @@ go build -ldflags '-s -w'
|
||||
|
||||
Installing `qt@5` from [Homebrew](https://brew.sh/) may be very slow if Homebrew chooses to do a from-source build instead of a binary Bottle build, particularly owing to QtWebEngine (Chromium).
|
||||
|
||||
### macOS (Docker)
|
||||
|
||||
*Tested with osxcross 14.5 / Go 1.19 / MacPorts Qt 5.15 / Debian Clang 14.0*
|
||||
|
||||
For dynamic linking:
|
||||
|
||||
1. Build the necessary docker container for cross-compilation:
|
||||
- `docker build -t miqt/osxcross:latest -f docker/macos-cross-x86_64-sdk14.5-go1.19-qt5.15-dynamic.Dockerfile .`
|
||||
2. Build your application:
|
||||
- `docker run --rm -v $(pwd):/src -w /src miqt/osxcross:latest go build -ldflags '-s -w'`
|
||||
3. Copy necessary Qt LGPL libraries and plugin files.
|
||||
|
||||
See FAQ Q3 for advice about docker performance.
|
||||
|
||||
### Android (Docker)
|
||||
|
||||
*Tested with Raymii Qt 5.15 / Android SDK 31 / Android NDK 22*
|
||||
|
@ -0,0 +1,47 @@
|
||||
FROM crazymax/osxcross:14.5-debian AS osxcross
|
||||
|
||||
FROM debian:bookworm
|
||||
|
||||
COPY --from=osxcross /osxcross /osxcross
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
apt-get install --no-install-recommends -qyy \
|
||||
golang-go \
|
||||
clang \
|
||||
lld \
|
||||
libc6-dev \
|
||||
openssl \
|
||||
bzip2 \
|
||||
ca-certificates \
|
||||
curl \
|
||||
pkg-config && \
|
||||
apt-get clean
|
||||
|
||||
ENV PATH="/osxcross/bin:$PATH"
|
||||
ENV LD_LIBRARY_PATH="/osxcross/lib:$LD_LIBRARY_PATH"
|
||||
|
||||
# The oldest macOS target with a working Qt 5.15 build on macports.org is High
|
||||
# Sierra (10.13)
|
||||
# @ref https://ports.macports.org/port/qt5-qtbase/details/
|
||||
#
|
||||
# Go 1.19 and Go 1.20 are the last versions of Go that can target macOS 10.13.
|
||||
# For later versions of Go, a higher MACOSX_DEPLOYMENT_TARGET version can be set.
|
||||
# @ref https://tip.golang.org/doc/go1.20#darwin
|
||||
ENV MACOSX_DEPLOYMENT_TARGET=10.13
|
||||
|
||||
# Preemptively mark some dependencies as installed that don't seem to download properly
|
||||
RUN /usr/bin/env UNATTENDED=1 osxcross-macports fake-install py312 py312-packaging xorg xrender
|
||||
|
||||
# Install Qt 5.15 and dependencies
|
||||
RUN /usr/bin/env UNATTENDED=1 osxcross-macports install qt5-qtbase
|
||||
|
||||
RUN rmdir /opt/ && \
|
||||
ln -s /osxcross/macports/pkgs/opt /opt
|
||||
|
||||
ENV CC=x86_64-apple-darwin23.6-clang
|
||||
ENV CXX=x86_64-apple-darwin23.6-clang++
|
||||
ENV GOOS=darwin
|
||||
ENV GOARCH=amd64
|
||||
ENV CGO_ENABLED=1
|
||||
ENV PKG_CONFIG_PATH=/opt/local/libexec/qt5/lib/pkgconfig/
|
||||
ENV CGO_CXXFLAGS="-Wno-ignored-attributes -D_Bool=bool"
|
Loading…
Reference in New Issue
Block a user