summary refs log tree commit diff
path: root/pkgs/development/compilers/gcc-upc-4.0
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-03-04 16:20:11 +0000
committerLudovic Courtès <ludo@gnu.org>2008-03-04 16:20:11 +0000
commit8b34b723f7f6019cd8073b2348d10e01b3003ab6 (patch)
treed5c935bb2ca4a257a06e0f148bb21a0781f4f7d1 /pkgs/development/compilers/gcc-upc-4.0
parentcfe56735b02dab0fb62540a2d3004826931615a5 (diff)
downloadnixpkgs-8b34b723f7f6019cd8073b2348d10e01b3003ab6.tar
nixpkgs-8b34b723f7f6019cd8073b2348d10e01b3003ab6.tar.gz
nixpkgs-8b34b723f7f6019cd8073b2348d10e01b3003ab6.tar.bz2
nixpkgs-8b34b723f7f6019cd8073b2348d10e01b3003ab6.tar.lz
nixpkgs-8b34b723f7f6019cd8073b2348d10e01b3003ab6.tar.xz
nixpkgs-8b34b723f7f6019cd8073b2348d10e01b3003ab6.tar.zst
nixpkgs-8b34b723f7f6019cd8073b2348d10e01b3003ab6.zip
Add GCC-UPC, a compiler for the UPC distributed shared memory language.
svn path=/nixpkgs/trunk/; revision=10956
Diffstat (limited to 'pkgs/development/compilers/gcc-upc-4.0')
-rw-r--r--pkgs/development/compilers/gcc-upc-4.0/builder.sh87
-rw-r--r--pkgs/development/compilers/gcc-upc-4.0/default.nix59
-rw-r--r--pkgs/development/compilers/gcc-upc-4.0/honor-cflags.patch20
-rw-r--r--pkgs/development/compilers/gcc-upc-4.0/no-sys-dirs.patch202
4 files changed, 368 insertions, 0 deletions
diff --git a/pkgs/development/compilers/gcc-upc-4.0/builder.sh b/pkgs/development/compilers/gcc-upc-4.0/builder.sh
new file mode 100644
index 00000000000..5df3168027f
--- /dev/null
+++ b/pkgs/development/compilers/gcc-upc-4.0/builder.sh
@@ -0,0 +1,87 @@
+source $stdenv/setup
+
+
+export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
+mkdir $NIX_FIXINC_DUMMY
+
+
+# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
+# Thing.
+export CPP="gcc -E"
+export CXXCPP="gcc -E"
+
+
+if test "$noSysDirs" = "1"; then
+
+    if test -e $NIX_GCC/nix-support/orig-libc; then
+
+        # Figure out what extra flags to pass to the gcc compilers
+        # being generated to make sure that they use our glibc.
+        extraCFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
+        extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
+
+        # Use *real* header files, otherwise a limits.h is generated
+        # that does not include Glibc's limits.h (notably missing
+        # SSIZE_MAX, which breaks the build).
+        export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
+        
+    else
+        # Hack: support impure environments.
+        extraCFlags="-isystem /usr/include"
+        extraLDFlags="-L/usr/lib64 -L/usr/lib"
+        export NIX_FIXINC_DUMMY=/usr/include
+    fi
+
+    extraCFlags="-g0 $extraCFlags"
+    extraLDFlags="--strip-debug $extraLDFlags"
+
+    export NIX_EXTRA_CFLAGS=$extraCFlags
+    for i in $extraLDFlags; do
+        export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
+    done
+
+    export CFLAGS=$extraCFlags
+    export CXXFLAGS=$extraCFlags
+    
+    makeFlagsArray=( \
+        NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+        SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
+        LIMITS_H_TEST=true \
+        X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
+        )
+fi
+
+
+preConfigure=preConfigure
+preConfigure() {
+    # Perform the build in a different directory.
+    mkdir ../build
+    cd ../build
+    configureScript=../$sourceRoot/configure
+}
+
+
+postInstall=postInstall
+postInstall() {
+    # Remove precompiled headers for now.  They are very big and
+    # probably not very useful yet.
+    find $out/include -name "*.gch" -exec rm -rf {} \; -prune
+
+    # Remove `fixincl' to prevent a retained dependency on the
+    # previous gcc.
+    rm -rf $out/libexec/gcc/*/*/install-tools
+
+    # Get rid of some "fixed" header files
+    rm -rf $out/lib/gcc/*/*/include/root
+}
+
+
+if test -z "$profiledCompiler"; then
+    buildFlags="bootstrap"
+else    
+    buildFlags="profiledbootstrap"
+fi
+
+genericBuild
diff --git a/pkgs/development/compilers/gcc-upc-4.0/default.nix b/pkgs/development/compilers/gcc-upc-4.0/default.nix
new file mode 100644
index 00000000000..ec3fe905477
--- /dev/null
+++ b/pkgs/development/compilers/gcc-upc-4.0/default.nix
@@ -0,0 +1,59 @@
+# Nix expression for GCC-UPC 4.0, based on that of GCC 4.0.
+
+{ stdenv, fetchurl, noSysDirs, bison, autoconf, gnum4
+, profiledCompiler ? false
+, gmp ? null , mpfr ? null
+, texinfo ? null
+}:
+
+with import ../../../lib;
+
+# GCC-UPC apparently doesn't support GCov and friends.
+assert profiledCompiler == false;
+
+stdenv.mkDerivation {
+  name = "gcc-upc-4.0.3.5";
+  builder = ../gcc-4.0/builder.sh;
+  src = fetchurl {
+    url = "ftp://ftp.intrepid.com/pub/upc/rls/upc-4.0.3.5/upc-4.0.3.5.src.tar.gz";
+    sha256 = "0afnz1bz0kknhl18205bbwncyza08983ivfaagj5yl7x3nwy7prv";
+  };
+  
+  patches = [ ./honor-cflags.patch ]
+    ++ optional noSysDirs [ ./no-sys-dirs.patch ];
+    
+  inherit noSysDirs profiledCompiler;
+
+  # Attributes used by `wrapGCC'.
+  langC   = true ;
+  langCC  = false;
+  langF77 = false;
+  langUPC = true;    # unused
+
+  buildInputs = [gmp mpfr texinfo
+
+                 # Bison is needed to build the parsers.
+                 bison
+
+		 # For some reason, `autoheader' and `m4' are needed.
+		 autoconf gnum4];
+
+  # Note: We use `--enable-maintainer-mode' so that `bison' is actually
+  # run when needed.
+  configureFlags = "
+    --disable-multilib
+    --disable-libstdcxx-pch
+    --disable-libmudflap
+    --with-system-zlib
+    ${if stdenv.isi686 then "--with-arch=i686" else ""}
+    --enable-maintainer-mode
+  ";
+
+  meta = {
+    homepage = http://www.intrepid.com/upc.html;
+    license = "GPL/LGPL";
+    description = ''A GCC-based compiler for the Unified Parallel C (UPC)
+                    language, a distributed shared memory aware variant of
+		    C (see http://upc.gwu.edu/).'';
+  };
+}
diff --git a/pkgs/development/compilers/gcc-upc-4.0/honor-cflags.patch b/pkgs/development/compilers/gcc-upc-4.0/honor-cflags.patch
new file mode 100644
index 00000000000..98628845511
--- /dev/null
+++ b/pkgs/development/compilers/gcc-upc-4.0/honor-cflags.patch
@@ -0,0 +1,20 @@
+--- upc-4.0.3.5/gcc/upc/Make-lang.in	2008-03-03 18:56:13.000000000 +0100
++++ upc-4.0.3.5/gcc/upc/Make-lang.in	2008-03-03 18:57:27.000000000 +0100
+@@ -70,7 +70,7 @@ xupc$(exeext): $(srcdir)/upc/upc-cmd.c M
+ 	    "-DLIB_PATH=\"$${libdir}\"" \
+ 	    "-DINC_PATH=\"$${incdir}\"" \
+ 	    -c $(srcdir)/upc/upc-cmd.c -o xupc-tmp.o
+-	$(CC) xupc-tmp.o -o xupc$(exeext) $(LIBS)
++	$(CC) xupc-tmp.o $(ALL_CFLAGS) $(LDFLAGS) -o xupc$(exeext) $(LIBS)
+ 	rm -f xupc-tmp.o
+ 
+ upc-cmd$(exeext): $(srcdir)/upc/upc-cmd.c Makefile cc1upc$(exeext) $(LIBDEPS)
+@@ -80,7 +80,7 @@ upc-cmd$(exeext): $(srcdir)/upc/upc-cmd.
+ 	    "-DCOMPILER=\"gcc\"" \
+ 	    "-DBIN_PATH=\"$(bindir)\"" \
+ 	    -c $(srcdir)/upc/upc-cmd.c -o upc-cmd-tmp.o
+-	$(CC) upc-cmd-tmp.o -o upc-cmd$(exeext) $(LIBS)
++	$(CC) upc-cmd-tmp.o $(ALL_CFLAGS) $(LDFLAGS) -o upc-cmd$(exeext) $(LIBS)
+ 	rm -f upc-cmd-tmp.o
+ 
+ # UPC language specific files.
diff --git a/pkgs/development/compilers/gcc-upc-4.0/no-sys-dirs.patch b/pkgs/development/compilers/gcc-upc-4.0/no-sys-dirs.patch
new file mode 100644
index 00000000000..dcac5342637
--- /dev/null
+++ b/pkgs/development/compilers/gcc-upc-4.0/no-sys-dirs.patch
@@ -0,0 +1,202 @@
+diff -rc gcc-4.0.0-orig/gcc/cppdefault.c gcc-4.0.0/gcc/cppdefault.c
+*** gcc-4.0.0-orig/gcc/cppdefault.c	2004-11-03 04:23:49.000000000 +0100
+--- gcc-4.0.0/gcc/cppdefault.c	2005-04-22 09:53:28.000000000 +0200
+***************
+*** 41,46 ****
+--- 41,50 ----
+  # undef CROSS_INCLUDE_DIR
+  #endif
+  
++ #undef LOCAL_INCLUDE_DIR
++ #undef SYSTEM_INCLUDE_DIR
++ #undef STANDARD_INCLUDE_DIR
++ 
+  const struct default_include cpp_include_defaults[]
+  #ifdef INCLUDE_DEFAULTS
+  = INCLUDE_DEFAULTS;
+diff -rc gcc-4.0.0-orig/gcc/Makefile.in gcc-4.0.0/gcc/Makefile.in
+*** gcc-4.0.0-orig/gcc/Makefile.in	2005-04-04 21:45:13.000000000 +0200
+--- gcc-4.0.0/gcc/Makefile.in	2005-04-22 10:38:50.000000000 +0200
+***************
+*** 213,219 ****
+  CPPFLAGS = @CPPFLAGS@
+  
+  # These exists to be overridden by the x-* and t-* files, respectively.
+! X_CFLAGS =
+  T_CFLAGS =
+  
+  X_CPPFLAGS =
+--- 213,219 ----
+  CPPFLAGS = @CPPFLAGS@
+  
+  # These exists to be overridden by the x-* and t-* files, respectively.
+! X_CFLAGS = $(NIX_EXTRA_CFLAGS) $(NIX_EXTRA_LDFLAGS)
+  T_CFLAGS =
+  
+  X_CPPFLAGS =
+***************
+*** 373,379 ****
+  MD5_H	    = $(srcdir)/../include/md5.h
+  
+  # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+! NATIVE_SYSTEM_HEADER_DIR = /usr/include
+  # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+  
+--- 373,383 ----
+  MD5_H	    = $(srcdir)/../include/md5.h
+  
+  # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+! # Nix: we override NATIVE_SYSTEM_HEADER_DIR in order to prevent
+! # `fixinc' from fixing header files in /usr/include.  However,
+! # NATIVE_SYSTEM_HEADER_DIR must point to an existing directory, so set
+! # it to some dummy directory.
+! NATIVE_SYSTEM_HEADER_DIR = $(NIX_FIXINC_DUMMY)
+  # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+  
+***************
+*** 385,391 ****
+  STMP_FIXINC = @STMP_FIXINC@
+  
+  # Test to see whether <limits.h> exists in the system header files.
+! LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
+  
+  # Directory for prefix to system directories, for
+  # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.
+--- 389,395 ----
+  STMP_FIXINC = @STMP_FIXINC@
+  
+  # Test to see whether <limits.h> exists in the system header files.
+! LIMITS_H_TEST = true
+  
+  # Directory for prefix to system directories, for
+  # each of $(system_prefix)/usr/include, $(system_prefix)/usr/lib, etc.
+***************
+*** 2677,2683 ****
+    -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
+    -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
+    -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
+!   -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
+    -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
+    -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
+    @TARGET_SYSTEM_ROOT_DEFINE@
+--- 2681,2687 ----
+    -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
+    -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
+    -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
+!   -DLOCAL_INCLUDE_DIR=\"/no-such-dir\" \
+    -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
+    -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
+    @TARGET_SYSTEM_ROOT_DEFINE@
+diff -rc gcc-4.0.0-orig/ltcf-cxx.sh gcc-4.0.0/ltcf-cxx.sh
+*** gcc-4.0.0-orig/ltcf-cxx.sh	2004-10-02 18:33:06.000000000 +0200
+--- gcc-4.0.0/ltcf-cxx.sh	2005-04-22 09:53:28.000000000 +0200
+***************
+*** 988,994 ****
+    # the conftest object file.
+    pre_test_object_deps_done=no
+  
+!   for p in `eval $output_verbose_link_cmd`; do
+  
+      case $p in
+  
+--- 988,994 ----
+    # the conftest object file.
+    pre_test_object_deps_done=no
+  
+!   for p in `true`; do
+  
+      case $p in
+  
+Only in gcc-4.0.0: ltcf-cxx.sh.orig
+diff -rc gcc-4.0.0-orig/ltconfig gcc-4.0.0/ltconfig
+*** gcc-4.0.0-orig/ltconfig	2004-10-02 18:33:06.000000000 +0200
+--- gcc-4.0.0/ltconfig	2005-04-22 13:33:33.000000000 +0200
+***************
+*** 2321,2326 ****
+--- 2321,2331 ----
+  # A language-specific compiler.
+  CC=$CC
+  
++ # Ugly hack to get libmudflap (and possibly other libraries) to build.
++ # Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
++ # to Glibc gets lost.  Here we forcibly add it to any invocation.
++ CC="\$CC $NIX_EXTRA_LDFLAGS"
++ 
+  # Is the compiler the GNU C compiler?
+  with_gcc=$with_gcc
+  
+Only in gcc-4.0.0: ltconfig~
+diff -rc gcc-4.0.0-orig/Makefile.in gcc-4.0.0/Makefile.in
+*** gcc-4.0.0-orig/Makefile.in	2005-04-21 09:04:10.000000000 +0200
+--- gcc-4.0.0/Makefile.in	2005-04-22 09:53:28.000000000 +0200
+***************
+*** 336,342 ****
+  NM = @NM@
+  
+  LD = @LD@
+! LDFLAGS = 
+  
+  RANLIB = @RANLIB@
+  
+--- 336,342 ----
+  NM = @NM@
+  
+  LD = @LD@
+! LDFLAGS = $(NIX_EXTRA_LDFLAGS)
+  
+  RANLIB = @RANLIB@
+  
+***************
+*** 387,393 ****
+  # CFLAGS will be just -g.  We want to ensure that TARGET libraries
+  # (which we know are built with gcc) are built with optimizations so
+  # prepend -O2 when setting CFLAGS_FOR_TARGET.
+! CFLAGS_FOR_TARGET = -O2 $(CFLAGS)
+  # If GCC_FOR_TARGET is not overriden on the command line, then this
+  # variable is passed down to the gcc Makefile, where it is used to
+  # build libgcc2.a.  We define it here so that it can itself be
+--- 387,393 ----
+  # CFLAGS will be just -g.  We want to ensure that TARGET libraries
+  # (which we know are built with gcc) are built with optimizations so
+  # prepend -O2 when setting CFLAGS_FOR_TARGET.
+! CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(NIX_EXTRA_CFLAGS)
+  # If GCC_FOR_TARGET is not overriden on the command line, then this
+  # variable is passed down to the gcc Makefile, where it is used to
+  # build libgcc2.a.  We define it here so that it can itself be
+***************
+*** 400,406 ****
+  RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
+  CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+  RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+! CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
+  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
+  
+  DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
+--- 400,406 ----
+  RAW_CXX_FOR_TARGET = @RAW_CXX_FOR_TARGET@
+  CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+  RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = @RAW_CXX_FOR_TARGET_FOR_RECURSIVE_MAKE@
+! CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(NIX_EXTRA_CFLAGS)
+  LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
+  
+  DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
+***************
+*** 434,440 ****
+      fi; \
+    fi`
+  
+! LDFLAGS_FOR_TARGET = 
+  
+  NM_FOR_TARGET=@NM_FOR_TARGET@
+  CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
+--- 434,440 ----
+      fi; \
+    fi`
+  
+! LDFLAGS_FOR_TARGET = $(NIX_EXTRA_LDFLAGS)
+  
+  NM_FOR_TARGET=@NM_FOR_TARGET@
+  CONFIGURED_NM_FOR_TARGET=@CONFIGURED_NM_FOR_TARGET@
+Only in gcc-4.0.0: Makefile.in.orig