diff options
| author | Fuwn <[email protected]> | 2025-11-28 10:18:47 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-11-28 10:18:47 +0000 |
| commit | 2a6888179e4d0de3fc8783ad2b8f0ee2373b1593 (patch) | |
| tree | 33b6517b97307a94c053183e82229cdbea96705d | |
| parent | chore(flake): replace clang stdenv with clang without libraries (diff) | |
| download | maple-2a6888179e4d0de3fc8783ad2b8f0ee2373b1593.tar.xz maple-2a6888179e4d0de3fc8783ad2b8f0ee2373b1593.zip | |
chore: Support macOS
| -rw-r--r-- | build.ninja | 2 | ||||
| -rw-r--r-- | flake.nix | 58 | ||||
| -rw-r--r-- | maple/maple.cc | 5 |
3 files changed, 37 insertions, 28 deletions
diff --git a/build.ninja b/build.ninja index 8505e2c..861ce91 100644 --- a/build.ninja +++ b/build.ninja @@ -1,5 +1,5 @@ cc = clang++ -cxxflags = -std=c++23 -Weverything -Wno-padded -Wno-c++98-compat -MMD -Wno-c++98-compat-pedantic +cxxflags = -std=c++20 -Weverything -Wno-padded -Wno-c++98-compat -MMD -Wno-c++98-compat-pedantic ldflags = -lssl -lcrypto outdir = build name = maple @@ -34,36 +34,42 @@ license = licenses.gpl3Only; maintainers = [ maintainers.Fuwn ]; mainPackage = "maple"; - platforms = platforms.linux; + platforms = platforms.unix; }; maple = with pkgs; - (stdenvAdapters.useMoldLinker clangStdenvNoLibs).mkDerivation { - inherit meta; - - name = "maple"; - version = "0.1.6"; - src = lib.cleanSource ./.; - - nativeBuildInputs = [ - ninja - clang - ]; - - buildInputs = [ - libressl.dev - ]; - - buildPhase = '' - mkdir -p $out/bin - ninja - ''; - - installPhase = '' - cp build/maple $out/bin/maple - ''; - }; + ( + if pkgs.stdenv.isDarwin then + pkgs.clangStdenvNoLibs + else + pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenvNoLibs + ).mkDerivation + { + inherit meta; + + name = "maple"; + version = "0.1.6"; + src = lib.cleanSource ./.; + + nativeBuildInputs = [ + ninja + clang + ]; + + buildInputs = [ + libressl.dev + ]; + + buildPhase = '' + mkdir -p $out/bin + ninja + ''; + + installPhase = '' + cp build/maple $out/bin/maple + ''; + }; in { packages = { diff --git a/maple/maple.cc b/maple/maple.cc index 85ec862..1a1ba5c 100644 --- a/maple/maple.cc +++ b/maple/maple.cc @@ -20,7 +20,6 @@ #include <algorithm> #include <array> -#include <asm-generic/socket.h> #include <cctype> #include <csignal> #include <cstddef> @@ -37,6 +36,10 @@ #include <unistd.h> #include <vector> +#if !defined(__APPLE__) +#include <asm-generic/socket.h> +#endif + #include "gemini.hh" #include "maple.hh" #include "titan.hh" |