From a35373f5842389cf2b6dc51d4e8166bd44beface Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 27 Jan 2017 11:49:04 +0100 Subject: [PATCH] luaPackages: refactor common platform strings --- pkgs/top-level/lua-packages.nix | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index 6bf6bc4a38e7..3db9e66a98ee 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -14,6 +14,14 @@ let isLua51 = lua.luaversion == "5.1"; 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 = with self; { inherit lua; @@ -167,9 +175,7 @@ let preBuild = '' makeFlagsArray=( - ${if stdenv.isLinux then "linux" - else if stdenv.isDarwin then "macosx" - else "bsd"} + ${platformString} LUAPATH="$out/lib/lua/${lua.luaversion}" LUACPATH="$out/lib/lua/${lua.luaversion}" INC_PATH="-I${lua}/include" @@ -199,11 +205,7 @@ let preBuild = '' makeFlagsArray=( LUAV=${lua.luaversion} - PLAT=${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"} + PLAT=${platformString} prefix=$out ); ''; @@ -246,7 +248,7 @@ let preBuild = '' makeFlagsArray=( - linux + ${platformString} LUAPATH="$out/share/lua/${lua.luaversion}" LUACPATH="$out/lib/lua/${lua.luaversion}" INCDIR="-I${lua}/include" @@ -346,7 +348,7 @@ let makeFlagsArray=(CC=$CC); ''; - buildFlags = if stdenv.isDarwin then "macosx" else ""; + buildFlags = platformString; installPhase = '' mkdir -p $out/lib/lua/${lua.luaversion}