summary refs log blame commit diff
path: root/pkgs/test/simple/builder.sh
blob: 58bf16c43b3420f7878cc46f82155c6fd3e457d4 (plain) (tree)
1
2
3
4
5
6
7





                  
                           













                                 

                                                                                        


              

      















                                                    
#! /bin/sh

export NIX_DEBUG=1

. $stdenv/setup

export NIX_ENFORCE_PURITY=1

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

exit 0

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