[33782] trunk/dports/lang/lemon

mww at macports.org mww at macports.org
Tue Feb 5 01:00:12 PST 2008


Revision: 33782
          http://trac.macosforge.org/projects/macports/changeset/33782
Author:   mww at macports.org
Date:     2008-02-05 01:00:11 -0800 (Tue, 05 Feb 2008)

Log Message:
-----------
make lemon find its template, make a 'c++' version (produces .cpp and .hpp files), inc. revision

Modified Paths:
--------------
    trunk/dports/lang/lemon/Portfile

Added Paths:
-----------
    trunk/dports/lang/lemon/files/
    trunk/dports/lang/lemon/files/Makefile
    trunk/dports/lang/lemon/files/configure
    trunk/dports/lang/lemon/files/patch-lemon.c.diff

Modified: trunk/dports/lang/lemon/Portfile
===================================================================
--- trunk/dports/lang/lemon/Portfile	2008-02-05 08:43:11 UTC (rev 33781)
+++ trunk/dports/lang/lemon/Portfile	2008-02-05 09:00:11 UTC (rev 33782)
@@ -4,6 +4,7 @@
 
 name			lemon
 version			1.39
+revision		1
 categories		lang devel
 platforms		darwin
 maintainers		mww
@@ -15,17 +16,20 @@
 				freebsd
 checksums		sha1 0baa13c54d437b21ccf802792e4ef081e5af3348
 use_bzip2		yes
+post-extract {
+	xinstall -m 644 ${filespath}/Makefile ${worksrcpath}
+	xinstall -m 755 ${filespath}/configure ${worksrcpath}
+}
 
-use_configure	no
+patchfiles		patch-lemon.c.diff
 
-build.cmd		gcc
-build.target	lemon.c -o lemon
-build.args		-DLEMPAR=\"${prefix}/share/lemon/lempar.c\"
+configure.env-append	PREFIX=${prefix}
 
 destroot {
 	xinstall -m 755 -d ${destroot}${prefix}/share/lemon
-	xinstall -m 755 ${worksrcpath}/lemon ${destroot}${prefix}/bin
-	xinstall -m 644 ${worksrcpath}/lempar.c ${destroot}${prefix}/share/lemon/
+	xinstall -m 755 -W ${worksrcpath} lemon lemoncxx ${destroot}${prefix}/bin
+	xinstall -m 644 ${worksrcpath}/lempar.c ${destroot}${prefix}/share/lemon/lempar.c
+	xinstall -m 644 ${worksrcpath}/lempar.c ${destroot}${prefix}/share/lemon/lempar.cpp
 }
 
 livecheck.check	moddate

Added: trunk/dports/lang/lemon/files/Makefile
===================================================================
--- trunk/dports/lang/lemon/files/Makefile	                        (rev 0)
+++ trunk/dports/lang/lemon/files/Makefile	2008-02-05 09:00:11 UTC (rev 33782)
@@ -0,0 +1,8 @@
+#!/bin/sh
+include flags
+all: lemon lemoncxx
+lemon: lemon.c
+	$(CC) $< -o $@ -DLEMPAR=\"$(PREFIX)/share/lemon/lempar.c\" -DCSUFFIX=\".c\" -DHSUFFIX=\".h\"
+lemoncxx: lemon.c
+	$(CC) $< -o $@ -DLEMPAR=\"$(PREFIX)/share/lemon/lempar.cpp\" -DCSUFFIX=\".cpp\" -DHSUFFIX=\".hpp\"
+

Added: trunk/dports/lang/lemon/files/configure
===================================================================
--- trunk/dports/lang/lemon/files/configure	                        (rev 0)
+++ trunk/dports/lang/lemon/files/configure	2008-02-05 09:00:11 UTC (rev 33782)
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo "CC=${CC:-cc}" > flags
+echo "PREFIX=${PREFIX}" >> flags
+

Added: trunk/dports/lang/lemon/files/patch-lemon.c.diff
===================================================================
--- trunk/dports/lang/lemon/files/patch-lemon.c.diff	                        (rev 0)
+++ trunk/dports/lang/lemon/files/patch-lemon.c.diff	2008-02-05 09:00:11 UTC (rev 33782)
@@ -0,0 +1,38 @@
+--- work/lemon-1.39/lemon.c	2006-07-20 08:09:51.000000000 +0200
++++ lemon.c	2008-02-05 09:49:51.000000000 +0100
+@@ -2994,7 +2994,7 @@
+ PRIVATE FILE *tplt_open(lemp)
+ struct lemon *lemp;
+ {
+-  static char templatename[] = "lempar.c";
++  static char templatename[] = LEMPAR;
+   char buf[1000];
+   FILE *in;
+   char *tpltname;
+@@ -3466,7 +3466,7 @@
+ 
+   in = tplt_open(lemp);
+   if( in==0 ) return;
+-  out = file_open(lemp,".c","wb");
++  out = file_open(lemp,CSUFFIX,"wb");
+   if( out==0 ){
+     fclose(in);
+     return;
+@@ -3877,7 +3877,7 @@
+ 
+   if( lemp->tokenprefix ) prefix = lemp->tokenprefix;
+   else                    prefix = "";
+-  in = file_open(lemp,".h","rb");
++  in = file_open(lemp,HSUFFIX,"rb");
+   if( in ){
+     for(i=1; i<lemp->nterminal && fgets(line,LINESIZE,in); i++){
+       sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i);
+@@ -3889,7 +3889,7 @@
+       return;
+     }
+   }
+-  out = file_open(lemp,".h","wb");
++  out = file_open(lemp,HSUFFIX,"wb");
+   if( out ){
+     for(i=1; i<lemp->nterminal; i++){
+       fprintf(out,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080205/d7274c1a/attachment.html


More information about the macports-changes mailing list