diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-02-09T12·48+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2011-02-09T12·48+0000 |
commit | 3087b3f7513ce713e0b759f63b9a4e9142e46f82 (patch) | |
tree | ef9c92ef186a8336dc8d293f37052247a008cd06 | |
parent | eb94581d399b8d0945b883b14c4a892fdab95dfc (diff) |
* Obsolete.
22 files changed, 0 insertions, 353 deletions
diff --git a/make/examples/aterm/aterm/default.nix b/make/examples/aterm/aterm/default.nix deleted file mode 100644 index 56e830c84af4..000000000000 --- a/make/examples/aterm/aterm/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{sharedLib ? true}: - -rec { - - inherit (import ../../../lib) compileC makeLibrary; - - sources = [ - ./afun.c - ./aterm.c - ./bafio.c - ./byteio.c - ./gc.c - ./hash.c - ./list.c - ./make.c - ./md5c.c - ./memory.c - ./tafio.c - ./version.c - ]; - - compile = main: compileC {inherit main sharedLib;}; - - libATerm = makeLibrary { - libraryName = "ATerm"; - objects = map compile sources; - inherit sharedLib; - }; - -} diff --git a/make/examples/aterm/default.nix b/make/examples/aterm/default.nix deleted file mode 100644 index edaac40aa499..000000000000 --- a/make/examples/aterm/default.nix +++ /dev/null @@ -1 +0,0 @@ -import test/default.nix \ No newline at end of file diff --git a/make/examples/aterm/test/default.nix b/make/examples/aterm/test/default.nix deleted file mode 100644 index e59b86b94300..000000000000 --- a/make/examples/aterm/test/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -with (import ../../../lib); - -let { - inherit (import ../aterm {}) libATerm; - - compileTest = main: link { - objects = [(compileC {inherit main; localIncludePath = [ ../aterm ];})]; - libraries = libATerm; - }; - - body = [ - (compileTest ./fib.c) - (compileTest ./primes.c) - ]; -} diff --git a/make/examples/default.nix b/make/examples/default.nix deleted file mode 100644 index 8b5b8bca5efc..000000000000 --- a/make/examples/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -[ (import ./trivial) - (import ./simple-header) - (import ./not-so-simple-header) - (import ./not-so-simple-header-auto) - (import ./aterm) -] \ No newline at end of file diff --git a/make/examples/not-so-simple-header-auto/bar/hello.h b/make/examples/not-so-simple-header-auto/bar/hello.h deleted file mode 100644 index 4595fad98d43..000000000000 --- a/make/examples/not-so-simple-header-auto/bar/hello.h +++ /dev/null @@ -1 +0,0 @@ -#define WHAT "World" diff --git a/make/examples/not-so-simple-header-auto/default.nix b/make/examples/not-so-simple-header-auto/default.nix deleted file mode 100644 index 521af7e89fc4..000000000000 --- a/make/examples/not-so-simple-header-auto/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -with import ../../lib; - -let { - - hello = link {programName = "hello"; objects = compileC { - main = ./foo/hello.c; - localIncludes = "auto"; - };}; - -# body = findIncludes {main = ./foo/hello.c;}; - - body = [hello]; -} diff --git a/make/examples/not-so-simple-header-auto/foo/fnord/indirect.h b/make/examples/not-so-simple-header-auto/foo/fnord/indirect.h deleted file mode 100644 index 2fde1e26c1dd..000000000000 --- a/make/examples/not-so-simple-header-auto/foo/fnord/indirect.h +++ /dev/null @@ -1,3 +0,0 @@ -#define HELLO "Hello" - -#include "../../bar/hello.h" diff --git a/make/examples/not-so-simple-header-auto/foo/hello.c b/make/examples/not-so-simple-header-auto/foo/hello.c deleted file mode 100644 index 7d5b402ce5c2..000000000000 --- a/make/examples/not-so-simple-header-auto/foo/hello.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdio.h> - -#include "fnord/indirect.h" - -int main(int argc, char * * argv) -{ - printf(HELLO " " WHAT "\n"); - return 0; -} diff --git a/make/examples/not-so-simple-header/bar/hello.h b/make/examples/not-so-simple-header/bar/hello.h deleted file mode 100644 index 4595fad98d43..000000000000 --- a/make/examples/not-so-simple-header/bar/hello.h +++ /dev/null @@ -1 +0,0 @@ -#define WHAT "World" diff --git a/make/examples/not-so-simple-header/default.nix b/make/examples/not-so-simple-header/default.nix deleted file mode 100644 index 61ded57c82bb..000000000000 --- a/make/examples/not-so-simple-header/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -let { - - inherit (import ../../lib) compileC link; - - hello = link {programName = "hello"; objects = compileC { - main = ./foo/hello.c; - localIncludes = [ - [./foo/fnord/indirect.h "fnord/indirect.h"] - [./bar/hello.h "fnord/../../bar/hello.h"] - ]; - };}; - - body = [hello]; -} diff --git a/make/examples/not-so-simple-header/foo/fnord/indirect.h b/make/examples/not-so-simple-header/foo/fnord/indirect.h deleted file mode 100644 index 2fde1e26c1dd..000000000000 --- a/make/examples/not-so-simple-header/foo/fnord/indirect.h +++ /dev/null @@ -1,3 +0,0 @@ -#define HELLO "Hello" - -#include "../../bar/hello.h" diff --git a/make/examples/not-so-simple-header/foo/hello.c b/make/examples/not-so-simple-header/foo/hello.c deleted file mode 100644 index 7d5b402ce5c2..000000000000 --- a/make/examples/not-so-simple-header/foo/hello.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdio.h> - -#include "fnord/indirect.h" - -int main(int argc, char * * argv) -{ - printf(HELLO " " WHAT "\n"); - return 0; -} diff --git a/make/examples/simple-header/default.nix b/make/examples/simple-header/default.nix deleted file mode 100644 index e943471aaa4c..000000000000 --- a/make/examples/simple-header/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -let { - - inherit (import ../../lib) compileC link; - - hello = link {objects = compileC { - main = ./hello.c; - localIncludes = [ [./hello.h "hello.h"] ]; - };}; - - body = [hello]; -} diff --git a/make/examples/simple-header/hello.c b/make/examples/simple-header/hello.c deleted file mode 100644 index 15f1ac714e10..000000000000 --- a/make/examples/simple-header/hello.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <stdio.h> - -#include "hello.h" - -int main(int argc, char * * argv) -{ - printf("Hello " WHAT "\n"); - return 0; -} diff --git a/make/examples/simple-header/hello.h b/make/examples/simple-header/hello.h deleted file mode 100644 index 4595fad98d43..000000000000 --- a/make/examples/simple-header/hello.h +++ /dev/null @@ -1 +0,0 @@ -#define WHAT "World" diff --git a/make/examples/trivial/default.nix b/make/examples/trivial/default.nix deleted file mode 100644 index 132245e5823f..000000000000 --- a/make/examples/trivial/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -let { - - inherit (import ../../lib) compileC link; - - hello = link {objects = compileC {main = ./hello.c;};}; - - body = [hello]; -} diff --git a/make/examples/trivial/hello.c b/make/examples/trivial/hello.c deleted file mode 100644 index 237ad8ffe76f..000000000000 --- a/make/examples/trivial/hello.c +++ /dev/null @@ -1,7 +0,0 @@ -#include <stdio.h> - -int main(int argc, char * * argv) -{ - printf("Hello World\n"); - return 0; -} diff --git a/make/lib/compile-c.sh b/make/lib/compile-c.sh deleted file mode 100644 index 3558dd89ead4..000000000000 --- a/make/lib/compile-c.sh +++ /dev/null @@ -1,73 +0,0 @@ -. $stdenv/setup - -mainName=$(basename $main | cut -c34-) - -echo "compiling \`$mainName'..." - -# Turn $localIncludes into an array. -localIncludes=($localIncludes) - -# Determine how many `..' levels appear in the header file references. -# E.g., if there is some reference `../../foo.h', then we have to -# insert two extra levels in the directory structure, so that `a.c' is -# stored at `dotdot/dotdot/a.c', and a reference from it to -# `../../foo.h' resolves to `dotdot/dotdot/../../foo.h' == `foo.h'. -n=0 -maxDepth=0 -for ((n = 0; n < ${#localIncludes[*]}; n += 2)); do - target=${localIncludes[$((n + 1))]} - - # Split the target name into path components using some IFS magic. - savedIFS="$IFS" - IFS=/ - components=($target) - depth=0 - for ((m = 0; m < ${#components[*]}; m++)); do - c=${components[m]} - if test "$c" = ".."; then - depth=$((depth + 1)) - fi - done - IFS="$savedIFS" - - if test $depth -gt $maxDepth; then - maxDepth=$depth; - fi -done - -# Create the extra levels in the directory hierarchy. -prefix= -for ((n = 0; n < maxDepth; n++)); do - prefix="dotdot/$prefix" -done - -# Create symlinks to the header files. -for ((n = 0; n < ${#localIncludes[*]}; n += 2)); do - source=${localIncludes[n]} - target=${localIncludes[$((n + 1))]} - - # Create missing directories. We use IFS magic to split the path - # into path components. - savedIFS="$IFS" - IFS=/ - components=($prefix$target) - fullPath=(.) - for ((m = 0; m < ${#components[*]} - 1; m++)); do - fullPath=("${fullPath[@]}" ${components[m]}) - if ! test -d "${fullPath[*]}"; then - mkdir "${fullPath[*]}" - fi - done - IFS="$savedIFS" - - ln -sf $source $prefix$target -done - -# Create a symlink to the main file. -if ! test "$(readlink $prefix$mainName)" = $main; then - ln -s $main $prefix$mainName -fi - -mkdir $out -test "$prefix" && cd $prefix -gcc -Wall $cFlags -c $mainName -o $out/$mainName.o diff --git a/make/lib/default.nix b/make/lib/default.nix deleted file mode 100644 index 81440ca6a770..000000000000 --- a/make/lib/default.nix +++ /dev/null @@ -1,69 +0,0 @@ -rec { - - # Should point at your Nixpkgs installation. - pkgPath = ./pkgs; - - pkgs = import (pkgPath + /system/all-packages.nix) {}; - - stdenv = pkgs.stdenv; - - - compileC = - { main - , localIncludes ? "auto" - , localIncludePath ? [] - , cFlags ? "" - , sharedLib ? false - }: - stdenv.mkDerivation { - name = "compile-c"; - builder = ./compile-c.sh; - - localIncludes = - if localIncludes == "auto" then - dependencyClosure { - scanner = main: - import (findIncludes { - inherit main; - }); - searchPath = localIncludePath; - startSet = [main]; - } - else - localIncludes; - - inherit main; - - cFlags = [ - cFlags - (if sharedLib then ["-fpic"] else []) - (map (p: "-I" + (relativise (dirOf main) p)) localIncludePath) - ]; - }; - - - findIncludes = {main}: stdenv.mkDerivation { - name = "find-includes"; - realBuilder = pkgs.perl ~ "bin/perl"; - args = [ ./find-includes.pl ]; - inherit main; - }; - - - link = {objects, programName ? "program", libraries ? []}: stdenv.mkDerivation { - name = "link"; - builder = ./link.sh; - inherit objects programName libraries; - }; - - - makeLibrary = {objects, libraryName ? [], sharedLib ? false}: - # assert sharedLib -> fold (obj: x: assert obj.sharedLib && x) false objects - stdenv.mkDerivation { - name = "library"; - builder = ./make-library.sh; - inherit objects libraryName sharedLib; - }; - - -} diff --git a/make/lib/find-includes.pl b/make/lib/find-includes.pl deleted file mode 100644 index 43406825aeac..000000000000 --- a/make/lib/find-includes.pl +++ /dev/null @@ -1,21 +0,0 @@ -use strict; - -my $root = $ENV{"main"}; -my $out = $ENV{"out"}; - -open OUT, ">$out" or die "$!"; -print OUT "[\n"; - -open IN, "<$root" or die "$!"; -while (<IN>) { - if (/^\#include\s+\"(.*)\"/) { - print OUT "\"$1\"\n"; - } - if (/^\#include\s+\<(.*)\>/) { - print OUT "\"$1\"\n"; - } -} -close IN; - -print OUT "]\n"; -close OUT; diff --git a/make/lib/link.sh b/make/lib/link.sh deleted file mode 100644 index a48f750f41d6..000000000000 --- a/make/lib/link.sh +++ /dev/null @@ -1,21 +0,0 @@ -. $stdenv/setup - -shopt -s nullglob - -objs= -for i in $objects; do - obj=$(echo $i/*.o) - objs="$objs $obj" -done - -libs= -for i in $libraries; do - lib=$(echo $i/*.a; echo $i/*.so) - name=$(echo $(basename $lib) | sed -e 's/^lib//' -e 's/.a$//' -e 's/.so$//') - libs="$libs -L$(dirname $lib) -l$name" -done - -echo "linking object files into \`$programName'..." - -mkdir $out -gcc -o $out/$programName $objs $libs diff --git a/make/lib/make-library.sh b/make/lib/make-library.sh deleted file mode 100644 index a486a7bf740c..000000000000 --- a/make/lib/make-library.sh +++ /dev/null @@ -1,28 +0,0 @@ -. $stdenv/setup - -objs= -for i in $objects; do - obj=$(echo $i/*.o) - objs="$objs $obj" -done - -echo "archiving object files into library \`$libraryName'..." - -ensureDir $out - -if test -z "$sharedLib"; then - - outPath=$out/lib${libraryName}.a - - ar crs $outPath $objs - ranlib $outPath - -else - - outPath=$out/lib${libraryName}.so - - gcc -shared -o $outPath $objs - -fi - - |