Browse Source

add pcc compiler

Waldemar Brodkorb 14 years ago
parent
commit
d327bc15c7

+ 46 - 0
package/pcc/Makefile

@@ -0,0 +1,46 @@
+# This file is part of the OpenADK project. OpenADK is copyrighted
+# material, please see the LICENCE file in the top-level directory.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=		pcc
+PKG_VERSION:=		1.0.0
+PKG_RELEASE:=		1
+PKG_MD5SUM:=		6e5d851ee57fe58702fe4e80ecd1f852
+PKG_DESCR:=		Portable C Compiler
+PKG_SECTION:=		lang
+PKG_DEPENDS:=		pcc-libs
+# binutils
+PKG_URL:=		http://pcc.ludd.ltu.se/
+PKG_SITES:=		http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/
+PKG_NOPARALLEL:=	1
+
+DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tgz
+
+include $(TOPDIR)/mk/package.mk
+
+$(eval $(call PKG_template,PCC,pcc,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION}))
+
+# we cross-compile a native compiler for the target system
+CONFIGURE_ARGS+=	--host=${REAL_GNU_TARGET_NAME}
+CONFIGURE_ARGS+=	--target=${REAL_GNU_TARGET_NAME}
+CONFIGURE_ARGS+=	--with-assembler=/usr/bin/as
+CONFIGURE_ARGS+=	--with-linker=/usr/bin/ld
+
+ifeq ($(ADK_TARGET_LIB_GLIBC),y)
+TARGET_CPPFLAGS+=	-DADK_FOR_GLIBC
+else
+ifeq ($(ADK_TARGET_LIB_EGLIBC),y)
+TARGET_CPPFLAGS+=	-DADK_FOR_GLIBC
+else
+ifeq ($(ADK_TARGET_LIB_UCLIBC),y)
+TARGET_CPPFLAGS+=	-DADK_FOR_UCLIBC
+endif
+endif
+endif
+
+pcc-install:
+	$(INSTALL_DIR) $(IDIR_PCC)
+	cd ${WRKINST} && cp -r * ${IDIR_PCC}/
+
+include ${TOPDIR}/mk/pkg-bottom.mk

+ 23 - 0
package/pcc/patches/100-adk.patch

@@ -0,0 +1,23 @@
+Index: os/linux/ccconfig.h
+===================================================================
+RCS file: /cvsroot/pcc/os/linux/ccconfig.h,v
+retrieving revision 1.19
+diff -u -p -r1.19 ccconfig.h
+--- a/os/linux/ccconfig.h	9 Nov 2010 08:40:50 -0000	1.19
++++ b/os/linux/ccconfig.h	2 Apr 2011 14:19:17 -0000
+@@ -67,6 +67,15 @@
+ #error defines for arch missing
+ #endif
+ 
++#ifdef ADK_FOR_UCLIBC
++#undef DYNLINKER
++#define DYNLINKER { "-dynamic-linker", "/lib/ld-uClibc.so.0", NULL }
++#elif defined(ADK_FOR_GLIBC)
++/* see above */
++#else
++#error What now?
++#endif
++
+ #ifndef LIBDIR
+ #define LIBDIR "/usr/lib/"
+ #endif

+ 33 - 0
package/pcc/patches/200-cc_ccom_Makefile_in.patch

@@ -0,0 +1,33 @@
+$MirOS: ports/lang/pcc/patches/patch-cc_ccom_Makefile_in,v 1.4 2011/04/02 17:45:46 tg Exp $
+
+	• fix missing @CPPFLAGS@
+	• fix cross-compiling
+
+--- a/cc/ccom/Makefile.in.orig	Sun Apr 11 15:00:40 2010
++++ b/cc/ccom/Makefile.in	Sat Apr  2 17:43:44 2011
+@@ -11,9 +11,14 @@ XFL=-DPCC_DEBUG
+ CC = @CC@
+ EXEEXT = @EXEEXT@
+ CC_FOR_BUILD = @CC_FOR_BUILD@
++CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ -D_ISOC99_SOURCE \
++	@ADD_CPPFLAGS@ ${XFL} -Dos_${TARGOS} -Dmach_${TARGMACH} \
++	-I${srcdir} -I${builddir} -I${top_builddir} -I${MIPDIR} -I${MDIR} \
++	-I${top_srcdir}/os/${TARGOS}
+ _CFLAGS = @CFLAGS@
+ CFLAGS = $(_CFLAGS) @ADD_CFLAGS@
+-CPPFLAGS = @ADD_CPPFLAGS@ ${XFL} -Dos_${TARGOS} -Dmach_${TARGMACH} \
++CPPFLAGS = @CPPFLAGS@ @ADD_CPPFLAGS@ ${XFL} -Dos_${TARGOS} -Dmach_${TARGMACH} \
+ 	-D_ISOC99_SOURCE \
+ 	-I${srcdir} -I${builddir} -I${top_builddir} -I${MIPDIR} -I${MDIR} \
+ 	-I${top_srcdir}/os/${TARGOS} 
+@@ -92,7 +97,8 @@ compat.o: $(MIPDIR)/compat.c external.h
+ 	$(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(MIPDIR)/compat.c
+ 
+ external.h external.c: ${MIPDIR}/mkext.c $(MDIR)/table.c
+-	$(CC_FOR_BUILD) $(DEFS) $(CPPFLAGS) $(CFLAGS) -DMKEXT -o mkext \
++	$(CC_FOR_BUILD) $(DEFS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
++	    -DMKEXT -o mkext \
+ 	${MIPDIR}/mkext.c $(MDIR)/table.c ${MIPDIR}/common.c
+ 	./mkext
+ 

+ 38 - 0
package/pcc/patches/999-autoconf.patch

@@ -0,0 +1,38 @@
+--- a/configure	Fri Apr  1 13:58:07 2011
++++ b/configure	Sat Apr  2 19:21:15 2011
+@@ -672,6 +672,8 @@ ac_ct_CC
+ EXEEXT
+ OBJEXT
+ CC_FOR_BUILD
++CPPFLAGS_FOR_BUILD
++CFLAGS_FOR_BUILD
+ CPP
+ GREP
+ EGREP
+@@ -3292,6 +3294,8 @@ else
+ echo "${ECHO_T}not cross compiling" >&6; }
+         CC_FOR_BUILD=${CC-cc}
+ 
++	test -n "$CPPFLAGS_FOR_BUILD" || CPPFLAGS_FOR_BUILD=$CPPFLAGS
++	test -n "$CFLAGS_FOR_BUILD" || CFLAGS_FOR_BUILD=$CFLAGS
+ fi
+ 
+ 
+@@ -5765,6 +5769,8 @@ ac_ct_CC!$ac_ct_CC$ac_delim
+ EXEEXT!$EXEEXT$ac_delim
+ OBJEXT!$OBJEXT$ac_delim
+ CC_FOR_BUILD!$CC_FOR_BUILD$ac_delim
++CPPFLAGS_FOR_BUILD!$CPPFLAGS_FOR_BUILD$ac_delim
++CFLAGS_FOR_BUILD!$CFLAGS_FOR_BUILD$ac_delim
+ CPP!$CPP$ac_delim
+ GREP!$GREP$ac_delim
+ EGREP!$EGREP$ac_delim
+@@ -5787,7 +5793,7 @@ LIBOBJS!$LIBOBJS$ac_delim
+ LTLIBOBJS!$LTLIBOBJS$ac_delim
+ _ACEOF
+ 
+-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 78; then
++  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 80; then
+     break
+   elif $ac_last_try; then
+     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5