aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2015-09-30 17:51:11 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2015-10-03 13:21:37 +0200
commit0cd9d47c2d0f6ef65fee4fa97a060ab4f3ed65aa (patch)
tree92d47467200e5c8a577657cf536485717299428b /main
parent53679caf4fa9cfa393975176fe5d544dfd4e5ce6 (diff)
downloadaports-0cd9d47c2d0f6ef65fee4fa97a060ab4f3ed65aa.tar.bz2
aports-0cd9d47c2d0f6ef65fee4fa97a060ab4f3ed65aa.tar.xz
main/mcpp: move from testing
Diffstat (limited to 'main')
-rw-r--r--main/mcpp/01-zeroc-fixes.patch75
-rw-r--r--main/mcpp/02-gniibe-fixes.patch33
-rw-r--r--main/mcpp/APKBUILD65
3 files changed, 173 insertions, 0 deletions
diff --git a/main/mcpp/01-zeroc-fixes.patch b/main/mcpp/01-zeroc-fixes.patch
new file mode 100644
index 0000000000..fff5d321fe
--- /dev/null
+++ b/main/mcpp/01-zeroc-fixes.patch
@@ -0,0 +1,75 @@
+Description: Fixes by ZeroC, Inc.
+Author: ZeroC, Inc.
+Bug-Debian: http://bugs.debian.org/611749
+
+--- mcpp-2.7.2.orig/src/main.c
++++ mcpp-2.7.2/src/main.c
+@@ -326,6 +326,8 @@ static void init_main( void)
+ = FALSE;
+ option_flags.trig = TRIGRAPHS_INIT;
+ option_flags.dig = DIGRAPHS_INIT;
++ sh_file = NULL;
++ sh_line = 0;
+ }
+
+ int mcpp_lib_main
+--- mcpp-2.7.2.orig/src/support.c
++++ mcpp-2.7.2/src/support.c
+@@ -188,7 +188,7 @@ static char * append_to_buffer(
+ size_t length
+ )
+ {
+- if (mem_buf_p->bytes_avail < length) { /* Need to allocate more memory */
++ if (mem_buf_p->bytes_avail < length + 1) { /* Need to allocate more memory */
+ size_t size = MAX( BUF_INCR_SIZE, length);
+
+ if (mem_buf_p->buffer == NULL) { /* 1st append */
+@@ -1722,6 +1722,8 @@ com_start:
+ sp -= 2;
+ while (*sp != '\n') /* Until end of line */
+ mcpp_fputc( *sp++, OUT);
++ mcpp_fputc( '\n', OUT);
++ wrong_line = TRUE;
+ }
+ goto end_line;
+ default: /* Not a comment */
+--- mcpp-2.7.2.orig/src/internal.H
++++ mcpp-2.7.2/src/internal.H
+@@ -390,6 +390,8 @@ extern char * const work_end; /* E
+ extern char identifier[]; /* Lastly scanned name */
+ extern IFINFO ifstack[]; /* Information of #if nesting */
+ extern char work_buf[];
++extern FILEINFO * sh_file;
++extern int sh_line;
+ /* Temporary buffer for directive line and macro expansion */
+
+ /* main.c */
+@@ -557,6 +559,6 @@ extern void init_system( void);
+ #endif
+ #endif
+
+-#if HOST_HAVE_STPCPY
++#if HOST_HAVE_STPCPY && !defined(stpcpy)
+ extern char * stpcpy( char * dest, const char * src);
+ #endif
+--- mcpp-2.7.2.orig/src/system.c
++++ mcpp-2.7.2/src/system.c
+@@ -3858,6 +3858,9 @@ static int chk_dirp(
+ }
+ #endif
+
++FILEINFO* sh_file;
++int sh_line;
++
+ void sharp(
+ FILEINFO * sharp_file,
+ int flag /* Flag to append to the line for GCC */
+@@ -3868,8 +3871,6 @@ void sharp(
+ * else (i.e. 'sharp_file' is NULL) 'infile'.
+ */
+ {
+- static FILEINFO * sh_file;
+- static int sh_line;
+ FILEINFO * file;
+ int line;
+
diff --git a/main/mcpp/02-gniibe-fixes.patch b/main/mcpp/02-gniibe-fixes.patch
new file mode 100644
index 0000000000..cb5aa6c345
--- /dev/null
+++ b/main/mcpp/02-gniibe-fixes.patch
@@ -0,0 +1,33 @@
+Description: Simple fixes
+ * Fix freeing unmalloced memory
+ The memory of 'in_file' is not malloced, but points to argv[].
+ It is wrong to free it.
+ * When there is no input file specified by argv, it causes error
+ and fp_in == NULL. Check is needed to call fclose for fp_in.
+Author: NIIBE Yutaka
+
+## Fixes the issue reported at:
+## http://www.forallsecure.com/bug-reports/6b11b6fccda17cc467e055ccf7fec3fa2d89ec00/
+
+Index: mcpp-2.7.2/src/main.c
+===================================================================
+--- mcpp-2.7.2.orig/src/main.c 2013-07-09 03:03:05.610947658 +0000
++++ mcpp-2.7.2/src/main.c 2013-07-09 03:03:05.534947624 +0000
+@@ -428,16 +428,11 @@
+
+ fatal_error_exit:
+ #if MCPP_LIB
+- /* Free malloced memory */
+- if (mcpp_debug & MACRO_CALL) {
+- if (in_file != stdin_name)
+- free( in_file);
+- }
+ clear_filelist();
+ clear_symtable();
+ #endif
+
+- if (fp_in != stdin)
++ if (fp_in && fp_in != stdin)
+ fclose( fp_in);
+ if (fp_out != stdout)
+ fclose( fp_out);
diff --git a/main/mcpp/APKBUILD b/main/mcpp/APKBUILD
new file mode 100644
index 0000000000..007b6a4727
--- /dev/null
+++ b/main/mcpp/APKBUILD
@@ -0,0 +1,65 @@
+# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
+# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
+pkgname=mcpp
+pkgver=2.7.2
+pkgrel=0
+pkgdesc="A portable C preprocessor"
+url="http://mcpp.sourceforge.net"
+arch="all"
+license="custom"
+depends=""
+depends_dev=""
+makedepends=""
+install=""
+subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
+source="http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
+ 01-zeroc-fixes.patch
+ 02-gniibe-fixes.patch"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+ cd "$_builddir"
+ update_config_sub || return 1
+
+ local i
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --localstatedir=/var \
+ --enable-mcpplib \
+ --disable-static \
+ || return 1
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+
+ mkdir -p "$pkgdir"/usr/share/licenses/$pkgname
+ mv "$pkgdir"/usr/share/doc/$pkgname/LICENSE \
+ "$pkgdir"/usr/share/licenses/$pkgname/LICENSE || return 1
+}
+
+md5sums="512de48c87ab023a69250edc7a0c7b05 mcpp-2.7.2.tar.gz
+e231a2c976ccf14b548deaee840faeb7 01-zeroc-fixes.patch
+1801827678e80d0ef73655a88064a35b 02-gniibe-fixes.patch"
+sha256sums="3b9b4421888519876c4fc68ade324a3bbd81ceeb7092ecdbbc2055099fcb8864 mcpp-2.7.2.tar.gz
+6ed331f58edc7a24e769ac065ab43ed9f09f06487fda37095cacd413b81f522c 01-zeroc-fixes.patch
+30a790e63e387a95e45c2b73b3942948e1e852155250dd769a5598c33d374504 02-gniibe-fixes.patch"
+sha512sums="1ca885cb13fdb684de9d0595a9215b52f48a93a69077d82cdcacafe40d9a61fb77b00a3ff2b8890e7bc0a0fcc0c8d70d4093c00c280351cd4459aba67c573235 mcpp-2.7.2.tar.gz
+86b2e851490e180dfe3028a5a37019ea423924c921ab053a642fb78d4533a87f913ede2928daf9da4daf60e67795a24521186b40c76961ae99ebeb75f8aa95ad 01-zeroc-fixes.patch
+a31a0f2e7430381e5e62ea4257a35891ce9d2f3beed60c6caad3b6d298a58557e9c850223840ef8c6f6c2e8139cf4a4edf29ac93b2532680feafba503fcfaf6d 02-gniibe-fixes.patch"