summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Severance2018-07-05 01:44:50 -0400
committerChris Severance2018-07-05 01:44:50 -0400
commitfe16b3a1d125051fb5d42df1a3b1791f53bf3cc6 (patch)
treed754d193aea1e70c35d76c4aba4f445562daa3a9
parent5e11c7f89a295d46cbdcea4c26e17f742e4fbca9 (diff)
downloadaur-fe16b3a1d125051fb5d42df1a3b1791f53bf3cc6.tar.gz
autu: Update to 2.01-1
-rw-r--r--.SRCINFO19
-rw-r--r--0000-make-install.patch68
-rw-r--r--PKGBUILD168
3 files changed, 209 insertions, 46 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a6d03e40add7..06579a5e836c 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,20 @@
+# Generated by mksrcinfo v8
+# Thu Jul 5 05:44:50 UTC 2018
pkgbase = p2c
- pkgdesc = pascal to c/c++ converter
- pkgver = 1.21alpha2
- pkgrel = 11
- url = http://packages.debian.org/sid/p2c
+ pkgdesc = Pascal to C/C++ translator converter
+ pkgver = 2.01
+ pkgrel = 1
+ url = https://schneider.ncifcrf.gov/p2c/
arch = x86_64
license = GPL
depends = perl
- source = http://www.ccrnp.ncifcrf.gov/~toms/p2c/p2c-1.21alpha2.tar.gz
- md5sums = 8340429ae80be2e0e82c01f70c0355bb
+ depends = lib32-glibc
+ source = https://schneider.ncifcrf.gov/p2c/p2c-2.01.tar.gz
+ source = 0000-make-install.patch
+ md5sums = 6f08c45f1adcdc35789340834dd9c084
+ md5sums = 3cf28ada6f5935e5ce7eb6515fd429ef
+ sha256sums = a05635e6b0b40bee9617771ba628deefae13369cd7d49bb880cc8590495fcf60
+ sha256sums = a1dd6995cb13e87bbf6f707224c1a58fbebe9101aeccd7ba3aca0e760950773a
pkgname = p2c
diff --git a/0000-make-install.patch b/0000-make-install.patch
new file mode 100644
index 000000000000..591183184e1d
--- /dev/null
+++ b/0000-make-install.patch
@@ -0,0 +1,68 @@
+--- Makefile.orig 2015-11-18 15:12:06.000000000 -0500
++++ Makefile 2018-07-04 17:18:54.680325305 -0400
+@@ -143,64 +143,22 @@ p2cc: p2cc.perl
+ COPY = cp
+
+ newhome:
+ rm -f trans.o # force trans.c to be recompiled (if HOMEDIR changes)
+
+-install: proto \
+- makedirs \
+- $(BINDIR)/p2c \
+- $(BINDIR)/p2cc \
+- $(LIBDIR)/libp2c.a \
+- $(MANDIR)/p2c.1 \
+- $(INCDIR)/p2c.h \
+- $(HOMEDIR)/p2crc \
+- $(HOMEDIR)/loc.p2crc \
+- $(HOMEDIR)/system.imp \
+- $(HOMEDIR)/system.m2 \
+- $(HOMEDIR)/turbo.imp \
+- $(HOMEDIR)/string.pas
+-
+-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
+-
+-$(BINDIR)/p2c: p2c
++install:
+ $(COPY) p2c $(BINDIR)/p2c
+-
+-$(BINDIR)/p2cc: p2cc
+ $(COPY) p2cc $(BINDIR)/p2cc
+-
+-$(LIBDIR)/libp2c.a: libp2c.a
+ $(COPY) libp2c.a $(LIBDIR)/libp2c.a
+ if [ -f /usr/bin/ranlib -o -f /bin/ranlib ]; then ranlib $(LIBDIR)/libp2c.a; fi
+-
+-$(MANDIR)/p2c.1: $(MANFILE)
+ $(COPY) $(MANFILE) $(MANDIR)/p2c.1
+-
+-$(INCDIR)/p2c.h: p2c.h
+ $(COPY) p2c.h $(INCDIR)/p2c.h
+-
+-$(HOMEDIR)/p2crc: sys.p2crc
+ $(COPY) sys.p2crc $(HOMEDIR)/p2crc
+-
+-$(HOMEDIR)/loc.p2crc: loc.p2crc
+ $(COPY) loc.p2crc $(HOMEDIR)/loc.p2crc
+-
+-$(HOMEDIR)/system.imp: system.imp
+ $(COPY) system.imp $(HOMEDIR)/system.imp
+-
+-$(HOMEDIR)/system.m2: system.m2
+ $(COPY) system.m2 $(HOMEDIR)/system.m2
+-
+-$(HOMEDIR)/turbo.imp: turbo.imp
+ $(COPY) turbo.imp $(HOMEDIR)/turbo.imp
+-
+-$(HOMEDIR)/string.pas: string.pas
+ $(COPY) string.pas $(HOMEDIR)/string.pas
+
+
+
+ # Miscellaneous
diff --git a/PKGBUILD b/PKGBUILD
index 045406022af6..ecd311dc4e12 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,51 +1,139 @@
-# $Id: PKGBUILD 266875 2017-11-15 14:29:11Z foutrelis $
-# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
-# Maintainer: tardo <tardo@nagi-fanboi.net>
+# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
+# Contributor: tardo <tardo@nagi-fanboi.net>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
-pkgname=p2c
-pkgver=1.21alpha2
-pkgrel=11
-pkgdesc="pascal to c/c++ converter"
+# Todo: fix (Anyptr)_OutMem() to be 64 bit safe and enable 64 bit compile
+_opt_32bit=1
+
+set -u
+pkgname='p2c'
+pkgver='2.01'
+pkgrel='1'
+pkgdesc='Pascal to C/C++ translator converter'
arch=('x86_64')
-url="http://packages.debian.org/sid/p2c"
+#url="http://packages.debian.org/sid/p2c"
+url='https://schneider.ncifcrf.gov/p2c/'
license=('GPL')
depends=('perl')
-# http://ftp.debian.org/debian/pool/main/p/p2c/p2c_$pkgver-3.diff.gz)
-source=(http://www.ccrnp.ncifcrf.gov/~toms/p2c/p2c-$pkgver.tar.gz)
-md5sums=('8340429ae80be2e0e82c01f70c0355bb')
+if [ "${_opt_32bit}" -ne 0 ]; then
+ depends+=('lib32-glibc')
+fi
+# http://ftp.debian.org/debian/pool/main/p/p2c/p2c_${pkgver}-3.diff.gz)
+#source=("http://www.ccrnp.ncifcrf.gov/~toms/p2c/p2c-${pkgver}.tar.gz")
+#source=('https://alum.mit.edu/www/toms/p2c/p2c-2.01.tar.gz
+_srcdir="${pkgname}-${pkgver}"
+source=("https://schneider.ncifcrf.gov/p2c/${_srcdir}.tar.gz")
+source+=('0000-make-install.patch')
+#options=('!strip')
+md5sums=('6f08c45f1adcdc35789340834dd9c084'
+ '3cf28ada6f5935e5ce7eb6515fd429ef')
+sha256sums=('a05635e6b0b40bee9617771ba628deefae13369cd7d49bb880cc8590495fcf60'
+ 'a1dd6995cb13e87bbf6f707224c1a58fbebe9101aeccd7ba3aca0e760950773a')
+_checkdir="${_srcdir}/check"
+
+prepare() {
+ set -u
+ cd "${_srcdir}/src"
+
+ #patch -Np2 -i '../p2c_${pkgver}-3.diff'
+ #sed -e 's:getline:xgetline:' -i *.c *.hdrs
+
+ # Add includes to get rid of some warnings
+ sed -e '/^#include <stdio.h>/ a #include <stdlib.h>' -i 'makeproto.c'
+ # expose conflicting declarations
+ sed -e '/^#include "trans.h"/ i #include <unistd.h>' -i 'trans.c'
+ # Switch to built in link,unlink declarations
+ sed -e '/^int u*n*link / s:^.*$:/* & */:g' -i 'trans.h'
+
+ # Remove supplied binaries
+ rm -f 'makeproto' 'p2cc' 'libp2c.a'
+
+ # The mess in make install is too big to fix with sed
+ # cp -p Makefile{,.orig}; false
+ # diff -pNau5 Makefile{.orig,} > '0000-make-install.patch'
+ patch -Nbup0 -i "${srcdir}/0000-make-install.patch"
+
+ local _ccc='#'
+ if [ "${_opt_32bit}" -ne 0 ]; then
+ _ccc=''
+ fi
+ # Make package compatible
+ #cp -p Makefile{,.Arch}
+ sed -e '#Switch from private to public build' \
+ -e '/private version/,/^$/ s:^[A-Z]:#&:g' \
+ -e '/public version/,/^$/ s:^#\([A-Z]\):\1:g' \
+ -e '# Fix MANDIR' \
+ -e '/^MANDIR =/ s:/usr/:&share/:g' \
+ -e '#Add DESTDIR' \
+ -e '/^install:/,/^$/ s:\$([A-Z]\+DIR):$(DESTDIR)&:g' \
+ -e '# Make $(COPY) create the folders' \
+ -e 's:^COPY = .*$:COPY = install -Dp:g' \
+ -e '# No need to resolve .. on these dirs' \
+ -e 's:^ABS\([A-Z]*DIR\) = .*$:ABS\1 = $(\1):g' \
+ -e '# The messy install covered for a missed target' \
+ -e '/^all:/ s:$: p2cc:g' \
+ -e '#newhome forgot the target too' \
+ -e '/^newhome:/,/^$/ s:trans.o:& p2cc:g' \
+ -e '# 32 bit compile' \
+ -e "${_ccc}"'s:^CC = cc:& -m32:g' \
+ -i 'Makefile'
+ test ! -s 'Makefile.Arch'
+
+ # Get rid of a generated code warning
+ sed -e 's:^MainType\s:&int:g' -i 'sys.p2crc'
+
+ cd '..'
+ # Fix the permissions
+ find -type 'd' -exec chmod 755 '{}' '+'
+ find -type 'f' -exec chmod 644 '{}' '+'
+
+ # get rid of home for make test examples check()
+ rm -r "../${_srcdir}/home/"
+
+ # make clean for examples
+ cd 'examples'
+ rm 'basic' 'cref' 'e' 'fact' 'self' *.c
+ rm -r '../examples/c/'
+
+ # point examples check to the just compiled test version
+ sed -e 's:^P2C = .*$:P2C = ../check/usr/bin/p2c:g' \
+ -e '# Fix INC to use our include dir' \
+ -e 's:^INC = .*$:INC = ../check/usr/include:g' \
+ -e '# Move to src folder' \
+ -e 's:^LIB = .*$:LIB = ../check/usr/lib/libp2c.a:g' \
+ -e '# 32 bit compile' \
+ -e "${_ccc}"'s:\$(CC) :&-m32 :g' \
+ -i 'Makefile'
+
+ set +u
+}
build() {
- cd "$srcdir"
-# patch -Np1 <../p2c_$pkgver-3.diff
-
- cd src
- sed -i 's#getline#xgetline#' *.c *.hdrs
- make \
- BINDIR=/usr/bin \
- MANDIR=/usr/share/man/man1 \
- LIBDIR=/usr/lib \
- HOMEDIR=/usr/lib/p2c \
- INCDIR=/usr/include/p2c \
- ABSHOMEDIR=/usr/lib/p2c \
- ABSLIBDIR=/usr/lib \
- ABSINCDIR=/usr/include/p2c
+ set -u
+ cd "${_srcdir}/src"
+ # make check() executable
+ make OPT='-O2 -s' ABSHOMEDIR="${srcdir}/${_checkdir}/usr/lib/p2c"
+ mv p2c{,_test}
+ # make package() executable
+ make newhome
+ make OPT='-O2 -s'
+ set +u
+}
+
+check() {
+ cd "${_srcdir}"
+ # switching from /usr/include/p2c to any other dir unhides warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
+ # we fix this by compiling -m32 where sizeof(int)==sizeof(void *)
+ make -C 'src' install DESTDIR="${srcdir}/${_checkdir}"
+ install -p 'src/p2c_test' "${srcdir}/${_checkdir}/usr/bin/p2c"
+ make -C 'examples'
+ rm -r "${srcdir}/${_checkdir}"
}
package() {
- cd "$srcdir"/src
-
- mkdir -p "$pkgdir"/usr/bin \
- "$pkgdir"/usr/share/man/man1 \
- "$pkgdir"/usr/lib \
- "$pkgdir"/usr/include/p2c
- make install \
- BINDIR="$pkgdir"/usr/bin \
- MANDIR="$pkgdir"/usr/share/man/man1 \
- LIBDIR="$pkgdir"/usr/lib \
- HOMEDIR="$pkgdir"/usr/lib/p2c \
- INCDIR="$pkgdir"/usr/include/p2c \
- ABSHOMEDIR="$pkgdir"/usr/lib/p2c \
- ABSLIBDIR="$pkgdir"/usr/lib \
- ABSINCDIR="$pkgdir"/usr/include/p2c
+ set -u
+ cd "${_srcdir}"
+ make -C 'src' install DESTDIR="${pkgdir}"
+ set +u
}
+set +u