gpc support
authorbrian <brian@brianweb.net>
Fri, 21 May 2004 07:27:46 +0000 (00:27 -0700)
committerbrian <brian@brianweb.net>
Fri, 21 May 2004 07:27:46 +0000 (00:27 -0700)
darcs-hash:20040521072746-24bed-52da8d0bde41d731130b083f86fd7861cbd4a14d.gz

Makefile
upstream/Makefile
upstream/patches/gpc-noutils.patch [new file with mode: 0644]
upstream/patches/gpc-with-3.3.3.patch [new file with mode: 0644]

index fa38892..d450f4b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,7 @@ flags = -march=mips1
 MIPS_CC = mips-unknown-elf-gcc
 MIPS_CXX = mips-unknown-elf-g++
 MIPS_G77 = mips-unknown-elf-g77
 MIPS_CC = mips-unknown-elf-gcc
 MIPS_CXX = mips-unknown-elf-g++
 MIPS_G77 = mips-unknown-elf-g77
+MIPS_PC = mips-unknown-elf-gpc
 
 # Be VERY careful about changing any of these as they can break binary 
 # compatibility and create hard to find bugs
 
 # Be VERY careful about changing any of these as they can break binary 
 # compatibility and create hard to find bugs
@@ -35,6 +36,8 @@ mips_optflags = -O3 -g \
        -freduce-all-givs
 
 MIPS_CFLAGS = $(mips_optflags) $(flags) -I. -Wall -Wno-unused -Werror
        -freduce-all-givs
 
 MIPS_CFLAGS = $(mips_optflags) $(flags) -I. -Wall -Wno-unused -Werror
+MIPS_CXXFLAGS = $(MIPS_CFLAGS)
+MIPS_PCFLAGS = $(MIPS_CFLAGS) --big-endian
 MIPS_LD = mips-unknown-elf-gcc
 MIPS_LDFLAGS= $(flags) --static -Wl,--gc-sections
 MIPS_STRIP = mips-unknown-elf-strip
 MIPS_LD = mips-unknown-elf-gcc
 MIPS_LDFLAGS= $(flags) --static -Wl,--gc-sections
 MIPS_STRIP = mips-unknown-elf-strip
@@ -132,7 +135,11 @@ build/%.mips: build/%.o $(tasks)/build_gcc $(tasks)/build_libc
 
 build/%.mips: src/%.cc $(tasks)/build_gcc_step2 $(tasks)/build_libc
        @mkdir -p `dirname $@`
 
 build/%.mips: src/%.cc $(tasks)/build_gcc_step2 $(tasks)/build_libc
        @mkdir -p `dirname $@`
-       $(MIPS_CXX) $(MIPS_CFLAGS) $($(notdir $*)_CFLAGS) $(MIPS_LDFLAGS) $($(notdir $*)_LDFLAGS) -o $@ $<
+       $(MIPS_CXX) $(MIPS_CXXFLAGS) $($(notdir $*)_CXXFLAGS) $(MIPS_LDFLAGS) $($(notdir $*)_LDFLAGS) -o $@ $<
+
+build/%.mips: src/%.pas $(tasks)/build_gpc
+       @mkdir -p `dirname $@`
+       $(MIPS_PC) $(MIPS_PCFLAGS) $($(notdir $*)_PCFLAGS) $(MIPS_LDFLAGS) $($(notdir $*)_LDFLAGS) -o $@ $<
 
 build/%.mips.stripped: build/%.mips $(tasks)/build_linker
        cp $< $@
 
 build/%.mips.stripped: build/%.mips $(tasks)/build_linker
        cp $< $@
@@ -265,6 +272,9 @@ build/tests/FDTest.class: build/tests/Test.class
 fdtest: build/tests/FDTest.class
        $(JAVA) -cp build tests.FDTest
 
 fdtest: build/tests/FDTest.class
        $(JAVA) -cp build tests.FDTest
 
+# Pascal Test
+pascaltest: build/tests/PascalHello.class
+       $(JAVA) -cp build tests.PascalHello
 
 # Simple
 Simple_LDFLAGS = -nostdlib
 
 # Simple
 Simple_LDFLAGS = -nostdlib
index bade846..32a90e2 100644 (file)
@@ -9,6 +9,11 @@ patches_gcc = gcc-fixes.patch gcc-fdata-sections-bss.patch
 configure_gcc = --target=mips-unknown-elf --disable-threads --with-gnu-ld --with-gnu-as --with-newlib=yes --enable-sjlj-exceptions --enable-languages="c"
 configure_gcc_step2 = $(configure_gcc) --enable-languages="c,c++"
 
 configure_gcc = --target=mips-unknown-elf --disable-threads --with-gnu-ld --with-gnu-as --with-newlib=yes --enable-sjlj-exceptions --enable-languages="c"
 configure_gcc_step2 = $(configure_gcc) --enable-languages="c,c++"
 
+version_gpc = 20030830
+url_gpc = http://www.gnu-pascal.de/alpha/gpc-$(version_gpc).tar.gz
+patches_gpc = $(patches_gcc) gpc-with-3.3.3.patch gpc-noutils.patch
+configure_gpc = $(configure_gcc) --enable-languages="pascal"
+
 version_binutils = 2.14
 url_binutils = ftp://ftp.gnu.org/gnu/binutils/binutils-$(version_binutils).tar.gz
 patches_binutils = binutils-no64.patch binutils-nocompilein.patch
 version_binutils = 2.14
 url_binutils = ftp://ftp.gnu.org/gnu/binutils/binutils-$(version_binutils).tar.gz
 patches_binutils = binutils-no64.patch binutils-nocompilein.patch
@@ -191,6 +196,30 @@ tasks/build_gcc_step2: tasks/patch_gcc tasks/build_libc
                $(MAKE) install
        touch $@
 
                $(MAKE) install
        touch $@
 
+tasks/extract_gpc: tasks/download_gcc tasks/download_gpc
+       mkdir -p build/gpc.extract
+       cd build/gpc.extract && \
+               gzip -dc ../../download/gcc-core-$(version_gcc).tar.gz | tar xf - && \
+               gzip -dc ../../download/gpc-$(version_gpc).tar.gz      | tar xf - && \
+               test ! -e gcc-$(version_gcc)/gcc/p && \
+               mv gpc-$(version_gpc)/p gcc-$(version_gcc)/gcc/p
+       mv build/gpc.extract/gcc-$(version_gcc) build/gpc-$(version_gpc)
+       rm -rf build/gpc.extract
+       touch $@
+
+tasks/build_gpc: tasks/patch_gpc tasks/build_libc
+       mkdir -p $(usr)
+       # We need to preapply this patch because gpc's configury doesn't like 3.3.3
+       cd build/gpc-$(version_gpc) && cat gcc/version.c | grep -q GPC || $(PATCH) -p0 < gcc/p/diffs/gcc-3.3.diff
+       
+       # echo | is to dismiss the gcc version warning
+       mkdir -p build/gpc-obj && cd build/gpc-obj && \
+               echo | ../gpc-$(version_gpc)/configure --prefix=$(usr) $(configure_gpc) && \
+               $(MAKE) TARGET_CFLAGS="$(MIPS_CFLAGS)" && \
+               cd gcc && $(MAKE) pascal.install
+       
+       touch $@
+
 tasks/build_openbsdglob: tasks/download_openbsdglob tasks/build_newlib
        @mkdir -p $(usr)/mips-unknown-elf/{include,lib}
        cd build && gzip -dc ../download/openbsdglob.tar.gz | tar xf -
 tasks/build_openbsdglob: tasks/download_openbsdglob tasks/build_newlib
        @mkdir -p $(usr)/mips-unknown-elf/{include,lib}
        cd build && gzip -dc ../download/openbsdglob.tar.gz | tar xf -
diff --git a/upstream/patches/gpc-noutils.patch b/upstream/patches/gpc-noutils.patch
new file mode 100644 (file)
index 0000000..18dc3a3
--- /dev/null
@@ -0,0 +1,22 @@
+--- gcc/p/Make-lang.in.orig    2004-05-21 03:22:35.000000000 -0400
++++ gcc/p/Make-lang.in 2004-05-21 03:24:03.000000000 -0400
+@@ -374,8 +374,8 @@
+ MAKEINFO_ES=LANG=es_ES LC_ALL=es_ES $(MAKEINFO) $(MAKEINFOFLAGS) $(GPC_DOC_DIRS_ES)
+ # Define the names for selecting Pascal in LANGUAGES.
+-Pascal pascal: xgpc$(exeext) gpc1$(exeext) gpcpp$(exeext) gpc-run pascal.utils \
+-               pascal.rts specs pascal.generated-files pascal.docdemos
++Pascal pascal: xgpc$(exeext) gpc1$(exeext) gpcpp$(exeext) gpc-run \
++               pascal.rts specs pascal.generated-files
+ # Tell GNU make to ignore these if they exist.
+ .PHONY: Pascal pascal
+@@ -1026,7 +1026,7 @@
+       fi; exit 0
+ pascal.install-normal: pascal.install-common pascal.install-compiler \
+- install-gpcpp pascal.install-utils pascal.install-lib pascal.install-man \
++ install-gpcpp pascal.install-lib pascal.install-man \
+  pascal.install-info pascal.install-units pascal.install-doc
+ # This target will install GPC into an existing GCC installation,
diff --git a/upstream/patches/gpc-with-3.3.3.patch b/upstream/patches/gpc-with-3.3.3.patch
new file mode 100644 (file)
index 0000000..1cddf45
--- /dev/null
@@ -0,0 +1,25 @@
+--- gcc/p/diffs/gcc-3.3.diff~  2004-05-21 02:17:02.000000000 -0400
++++ gcc/p/diffs/gcc-3.3.diff   2004-05-21 02:17:02.000000000 -0400
+@@ -727,22 +727,3 @@
+         abort ();
+       }
+   
+-*** gcc/varasm.c      Sat Aug 16 19:06:03 2003
+---- gcc/varasm.c      Sat Aug 16 19:04:13 2003
+-***************
+-*** 2411,2417 ****
+-        if (get_set_constructor_bytes (t2, tmp2, len) != NULL_TREE)
+-          return 0;
+-  
+-!       return memcmp (tmp1, tmp2, len) != 0;
+-      }
+-        else
+-      {
+---- 2411,2417 ----
+-        if (get_set_constructor_bytes (t2, tmp2, len) != NULL_TREE)
+-          return 0;
+-  
+-!       return memcmp (tmp1, tmp2, len) == 0;
+-      }
+-        else
+-      {