libstdcxx5: init at 3.3.6

This commit is contained in:
Nikolay Amiantov 2016-09-03 16:51:36 +03:00
parent 358232f68a
commit a38476a32e
3 changed files with 170 additions and 0 deletions

View file

@ -0,0 +1,115 @@
{ stdenv, fetchurl, fetchpatch, flex, bison, file }:
stdenv.mkDerivation rec {
name = "libstdc++5-${version}";
version = "3.3.6";
src = [
(fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
sha256 = "1dpyrpsgakilz2rnh5f8gvrzq5pwzvndacc0df6m04bpqn5fx6sg";
})
(fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
sha256 = "14lxl81f7adpc9jxfiwzdxsdzs5zv4piv8xh7f9w910hfzrgvsby";
})
];
patches = [
./no-sys-dirs.patch
(fetchpatch {
name = "siginfo.patch";
url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/siginfo.patch?h=packages/libstdc%2B%2B5&id=e36ee8ed9bb5942db14cf6249a2ead14974a2bfa";
sha256 = "15zldbm33yba293dgrgsbv3j332hkc3iqpyc8fa7zl42mh9qk22j";
addPrefixes = true;
})
(fetchpatch {
name = "gcc-3.4.3-no_multilib_amd64.patch";
url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/gcc-3.4.3-no_multilib_amd64.patch?h=packages/libstdc%2B%2B5&id=e36ee8ed9bb5942db14cf6249a2ead14974a2bfa";
sha256 = "11m5lc51b0addhc4yq4rz0dwpv6k73rrj73wya3lqdk8rly6cjpm";
addPrefixes = true;
})
];
postPatch = ''
# fix build issue with recent gcc
sed -i "s#O_CREAT#O_CREAT, 0666#" gcc/collect2.c
# No fixincludes
sed -i -e 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
'';
preConfigure = ''
mkdir ../build
cd ../build
configureScript=../$sourceRoot/configure
'';
preBuild = ''
# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad
# Thing.
export CPP="gcc -E"
# 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_CC/nix-support/orig-libc-dev)/include"
# The path to the Glibc binaries such as `crti.o'.
glibc_libdir="$(cat $NIX_CC/nix-support/orig-libc)/lib"
# Figure out what extra flags to pass to the gcc compilers
# being generated to make sure that they use our glibc.
EXTRA_FLAGS="-I$NIX_FIXINC_DUMMY $(cat $NIX_CC/nix-support/libc-cflags) -O2"
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before)"
for i in $extraLDFlags; do
EXTRA_FLAGS="$EXTRA_FLAGS -Wl,$i"
done
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
# the startfiles.
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
# for the startfiles.
makeFlagsArray=( \
"''${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
CFLAGS_FOR_BUILD="$EXTRA_FLAGS" \
CFLAGS_FOR_TARGET="$EXTRA_FLAGS" \
CXXFLAGS_FOR_BUILD="$EXTRA_FLAGS" \
CXXFLAGS_FOR_TARGET="$EXTRA_FLAGS" \
FLAGS_FOR_TARGET="$EXTRA_FLAGS" \
LDFLAGS_FOR_BUILD="$EXTRA_FLAGS" \
LDFLAGS_FOR_TARGET="$EXTRA_FLAGS" \
BOOT_CFLAGS="$EXTRA_FLAGS" \
BOOT_LDFLAGS="$EXTRA_FLAGS"
)
'';
hardeningDisable = [ "format" ];
nativeBuildInputs = [ flex bison file ];
configureFlags = [ "--disable-multilib" "--enable-__cxa-atexit" "--enable-threads=posix" "--enable-languages=c++" "--enable-clocale=gnu" ];
buildFLags = [ "all-target-libstdc++-v3" ];
installFlags = [ "install-target-libstdc++-v3" ];
postInstall = ''
# Remove includefiles and libs provided by gcc
shopt -s extglob
rm -rf $out/{bin,include,share,man,info}
rm -f $out/lib/*.a
rm -rf $out/lib/!(libstdc++*)
'';
meta = with stdenv.lib; {
homepage = http://gcc.gnu.org/;
license = licenses.lgpl3Plus;
description = "GNU Compiler Collection, version ${version} -- C++ standard library";
platforms = platforms.linux;
maintainers = with maintainers; [ abbradar ];
};
}

View file

@ -0,0 +1,53 @@
diff -ru3 gcc-3.3.6-old/gcc/cppdefault.c gcc-3.3.6/gcc/cppdefault.c
--- gcc-3.3.6-old/gcc/cppdefault.c 2003-11-07 02:13:31.000000000 +0300
+++ gcc-3.3.6/gcc/cppdefault.c 2016-09-02 16:00:03.492484016 +0300
@@ -26,6 +26,10 @@
#include "system.h"
#include "cppdefault.h"
+#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 -ru3 gcc-3.3.6-old/gcc/gcc.c gcc-3.3.6/gcc/gcc.c
--- gcc-3.3.6-old/gcc/gcc.c 2004-04-01 20:55:17.000000000 +0400
+++ gcc-3.3.6/gcc/gcc.c 2016-09-02 16:01:24.843520114 +0300
@@ -6130,10 +6130,6 @@
NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
}
- add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_1,
- "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
- add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_2,
- "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
#if 0 /* Can cause surprises, and one can use -B./ instead. */
add_prefix (&startfile_prefixes, "./", NULL,
PREFIX_PRIORITY_LAST, 1, NULL, 0);
diff -ru3 gcc-3.3.6-old/gcc/Makefile.in gcc-3.3.6/gcc/Makefile.in
--- gcc-3.3.6-old/gcc/Makefile.in 2004-04-01 20:55:23.000000000 +0400
+++ gcc-3.3.6/gcc/Makefile.in 2016-09-02 16:00:03.493484017 +0300
@@ -260,7 +260,11 @@
PARTITION_H = $(srcdir)/../include/partition.h
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
-NATIVE_SYSTEM_HEADER_DIR = /usr/include
+# 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@
@@ -2201,7 +2205,7 @@
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_alias)\" \
-DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
- -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
+ -DLOCAL_INCLUDE_DIR=\"/no-such-dir\" \
-DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
-DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
@TARGET_SYSTEM_ROOT_DEFINE@

View file

@ -6360,6 +6360,8 @@ in
libcxx = llvmPackages.libcxx;
libcxxabi = llvmPackages.libcxxabi;
libstdcxx5 = callPackage ../development/libraries/libstdc++5 { };
libsigrok = callPackage ../development/tools/libsigrok { };
# old version:
libsigrok-0-3-0 = libsigrok.override {