nixpkgs/pkgs/test/simple/builder.sh
Eelco Dolstra 946a2d4a48 * gcc-wrapper now filters out -L and -I flags referring to paths
outside the store (in pure builds).

svn path=/nixpkgs/trunk/; revision=817
2004-03-08 18:29:08 +00:00

42 lines
681 B
Bash
Executable File

#! /bin/sh
export NIX_DEBUG=1
. $stdenv/setup
#export NIX_CFLAGS_COMPILE="-v $NIX_CFLAGS_COMPILE"
mkdir $out
mkdir $out/bin
cat > hello.c <<EOF
#include <stdio.h>
int main(int argc, char * * argv)
{
printf("Hello World!\n");
return 0;
}
EOF
#gcc -I/nix/store/foo -I /nix/store/foo -I/usr/lib -I /usr/lib hello.c -o $out/bin/hello
gcc -L /nix/store/abcd/lib -isystem /usr/lib hello.c -o $out/bin/hello
$out/bin/hello
cat > hello2.cc <<EOF
#include <iostream>
int main(int argc, char * * argv)
{
std::cout << "Hello World!\n";
std::cout << VALUE << std::endl;
return 0;
}
EOF
g++ hello2.cc -o $out/bin/hello2 -DVALUE="1 + 2 * 3"
$out/bin/hello2
ld -v