You are not logged in.

#1 2004-08-26 12:56:30

oz
Member
Registered: 2004-05-20
Posts: 102

[Devel:Compiler] TCC package (Tiny C Compiler)

[Edit:] I had to add a couple lines to the PKGBUILD to force it to use the right library paths

Tiny C is a fast lightweight C compiler and interpreter (allowing C to be used as a scripting language).

PKGBUILD:

# Contributor: Chris Osgood <archlinux at functionalfuture.com>
pkgname=tcc
pkgver=0.9.20
pkgrel=2
pkgdesc="Tiny C Compiler (TCC) is a lightweight C compiler that can also interpret C as a scripting language."
url="http://fabrice.bellard.free.fr/tcc"
license="LGPL"
depends=( )
makedepends=('perl')
source=(http://fabrice.bellard.free.fr/$pkgname/$pkgname-$pkgver.tar.gz)
md5sums=('c883b88e874a9bb9163eb14dc43b178c')

build() {
  cd $startdir/src/$pkgname-$pkgver
  patch -Np1 -i ../../tcc.patch
  ./configure --prefix=$startdir/pkg/usr
  echo '#undef CONFIG_TCC_LIBDIR' >> config.h
  echo '#define CONFIG_TCC_LIBDIR "/usr/lib"' >> config.h
  make || return 1
  mkdir -p $startdir/pkg/usr/bin
  mkdir -p $startdir/pkg/usr/include
  mkdir -p $startdir/pkg/usr/lib
  mkdir -p $startdir/pkg/usr/man/man1
  make install
}

tcc.patch (My patch that makes it compilable with GCC 3.4):

diff -ru tcc-0.9.20_orig/bcheck.c tcc-0.9.20/bcheck.c
--- tcc-0.9.20_orig/bcheck.c    2003-10-05 06:23:48.000000000 -0400
+++ tcc-0.9.20/bcheck.c 2004-08-26 08:45:39.000000000 -0400
@@ -168,7 +168,7 @@

 /* return '(p + offset)' for pointer arithmetic (a pointer can reach
    the end of a region in this case */
-void *__bound_ptr_add(void *p, int offset)
+ __attribute__((regparm(2))) void *__bound_ptr_add(void *p, int offset)
 {
     unsigned long addr = (unsigned long)p;
     BoundEntry *e;
@@ -194,7 +194,7 @@
 /* return '(p + offset)' for pointer indirection (the resulting must
    be strictly inside the region */
 #define BOUND_PTR_INDIR(dsize)                                          
-void *__bound_ptr_indir ## dsize (void *p, int offset)                  
+__attribute__((regparm(2))) void *__bound_ptr_indir ## dsize (void *p, int offset)                  
 {                                                                       
     unsigned long addr = (unsigned long)p;                              
     BoundEntry *e;                                                      
@@ -227,7 +227,7 @@
 #endif

 /* called when entering a function to add all the local regions */
-void __bound_local_new(void *p1)
+__attribute__((regparm(1))) void __bound_local_new(void *p1)
 {
     unsigned long addr, size, fp, *p = p1;
     GET_CALLER_FP(fp);
@@ -243,7 +243,7 @@
 }

 /* called when leaving a function to delete all the local regions */
-void __bound_local_delete(void *p1)
+__attribute__((regparm(1))) void __bound_local_delete(void *p1)
 {
     unsigned long addr, fp, *p = p1;
     GET_CALLER_FP(fp);

Offline

Board footer

Powered by FluxBB