summaryrefslogtreecommitdiff
path: root/source/d/p2c
diff options
context:
space:
mode:
Diffstat (limited to 'source/d/p2c')
-rwxr-xr-xsource/d/p2c/p2c.SlackBuild122
-rw-r--r--source/d/p2c/p2c.examples.diff15
-rw-r--r--source/d/p2c/p2c_1.21alpha2-2.1.diff320
-rw-r--r--source/d/p2c/p2c_time.diff10
-rw-r--r--source/d/p2c/slack-desc19
5 files changed, 486 insertions, 0 deletions
diff --git a/source/d/p2c/p2c.SlackBuild b/source/d/p2c/p2c.SlackBuild
new file mode 100755
index 00000000..11bdee85
--- /dev/null
+++ b/source/d/p2c/p2c.SlackBuild
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+# Sources:
+# ftp://ftp.pal.xgw.fi/pub/gnu/alpha/gnu/p2c-1.21alpha2.tar.gz
+# ftp://ftp.clara.net/pub/mirrors/gnu/hurd/p2c-1.21alpha2.tar.gz
+# ftp://ftp.obspm.fr/pub1/computing/gnu/hurd/p2c-1.21alpha2.tar.gz
+
+VERSION=${VERSION:-1.21alpha2}
+ARCH=${ARCH:-x86_64}
+NUMJOBS=${NUMJOBS:-" -j7 "}
+BUILD=${BUILD:-3}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-p2c
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+
+# Explode the package framework:
+cd $PKG
+explodepkg $CWD/_p2c.tar.gz
+
+cd $TMP
+rm -rf p2c-1.21alpha-07.Dec.93
+tar xvf $CWD/p2c-1.21alpha2.tar.gz || exit 1
+cd p2c-1.21alpha-07.Dec.93 || exit 1
+
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+zcat $CWD/p2c_1.21alpha2-2.1.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+zcat $CWD/p2c_time.diff.gz | patch -p0 --verbose --backup --suffix=.orig || exit 1
+find . -name "*.orig" | xargs rm --verbose
+# Fix library paths:
+sed -i -e "s#/lib #/lib${LIBDIRSUFFIX} #g" \
+ -e "s#/lib\$#/lib${LIBDIRSUFFIX}#g" \
+ -e "s#/lib/#/lib${LIBDIRSUFFIX}/#g" \
+ $( grep -lr '/lib' * )
+
+cd src
+make OPT="$SLKCFLAGS" || exit 1
+make p2cc
+
+mv $PKG/usr/lib $PKG/usr/lib${LIBDIRSUFFIX} 2>/dev/null
+cat p2c > $PKG/usr/bin/p2c
+cat p2cc > $PKG/usr/bin/p2cc
+cat libp2c.a > $PKG/usr/lib${LIBDIRSUFFIX}/libp2c.a
+cat p2c.man | gzip -9c > $PKG/usr/man/man1/p2c.1.gz
+cat p2cc.man | gzip -9c > $PKG/usr/man/man1/p2cc.1.gz
+cat sys.p2crc > $PKG/usr/lib${LIBDIRSUFFIX}/p2c/p2crc
+cat loc.p2crc > $PKG/usr/lib${LIBDIRSUFFIX}/p2c/loc.p2crc
+cat system.imp > $PKG/usr/lib${LIBDIRSUFFIX}/p2c/system.imp
+cat system.m2 > $PKG/usr/lib${LIBDIRSUFFIX}/p2c/system.m2
+cat turbo.imp > $PKG/usr/lib${LIBDIRSUFFIX}/p2c/turbo.imp
+cat string.pas > $PKG/usr/lib${LIBDIRSUFFIX}/p2c/string.pas
+cat p2c.h > $PKG/usr/include/p2c/p2c.h
+cd ..
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+mkdir -p $PKG/usr/doc/p2c-1.21alpha2
+cp -a \
+ README ftp.README \
+ $PKG/usr/doc/p2c-1.21alpha2
+( cd src
+ for file in HISTORY NOTES COPYING INSTALL ; do
+ cp -a $file $PKG/usr/doc/p2c-1.21alpha2
+ done
+)
+cp -a src/README $PKG/usr/doc/p2c-1.21alpha2/README.src
+cp -a examples $PKG/usr/doc/p2c-1.21alpha2
+( cd $PKG/usr/doc/p2c-1.21alpha2
+ zcat $CWD/p2c.examples.diff.gz | patch -p1 --verbose || exit 1
+) || exit 1
+rm -f $PKG/usr/doc/p2c-1.21alpha2/examples/Makefile~
+rm -rf $PKG/usr/doc/p2c-1.21alpha2/examples/c
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Build the package:
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/p2c-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/d/p2c/p2c.examples.diff b/source/d/p2c/p2c.examples.diff
new file mode 100644
index 00000000..2a66af55
--- /dev/null
+++ b/source/d/p2c/p2c.examples.diff
@@ -0,0 +1,15 @@
+--- ./examples/Makefile.orig 1993-12-07 23:36:58.000000000 -0600
++++ ./examples/Makefile 2007-06-02 12:53:13.000000000 -0500
+@@ -4,9 +4,9 @@
+
+ # The following definitions assume p2c has been compiled into the "home"
+ # directory as shown in src/Makefile.
+-P2C = ../p2c
+-INC = ../home
+-LIB = ../home/libp2c.a
++P2C = p2c
++INC = /usr/include/p2c
++LIB = /usr/lib/libp2c.a
+
+
+ default: comp
diff --git a/source/d/p2c/p2c_1.21alpha2-2.1.diff b/source/d/p2c/p2c_1.21alpha2-2.1.diff
new file mode 100644
index 00000000..b7fbaf00
--- /dev/null
+++ b/source/d/p2c/p2c_1.21alpha2-2.1.diff
@@ -0,0 +1,320 @@
+--- p2c-1.21alpha2.orig/debian/README.Debian
++++ p2c-1.21alpha2/debian/README.Debian
+@@ -0,0 +1,54 @@
++p2c for Debian
++--------------
++
++You should be aware that p2c is not perfect in converting Pascal sources
++to C, and it won't make the best C code.
++
++Also if you notice that your translated C program won't compile because
++of an undefined reference to PASCAL_MAIN function, just comment that line
++from the C file and it should work.
++
++Here are some words from src/INSTALL file that could be of some use:
++
+++++
++
++ Incomplete interface texts for standard Turbo units are included in
++ turbo.imp. Turbo users will have to flesh these out and write emulations
++ for whatever parts of the Turbo runtime library they need.
++
++ If you wish to edit various system-wide configuration parameters, it is
++ better to put them in loc.p2crc than in sys.p2crc. As an example, on a
++ Turbo-oriented environment you may wish to add
++
++ Language Turbo
++
++ to the loc.p2crc file to replace the normal default (HP Pascal).
++
++ PORTABILITY
++
++ P2c was originally developed on a homebrew C compiler on the HP Pascal
++ Workstation operating system. Current development takes place on HP-UX,
++ which is System V based. The translator has also been compiled and used
++ on Sun-3's, so presumably it is fairly portable among 32-bit Unix machines.
++
++ Many parts of the code will have to be adjusted in order for p2c to work
++ on a machine with 16-bit ints. I have never had reason or opportunity to
++ track these down since I don't have access to such a machine. Please note
++ that code _generated_ by p2c works with either size of int even though p2c
++ itself does not.
++
++ If your compiler supports ANSI prototypes, most of the 16-bit portability
++ problems will go away except for possible %d/%ld sloppiness in sprintf control
++ strings. There may be places where p2c tries to cast a pointer into an
++ int, but I believe all such cases use longs consistently. You will have
++ a problem if your long type is not large enough to store a pointer.
++
++ Because p2c was developed to run under Unix, it is sloppy about memory
++ allocation. Some data structures are allocated but never freed. Profiles
++ show that the waste is not too great in most cases, but if it is a problem
++ you may have to write a garbage collector (this shouldn't be too hard if you
++ only run the collector after translating each procedure).
++
+++++
++
++ -- Josip Rodin <joy-packages@debian.org>, Mon, 28 Dec 1998 18:14:23 +0100
+--- p2c-1.21alpha2.orig/debian/rules
++++ p2c-1.21alpha2/debian/rules
+@@ -0,0 +1,46 @@
++#!/usr/bin/make -f
++# Derived from a dh_make example and Andrew Howell's rules file.
++
++#export DH_VERBOSE=1
++export DH_COMPAT=4
++
++CFLAGS := -g -Wall
++ifneq "$(findstring noopt,$(DEB_BUILD_OPTIONS))" ""
++CFLAGS += -O0
++else
++CFLAGS += -O2
++endif
++
++build: src/p2c
++src/p2c: src/p2c.h
++ $(MAKE) -C src OPT="$(CFLAGS)" LFLAGS="-s"
++
++clean:
++ dh_testdir
++ dh_testroot
++ $(MAKE) -C src clean
++ dh_clean
++
++binary-indep:
++# No architecture independant packages here.
++
++binary-arch: build
++ dh_testdir
++ dh_testroot
++ dh_clean -k
++ $(MAKE) -C src install PREFIX="$(CURDIR)/debian/p2c/usr"
++ dh_installdocs src/README src/NOTES
++ dh_installexamples examples/*
++ dh_installchangelogs src/HISTORY
++ dh_link usr/share/man/man1/p2c.1.gz usr/share/man/man1/p2cc.1.gz
++ dh_strip
++ dh_compress
++ dh_fixperms
++ dh_installdeb
++ dh_shlibdeps
++ dh_gencontrol
++ dh_md5sums
++ dh_builddeb
++
++binary: binary-indep binary-arch
++.PHONY: build clean binary-indep binary-arch binary
+--- p2c-1.21alpha2.orig/debian/control
++++ p2c-1.21alpha2/debian/control
+@@ -0,0 +1,26 @@
++Source: p2c
++Section: devel
++Priority: optional
++Maintainer: Josip Rodin <joy-packages@debian.org>
++Build-Depends: debhelper (>= 4)
++Standards-Version: 3.6.0
++
++Package: p2c
++Architecture: any
++Depends: ${shlibs:Depends}
++Suggests: gcc, gpc
++Description: Pascal to C translator
++ P2c is a tool for translating Pascal programs into C. The input
++ consists of a set of source files in any of the following Pascal
++ dialects: HP Pascal, Turbo/UCSD Pascal, DEC VAX Pascal, Oregon Software
++ Pascal/2, Macintosh Programmer's Workshop Pascal, Sun/Berkeley Pascal,
++ Texas Instruments Pascal, Apollo Domain Pascal. Modula-2 syntax is also
++ supported.
++ .
++ Output is a set of .c and .h files that comprise an equivalent program
++ in any of several dialects of C. Output code may be kept machine and
++ dialect-independent, or it may be targeted to a specific machine and
++ compiler. Most reasonable Pascal programs are converted into fully
++ functional C which will compile and run with no further modifications,
++ although p2c sometimes chooses to generate readable code at the expense
++ of absolute generality.
+--- p2c-1.21alpha2.orig/debian/copyright
++++ p2c-1.21alpha2/debian/copyright
+@@ -0,0 +1,25 @@
++This package was put together by Andrew Howell.
++The current maintainer is Josip Rodin <joy-packages@debian.org>.
++
++The original source can be found at:
++ http://www.synaptics.com/people/daveg/
++
++p2c's author is Dave Gillespie <daveg@synaptics.com>.
++
++Copyright 1989-1993 Free Software Foundation, Inc.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; version 2 dated June, 1991.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software Foundation,
++ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++On Debian systems, the complete text of the GNU General Public License
++can be found in the file /usr/share/common-licenses/GPL.
+--- p2c-1.21alpha2.orig/debian/changelog
++++ p2c-1.21alpha2/debian/changelog
+@@ -0,0 +1,52 @@
++p2c (1.21alpha2-2.1) unstable; urgency=low
++
++ * Non-maintainer upload (0-day)
++ * Applied patch by Peter De Wachter that fixes double memory free()'s
++ (Closes: #305412, #307706)
++
++ -- Roland Stigge <stigge@antcom.de> Thu, 5 May 2005 16:04:37 +0200
++
++p2c (1.21alpha2-2) unstable; urgency=low
++
++ * Added debhelper to build-depends, closes: #190499.
++ * Updated package standards.
++
++ -- Josip Rodin <joy-packages@debian.org> Sat, 16 Aug 2003 13:02:10 +0200
++
++p2c (1.21alpha2-1) unstable; urgency=low
++
++ * New upstream version. Although it is marked as "alpha", it has been
++ made in 1993, so... :) (closes: #39400)
++ * Updated for Policy 3.x, rewrote most of debian/* and made a better
++ src/Makefile patch.
++
++ -- Josip Rodin <jrodin@jagor.srce.hr> Sat, 11 Sep 1999 23:34:19 +0200
++
++p2c (1.20-3) unstable; urgency=low
++
++ * Removed `-m486 -fomit-frame-pointer' from the gcc flags, since ix86
++ doesn't need it and it bugs m68k (and other ports).
++
++ -- Josip Rodin <jrodin@jagor.srce.hr> Thu, 7 Jan 1999 19:01:32 +0100
++
++p2c (1.20-2) unstable; urgency=low
++
++ * Fixed the FSF address in copyright file
++
++ -- Josip Rodin <jrodin@jagor.srce.hr> Tue, 29 Dec 1998 21:13:52 +0100
++
++p2c (1.20-1) unstable; urgency=low
++
++ * Initial Release for potato (2.2)
++ * Converted to new packaging format/standards
++
++ -- Josip Rodin <jrodin@jagor.srce.hr> Mon, 28 Dec 1998 18:14:23 +0100
++
++Changes by Andrew Howell <andrew@it.com.au>:
++
++1.20-2:
++ 951123
++ * Converted to ELF.
++
++1.20-1:
++ * added Debian GNU/Linux package maintenance system files
+--- p2c-1.21alpha2.orig/src/Makefile
++++ p2c-1.21alpha2/src/Makefile
+@@ -19,22 +19,23 @@
+ SHELL = /bin/sh
+
+ # Directories (private version)
+-HOMEDIR = ../home
+-INCDIR = ../home/p2c
+-BINDIR = ..
+-LIBDIR = ../home
+-MANDIR = ../home
+-MANFILE = p2c.cat # human-readable manual (for cat.1)
++#HOMEDIR = ../home
++#INCDIR = ../home/p2c
++#BINDIR = ..
++#LIBDIR = ../home
++#MANDIR = ../home
++#MANFILE = p2c.cat # human-readable manual (for cat.1)
+ #MANFILE = p2c.man.inst # uncompressed nroff source (for man.1)
+ #MANFILE = p2c.man.Z # compressed nroff source (for man.1.Z)
+
+ # Directories (public version)
+-#HOMEDIR = /usr/lib/p2c
+-#INCDIR = /usr/include/p2c
+-#BINDIR = /usr/bin
+-#LIBDIR = /usr/lib
+-#MANDIR = /usr/man/man1
+-#MANFILE = p2c.man.inst
++PREFIX = /usr
++HOMEDIR = $(PREFIX)/lib/p2c
++INCDIR = $(PREFIX)/include/p2c
++BINDIR = $(PREFIX)/bin
++LIBDIR = $(PREFIX)/lib
++MANDIR = $(PREFIX)/share/man/man1
++MANFILE = p2c.man.inst
+
+ # Compiler options
+ CC = cc # you may wish to use gcc here instead
+@@ -64,9 +65,9 @@
+ LIBOBJS = p2clib.o loc.p2clib.o
+ OTHERLIBOBJS =
+
+-ABSHOMEDIR = `cd $(HOMEDIR); pwd`
+-ABSINCDIR = `cd $(INCDIR); pwd`
+-ABSLIBDIR = `cd $(LIBDIR); pwd`
++ABSHOMEDIR = /usr/lib/p2c
++ABSINCDIR = /usr/include/p2c
++ABSLIBDIR = /usr/lib
+
+ MISCSRCS = makeproto.c
+ PROTOS = p2c.proto p2c.hdrs
+@@ -161,11 +162,11 @@
+
+ SHELL=/bin/sh
+ makedirs:
+- if [ ! -d $(HOMEDIR) ]; then mkdir $(HOMEDIR); else true; fi
+- if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); else true; fi
+- if [ ! -d $(LIBDIR) ]; then mkdir $(LIBDIR); else true; fi
+- if [ ! -d $(MANDIR) ]; then mkdir $(MANDIR); else true; fi
+- if [ ! -d $(INCDIR) ]; then mkdir $(INCDIR); else true; fi
++ if [ ! -d $(HOMEDIR) ]; then mkdir -p $(HOMEDIR); else true; fi
++ if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR); else true; fi
++ if [ ! -d $(LIBDIR) ]; then mkdir -p $(LIBDIR); else true; fi
++ if [ ! -d $(MANDIR) ]; then mkdir -p $(MANDIR); else true; fi
++ if [ ! -d $(INCDIR) ]; then mkdir -p $(INCDIR); else true; fi
+
+ $(BINDIR)/p2c: p2c
+ $(COPY) p2c $(BINDIR)/p2c
+@@ -212,6 +213,7 @@
+
+ clean:
+ rm -f $(OBJS) $(LIBOBJS) $(PROTOS) p2c libp2c.a
++ rm -f makeproto p2cc p2c.man.inst p2c.cat
+
+ wc:
+ wc $(SRCS) $(LIBSRCS) trans.h
+--- p2c-1.21alpha2.orig/src/decl.c
++++ p2c-1.21alpha2/src/decl.c
+@@ -789,8 +789,10 @@
+ mpp2 = &mp2->snext;
+ if (mp2)
+ *mpp2 = mp2->snext;
++#if 0
+ if (mp->kind == MK_CONST)
+ free_value(&mp->val);
++#endif
+ freeexpr(mp->constdefn);
+ if (mp->cbase)
+ forget_ctx(mp, 1);
+--- p2c-1.21alpha2.orig/src/parse.c
++++ p2c-1.21alpha2/src/parse.c
+@@ -4642,8 +4642,10 @@
+ }
+ }
+ if (conserve_mem) {
++#if 0
+ free_stmt((Stmt *)func->val.i); /* is this safe? */
+ func->val.i = 0;
++#endif
+ forget_ctx(func, 0);
+ }
+ outsection(spacing);
diff --git a/source/d/p2c/p2c_time.diff b/source/d/p2c/p2c_time.diff
new file mode 100644
index 00000000..fcd0875d
--- /dev/null
+++ b/source/d/p2c/p2c_time.diff
@@ -0,0 +1,10 @@
+--- ./src/out.c.orig Fri Feb 22 18:39:33 2002
++++ ./src/out.c Fri Feb 22 18:41:13 2002
+@@ -41,6 +41,7 @@
+
+ #if USETIME
+ # include <sys/time.h>
++# include <time.h>
+ #else
+ # include <time.h>
+ #endif
diff --git a/source/d/p2c/slack-desc b/source/d/p2c/slack-desc
new file mode 100644
index 00000000..058ac204
--- /dev/null
+++ b/source/d/p2c/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+p2c: p2c (Pascal to C translator)
+p2c:
+p2c: P2c is a tool for translating Pascal programs into C. The input
+p2c: consists of a set of source files in any of the following Pascal
+p2c: dialects: HP Pascal, Turbo/UCSD Pascal, DEC VAX Pascal, Oregon
+p2c: Software Pascal/2, Macintosh Programmer's Workshop Pascal,
+p2c: Sun/Berkeley Pascal, Texas Instruments Pascal, Apollo Domain Pascal.
+p2c: Modula-2 syntax is also supported. Output is a set of .c and .h
+p2c: files that comprise an equivalent program in any of several dialects
+p2c: of C.
+p2c: