at master 1.6 kB view raw
1{ 2 lib, 3 stdenv, 4 withoutTargetLibc, 5 libcCross, 6 threadsCross, 7}: 8 9let 10 inherit (stdenv) hostPlatform targetPlatform; 11in 12 13{ 14 # For non-cross builds these flags are currently assigned in builder.sh. 15 # It would be good to consolidate the generation of makeFlags 16 # ({C,CXX,LD}FLAGS_FOR_{BUILD,TARGET}, etc...) at some point. 17 EXTRA_FLAGS_FOR_TARGET = 18 let 19 mkFlags = 20 dep: 21 lib.optionals ((!lib.systems.equals targetPlatform hostPlatform) && dep != null) ( 22 [ 23 "-O2 -idirafter ${lib.getDev dep}${dep.incdir or "/include"}" 24 ] 25 ++ lib.optionals (!withoutTargetLibc) [ 26 "-B${lib.getLib dep}${dep.libdir or "/lib"}" 27 ] 28 ); 29 in 30 mkFlags libcCross 31 ++ lib.optionals (!withoutTargetLibc) (mkFlags (threadsCross.package or null)) 32 ++ mkFlags (libcCross.w32api or null); 33 34 EXTRA_LDFLAGS_FOR_TARGET = 35 let 36 mkFlags = 37 dep: 38 lib.optionals ((!lib.systems.equals targetPlatform hostPlatform) && dep != null) ( 39 [ 40 "-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}" 41 ] 42 ++ ( 43 if withoutTargetLibc then 44 [ 45 "-B${lib.getLib dep}${dep.libdir or "/lib"}" 46 ] 47 else 48 [ 49 "-Wl,-rpath,${lib.getLib dep}${dep.libdir or "/lib"}" 50 "-Wl,-rpath-link,${lib.getLib dep}${dep.libdir or "/lib"}" 51 ] 52 ) 53 ); 54 in 55 mkFlags libcCross 56 ++ lib.optionals (!withoutTargetLibc) (mkFlags (threadsCross.package or null)) 57 ++ mkFlags (libcCross.w32api or null); 58}