From d47d494865afc199cd14f0454f0f99992d6db7e1 Mon Sep 17 00:00:00 2001 From: Ethan Niser Date: Thu, 1 Aug 2024 17:39:52 -0700 Subject: [PATCH] update flake to include tcl latest (addresses #243) and add core foundation lib and link flags for darwin --- Makefile | 12 ++++++++++-- flake.nix | 31 +++++++++++++++++++++---------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index f5fd00596..33f9bd5e9 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,20 @@ MINIMUM_RUST_VERSION := 1.73.0 CURRENT_RUST_VERSION := $(shell rustc -V | sed -E 's/rustc ([0-9]+\.[0-9]+\.[0-9]+).*/\1/') RUSTUP := $(shell command -v rustup 2> /dev/null) +UNAME_S := $(shell uname -s) # Executable used to execute the compatibility tests. SQLITE_EXEC ?= ./target/debug/limbo # Static library to use for SQLite C API compatibility tests. -SQLITE_LIB ?= ./target/debug/liblimbo_sqlite3.a +BASE_SQLITE_LIB = ./target/debug/liblimbo_sqlite3.a + +# On darwin link core foundation +ifeq ($(UNAME_S),Darwin) + SQLITE_LIB ?= ../../$(BASE_SQLITE_LIB) -framework CoreFoundation +else + SQLITE_LIB ?= ../../$(BASE_SQLITE_LIB) +endif all: check-rust-version check-wasm-target limbo limbo-wasm .PHONY: all @@ -52,5 +60,5 @@ test-compat: .PHONY: test-compat test-sqlite3: - LIBS=../../$(SQLITE_LIB) make -C sqlite3/tests test + LIBS="$(SQLITE_LIB)" make -C sqlite3/tests test .PHONY: test-sqlite3 diff --git a/flake.nix b/flake.nix index f3bdf78ab..ce9dca12d 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,11 @@ }; }; - outputs = { nixpkgs, fenix, ... }: let + outputs = { + nixpkgs, + fenix, + ... + }: let systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; forAllSystems = nixpkgs.lib.genAttrs systems; in { @@ -18,18 +22,25 @@ pkgs = nixpkgs.legacyPackages.${system}; rustStable = fenix.packages.${system}.stable.toolchain; wasmTarget = fenix.packages.${system}.targets.wasm32-wasi.latest.rust-std; + extraDarwinInputs = + if pkgs.stdenv.isDarwin + then [pkgs.darwin.apple_sdk.frameworks.CoreFoundation] + else []; in { default = with pkgs; mkShell { - buildInputs = [ - clang - libiconv - sqlite - gnumake - rustup # not used to install the toolchain, but the makefile uses it - rustStable - wasmTarget - ]; + buildInputs = + [ + clang + libiconv + sqlite + gnumake + rustup # not used to install the toolchain, but the makefile uses it + rustStable + wasmTarget + tcl + ] + ++ extraDarwinInputs; }; } );