mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
36fb29f8f0
* Add support for the creation of shared libraries to `compileC', `link', and `makeLibrary'. * Enable the ATerm library to be made into a shared library.
21 lines
414 B
Bash
21 lines
414 B
Bash
. $stdenv/setup
|
|
|
|
shopt -s nullglob
|
|
|
|
objs=
|
|
for i in $objects; do
|
|
obj=$(echo $i/*.o)
|
|
objs="$objs $obj"
|
|
done
|
|
|
|
libs=
|
|
for i in $libraries; do
|
|
lib=$(echo $i/*.a; echo $i/*.so)
|
|
name=$(echo $(basename $lib) | sed -e 's/^lib//' -e 's/.a$//' -e 's/.so$//')
|
|
libs="$libs -L$(dirname $lib) -l$name"
|
|
done
|
|
|
|
echo "linking object files into \`$programName'..."
|
|
|
|
mkdir $out
|
|
gcc -o $out/$programName $objs $libs
|