mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Copy vpnkit from Docker Desktop instead of compiling on M1 Macs
This commit is contained in:
parent
f1cbbdf43c
commit
8248d58f21
2 changed files with 19 additions and 10 deletions
9
BUILD.md
9
BUILD.md
|
@ -54,8 +54,6 @@ Create a .rpm:
|
||||||
|
|
||||||
## macOS
|
## macOS
|
||||||
|
|
||||||
_Note for Apple Silicon users:_ Unfortunately the build process requires using a Mac with an Intel chip for now. Building the container image uses Vagrant, which requires VMs, and for now the M1 chip can only run M1 VMs, VirtualBox isn't supported, etc.
|
|
||||||
|
|
||||||
Ensure you have the git submodules checked out:
|
Ensure you have the git submodules checked out:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -65,6 +63,8 @@ git submodule update
|
||||||
|
|
||||||
Install Xcode from the App Store.
|
Install Xcode from the App Store.
|
||||||
|
|
||||||
|
Install [Docker Desktop](https://www.docker.com/products/docker-desktop). Make sure to choose your correct CPU, either Intel Chip or Apple Chip.
|
||||||
|
|
||||||
Install Python 3.9.9 [[from python.org])(https://www.python.org/downloads/release/python-399/).
|
Install Python 3.9.9 [[from python.org])(https://www.python.org/downloads/release/python-399/).
|
||||||
|
|
||||||
Install Python dependencies:
|
Install Python dependencies:
|
||||||
|
@ -77,12 +77,13 @@ poetry install
|
||||||
Install [Homebrew](https://brew.sh/) dependencies:
|
Install [Homebrew](https://brew.sh/) dependencies:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
brew install create-dmg wget pkg-config opam dune ocaml
|
brew install create-dmg wget pkg-config
|
||||||
```
|
```
|
||||||
|
|
||||||
Install opam dependencies:
|
Install opam dependencies (you can skip this step if you are using an Apple M1 chip Mac):
|
||||||
|
|
||||||
```
|
```
|
||||||
|
brew install opam dune ocaml
|
||||||
opam init -y
|
opam init -y
|
||||||
opam install -y alcotest astring base64 bigarray-compat charrua-client-mirage charrua-core cmdliner cohttp-lwt cstruct cstruct-lwt datakit-server datakit-server-9p duration ezjsonm fd-send-recv fmt hvsock io-page io-page-unix ipaddr logs lwt lwt-dllist mirage-channel mirage-channel-lwt mirage-clock-lwt mirage-clock-unix mirage-flow-lwt mirage-kv-lwt mirage-profile mirage-protocols-lwt mirage-random mirage-stack-lwt mirage-time-lwt mirage-vnetif oUnit pcap-format ppx_cstruct ppx_sexp_conv protocol-9p re rresult sexplib sha tar tcpip uri uuidm uwt
|
opam install -y alcotest astring base64 bigarray-compat charrua-client-mirage charrua-core cmdliner cohttp-lwt cstruct cstruct-lwt datakit-server datakit-server-9p duration ezjsonm fd-send-recv fmt hvsock io-page io-page-unix ipaddr logs lwt lwt-dllist mirage-channel mirage-channel-lwt mirage-clock-lwt mirage-clock-unix mirage-flow-lwt mirage-kv-lwt mirage-profile mirage-protocols-lwt mirage-random mirage-stack-lwt mirage-time-lwt mirage-vnetif oUnit pcap-format ppx_cstruct ppx_sexp_conv protocol-9p re rresult sexplib sha tar tcpip uri uuidm uwt
|
||||||
```
|
```
|
||||||
|
|
|
@ -5,15 +5,23 @@ cd vendor/hyperkit/
|
||||||
make || { echo 'Failed to compile hyperkit' ; exit 1; }
|
make || { echo 'Failed to compile hyperkit' ; exit 1; }
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
# Compile vpnkit
|
# Compile vpnkit (on Intel chips, it's too hard to compile in Apple chips)
|
||||||
cd vendor/vpnkit/
|
ARCH=$(/usr/bin/arch)
|
||||||
make -f Makefile.darwin || { echo 'Failed to compile vpnkit' ; exit 1; }
|
if [ "$ARCH" == "i386" ]; then
|
||||||
cd ../..
|
cd vendor/vpnkit/
|
||||||
|
make -f Makefile.darwin || { echo 'Failed to compile vpnkit' ; exit 1; }
|
||||||
|
cd ../..
|
||||||
|
fi
|
||||||
|
|
||||||
# Copy binaries to share
|
# Copy binaries to share
|
||||||
mkdir -p share/bin
|
mkdir -p share/bin
|
||||||
cp vendor/hyperkit/build/hyperkit share/bin/hyperkit
|
cp vendor/hyperkit/build/hyperkit share/bin/hyperkit
|
||||||
cp vendor/vpnkit/_build/install/default/bin/vpnkit share/bin/vpnkit
|
if [ "$ARCH" == "i386" ]; then
|
||||||
|
cp vendor/vpnkit/_build/install/default/bin/vpnkit share/bin/vpnkit
|
||||||
|
elif [ "$ARCH" == "arm64" ]; then
|
||||||
|
# On Apple chips we copy the binary from Docker Desktop
|
||||||
|
cp /Applications/Docker.app/Contents/Resources/bin/com.docker.vpnkit share/bin/vpnkit
|
||||||
|
fi
|
||||||
|
|
||||||
# Build the dangerzone-converter image
|
# Build the dangerzone-converter image
|
||||||
echo "Building dangerzone-converter image"
|
echo "Building dangerzone-converter image"
|
||||||
|
@ -21,7 +29,7 @@ docker build dangerzone-converter --tag dangerzone.rocks/dangerzone
|
||||||
echo "Saving dangerzone-converter image"
|
echo "Saving dangerzone-converter image"
|
||||||
docker save dangerzone.rocks/dangerzone -o vm-builder/dangerzone-converter.tar
|
docker save dangerzone.rocks/dangerzone -o vm-builder/dangerzone-converter.tar
|
||||||
echo "Compressing dangerzone-converter image"
|
echo "Compressing dangerzone-converter image"
|
||||||
gzip vm-builder/dangerzone-converter.tar
|
gzip -f vm-builder/dangerzone-converter.tar
|
||||||
|
|
||||||
# Build the ISO
|
# Build the ISO
|
||||||
docker run -v $(pwd)/vm-builder:/vm-builder alpine:latest /vm-builder/build-iso.sh
|
docker run -v $(pwd)/vm-builder:/vm-builder alpine:latest /vm-builder/build-iso.sh
|
||||||
|
|
Loading…
Reference in a new issue