Skip to content

Commit

Permalink
Merge pull request #1 from gridaphobe/darwin-stdenv
Browse files Browse the repository at this point in the history
fix some packages that won't build in the darwin-clang-stdenv
  • Loading branch information
Joel Taylor committed Aug 24, 2014
2 parents 62f59bc + 1753a20 commit c634ba9
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 8 deletions.
1 change: 0 additions & 1 deletion pkgs/development/compilers/llvm/3.4/llvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,5 @@ in stdenv.mkDerivation rec {
license = stdenv.lib.licenses.bsd3;
maintainers = with stdenv.lib.maintainers; [ shlevy lovek323 raskin viric ];
platforms = stdenv.lib.platforms.all;
# broken = stdenv.isDarwin;
};
}
2 changes: 2 additions & 0 deletions pkgs/development/compilers/ocaml/4.01.0.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
sha256 = "b1ca708994180236917ae79e17606da5bd334ca6acd6873a550027e1c0ec874a";
};

patches = [ ./fix-clang-build-on-osx.diff ];

prefixKey = "-prefix ";
configureFlags = ["-no-tk"] ++ optionals useX11 [ "-x11lib" x11lib
"-x11include" x11inc ];
Expand Down
20 changes: 20 additions & 0 deletions pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/configure b/configure
index d45e88f..25d872b 100755
--- a/configure
+++ b/configure
@@ -322,7 +322,14 @@ case "$bytecc,$target" in
bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
mathlib="";;
*,*-*-darwin*)
- bytecccompopts="-fno-defer-pop $gcc_warnings"
+ # On recent version of OSX, gcc is a symlink to clang
+ if $bytecc --version | grep -q clang; then
+ # -fno-defer-pop is not supported by clang, and make recent
+ # versions of clang to fail
+ bytecccompopts="$gcc_warnings"
+ else
+ bytecccompopts="-fno-defer-pop $gcc_warnings"
+ fi
mathlib=""
mkexe="$mkexe -Wl,-no_compact_unwind"
# Tell gcc that we can use 32-bit code addresses for threaded code
6 changes: 4 additions & 2 deletions pkgs/development/libraries/boost/1.55.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames
, toolset ? null
, toolset ? if stdenv.isDarwin then "clang" else null
, enableRelease ? true
, enableDebug ? false
, enableSingleThreaded ? false
Expand Down Expand Up @@ -57,6 +57,8 @@ stdenv.mkDerivation {
sha256 = "0lkv5dzssbl5fmh2nkaszi8x9qbj80pr4acf9i26sj3rvlih1w7z";
};

patches = stdenv.lib.optional (toolset == "clang") [ ./boost-155-clang.patch ];

enableParallelBuilding = true;

buildInputs =
Expand All @@ -66,7 +68,7 @@ stdenv.mkDerivation {
configureScript = "./bootstrap.sh";
configureFlags = "--with-icu=${icu} --with-python=${python}/bin/python" + withToolset;

buildPhase = "${stdenv.lib.optionalString (toolset == "clang") "unset NIX_ENFORCE_PURITY; "}./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=${layout} variant=${variant} threading=${threading} link=${link} ${cflags} install${withToolset}";
buildPhase = "${stdenv.lib.optionalString (toolset == "clang") "unset NIX_ENFORCE_PURITY; "}./b2 -j$NIX_BUILD_CORES -sEXPAT_INCLUDE=${expat}/include -sEXPAT_LIBPATH=${expat}/lib --layout=${layout} variant=${variant} threading=${threading} link=${link} ${cflags} install";

# normal install does not install bjam, this is a separate step
installPhase = ''
Expand Down
90 changes: 90 additions & 0 deletions pkgs/development/libraries/boost/boost-155-clang.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
diff --git a/boost/atomic/detail/cas128strong.hpp b/boost/atomic/detail/cas128strong.hpp
index 906c13e..dcb4d7d 100644
--- a/boost/atomic/detail/cas128strong.hpp
+++ b/boost/atomic/detail/cas128strong.hpp
@@ -196,15 +196,17 @@ class base_atomic<T, void, 16, Sign>

public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
+ memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}

void
store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type value_s = 0;
+ storage_type value_s;
+ memset(&value_s, 0, sizeof(value_s));
memcpy(&value_s, &value, sizeof(value_type));
platform_fence_before_store(order);
platform_store128(value_s, &v_);
@@ -247,7 +249,9 @@ class base_atomic<T, void, 16, Sign>
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));

diff --git a/boost/atomic/detail/gcc-atomic.hpp b/boost/atomic/detail/gcc-atomic.hpp
index a130590..4af99a1 100644
--- a/boost/atomic/detail/gcc-atomic.hpp
+++ b/boost/atomic/detail/gcc-atomic.hpp
@@ -958,14 +958,16 @@ class base_atomic<T, void, 16, Sign>

public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
- explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
+ explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
+ memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}

void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type tmp = 0;
+ storage_type tmp;
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
__atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
}
@@ -980,7 +982,8 @@ class base_atomic<T, void, 16, Sign>

value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
- storage_type tmp = 0;
+ storage_type tmp;
+ memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
value_type res;
@@ -994,7 +997,9 @@ class base_atomic<T, void, 16, Sign>
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
@@ -1010,7 +1015,9 @@ class base_atomic<T, void, 16, Sign>
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
- storage_type expected_s = 0, desired_s = 0;
+ storage_type expected_s, desired_s;
+ memset(&expected_s, 0, sizeof(expected_s));
+ memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,
4 changes: 3 additions & 1 deletion pkgs/development/libraries/libc++abi/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ stdenv, fetchsvn, libcxx, libunwind, gnused }:
{ stdenv, coreutils, fetchsvn, libcxx, libunwind, gnused }:
let
rev = "199626";
in stdenv.mkDerivation {
Expand All @@ -12,6 +12,8 @@ in stdenv.mkDerivation {

NIX_CFLAGS_LINK="-L${libunwind}/lib -lunwind";

buildInputs = [ coreutils ];

postUnpack = ''
unpackFile ${libcxx.src}
export NIX_CFLAGS_COMPILE="-I${libunwind}/include -I$PWD/include -I$(readlink -f libcxx-*)/include"
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/tools/misc/sloccount/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ stdenv.mkDerivation rec {

configurePhase = ''
sed -i "makefile" -"es|PREFIX[[:blank:]]*=.*$|PREFIX = $out|g"
sed -i "makefile" -"es|gcc|$CC|g"
'';

doCheck = true;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/shells/fish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
description = "Smart and user-friendly command line shell";
homepage = "http://fishshell.com/";
license = licenses.gpl2;
platforms = platforms.linux;
platforms = platforms.unix;
maintainers = with maintainers; [ ocharles ];
};
}
2 changes: 2 additions & 0 deletions pkgs/tools/compression/bzip2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ stdenv.mkDerivation {
sharedLibrary =
!stdenv.isDarwin && !(stdenv ? isDietLibC) && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;

patchPhase = stdenv.lib.optionalString stdenv.isDarwin "substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'";

preConfigure = "substituteInPlace Makefile --replace '$(PREFIX)/man' '$(PREFIX)/share/man'";

makeFlags = if linkStatic then "LDFLAGS=-static" else "";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/tools/networking/isync/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ stdenv.mkDerivation rec {
license = [ "GPLv2+" ];

maintainers = with stdenv.lib.maintainers; [ the-kenny viric ];
platforms = stdenv.lib.platforms.linux;
platforms = stdenv.lib.platforms.unix;
};
}
2 changes: 1 addition & 1 deletion pkgs/tools/typesetting/tex/tex4ht/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
cd src
for f in tex4ht t4ht htcmd ; do
# -DENVFILE="$out/share/texmf-nix/tex4ht/base/unix/tex4ht.env"
gcc -o $f $f.c -I${tetex}/include -L${tetex}/lib -DHAVE_DIRENT_H -DHAVE_DIRENT_H -DKPATHSEA -lkpathsea
$CC -o $f $f.c -I${tetex}/include -L${tetex}/lib -DHAVE_DIRENT_H -DHAVE_DIRENT_H -DKPATHSEA -lkpathsea
done
cd -
'';
Expand Down
1 change: 0 additions & 1 deletion pkgs/tools/typesetting/tex/texlive/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ rec {
setupHook = ./setup-hook.sh;

doMainBuild = fullDepEntry ( stdenv.lib.optionalString stdenv.isDarwin ''
export MACOSX_DEPLOYMENT_TARGET=10.9
export DYLD_LIBRARY_PATH="${poppler}/lib"
'' + ''
mkdir -p $out
Expand Down

0 comments on commit c634ba9

Please sign in to comment.