From 38d6189d4335bbcdc38f0c31cf769082b96f22fa Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 30 Mar 2025 15:41:37 -0400 Subject: Further support for .dylib files on mac by changing syntax for library imports to `use -lfoo` instead of `use foo.so` --- examples/commands/commands.tm | 2 +- examples/game/raylib.tm | 2 +- examples/http/http.tm | 2 +- examples/tomo-install/tomo-install.tm | 12 ++++++++++-- 4 files changed, 13 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/commands/commands.tm b/examples/commands/commands.tm index be18b776..70a2303b 100644 --- a/examples/commands/commands.tm +++ b/examples/commands/commands.tm @@ -1,7 +1,7 @@ # Functions for running system commands use ./commands.c -use libunistring.so +use -lunistring extern run_command:func(exe:Text, args:[Text], env:{Text,Text}, input:[Byte]?, output:&[Byte]?, error:&[Byte]? -> Int32) extern command_by_line:func(exe:Text, args:[Text], env:{Text,Text} -> func(->Text?)?) diff --git a/examples/game/raylib.tm b/examples/game/raylib.tm index faa6f227..fc0affb9 100644 --- a/examples/game/raylib.tm +++ b/examples/game/raylib.tm @@ -1,5 +1,5 @@ # Raylib wrapper for some functions and structs -use libraylib.so +use -lraylib use use diff --git a/examples/http/http.tm b/examples/http/http.tm index 2555986f..12203faf 100644 --- a/examples/http/http.tm +++ b/examples/http/http.tm @@ -1,6 +1,6 @@ # A simple HTTP library built using CURL -use libcurl.so +use -lcurl use struct HTTPResponse(code:Int, body:Text) diff --git a/examples/tomo-install/tomo-install.tm b/examples/tomo-install/tomo-install.tm index 0205c380..0a6c608d 100644 --- a/examples/tomo-install/tomo-install.tm +++ b/examples/tomo-install/tomo-install.tm @@ -61,14 +61,22 @@ func main(paths:[Path]): curl @curl_flags @url | tar xz -C ~/.local/share/tomo/installed --strip-components=1 --one-top-level=@hash echo @original_url > ~/.local/share/tomo/installed/@hash/source.url tomo -L ~/.local/share/tomo/installed/@hash - ln -f -s ../installed/@hash/lib@hash.so ~/.local/share/tomo/lib/lib@hash.so + if [ "`uname -s`" = "Darwin" ]; then + ln -f -s ../installed/@hash/lib@hash.dylib ~/.local/share/tomo/lib/lib@hash.dylib + else + ln -f -s ../installed/@hash/lib@hash.so ~/.local/share/tomo/lib/lib@hash.so + fi `:get_output()!) if alias: say($Shell( set -exuo pipefail ln -f -s @hash ~/.local/share/tomo/installed/@alias - ln -f -s lib@hash.so ~/.local/share/tomo/lib/lib@alias.so + if [ "`uname -s`" = "Darwin" ]; then + ln -f -s lib@hash.dylib ~/.local/share/tomo/lib/lib@alias.dylib + else + ln -f -s lib@hash.so ~/.local/share/tomo/lib/lib@alias.so + fi ):get_output()!) say("$\[1]Installed $url!$\[]") -- cgit v1.2.3