about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2014-06-03 20:37:30 -0500
committerAustin Seipp <aseipp@pobox.com>2014-06-03 20:37:30 -0500
commitec1eadf5a08e8bb13f4dbaacde478f46f612fc42 (patch)
treed5d5b082f53a408309293fc99adf27c818ad7ddb
parenta8ee945a134bb2f1ecb684ebd99f637dae347e00 (diff)
parentd56dcb50f4764c84ec2309ba12978bd71adcd950 (diff)
downloadnixlib-ec1eadf5a08e8bb13f4dbaacde478f46f612fc42.tar
nixlib-ec1eadf5a08e8bb13f4dbaacde478f46f612fc42.tar.gz
nixlib-ec1eadf5a08e8bb13f4dbaacde478f46f612fc42.tar.bz2
nixlib-ec1eadf5a08e8bb13f4dbaacde478f46f612fc42.tar.lz
nixlib-ec1eadf5a08e8bb13f4dbaacde478f46f612fc42.tar.xz
nixlib-ec1eadf5a08e8bb13f4dbaacde478f46f612fc42.tar.zst
nixlib-ec1eadf5a08e8bb13f4dbaacde478f46f612fc42.zip
Merge pull request #2691 from joelteon/cdecl-osx
Update cdecl to block-supporting version
-rw-r--r--lib/maintainers.nix1
-rw-r--r--pkgs/development/tools/cdecl/cdecl-2.5-gentoo.patch29
-rw-r--r--pkgs/development/tools/cdecl/cdecl-2.5-implicit-pointer.patch12
-rw-r--r--pkgs/development/tools/cdecl/cdecl-2.5-lex.patch13
-rw-r--r--pkgs/development/tools/cdecl/cdecl-2.5.patch64
-rw-r--r--pkgs/development/tools/cdecl/default.nix21
6 files changed, 26 insertions, 114 deletions
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 562c88b2d849..8a98cb146513 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -45,6 +45,7 @@
   iElectric = "Domen Kozar <domen@dev.si>";
   iyzsong = "Song Wenwu <iyzsong@gmail.com>";
   jcumming = "Jack Cummings <jack@mudshark.org>";
+  joelteon = "Joel Taylor <me@joelt.io>";
   jwiegley = "John Wiegley <johnw@newartisans.com>";
   kkallio = "Karn Kallio <tierpluspluslists@gmail.com>";
   ktosiek = "Tomasz Kontusz <tomasz.kontusz@gmail.com>";
diff --git a/pkgs/development/tools/cdecl/cdecl-2.5-gentoo.patch b/pkgs/development/tools/cdecl/cdecl-2.5-gentoo.patch
deleted file mode 100644
index b3a67515620c..000000000000
--- a/pkgs/development/tools/cdecl/cdecl-2.5-gentoo.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- a/cdecl.c	2009-07-07 13:20:37.000000000 +0200
-+++ a/cdecl.c.new	2009-07-07 13:25:00.000000000 +0200
-@@ -91,7 +91,7 @@
- #ifdef USE_READLINE
- # include <readline/readline.h>
-   /* prototypes for functions related to readline() */
--  char * getline();
-+  char * mygetline();
-   char ** attempt_completion(char *, int, int);
-   char * keyword_completion(char *, int);
-   char * command_completion(char *, int);
-@@ -375,7 +375,7 @@
- static char *line_read = NULL;
- 
- /* Read a string, and return a pointer to it.  Returns NULL on EOF. */
--char * getline ()
-+char * mygetline ()
- {
-   /* If the buffer has already been allocated, return the memory
-      to the free pool. */
-@@ -887,7 +887,7 @@
- 
- 	if (!quiet) (void) printf("Type `help' or `?' for help\n");
- 	ret = 0;
--	while ((line = getline())) {
-+	while ((line = mygetline())) {
- 	    if (!strcmp(line, "quit") || !strcmp(line, "exit")) {
- 		free(line);
- 		return ret;
diff --git a/pkgs/development/tools/cdecl/cdecl-2.5-implicit-pointer.patch b/pkgs/development/tools/cdecl/cdecl-2.5-implicit-pointer.patch
deleted file mode 100644
index ee4949beb6ed..000000000000
--- a/pkgs/development/tools/cdecl/cdecl-2.5-implicit-pointer.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Index: cdecl-2.5/cdecl.c
-===================================================================
---- cdecl-2.5.orig/cdecl.c
-+++ cdecl-2.5/cdecl.c
-@@ -204,6 +204,7 @@ int DebugFlag = 0;		/* -d, output debugg
- #define ANSI	4	/* combo not allowed anymore in ANSI compiler */
- #define A	ANSI
- 
-+extern char **completion_matches PARAMS((char *, rl_compentry_func_t *));
- /* This is an lower left triangular array. If we needed */
- /* to save 9 bytes, the "long" row can be removed. */
- char crosscheck[9][9] = {
\ No newline at end of file
diff --git a/pkgs/development/tools/cdecl/cdecl-2.5-lex.patch b/pkgs/development/tools/cdecl/cdecl-2.5-lex.patch
new file mode 100644
index 000000000000..ecdee5d544f6
--- /dev/null
+++ b/pkgs/development/tools/cdecl/cdecl-2.5-lex.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index 1643b74..8f1ae11 100644
+--- a/Makefile
++++ b/Makefile
+@@ -33,7 +33,7 @@ c++decl: cdgram.c cdlex.c cdecl.c
+ 	rm -f cdecl
+ 
+ cdlex.c: cdlex.l
+-	lex cdlex.l && mv lex.yy.c cdlex.c
++	flex cdlex.l && mv lex.yy.c cdlex.c
+ 
+ cdgram.c: cdgram.y
+ 	yacc cdgram.y && mv y.tab.c cdgram.c
diff --git a/pkgs/development/tools/cdecl/cdecl-2.5.patch b/pkgs/development/tools/cdecl/cdecl-2.5.patch
deleted file mode 100644
index 4b00849f372b..000000000000
--- a/pkgs/development/tools/cdecl/cdecl-2.5.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-diff --git a/Makefile b/Makefile
-index 9e85686..b8e6e02 100644
---- a/Makefile
-+++ b/Makefile
-@@ -15,13 +15,14 @@
- #
- # add -DUSE_READLINE	To compile in support for the GNU readline library.
- 
--CFLAGS= -s -O2 -DUSE_READLINE
-+CFLAGS=-DUSE_READLINE
- CC= gcc
--LIBS= -lreadline -ltermcap
-+LIBS= -lreadline -lncursesw
- ALLFILES= makefile cdgram.y cdlex.l cdecl.c cdecl.1 testset testset++
--BINDIR= /usr/bin
--MANDIR= /usr/man/man1
--CATDIR= /usr/man/cat1
-+PREFIX?= /usr
-+BINDIR= $(PREFIX)/bin
-+MANDIR= $(PREFIX)/man/man1
-+CATDIR= $(PREFIX)/man/cat1
- INSTALL= install -c
- INSTALL_DATA= install -c -m 644
- 
-@@ -33,7 +34,7 @@ c++decl: cdgram.c cdlex.c cdecl.c
- 	rm -f cdecl
- 
- cdlex.c: cdlex.l
--	lex cdlex.l && mv lex.yy.c cdlex.c
-+	flex cdlex.l && mv lex.yy.c cdlex.c
- 
- cdgram.c: cdgram.y
- 	yacc cdgram.y && mv y.tab.c cdgram.c
-@@ -43,8 +44,10 @@ test:
- 	./c++decl < testset++
- 
- install: cdecl
-+	$(INSTALL) -d $(BINDIR)
- 	$(INSTALL) cdecl $(BINDIR)
- 	ln $(BINDIR)/cdecl $(BINDIR)/c++decl
-+	$(INSTALL) -d $(MANDIR)
- 	$(INSTALL_DATA) cdecl.1 $(MANDIR)
- 	$(INSTALL_DATA) c++decl.1 $(MANDIR)
- 
-diff --git a/cdecl.c b/cdecl.c
-index f03f01e..1fdde9f 100644
---- a/cdecl.c
-+++ b/cdecl.c
-@@ -67,6 +67,7 @@ char cdeclsccsid[] = "@(#)cdecl.c	2.5 1/15/96";
- # include <stddef.h>
- # include <string.h>
- # include <stdarg.h>
-+# include <errno.h>
- #else
- # ifndef NOVARARGS
- #  include <varargs.h>
-@@ -124,7 +125,6 @@ char real_prompt[MAX_NAME+3];
- 
- #if __STDC__
-   char *ds(char *), *cat(char *, ...), *visible(int);
--  int getopt(int,char **,char *);
-   int main(int, char **);
-   int yywrap(void);
-   int dostdin(void);
diff --git a/pkgs/development/tools/cdecl/default.nix b/pkgs/development/tools/cdecl/default.nix
index a9eb323f9a83..d923fea8b598 100644
--- a/pkgs/development/tools/cdecl/default.nix
+++ b/pkgs/development/tools/cdecl/default.nix
@@ -1,22 +1,25 @@
-{stdenv, fetchurl, yacc, flex, readline, ncurses}:
+{stdenv, fetchurl, yacc, flex, readline, ncurses, gnused}:
 
 stdenv.mkDerivation {
   name = "cdecl-2.5";
   src = fetchurl {
-    url = ftp://metalab.unc.edu/pub/linux/devel/lang/c/cdecl-2.5.tar.gz;
-    md5 = "29895dab52e85b2474a59449e07b7996";
+    url = "http://cdecl.org/files/cdecl-blocks-2.5.tar.gz";
+    md5 = "c1927e146975b1c7524cbaf07a7c10f8";
   };
 
-  patches = [ ./cdecl-2.5-implicit-pointer.patch ./cdecl-2.5.patch ./cdecl-2.5-gentoo.patch ];
-  preBuild = "
-    makeFlags=\"PREFIX=$out\"
-  ";
+  patches = [ ./cdecl-2.5-lex.patch ];
+  preBuild = ''
+    ${gnused}/bin/sed 's/getline/cdecl_getline/g' -i cdecl.c;
+    makeFlagsArray=(CFLAGS="-DBSD -DUSE_READLINE -std=gnu89" LIBS=-lreadline);
+    makeFlags="$makeFlags PREFIX=$out BINDIR=$out/bin MANDIR=$out/man1 CATDIR=$out/cat1";
+    mkdir -p $out/bin;
+  '';
   buildInputs = [yacc flex readline ncurses];
 
   meta = {
     description = "Translator English -- C/C++ declarations";
     license = "Public Domain";
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    maintainers = with stdenv.lib.maintainers; [viric joelteon];
+    platforms = stdenv.lib.platforms.unix;
   };
 }