initial macos builds

This commit is contained in:
Bert van der Weerd 2022-02-07 00:15:58 +01:00
parent 9bd3182a32
commit 704d78b3c9
No known key found for this signature in database
GPG Key ID: 4CFABB96ADE0F5B1
5 changed files with 179 additions and 6 deletions

View File

@ -1,4 +1,4 @@
.PHONY : help all clean veryclean fetch prune docker push build update docker-debian11 debian11 docker-mint20 mint20 docker-ubuntu20 ubuntu20 docker-ubuntu21 ubuntu21 docker-fedora34 fedora34 docker-fedora35 fedora35
.PHONY : help clean veryclean fetch prune docker push build update docker-debian11 debian11 docker-mint20 mint20 docker-ubuntu20 ubuntu20 docker-ubuntu21 ubuntu21 docker-fedora34 fedora34 docker-fedora35 fedora35 docker-macos-x86_64 macos-x86_64 docker-macos-aarch64 macos-aarch64
version:=$(shell cat version)
release:=$(shell cat release)
@ -7,8 +7,8 @@ source_release:=$(shell cat source_release)
tarball=librewolf-$(version)-$(source_release).source.tar.gz
help :
@echo "Use: make [help] [all] [docker] [push] [build] [clean]"
@echo " [veryclean] [fetch] [prune]"
@echo "Use: make [help] [docker] [push] [build] [clean] [veryclean]"
@echo " [fetch] [update] [prune]"
@echo ""
@echo "docker targets:"
@echo " [docker-debian11]"
@ -17,6 +17,8 @@ help :
@echo " [docker-ubuntu21]"
@echo " [docker-fedora34]"
@echo " [docker-fedora35]"
@echo " [docker-macos-x86_64]"
@echo " [docker-macos-aarch64]"
@echo ""
@echo "build targets:"
@echo " [debian11]"
@ -25,11 +27,11 @@ help :
@echo " [ubuntu21]"
@echo " [fedora34]"
@echo " [fedora35]"
@echo " [macos-x64_64]"
@echo " [macos-aarch64]"
@echo ""
all :
@echo "Nothing happens."
clean :
sudo rm -rf work
@ -80,6 +82,11 @@ update :
@echo Source version: $(shell cat version)-$(shell cat source_release)
@echo Bsys5 release: $(shell cat release)
#
# Linux
#
## debian11
docker-debian11 :
${MAKE} -f assets/linux.mk distro=debian11 "distro_image=debian:bullseye" docker
@ -110,3 +117,20 @@ docker-fedora35 :
${MAKE} -f assets/linux.mk distro=fedora35 "distro_image=fedora:35" docker
fedora35 : work
${MAKE} -f assets/linux.mk distro=fedora35 build
#
# MacOS
#
## macos-x86_64
docker-macos-x86_64 :
${MAKE} -f assets/macos.mk arch=x86_64 docker
macos-x86_64 : work
${MAKE} -f assets/macos.mk arch=x86_64 build
## macos-aarch64
docker-macos-aarch64 :
${MAKE} -f assets/macos.mk arch=aarch64 docker
macos-aarch64 : work
${MAKE} -f assets/macos.mk arch=aarch64 build

View File

@ -15,7 +15,8 @@ outfile=librewolf-$(version)-$(release).en-US.$(distro)-x86_64.tar.bz2
docker :
docker build --build-arg "distro=$(distro_image)" -t librewolf/bsys5-image-$(distro) - < assets/linux.Dockerfile
build : work
build :
if [ $(use_docker) = true ]; then \
docker run --rm -v $(shell pwd)/work:/work:rw librewolf/bsys5-image-$(distro) sh -c "cd /work/librewolf-$(version)-$(source_release) && ./mach build && ./mach package" ; \
else \

63
assets/macos.Dockerfile Normal file
View File

@ -0,0 +1,63 @@
# $(arch)
FROM debian:bullseye
ARG arch=error
# version of librewolf we use to bootstrap (does not need to be recent)
ENV version 96.0.3
ENV source_release 5
# we use this wasi version
ENV wasi_fullversion 14.0
ENV wasi_mainversion 14
# dependencies needed to run ./mach bootstrap
RUN ( apt-get -y update && apt-get -y upgrade && apt-get -y install mercurial python3 python3-dev python3-pip wget ; true)
# setup wasi
RUN ( export target_wasi_location=$HOME/.mozbuild/wrlb/ && wget -q https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$wasi_mainversion/wasi-sdk-$wasi_fullversion-linux.tar.gz && tar xf wasi-sdk-$wasi_fullversion-linux.tar.gz && mkdir -p $target_wasi_location && rm -rf $target_wasi_location/wasi-sysroot && cp -r wasi-sdk-$wasi_fullversion/share/wasi-sysroot $target_wasi_location && rm -f wasi-sdk-*.tar.gz* && rm -rf wasi-sdk-* )
# setup osx sdk
RUN mkdir -p /osx-cross/MacOSX-SDKs
WORKDIR /osx-cross/MacOSX-SDKs
RUN wget -q "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz"
RUN tar xf MacOSX11.3.sdk.tar.xz
RUN rm -f MacOSX11.3.sdk.tar.xz
WORKDIR /
# run the bootstrap
RUN wget -q -O librewolf-$version-$source_release.source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$version-$source_release.source.tar.gz?job=Build
RUN tar xf librewolf-$version-$source_release.source.tar.gz
WORKDIR librewolf-$version-$source_release
RUN echo ac_add_options --target=$arch-apple-darwin > mozconfig
RUN echo ac_add_options --enable-bootstrap >> mozconfig
RUN echo ac_add_options --with-macos-sdk=/osx-cross/MacOSX-SDKs/MacOSX11.3.sdk >> mozconfig
RUN MOZBUILD_STATE_PATH=$HOME/.mozbuild ./mach --no-interactive bootstrap --application-choice=browser
RUN ./mach artifact toolchain --from-build linux64-libdmg
RUN ./mach artifact toolchain --from-build linux64-cctools-port
RUN ./mach artifact toolchain --from-build linux64-hfsplus
RUN ./mach artifact toolchain --from-build linux64-binutils
RUN ./mach artifact toolchain --from-build linux64-clang-macosx-cross
RUN /root/.cargo/bin/cargo install cbindgen
RUN /root/.cargo/bin/rustup target add $(arch)-apple-darwin
RUN cp -r binutils /root/.mozbuild
RUN cp -r cctools /root/.mozbuild
RUN cp -r clang /root/.mozbuild
RUN cp -r dmg /root/.mozbuild
RUN cp -r hfsplus-tools /root/.mozbuild
WORKDIR /
RUN rm -rf librewolf-$version-$source_release librewolf-$version-$source_release.source.tar.g
RUN apt-get -y install build-essential libpython3-dev m4 unzip uuid zip libasound2-dev libcurl4-openssl-dev libdbus-1-dev libdbus-glib-1-dev libdrm-dev libgtk-3-dev libpulse-dev libx11-xcb-dev libxt-dev xvfb rsync
RUN pip install testresources pycairo
# our work happens here, on the host filesystem.
WORKDIR /work
VOLUME ["/work"]

26
assets/macos.mk Normal file
View File

@ -0,0 +1,26 @@
# $(arch)
# $(use_docker)
.PHONY : docker build
version:=$(shell cat version)
release:=$(shell cat release)
source_release:=$(shell cat source_release)
use_docker=true
outfile=librewolf-$(version)-$(source_release).en-US.mac.$(arch).dmg
docker :
docker build --build-arg "arch=$(arch)" -t librewolf/bsys5-image-macos-$(arch) - < assets/macos.Dockerfile
build :
sed "s/_ARCH_/$(arch)/g" < assets/macos.mozconfig > work/librewolf-$(version)-$(source_release)/mozconfig
if [ $(use_docker) = true ]; then \
docker run --rm -v $(shell pwd)/work:/work:rw librewolf/bsys5-image-macos-$(arch) sh -c "cd /work/librewolf-$(version)-$(source_release) && ./mach build && ./mach package" ; \
else \
(cd /work/librewolf-$(version)-$(source_release) && ./mach build && ./mach package) ; \
fi
cp -v work/librewolf-96.0.3-5/obj-$(arch)-apple-darwin/dist/librewolf-$(version)-$(source_release).en-US.mac.dmg $(outfile)
sha256sum $(outfile) > $(outfile).sha256sum
cat $(outfile).sha256sum

59
assets/macos.mozconfig Normal file
View File

@ -0,0 +1,59 @@
ac_add_options --enable-application=browser
# for crosscompiling...
ac_add_options --target=_ARCH_-apple-darwin
ac_add_options --with-macos-sdk=/osx-cross/MacOSX-SDKs/MacOSX11.3.sdk
CROSS_BUILD=1
export CROSS=/root/.mozbuild
CROSS=/root/.mozbuild
CCTOOLS=$CROSS/cctools
export DSYMUTIL="$CROSS/clang/bin/dsymutil"
mk_add_options "export PATH=$CCTOOLS/bin:$CROSS/binutils/bin:$CROSS/dmg:$PATH"
mk_add_options "export LD_LIBRARY_PATH=$MOZBUILD/clang/lib:$CCTOOLS/lib"
export CC="$CROSS/clang/bin/clang"
export CXX="$CROSS/clang/bin/clang++"
export HOST_CC="$CROSS/clang/bin/clang"
export HOST_CXX="$CROSS/clang/bin/clang++"
# These are needed for packaging.
export MKFSHFS="$CROSS/hfsplus-tools/newfs_hfs"
export DMG_TOOL="$CROSS/dmg/dmg"
export HFS_TOOL="$CROSS/dmg/hfsplus"
# standard librwolf settings
ac_add_options --allow-addon-sideload
ac_add_options --disable-crashreporter
ac_add_options --disable-debug
ac_add_options --disable-default-browser-agent
ac_add_options --disable-tests
ac_add_options --disable-updater
ac_add_options --enable-hardening
ac_add_options --enable-optimize
ac_add_options --enable-release
ac_add_options --enable-rust-simd
ac_add_options --with-app-name=librewolf
ac_add_options --with-branding=browser/branding/librewolf
ac_add_options --with-unsigned-addon-scopes=app,system
export MOZ_REQUIRE_SIGNING=
mk_add_options MOZ_CRASHREPORTER=0
mk_add_options MOZ_DATA_REPORTING=0
mk_add_options MOZ_SERVICES_HEALTHREPORT=0
mk_add_options MOZ_TELEMETRY_REPORTING=0
# wasi: we ask maintainers to all use this as wasi sysroot..
# There is a script 'setup-wasi-linux.sh' that attempts to download the wasi sdk and place it into the location pointed to below.
ac_add_options --with-wasi-sysroot=/root/.mozbuild/wrlb/wasi-sysroot