stdenvBootstrapTools: inherit {cross,local}System
It's expected that attributes in the top-level package set will all use
that package set, but this wasn't the case for the bootstrap tools.
This led some very confusing behaviour:
- pkgsMusl.stdenvBootstrapTools would build glibc bootstrap tools
- stdenvBootstrapTools was _always_ cross compiled, even if
Nixpkgs wasn't, because it always set crossSystem. This also didn't
match the behaviour of using make-bootstrap-tools.nix as an
entrypoint, where crossSystem would default to null.
For the Linux stdenv, I've made the ideal fix, which is to make pkgs an
argument rather than taking the arguments for pkgs, and then
re-importing it. This means it'll always use exactly the same package
set that's calling it, and should also mean faster eval due to not
importing Nixpkgs twice.
The Darwin stdenv is more complicated, and I'm not able to easily test
it, so I wasn't confident in making the same fix there. Instead, I've
just made sure crossSystem and localSystem are set to the correct values
so they're not always cross compiled and match the parent package set's.
It would still be preferable if somebody could make Darwin's
make-bootstrap-tools.nix take pkgs as an argument, rather than all the
arguments for pkgs.
2022-05-30 14:16:22 +00:00
|
|
|
{ pkgs ? import ../../.. {} }:
|
2007-12-03 15:40:29 +00:00
|
|
|
|
2017-06-26 20:56:03 +00:00
|
|
|
let
|
2018-02-06 00:12:47 +00:00
|
|
|
libc = pkgs.stdenv.cc.libc;
|
2017-06-26 20:56:03 +00:00
|
|
|
in with pkgs; rec {
|
2006-10-19 18:03:13 +00:00
|
|
|
|
2009-01-30 09:27:15 +00:00
|
|
|
|
2014-10-29 12:36:03 +00:00
|
|
|
coreutilsMinimal = coreutils.override (args: {
|
2017-01-04 22:46:34 +00:00
|
|
|
# We want coreutils without ACL/attr support.
|
2009-01-30 09:27:15 +00:00
|
|
|
aclSupport = false;
|
2017-01-04 22:46:34 +00:00
|
|
|
attrSupport = false;
|
2016-06-28 07:48:56 +00:00
|
|
|
# Our tooling currently can't handle scripts in bin/, only ELFs and symlinks.
|
|
|
|
singleBinary = "symlinks";
|
2009-01-30 09:27:15 +00:00
|
|
|
});
|
|
|
|
|
2016-04-17 21:55:17 +00:00
|
|
|
tarMinimal = gnutar.override { acl = null; };
|
|
|
|
|
2014-10-29 12:36:03 +00:00
|
|
|
busyboxMinimal = busybox.override {
|
2021-03-16 02:23:35 +00:00
|
|
|
useMusl = !stdenv.targetPlatform.isRiscV;
|
2014-10-29 12:36:03 +00:00
|
|
|
enableStatic = true;
|
|
|
|
enableMinimal = true;
|
2010-08-21 12:50:49 +00:00
|
|
|
extraConfig = ''
|
|
|
|
CONFIG_ASH y
|
2017-08-14 14:41:48 +00:00
|
|
|
CONFIG_ASH_ECHO y
|
|
|
|
CONFIG_ASH_TEST y
|
2014-10-29 12:36:03 +00:00
|
|
|
CONFIG_ASH_OPTIMIZE_FOR_SIZE y
|
2010-08-21 12:50:49 +00:00
|
|
|
CONFIG_MKDIR y
|
2014-10-29 12:36:03 +00:00
|
|
|
CONFIG_TAR y
|
|
|
|
CONFIG_UNXZ y
|
2010-08-21 12:50:49 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-03-06 16:15:05 +00:00
|
|
|
bootGCC = gcc.cc.override { enableLTO = false; };
|
2018-12-31 19:56:07 +00:00
|
|
|
bootBinutils = binutils.bintools.override {
|
|
|
|
withAllTargets = false;
|
|
|
|
# Don't need two linkers, disable whatever's not primary/default.
|
2022-02-10 19:50:33 +00:00
|
|
|
enableGold = false;
|
2018-12-31 19:56:07 +00:00
|
|
|
# bootstrap is easier w/static
|
|
|
|
enableShared = false;
|
|
|
|
};
|
2018-03-06 16:15:05 +00:00
|
|
|
|
2014-10-27 11:31:53 +00:00
|
|
|
build =
|
2006-10-27 22:50:58 +00:00
|
|
|
|
2009-01-30 09:27:15 +00:00
|
|
|
stdenv.mkDerivation {
|
2015-10-23 11:04:10 +00:00
|
|
|
name = "stdenv-bootstrap-tools";
|
2009-01-30 09:27:15 +00:00
|
|
|
|
2020-12-02 14:37:31 +00:00
|
|
|
meta = {
|
|
|
|
# Increase priority to unblock nixpkgs-unstable
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/104679#issuecomment-732267288
|
|
|
|
schedulingPriority = 200;
|
|
|
|
};
|
|
|
|
|
2017-06-26 20:56:03 +00:00
|
|
|
nativeBuildInputs = [ buildPackages.nukeReferences buildPackages.cpio ];
|
2009-01-30 09:27:15 +00:00
|
|
|
|
|
|
|
buildCommand = ''
|
2014-10-27 11:31:53 +00:00
|
|
|
set -x
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin $out/lib $out/libexec
|
2009-01-30 09:27:15 +00:00
|
|
|
|
2018-11-01 20:18:51 +00:00
|
|
|
'' + (if (stdenv.hostPlatform.libc == "glibc") then ''
|
2009-01-30 09:27:15 +00:00
|
|
|
# Copy what we need of Glibc.
|
2018-01-05 21:36:24 +00:00
|
|
|
cp -d ${libc.out}/lib/ld*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libc*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libc_nonshared.a $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libm*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libdl*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/librt*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libpthread*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libnsl*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libutil*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libnss*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/libresolv*.so* $out/lib
|
|
|
|
cp -d ${libc.out}/lib/crt?.o $out/lib
|
|
|
|
|
2022-04-04 18:39:09 +00:00
|
|
|
# Hacky compat with our current unpack-bootstrap-tools.sh
|
|
|
|
ln -s librt.so "$out"/lib/librt-dummy.so
|
|
|
|
|
2018-01-05 21:36:24 +00:00
|
|
|
cp -rL ${libc.dev}/include $out
|
2016-03-03 11:09:50 +00:00
|
|
|
chmod -R u+w "$out"
|
|
|
|
|
2018-01-05 21:36:24 +00:00
|
|
|
# libc can contain linker scripts: find them, copy their deps,
|
2016-03-03 11:09:50 +00:00
|
|
|
# and get rid of absolute paths (nuke-refs would make them useless)
|
|
|
|
local lScripts=$(grep --files-with-matches --max-count=1 'GNU ld script' -R "$out/lib")
|
2018-01-05 21:36:24 +00:00
|
|
|
cp -d -t "$out/lib/" $(cat $lScripts | tr " " "\n" | grep -F '${libc.out}' | sort -u)
|
2016-03-03 11:09:50 +00:00
|
|
|
for f in $lScripts; do
|
2018-01-05 21:36:24 +00:00
|
|
|
substituteInPlace "$f" --replace '${libc.out}/lib/' ""
|
2016-03-03 11:09:50 +00:00
|
|
|
done
|
2014-10-27 11:31:53 +00:00
|
|
|
|
2009-01-30 09:27:15 +00:00
|
|
|
# Hopefully we won't need these.
|
|
|
|
rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
|
2009-06-22 14:28:07 +00:00
|
|
|
find $out/include -name .install -exec rm {} \;
|
|
|
|
find $out/include -name ..install.cmd -exec rm {} \;
|
2009-01-30 09:27:15 +00:00
|
|
|
mv $out/include $out/include-glibc
|
2018-11-01 20:18:51 +00:00
|
|
|
'' else if (stdenv.hostPlatform.libc == "musl") then ''
|
2018-01-05 21:36:24 +00:00
|
|
|
# Copy what we need from musl
|
|
|
|
cp ${libc.out}/lib/* $out/lib
|
|
|
|
cp -rL ${libc.dev}/include $out
|
|
|
|
chmod -R u+w "$out"
|
2014-10-27 11:31:53 +00:00
|
|
|
|
2018-01-05 21:36:24 +00:00
|
|
|
rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
|
|
|
|
find $out/include -name .install -exec rm {} \;
|
|
|
|
find $out/include -name ..install.cmd -exec rm {} \;
|
2018-01-05 22:26:46 +00:00
|
|
|
mv $out/include $out/include-libc
|
2018-01-05 21:36:24 +00:00
|
|
|
'' else throw "unsupported libc for bootstrap tools")
|
|
|
|
+ ''
|
2009-01-30 09:27:15 +00:00
|
|
|
# Copy coreutils, bash, etc.
|
2018-03-05 23:03:40 +00:00
|
|
|
cp -d ${coreutilsMinimal.out}/bin/* $out/bin
|
2009-01-30 09:27:15 +00:00
|
|
|
(cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
|
2014-10-27 11:31:53 +00:00
|
|
|
|
2016-04-17 21:59:55 +00:00
|
|
|
cp ${bash.out}/bin/bash $out/bin
|
|
|
|
cp ${findutils.out}/bin/find $out/bin
|
|
|
|
cp ${findutils.out}/bin/xargs $out/bin
|
|
|
|
cp -d ${diffutils.out}/bin/* $out/bin
|
|
|
|
cp -d ${gnused.out}/bin/* $out/bin
|
|
|
|
cp -d ${gnugrep.out}/bin/grep $out/bin
|
|
|
|
cp ${gawk.out}/bin/gawk $out/bin
|
|
|
|
cp -d ${gawk.out}/bin/awk $out/bin
|
2016-04-17 21:55:17 +00:00
|
|
|
cp ${tarMinimal.out}/bin/tar $out/bin
|
2016-04-17 21:59:55 +00:00
|
|
|
cp ${gzip.out}/bin/gzip $out/bin
|
2016-02-01 18:45:57 +00:00
|
|
|
cp ${bzip2.bin}/bin/bzip2 $out/bin
|
2016-04-17 21:59:55 +00:00
|
|
|
cp -d ${gnumake.out}/bin/* $out/bin
|
2009-01-30 09:27:15 +00:00
|
|
|
cp -d ${patch}/bin/* $out/bin
|
2010-08-01 20:57:13 +00:00
|
|
|
cp ${patchelf}/bin/* $out/bin
|
2009-01-30 09:27:15 +00:00
|
|
|
|
2016-01-24 07:30:07 +00:00
|
|
|
cp -d ${gnugrep.pcre.out}/lib/libpcre*.so* $out/lib # needed by grep
|
2014-10-27 11:31:53 +00:00
|
|
|
|
2009-01-30 09:27:15 +00:00
|
|
|
# Copy what we need of GCC.
|
2018-03-06 16:15:05 +00:00
|
|
|
cp -d ${bootGCC.out}/bin/gcc $out/bin
|
|
|
|
cp -d ${bootGCC.out}/bin/cpp $out/bin
|
|
|
|
cp -d ${bootGCC.out}/bin/g++ $out/bin
|
|
|
|
cp -d ${bootGCC.lib}/lib/libgcc_s.so* $out/lib
|
|
|
|
cp -d ${bootGCC.lib}/lib/libstdc++.so* $out/lib
|
2020-02-11 04:54:16 +00:00
|
|
|
cp -d ${bootGCC.out}/lib/libssp.a* $out/lib
|
|
|
|
cp -d ${bootGCC.out}/lib/libssp_nonshared.a $out/lib
|
2018-03-06 16:15:05 +00:00
|
|
|
cp -rd ${bootGCC.out}/lib/gcc $out/lib
|
2009-01-30 09:27:15 +00:00
|
|
|
chmod -R u+w $out/lib
|
|
|
|
rm -f $out/lib/gcc/*/*/include*/linux
|
|
|
|
rm -f $out/lib/gcc/*/*/include*/sound
|
|
|
|
rm -rf $out/lib/gcc/*/*/include*/root
|
2009-06-22 14:28:07 +00:00
|
|
|
rm -f $out/lib/gcc/*/*/include-fixed/asm
|
2010-08-21 12:50:49 +00:00
|
|
|
rm -rf $out/lib/gcc/*/*/plugin
|
2009-01-30 09:27:15 +00:00
|
|
|
#rm -f $out/lib/gcc/*/*/*.a
|
2018-03-06 16:15:05 +00:00
|
|
|
cp -rd ${bootGCC.out}/libexec/* $out/libexec
|
2014-10-29 12:36:03 +00:00
|
|
|
chmod -R u+w $out/libexec
|
|
|
|
rm -rf $out/libexec/gcc/*/*/plugin
|
2018-01-05 21:36:24 +00:00
|
|
|
mkdir -p $out/include
|
2018-03-06 16:15:05 +00:00
|
|
|
cp -rd ${bootGCC.out}/include/c++ $out/include
|
2009-01-30 09:27:15 +00:00
|
|
|
chmod -R u+w $out/include
|
|
|
|
rm -rf $out/include/c++/*/ext/pb_ds
|
|
|
|
rm -rf $out/include/c++/*/ext/parallel
|
|
|
|
|
2016-04-17 21:59:55 +00:00
|
|
|
cp -d ${gmpxx.out}/lib/libgmp*.so* $out/lib
|
2016-01-24 07:30:00 +00:00
|
|
|
cp -d ${mpfr.out}/lib/libmpfr*.so* $out/lib
|
2017-06-26 20:56:03 +00:00
|
|
|
cp -d ${libmpc.out}/lib/libmpc*.so* $out/lib
|
2016-01-24 07:30:24 +00:00
|
|
|
cp -d ${zlib.out}/lib/libz.so* $out/lib
|
2014-10-27 11:31:53 +00:00
|
|
|
|
2018-11-01 20:18:51 +00:00
|
|
|
'' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
2017-06-26 20:56:03 +00:00
|
|
|
# These needed for cross but not native tools because the stdenv
|
|
|
|
# GCC has certain things built in statically. See
|
|
|
|
# pkgs/stdenv/linux/default.nix for the details.
|
2020-11-17 21:20:48 +00:00
|
|
|
cp -d ${isl_0_20.out}/lib/libisl*.so* $out/lib
|
2017-06-26 20:56:03 +00:00
|
|
|
|
2021-03-04 19:46:32 +00:00
|
|
|
'' + lib.optionalString (stdenv.hostPlatform.isRiscV) ''
|
|
|
|
# libatomic is required on RiscV platform for C/C++ atomics and pthread
|
|
|
|
# even though they may be translated into native instructions.
|
|
|
|
cp -d ${bootGCC.out}/lib/libatomic.a* $out/lib
|
|
|
|
|
2017-06-26 20:56:03 +00:00
|
|
|
'' + ''
|
2017-04-13 13:28:09 +00:00
|
|
|
cp -d ${bzip2.out}/lib/libbz2.so* $out/lib
|
|
|
|
|
2009-01-30 09:27:15 +00:00
|
|
|
# Copy binutils.
|
|
|
|
for i in as ld ar ranlib nm strip readelf objdump; do
|
2018-12-31 19:56:07 +00:00
|
|
|
cp ${bootBinutils.out}/bin/$i $out/bin
|
2009-01-30 09:27:15 +00:00
|
|
|
done
|
2021-08-21 21:09:47 +00:00
|
|
|
cp -r '${lib.getLib binutils.bintools}'/lib/* "$out/lib/"
|
2009-01-30 09:27:15 +00:00
|
|
|
|
|
|
|
chmod -R u+w $out
|
2014-10-27 11:31:53 +00:00
|
|
|
|
2009-01-30 09:27:15 +00:00
|
|
|
# Strip executables even further.
|
|
|
|
for i in $out/bin/* $out/libexec/gcc/*/*/*; do
|
|
|
|
if test -x $i -a ! -L $i; then
|
|
|
|
chmod +w $i
|
2017-06-26 20:56:03 +00:00
|
|
|
$STRIP -s $i || true
|
2009-01-30 09:27:15 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
nuke-refs $out/bin/*
|
|
|
|
nuke-refs $out/lib/*
|
2021-08-21 21:09:47 +00:00
|
|
|
nuke-refs $out/lib/*/*
|
2009-01-30 09:27:15 +00:00
|
|
|
nuke-refs $out/libexec/gcc/*/*/*
|
2017-06-26 20:56:03 +00:00
|
|
|
nuke-refs $out/lib/gcc/*/*/*
|
2021-07-16 14:15:32 +00:00
|
|
|
nuke-refs $out/lib/gcc/*/*/include-fixed/*{,/*}
|
2009-01-30 09:27:15 +00:00
|
|
|
|
|
|
|
mkdir $out/.pack
|
|
|
|
mv $out/* $out/.pack
|
|
|
|
mv $out/.pack $out/pack
|
|
|
|
|
|
|
|
mkdir $out/on-server
|
2018-09-26 21:50:25 +00:00
|
|
|
XZ_OPT="-9 -e" tar cvJf $out/on-server/bootstrap-tools.tar.xz --hard-dereference --sort=name --numeric-owner --owner=0 --group=0 --mtime=@1 -C $out/pack .
|
2014-10-29 12:36:03 +00:00
|
|
|
cp ${busyboxMinimal}/bin/busybox $out/on-server
|
|
|
|
chmod u+w $out/on-server/busybox
|
|
|
|
nuke-refs $out/on-server/busybox
|
2009-01-30 09:27:15 +00:00
|
|
|
''; # */
|
|
|
|
|
|
|
|
# The result should not contain any references (store paths) so
|
|
|
|
# that we can safely copy them out of the store and to other
|
|
|
|
# locations in the store.
|
|
|
|
allowedReferences = [];
|
2006-10-20 11:16:15 +00:00
|
|
|
};
|
2009-01-30 09:27:15 +00:00
|
|
|
|
2015-10-23 11:04:10 +00:00
|
|
|
dist = stdenv.mkDerivation {
|
|
|
|
name = "stdenv-bootstrap-tools";
|
|
|
|
|
2020-12-02 14:37:31 +00:00
|
|
|
meta = {
|
|
|
|
# Increase priority to unblock nixpkgs-unstable
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/104679#issuecomment-732267288
|
|
|
|
schedulingPriority = 200;
|
|
|
|
};
|
|
|
|
|
2015-10-23 11:04:10 +00:00
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
echo "file tarball ${build}/on-server/bootstrap-tools.tar.xz" >> $out/nix-support/hydra-build-products
|
|
|
|
echo "file busybox ${build}/on-server/busybox" >> $out/nix-support/hydra-build-products
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2016-03-03 12:46:21 +00:00
|
|
|
bootstrapFiles = {
|
2016-12-25 22:54:45 +00:00
|
|
|
# Make them their own store paths to test that busybox still works when the binary is named /nix/store/HASH-busybox
|
|
|
|
busybox = runCommand "busybox" {} "cp ${build}/on-server/busybox $out";
|
|
|
|
bootstrapTools = runCommand "bootstrap-tools.tar.xz" {} "cp ${build}/on-server/bootstrap-tools.tar.xz $out";
|
2016-03-03 12:46:21 +00:00
|
|
|
};
|
|
|
|
|
2021-04-28 10:46:43 +00:00
|
|
|
bootstrapTools =
|
|
|
|
let extraAttrs = lib.optionalAttrs
|
2022-04-27 20:21:32 +00:00
|
|
|
config.contentAddressedByDefault
|
2021-04-28 10:46:43 +00:00
|
|
|
{
|
|
|
|
__contentAddressed = true;
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
if (stdenv.hostPlatform.libc == "glibc") then
|
2018-01-05 22:26:46 +00:00
|
|
|
import ./bootstrap-tools {
|
2018-11-01 20:19:17 +00:00
|
|
|
inherit (stdenv.buildPlatform) system; # Used to determine where to build
|
2021-04-28 10:46:43 +00:00
|
|
|
inherit bootstrapFiles extraAttrs;
|
2018-01-05 22:26:46 +00:00
|
|
|
}
|
2018-11-01 20:18:51 +00:00
|
|
|
else if (stdenv.hostPlatform.libc == "musl") then
|
2018-01-05 22:26:46 +00:00
|
|
|
import ./bootstrap-tools-musl {
|
2018-11-01 20:19:17 +00:00
|
|
|
inherit (stdenv.buildPlatform) system; # Used to determine where to build
|
2021-04-28 10:46:43 +00:00
|
|
|
inherit bootstrapFiles extraAttrs;
|
2018-01-05 22:26:46 +00:00
|
|
|
}
|
|
|
|
else throw "unsupported libc";
|
2016-03-03 12:46:21 +00:00
|
|
|
|
|
|
|
test = derivation {
|
|
|
|
name = "test-bootstrap-tools";
|
2018-11-01 20:19:17 +00:00
|
|
|
inherit (stdenv.hostPlatform) system; # We cannot "cross test"
|
2016-03-03 12:46:21 +00:00
|
|
|
builder = bootstrapFiles.busybox;
|
|
|
|
args = [ "ash" "-e" "-c" "eval \"$buildCommand\"" ];
|
2015-10-23 11:04:10 +00:00
|
|
|
|
2016-03-03 12:46:21 +00:00
|
|
|
buildCommand = ''
|
|
|
|
export PATH=${bootstrapTools}/bin
|
|
|
|
|
|
|
|
ls -l
|
|
|
|
mkdir $out
|
|
|
|
mkdir $out/bin
|
|
|
|
sed --version
|
|
|
|
find --version
|
|
|
|
diff --version
|
|
|
|
patch --version
|
|
|
|
make --version
|
|
|
|
awk --version
|
|
|
|
grep --version
|
|
|
|
gcc --version
|
|
|
|
|
2018-11-01 20:18:51 +00:00
|
|
|
'' + lib.optionalString (stdenv.hostPlatform.libc == "glibc") ''
|
2023-01-20 21:56:57 +00:00
|
|
|
rtld=$(echo ${bootstrapTools}/lib/${builtins.unsafeDiscardStringContext /* only basename */ (builtins.baseNameOf binutils.dynamicLinker)})
|
2023-01-14 19:40:04 +00:00
|
|
|
libc_includes=${bootstrapTools}/include-glibc
|
2018-11-01 20:18:51 +00:00
|
|
|
'' + lib.optionalString (stdenv.hostPlatform.libc == "musl") ''
|
2023-01-14 19:40:04 +00:00
|
|
|
rtld=$(echo ${bootstrapTools}/lib/ld-musl*.so.?)
|
|
|
|
libc_includes=${bootstrapTools}/include-libc
|
2018-01-05 22:26:46 +00:00
|
|
|
'' + ''
|
2023-01-14 19:40:04 +00:00
|
|
|
# path to version-specific libraries, like libstdc++.so
|
|
|
|
cxx_libs=$(echo ${bootstrapTools}/lib/gcc/*/*)
|
|
|
|
export CPP="cpp -idirafter $libc_includes -B${bootstrapTools}"
|
|
|
|
export CC="gcc -idirafter $libc_includes -B${bootstrapTools} -Wl,-dynamic-linker,$rtld -Wl,-rpath,${bootstrapTools}/lib -Wl,-rpath,$cxx_libs"
|
|
|
|
export CXX="g++ -idirafter $libc_includes -B${bootstrapTools} -Wl,-dynamic-linker,$rtld -Wl,-rpath,${bootstrapTools}/lib -Wl,-rpath,$cxx_libs"
|
2016-03-03 12:46:21 +00:00
|
|
|
|
|
|
|
echo '#include <stdio.h>' >> foo.c
|
|
|
|
echo '#include <limits.h>' >> foo.c
|
|
|
|
echo 'int main() { printf("Hello World\\n"); return 0; }' >> foo.c
|
|
|
|
$CC -o $out/bin/foo foo.c
|
|
|
|
$out/bin/foo
|
|
|
|
|
|
|
|
echo '#include <iostream>' >> bar.cc
|
|
|
|
echo 'int main() { std::cout << "Hello World\\n"; }' >> bar.cc
|
|
|
|
$CXX -v -o $out/bin/bar bar.cc
|
|
|
|
$out/bin/bar
|
|
|
|
|
2017-11-13 16:45:09 +00:00
|
|
|
tar xvf ${hello.src}
|
2016-03-03 12:46:21 +00:00
|
|
|
cd hello-*
|
|
|
|
./configure --prefix=$out
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
'';
|
|
|
|
};
|
2009-01-30 09:27:15 +00:00
|
|
|
}
|