MSYS2-packages/cdecl/build.patch
2017-06-01 22:23:34 +03:00

95 lines
2.6 KiB
Diff

diff --git cdecl-blocks-2.5.orig/Makefile cdecl-blocks-2.5/Makefile
index 2a1429d..86f759b 100644
--- cdecl-blocks-2.5.orig/Makefile
+++ cdecl-blocks-2.5/Makefile
@@ -15,13 +15,13 @@
#
# add -DUSE_READLINE To compile in support for the GNU readline library.
-CFLAGS= -g -O2
+CFLAGS= -g -O2 -DUSE_READLINE
CC= gcc
-LIBS=
+LIBS=-ledit
ALLFILES= makefile cdgram.y cdlex.l cdecl.c cdecl.1 testset testset++
-BINDIR= /usr/bin
-MANDIR= /usr/man/man1
-CATDIR= /usr/man/cat1
+BINDIR= $(PREFIX)/usr/bin
+MANDIR= $(PREFIX)/usr/share/man/man1
+CATDIR= $(PREFIX)/usr/man/cat1
INSTALL= install -c
INSTALL_DATA= install -c -m 644
@@ -34,10 +34,10 @@ c++decl: cdgram.c cdlex.c cdecl.c
rm -f cdecl
cdlex.c: cdlex.l
- lex cdlex.l && mv lex.yy.c cdlex.c
+ lex -ocdlex.c cdlex.l
cdgram.c: cdgram.y
- yacc cdgram.y && mv y.tab.c cdgram.c
+ yacc -ocdgram.c cdgram.y
test: cdecl
@./cdecl < testset | diff -U 3 - test_expected_output.txt \
@@ -48,8 +48,10 @@ test_cpp: c++decl
./c++decl < testset++
install: cdecl
+ $(INSTALL) -d $(BINDIR)
$(INSTALL) cdecl $(BINDIR)
ln -s cdecl $(BINDIR)/c++decl
+ $(INSTALL) -d $(MANDIR)
$(INSTALL_DATA) cdecl.1 $(MANDIR)
$(INSTALL_DATA) c++decl.1 $(MANDIR)
diff --git cdecl-blocks-2.5.orig/cdecl.c cdecl-blocks-2.5/cdecl.c
index 8ecaca4..c839c17 100644
--- cdecl-blocks-2.5.orig/cdecl.c
+++ cdecl-blocks-2.5/cdecl.c
@@ -93,12 +93,12 @@ void free(), exit(), perror();
#endif /* __STDC__ || DOS */
#ifdef USE_READLINE
-# include <readline/readline.h>
+# include <editline/readline.h>
/* prototypes for functions related to readline() */
- char * getline();
+ char * _getline();
char ** attempt_completion(char *, int, int);
char * keyword_completion(char *, int);
- char * command_completion(char *, int);
+ char * command_completion(const char *, int);
#endif
/* maximum # of chars from progname to display in prompt */
@@ -379,7 +379,7 @@ char *options[] = {
static char *line_read = NULL;
/* Read a string, and return a pointer to it. Returns NULL on EOF. */
-char * getline ()
+char * _getline ()
{
/* If the buffer has already been allocated, return the memory
to the free pool. */
@@ -408,7 +408,7 @@ char ** attempt_completion(char *text, int start, int end)
return matches;
}
-char * command_completion(char *text, int flag)
+char * command_completion(const char *text, int flag)
{
static int index, len;
char *command;
@@ -891,7 +891,7 @@ int dostdin()
if (!quiet) (void) printf("Type `help' or `?' for help\n");
ret = 0;
- while ((line = getline())) {
+ while ((line = _getline())) {
if (!strcmp(line, "quit") || !strcmp(line, "exit")) {
free(line);
return ret;