Peter Budai 4013e7f927 gnuplot: restructuring the build process (#3004)
* gnuplot: restructuring the build process
Adding proper makefile.am section to cover MINGW build.

* bump pkgrel
2017-10-03 12:05:21 +03:00

347 lines
11 KiB
Diff

diff -Naur gnuplot-5.2.0.orig/config/mingw/Makefile gnuplot-5.2.0/config/mingw/Makefile
--- gnuplot-5.2.0.orig/config/mingw/Makefile 2017-07-31 04:02:24.000000000 +0200
+++ gnuplot-5.2.0/config/mingw/Makefile 2017-09-10 18:36:11.300817700 +0200
@@ -236,8 +236,8 @@
ifndef TARGET
TARGET=wgnuplot.exe
-#TARGET=wgnuplot_pipes.exe
-#TARGET=gnuplot.exe
+TARGET=wgnuplot_pipes.exe
+TARGET=gnuplot.exe
endif
# Set PIPES and CONSOLE according to the target
@@ -571,7 +571,7 @@
$(MAKE) TARGET=gnuplot.exe gnuplot.pdf tutorial.pdf \
ps_symbols.pdf ps_fontfile_doc.pdf ps_guide.pdf
-support: $(HELPFILE) $(M)bf_test.exe $(QT_TARGET) $(QT_TRANSLATION) demo_plugin.dll $(LUATARGETS) $(HELPFILEJA)
+support: $(QT_TARGET) $(QT_TRANSLATION) $(LUATARGETS)
ja: $(HELPFILEJA)
@@ -598,8 +598,8 @@
$(CC) -c $(CFLAGS) $(CFLAGSEXTRA) -MMD -MT '$*.$$(O)' -MF $*.d -o $@ $<
LDLIBS = -lkernel32 -lgdi32 -lwinspool -lcomdlg32 -lcomctl32 -ladvapi32 -lshell32 -lmsimg32 -lgdiplus -lshlwapi -ld2d1 -ldwrite -lole32
-LDLIBS += -lhtmlhelp
-LDFLAGS2 += -L$(HHWPATH)lib
+#LDLIBS += -lhtmlhelp
+#LDFLAGS2 += -L$(HHWPATH)lib
ifdef MINGW64
LDFLAGS2 += -L.
endif
@@ -717,24 +717,24 @@
$(CC) $(CFLAGS) -I$(M)plugin -shared -o $@ $<
# convert gnuplot.doc to windows/wgnuplot.html
-$(BUILDHELPFILE): doc2html.exe $(D)gnuplot.doc $(D)windows/wgnuplot.hhp $(D)windows/wgnuplot.hhk \
- $(D)windows/wgnuplot.stp $(D)plotstyles.gnu $(CORETERM)
- ./doc2html $(D)gnuplot.doc $(D)windows/
- -./$(TARGET) -d -e "winhelp=1; cd '$(D)'" plotstyles.gnu
- -$(HHC) $(D)windows/wgnuplot.hhp
-
-$(HELPFILE): $(BUILDHELPFILE)
- $(CP) $^ $@
-
-htmlhelp.lib: htmlhelp.def
- dlltool -d htmlhelp.def -l htmlhelp.lib
-
-htmlhelp.def:
-ifndef MINGW64
- pexports c/Windows/System32/hhctrl.ocx > htmlhelp.def
-else
- gendef - /c/Windows/System32/hhctrl.ocx > htmlhelp.def
-endif
+#$(BUILDHELPFILE): doc2html.exe $(D)gnuplot.doc $(D)windows/wgnuplot.hhp $(D)windows/wgnuplot.hhk \
+# $(D)windows/wgnuplot.stp $(D)plotstyles.gnu $(CORETERM)
+# ./doc2html $(D)gnuplot.doc $(D)windows/
+# -./$(TARGET) -d -e "winhelp=1; cd '$(D)'" plotstyles.gnu
+# -$(HHC) $(D)windows/wgnuplot.hhp
+#
+#$(HELPFILE): $(BUILDHELPFILE)
+# $(CP) $^ $@
+#
+#htmlhelp.lib: htmlhelp.def
+# dlltool -d htmlhelp.def -l htmlhelp.lib
+
+#htmlhelp.def:
+#ifndef MINGW64
+# pexports c/Windows/System32/hhctrl.ocx > htmlhelp.def
+#else
+# gendef - /c/Windows/System32/hhctrl.ocx > htmlhelp.def
+#endif
# Working directory for patched Japanese sources
JA = ja/
@@ -973,9 +973,9 @@
cp -p wgnuplot_pipes.exe $(DESTDIR)/bin/
cp -p $(W)/wgnuplot.mnu $(DESTDIR)/bin/
cp -p $(W)/wgnuplot-ja.mnu $(DESTDIR)/bin/
- cp -p $(HELPFILE) $(DESTDIR)/bin/
+ #cp -p $(HELPFILE) $(DESTDIR)/bin/
ifdef HELPFILEJA
- cp -p $(HELPFILEJA) $(DESTDIR)/bin/
+ #cp -p $(HELPFILEJA) $(DESTDIR)/bin/
endif
# configuration files
mkdir -p $(DESTDIR)/$(GNUPLOT_SHARE_DIR)
@@ -1037,12 +1037,12 @@
cp -p $(TOP)/FAQ.pdf $(DESTDIR)/docs/
-cp -p tutorial.pdf $(DESTDIR)/docs/
mkdir -p $(DESTDIR)/docs/psdoc
- cp -p $(D)psdoc/ps_file.doc $(DESTDIR)/docs/psdoc/ps_file_doc.txt
- cp -p $(D)psdoc/ps_guide.ps $(DESTDIR)/docs/psdoc/
- -cp -p ps_guide.pdf $(DESTDIR)/docs/psdoc/
- -cp -p ps_symbols.ps $(DESTDIR)/docs/psdoc/
- -cp -p ps_symbols.pdf $(DESTDIR)/docs/psdoc/
- -cp -p ps_fontfile_doc.pdf $(DESTDIR)/docs/psdoc/
+ #cp -p $(D)psdoc/ps_file.doc $(DESTDIR)/docs/psdoc/ps_file_doc.txt
+ #cp -p $(D)psdoc/ps_guide.ps $(DESTDIR)/docs/psdoc/
+ #-cp -p ps_guide.pdf $(DESTDIR)/docs/psdoc/
+ #-cp -p ps_symbols.ps $(DESTDIR)/docs/psdoc/
+ #-cp -p ps_symbols.pdf $(DESTDIR)/docs/psdoc/
+ #-cp -p ps_fontfile_doc.pdf $(DESTDIR)/docs/psdoc/
# runtime libraries, configuration files etc.
ifdef EXTRADIST
cp -pR $(EXTRADIST)/* $(DESTDIR)/
diff -Naur gnuplot-5.2.0.orig/src/command.c gnuplot-5.2.0/src/command.c
--- gnuplot-5.2.0.orig/src/command.c 2017-08-30 20:48:26.000000000 +0200
+++ gnuplot-5.2.0/src/command.c 2017-09-10 18:33:08.422397000 +0200
@@ -117,7 +117,7 @@
#endif /* OS2_IPC */
-#ifndef _Windows
+#if !defined( _Windows) || defined(__MINGW32__)
# include "help.h"
#endif /* _Windows */
@@ -129,7 +129,7 @@
# else
# include <alloc.h>
# endif /* !MSC */
-# include <htmlhelp.h>
+//# include <htmlhelp.h>
# include "win/winmain.h"
#endif /* _Windows */
@@ -2857,7 +2857,7 @@
#ifdef NO_GIH
-#if defined(_Windows)
+#if defined(_Windows) && !defined (__MINGW32__)
void
help_command()
{
diff -Naur gnuplot-5.2.0.orig/src/win/winmain.c gnuplot-5.2.0/src/win/winmain.c
--- gnuplot-5.2.0.orig/src/win/winmain.c 2017-07-30 18:44:02.000000000 +0200
+++ gnuplot-5.2.0/src/win/winmain.c 2017-09-10 18:29:06.999408000 +0200
@@ -56,7 +56,7 @@
#include <commctrl.h>
#include <shlobj.h>
#include <shlwapi.h>
-#include <htmlhelp.h>
+//#include <htmlhelp.h>
#include <dos.h>
#include <stdio.h>
#include <stdlib.h>
@@ -371,7 +371,8 @@
else
lang = GetLanguageCode();
- filename = (LPTSTR) malloc((_tcslen(szModuleName) + _tcslen(name) + _tcslen(lang) + _tcslen(ext) + 1) * sizeof(TCHAR));
+ //filename = (LPTSTR) malloc((_tcslen(szModuleName) + _tcslen(name) + _tcslen(lang) + _tcslen(ext) + 1) * sizeof(TCHAR));
+ filename = (LPTSTR) malloc(1024 * sizeof(TCHAR));
if (filename) {
_tcscpy(filename, szModuleName);
_tcscat(filename, name);
--- gnuplot-5.2.0.orig/src/term.c 2017-07-09 01:49:45.000000000 +0200
+++ gnuplot-5.2.0/src/term.c 2017-09-22 06:30:56.438408900 +0200
@@ -1582,7 +1582,7 @@
#if defined(WXWIDGETS) && defined(_WIN32)
if (term_name == (char *) NULL)
- term_name = "wxt";
+ term_name = "win";
#endif
#ifdef QTTERM
--- gnuplot-5.2.0.orig/src/makefile.am.orig 2016-01-10 01:22:18.000000000 +0100
+++ gnuplot-5.2.0/src/makefile.am 2017-09-22 00:25:36.299247900 +0200
@@ -91,6 +91,26 @@
# Hercules and original pc graphics driver code
# corgraph.asm header.mac hrcgraph.asm pcgraph.asm lineproc.mac
+# MINGW specific build section
+if BUILD_MINGW
+
+AM_CPPFLAGS += -DHAVE_GDIPLUS -DHAVE_DWRITE -DHAVE_D2D -DWIN32
+AM_CPPFLAGS += -O2 -pipe -DUNICODE -D_UNICODE -Wno-unused-function
+AM_CPPFLAGS += -D_Windows -DHAVE_CONFIG_H
+AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO=1
+AM_CPPFLAGS += -DUSE_MOUSE=1 -DWIN_IPC
+
+
+AM_LDFLAGS =
+
+gnuplot_SOURCES += win/winmain.c win/wgnuplib.c win/wgraph.c win/wprinter.c \
+win/wpause.c win/wgdiplus.cpp win/wd2d.cpp win/wtext.h plot.h\
+gpexecute.c
+
+gnuplot_CPPFLAGS = $(AM_CPPFLAGS) -DPIPES -DWGP_CONSOLE
+gnuplot_LDADD += -lkernel32 -lgdi32 -lwinspool -lcomdlg32 -lcomctl32 -ladvapi32 -lshell32 -lmsimg32 -lgdiplus -lshlwapi -ld2d1 -ldwrite -lole32
+gnuplot_LDFLAGS = $(AM_LDFLAGS) -mconsole
+
if BUILD_WXWIDGETS
gnuplot_SOURCES += wxterminal/wxt_gui.cpp
endif
@@ -101,6 +121,43 @@
if BUILD_BITMAP
gnuplot_SOURCES += bitmap.c
+
+#wgnuplot section
+bin_PROGRAMS += wgnuplot
+
+menudir = $(prefix)/bin
+menu_DATA = win/wgnuplot.mnu
+dist_doc_DATA = ../FAQ.pdf ../README ../RELEASE_NOTES ../Copyright ../NEWS ../ChangeLog ../BUGS
+
+wgnuplot_SOURCES = $(gnuplot_SOURCES)
+wgnuplot_SOURCES += win/wtext.c win/screenbuf.c win/wmenu.c win/wredirect.cpp
+wgnuplot_CPPFLAGS = $(AM_CPPFLAGS) -DPIPES
+wgnuplot_LDADD = $(gnuplot_LDADD) wgplt_res.$(O)
+wgnuplot_LDFLAGS = $(AM_LDFLAGS) -mwindows --enable-auto-import
+
+
+#wgnuplot_pipes section
+bin_PROGRAMS += wgnuplot_pipes
+
+wgnuplot_pipes_SOURCES = $(gnuplot_SOURCES)
+wgnuplot_pipes_SOURCES += win/wtext.c win/screenbuf.c win/wmenu.c win/wredirect.cpp
+wgnuplot_pipes_CPPFLAGS = $(AM_CPPFLAGS) -DPIPES
+wgnuplot_pipes_LDADD = $(gnuplot_LDADD) wgplt_res.$(O)
+wgnuplot_pipes_LDFLAGS = $(AM_LDFLAGS) -mconsole
+
+RCFLAGS = --include-dir=$(srcdir)/win \
+ --define __WIN32__ --define __WIN95__ \
+ --define __GNUWIN32__ --use-temp-file
+RCOUT = wgplt_res.$(O)
+RES2COFF = echo wgplt_res.$(O)
+
+wgplt_res.$(O): win/wgnuplot.rc win/wgnuplib.rc win/wresourc.h win/texticon.ico win/grpicon.ico win/wgnuplot.exe.manifest win/wgnuplot.exe.manifest64
+ echo Making RESOURCE FILE
+ windres $(RCFLAGS) $< wgplt_res.$(O)
+ echo wgplt_res.$(O)
+
+endif
+
endif
DISTCLEANFILES = timestamp.h
--- gnuplot-5.2.0.orig/makefile.am 2017-06-05 00:03:34.000000000 +0200
+++ gnuplot-5.2.0/makefile.am 2017-09-22 06:53:00.751133800 +0200
@@ -7,6 +7,8 @@
Makefile.maint PATCHLEVEL PGPKEYS README RELEASE_NOTES \
VERSION configure.vms win
+dist_doc_DATA = FAQ.pdf README RELEASE_NOTES Copyright NEWS ChangeLog BUGS
+
DISTCLEANFILES = stamp-h
ACLOCAL_AMFLAGS = -I m4
--- gnuplot-5.2.0.orig/docs/makefile.am.orig 2017-07-06 01:01:27.000000000 +0200
+++ gnuplot-5.2.0/docs/makefile.am 2017-09-22 07:01:56.461836100 +0200
@@ -50,6 +50,12 @@
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/term
+if BUILD_MINGW
+AM_CPPFLAGS += -DWINDOWS_NO_GUI
+dist_doc_DATA = gnuplot.pdf
+endif
+
+
T = $(top_srcdir)/term/
CORETERM = $(T)ai.trm $(T)aquaterm.trm $(T)be.trm $(T)caca.trm \
$(T)cairo.trm $(T)canvas.trm $(T)cgm.trm $(T)context.trm \
@@ -124,7 +130,8 @@
done >$@
# for debugging
-alldoc: check dvi gih hlp html info ipf nroff pdf ps rnh rtf htb
+#alldoc: check dvi gih hlp html info ipf nroff pdf ps rnh rtf htb
+alldoc: gih
### [tn]roff documentation
troff: gnuplot.ms $(srcdir)/titlepag.ms
@@ -223,6 +230,7 @@
doc2tex_SOURCES = doc2tex.c termdoc.c
doc2tex_CPPFLAGS = -DALL_TERM_DOC $(AM_CPPFLAGS)
+doc2tex_CFLAGS= -DWINDOWS_NO_GUI
dvi: gnuplot.dvi
gnuplot.dvi: gnuplot.tex $(srcdir)/titlepag.tex $(srcdir)/toc_entr.sty
@@ -339,6 +347,7 @@
$(AM_V_GEN) ./doc2ipf$(EXEEXT) $(srcdir)/gnuplot.doc gnuplot.ipf
doc2ipf_SOURCES = doc2ipf.c termdoc.c xref.c
+doc2ipf_CFLAGS= -DWINDOWS_NO_GUI
### Rich Text Format
rtf: gnuplot.rtf
@@ -366,6 +375,8 @@
fi
checkdoc_SOURCES = checkdoc.c termdoc.c gnuplot.doc
+checkdoc_CFLAGS= -DWINDOWS_NO_GUI
+
clean-local:
$(AM_V_at)for f in figure*.pdf $(LUA_HELP); do \
--- gnuplot-5.2.0.orig/configure.ac.orig 2017-09-03 05:43:58.000000000 +0200
+++ gnuplot-5.2.0/configure.ac 2017-09-20 15:41:50.308502400 +0200
@@ -36,6 +36,8 @@
AC_C_STRINGIZE
AC_PROG_LN_S
+AC_CANONICAL_HOST
+
if test "${build}" != "${host}"
then
CC=${CC-${host_alias-gcc}}
@@ -49,6 +51,8 @@
CC_FOR_BUILD="${CC}"
AC_PROG_CC
+ build_mingw=no
+
# We must set the default linker to the linker used by gcc for the correct
# operation of libtool. If LD is not defined and we are using gcc, try to
# set the LD default to the ld used by gcc.
@@ -58,7 +62,10 @@
then
case $build in
*-*-mingw*)
- gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
+ gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'`
+ AC_MSG_NOTICE([MINGW environment detected, executing MINGW type build])
+ #AC_CONFIG_LINKS([src/config.h:config/config.mgw])
+ build_mingw=yes ;;
*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
esac
@@ -1087,6 +1094,8 @@
AM_CONDITIONAL(BUILD_GPCAIRO, test "${build_gpcairo}" = yes)
+AM_CONDITIONAL(BUILD_MINGW, test "${build_mingw}" = yes)
+
dnl Enable subsystem to generate statistical summary of file contents
AC_ARG_ENABLE(stats,dnl
[ --disable-stats Omit calculation of statistical summary of data],