2010-07-28 20:01:17 +02:00
|
|
|
{ stdenv, fetchurl, bison, flex, db4, perl, kernel, iproute }:
|
2009-03-17 15:18:45 +01:00
|
|
|
|
|
|
|
# tcc can even compile kernel modules for speed reason.
|
|
|
|
# that would be a nice use case to test!
|
|
|
|
|
2009-03-20 14:12:26 +01:00
|
|
|
# something is still wrong. The output can't be pasred sometimes
|
|
|
|
# Eg it contains continue/pass,drop/pass, drop/drop. I've replaced
|
|
|
|
# them by ok, drop, drop using sed. I'm not sure wether this is the correct way
|
|
|
|
# Man pages are missing as well. So use the link at the bottom
|
|
|
|
|
2009-03-17 15:18:45 +01:00
|
|
|
let version = "10b"; in
|
|
|
|
|
2010-07-28 20:01:17 +02:00
|
|
|
stdenv.mkDerivation {
|
2009-03-17 15:18:45 +01:00
|
|
|
|
|
|
|
name = "tcng-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = mirror://debian/pool/main/t/tcng/tcng_10b.orig.tar.gz;
|
|
|
|
sha256 = "1xjs0yn90rfa8ibxybg3gab1xzcjg60njymq2bd1b0a9i0arx7ji";
|
|
|
|
};
|
|
|
|
|
2010-07-28 20:01:17 +02:00
|
|
|
iproute2Src = iproute.src;
|
2009-03-17 15:18:45 +01:00
|
|
|
|
2010-07-28 20:01:17 +02:00
|
|
|
patches =
|
|
|
|
[ (fetchurl {
|
|
|
|
url = mirror://debian/pool/main/t/tcng/tcng_10b-2.diff.gz;
|
|
|
|
sha256 = "17i4s2ffif0k4b78gfhkp08lvvharbfvyhwbd0vkwgpria0b9zrd";
|
|
|
|
})
|
|
|
|
];
|
2009-03-17 15:18:45 +01:00
|
|
|
|
|
|
|
# one mailinglist post says you should just add your kernel version to the list.. (?)
|
|
|
|
patchPhase = ''
|
|
|
|
unset patchPhase
|
|
|
|
patchPhase
|
|
|
|
unpackFile $iproute2Src
|
|
|
|
IPROUTESRC=$(echo iproute*)
|
|
|
|
for script in $(find . -type f); do sed -e 's@#![ ]*/bin/bash@#! /bin/sh@' -i $script; done
|
|
|
|
find . -type f | xargs sed -i 's@/usr/bin/perl@${perl}/bin/perl@g'
|
2009-03-20 14:12:26 +01:00
|
|
|
find . -type f | xargs sed -i 's@/lib/cpp@cpp@g'
|
2009-03-17 15:18:45 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# gentoo ebulid says tcsim doesn't compile with 2.6 headers..
|
2009-03-20 14:12:26 +01:00
|
|
|
# DATADIR can still be overridden by env TOPDIR=...
|
|
|
|
# Don't know whats it for except including the default .tc files
|
2009-03-17 15:18:45 +01:00
|
|
|
configurePhase=''
|
|
|
|
cat >> config << EOF
|
|
|
|
YACC="yacc"
|
2009-03-20 14:12:26 +01:00
|
|
|
DATA_DIR="$out/lib/tcng"
|
2009-03-17 15:18:45 +01:00
|
|
|
EOF
|
|
|
|
./configure \
|
|
|
|
--kernel ${kernel}/lib/modules/2.6.28.6-default/build \
|
|
|
|
--iproute2 $IPROUTESRC \
|
|
|
|
--install-directory $out \
|
|
|
|
--no-manual \
|
|
|
|
--with-tcsim
|
|
|
|
'';
|
|
|
|
|
|
|
|
# hacky, how to enable building tcc the correct way?
|
|
|
|
# adding shared and tcc to SUBDIRS and run make again isn't nice but works
|
|
|
|
buildPhase = ''
|
|
|
|
sed -i 's@^\(SUBDIRS.*\)@\1 shared tcc@' Makefile
|
2010-07-28 20:01:17 +02:00
|
|
|
make
|
2009-03-17 15:18:45 +01:00
|
|
|
'';
|
|
|
|
|
2009-03-20 14:12:26 +01:00
|
|
|
# manually copy tcc and include files.. see comment above
|
2009-03-17 15:18:45 +01:00
|
|
|
installPhase = ''
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out{,/sbin,/lib/tcng/include}
|
2009-03-17 15:18:45 +01:00
|
|
|
make DESTDIR=$out install
|
|
|
|
cp tcc/tcc $out/sbin
|
2009-03-20 14:12:26 +01:00
|
|
|
cp tcc/*.tc $out/lib/tcng/include
|
2009-03-17 15:18:45 +01:00
|
|
|
'';
|
|
|
|
|
2010-07-28 20:01:17 +02:00
|
|
|
buildInputs = [ bison flex db4 perl ];
|
2009-03-17 15:18:45 +01:00
|
|
|
|
|
|
|
meta = {
|
2010-07-28 20:01:17 +02:00
|
|
|
description = "tcng - Traffic Control Next Generation";
|
|
|
|
homepage = "http://tcng.sourceforge.net/";
|
|
|
|
license = "GPLv2";
|
2009-03-17 15:18:45 +01:00
|
|
|
};
|
|
|
|
}
|