Homebrew Formula
I've started looking at what it'll take to get vpnkit into Homebrew-core or at minimum in a tap.
-
I think the main blocking issue is the legacy OPAM version that appears to be required. Looking at the CircleCI config the project is using 1.2.2_4: https://github.com/moby/vpnkit/blob/master/.circleci/config.yml#L19.
-
The makefiles assume they're running from within a git repo. A workaround is to have the brew formula fetch the git repo, but more ideal is fetching the released source tar file from GitHub.
-
The vpnkit tagged version 0.3.0 appears somewhat dated with a number of important fixes since then. It looks like vpnkit in Docker Desktop on macOS is compiled from ea9dbeaf887f5dad8391f4a34d127501fb6bbf64. Would it make sense to tag and release that as 0.4.0 since its already widely deployed?
-
Progress so far: https://github.com/bensallen/homebrew-vpnkit/blob/master/vpnkit.rb
Current build steps that work on master. Be weary of tcpip.3.3.0 though. It's on a branch that could be removed.
Right now I'm working on automating win/mac/linux builds with Github actions and will have it produce artifacts in releases. If you're interested you could pull from that when I complete the work. Repo is going to be protosam/vpnkit-builds.
$ git clone https://github.com/moby/vpnkit.git
$ cd vpnkit
$ brew install aspcud darcs gpatch mercurial wget pkg-config libtool
$ mkdir -p ~/bin
$ curl -sLo ~/bin/opam https://github.com/ocaml/opam/releases/download/2.1.1/opam-2.1.1-x86_64-macos
$ chmod +x ~/bin/opam
$ opam init --compiler=4.12.0
$ opam pin configurator --dev-repo -n
$ opam pin add tcpip.3.3.0 "https://github.com/djs55/mirage-tcpip.git#vpnkit-20210417" -n
$ opam pin add vpnkit . -n
$ opam install vpnkit charrua-client-mirage alcotest dune -y --update-invariant
$ opam exec -- dune build --profile release
$ ls -lah _build/install/default/bin/vpnkit