luaPackages: refactor common platform strings

This commit is contained in:
Vladimír Čunát 2017-01-27 11:49:04 +01:00
parent 70909be2ef
commit a35373f584
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA

View File

@ -14,6 +14,14 @@
let let
isLua51 = lua.luaversion == "5.1"; isLua51 = lua.luaversion == "5.1";
isLua52 = lua.luaversion == "5.2"; isLua52 = lua.luaversion == "5.2";
platformString =
if stdenv.isDarwin then "macosx"
else if stdenv.isFreeBSD then "freebsd"
else if stdenv.isLinux then "linux"
else if stdenv.isSunOS then "solaris"
else throw "unsupported platform";
self = _self; self = _self;
_self = with self; { _self = with self; {
inherit lua; inherit lua;
@ -167,9 +175,7 @@ let
preBuild = '' preBuild = ''
makeFlagsArray=( makeFlagsArray=(
${if stdenv.isLinux then "linux" ${platformString}
else if stdenv.isDarwin then "macosx"
else "bsd"}
LUAPATH="$out/lib/lua/${lua.luaversion}" LUAPATH="$out/lib/lua/${lua.luaversion}"
LUACPATH="$out/lib/lua/${lua.luaversion}" LUACPATH="$out/lib/lua/${lua.luaversion}"
INC_PATH="-I${lua}/include" INC_PATH="-I${lua}/include"
@ -199,11 +205,7 @@ let
preBuild = '' preBuild = ''
makeFlagsArray=( makeFlagsArray=(
LUAV=${lua.luaversion} LUAV=${lua.luaversion}
PLAT=${if stdenv.isDarwin then "macosx" PLAT=${platformString}
else if stdenv.isFreeBSD then "freebsd"
else if stdenv.isLinux then "linux"
else if stdenv.isSunOS then "solaris"
else throw "unsupported platform"}
prefix=$out prefix=$out
); );
''; '';
@ -246,7 +248,7 @@ let
preBuild = '' preBuild = ''
makeFlagsArray=( makeFlagsArray=(
linux ${platformString}
LUAPATH="$out/share/lua/${lua.luaversion}" LUAPATH="$out/share/lua/${lua.luaversion}"
LUACPATH="$out/lib/lua/${lua.luaversion}" LUACPATH="$out/lib/lua/${lua.luaversion}"
INCDIR="-I${lua}/include" INCDIR="-I${lua}/include"
@ -346,7 +348,7 @@ let
makeFlagsArray=(CC=$CC); makeFlagsArray=(CC=$CC);
''; '';
buildFlags = if stdenv.isDarwin then "macosx" else ""; buildFlags = platformString;
installPhase = '' installPhase = ''
mkdir -p $out/lib/lua/${lua.luaversion} mkdir -p $out/lib/lua/${lua.luaversion}