terralang / terra

Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
terralang.org
Other
2.71k stars 197 forks source link

Install libterra.so with system-standard name and symlink terra.so for other users #574

Closed elliottslaughter closed 2 years ago

elliottslaughter commented 2 years ago

Historically Terra has installed itself as terra.so on Unix, even though the system convention would be libterra.so. I believe at the time the reason was for compatibility with Lua, where modules are expected to be unprefixed (e.g., you can require("terra") to load terra.so automatically).

We don't currently have a test case for this, but you can verify this behavior manually with (after a build):

$ cd lib
$ ../luajit/bin/luajit-2.1.0-beta3 
LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2022 Mike Pall. https://luajit.org/
JIT: ON SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
> require("terra")
> 

This change makes libterra.so the default in CMake, but adds a target to symlink this to terra.so for compatibility with the Lua convention. This should benefit most users on Unix who (aside from LuaJIT) expect libraries to be prefixed with lib.