Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gnuplot builder #2339

Merged
merged 61 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9adabc4
Add Gnuplot builder
VarLad Jan 2, 2021
f927a60
Update build_tarballs.jl
VarLad Jan 2, 2021
33d10e1
Update build_tarballs.jl
VarLad Jan 2, 2021
7ba6661
Update build_tarballs.jl
VarLad Jan 2, 2021
5c2da86
Update build_tarballs.jl
VarLad Jan 2, 2021
a69dfc6
Update build_tarballs.jl
VarLad Jan 2, 2021
095aa53
Update build_tarballs.jl
VarLad Jan 2, 2021
e7b46b4
Update build_tarballs.jl
VarLad Jan 2, 2021
1b0ad3a
Update build_tarballs.jl
VarLad Jan 2, 2021
e027f90
Update build_tarballs.jl
VarLad Jan 2, 2021
7deecac
Update build_tarballs.jl
VarLad Jan 2, 2021
e342947
[Gnuplot] Some improvements
giordano Jan 2, 2021
ee45af0
Update build_tarballs.jl
VarLad Jan 3, 2021
27f3072
Update build_tarballs.jl
VarLad Jan 3, 2021
0cd9a4b
Update build_tarballs.jl
VarLad Jan 3, 2021
f15eece
Update build_tarballs.jl
VarLad Jan 3, 2021
0c89c50
Update build_tarballs.jl
VarLad Jan 3, 2021
b14b6ed
Update build_tarballs.jl
VarLad Jan 3, 2021
1eb11e6
Update build_tarballs.jl
VarLad Jan 6, 2021
60fffd9
Update build_tarballs.jl
VarLad Jan 6, 2021
11b330f
Update build_tarballs.jl
VarLad Jan 7, 2021
5c21866
Update build_tarballs.jl
VarLad Jan 7, 2021
2c9202b
Update build_tarballs.jl
VarLad Jan 7, 2021
9ed2996
Update build_tarballs.jl
VarLad Jan 7, 2021
ca57591
Update build_tarballs.jl
VarLad Jan 7, 2021
e1c7567
Update build_tarballs.jl
VarLad Jan 7, 2021
4167910
Update build_tarballs.jl
VarLad Jan 7, 2021
dc285d3
Update build_tarballs.jl
VarLad Mar 30, 2021
03ddd63
Update build_tarballs.jl
VarLad Mar 30, 2021
d6c82b4
Update build_tarballs.jl
VarLad Mar 30, 2021
01e663a
Update build_tarballs.jl
VarLad Apr 2, 2021
5adffc8
Update build_tarballs.jl
VarLad Apr 2, 2021
dbe6f4a
Update build_tarballs.jl
VarLad Apr 2, 2021
74246de
Update build_tarballs.jl
VarLad Apr 2, 2021
1896d85
Update build_tarballs.jl
VarLad Apr 2, 2021
d1db333
Update build_tarballs.jl
VarLad Apr 2, 2021
9924771
Update build_tarballs.jl
VarLad Apr 2, 2021
c2744fb
Update build_tarballs.jl
VarLad Apr 2, 2021
758facb
Update build_tarballs.jl
VarLad Apr 2, 2021
7f469d8
Update build_tarballs.jl
VarLad Apr 2, 2021
fd653e3
[Gnuplot] Fix for when building for the same system as the host
giordano Apr 2, 2021
bd91b76
[Gnuplot] Use more canonical URL for the source
giordano Apr 2, 2021
c47e38f
[Gnuplot] Apply patch from MinGW/Sys2 project
giordano Apr 2, 2021
874fd68
Update build_tarballs.jl
VarLad Apr 2, 2021
cfbaa7f
Update build_tarballs.jl
VarLad Apr 2, 2021
e905ce1
Update build_tarballs.jl
VarLad Apr 2, 2021
1a20c1e
[Gnuplot] Windows fixes
barche Apr 3, 2021
22de34a
[Gnuplot] Remove some dependencies
barche Apr 3, 2021
c052676
Update build_tarballs.jl
VarLad Apr 3, 2021
39575bb
Update build_tarballs.jl
VarLad Aug 25, 2021
5734542
Update 01-gnuplot.patch
VarLad Aug 25, 2021
3c6c9a5
Update build_tarballs.jl
VarLad Aug 25, 2021
73c2fb0
Update build_tarballs.jl
VarLad Aug 25, 2021
8456e9b
Update 01-gnuplot.patch
VarLad Aug 25, 2021
d6609de
Update build_tarballs.jl
ViralBShah Nov 19, 2022
1983688
Update to 5.4.5
ViralBShah Nov 19, 2022
90bc2b6
Update 01-gnuplot.patch
ViralBShah Nov 19, 2022
bdf4eec
Make sure winmain is built
barche Nov 20, 2022
6c3f283
Remove troublesome prntvpt dependency.
barche Nov 24, 2022
06a459a
Correct mingw patch
barche Dec 1, 2022
37a000e
Fix broken mingw binary
barche Dec 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions G/Gnuplot/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

using BinaryBuilder, Pkg

name = "Gnuplot"
version = v"5.4.5"

# Collection of sources required to complete build
sources = [
ArchiveSource("https://downloads.sourceforge.net/project/gnuplot/gnuplot/$(version)/gnuplot-$(version).tar.gz",
"66f679115dd30559e110498fc94d926949d4d370b4999a042e724b8e910ee478"),
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/gnuplot-*/

# Don't try this at home, it's evil
ln -s /opt/${host_target}/${host_target}/sys-root/usr/lib/libc.so /usr/lib/libc.so
barche marked this conversation as resolved.
Show resolved Hide resolved

if [[ "${target}" == "${MACHTYPE}" ]]; then
# Delete system libexpat to avoid confusion
rm /usr/lib/libexpat.so*
elif [[ "${target}" == *-mingw* ]]; then
# Apply patch from https://github.com/msys2/MINGW-packages/blob/5dcff9fd637714972b113c6d3fbf6db17e9b707a/mingw-w64-gnuplot/01-gnuplot.patch
atomic_patch -p1 ../patches/01-gnuplot.patch
autoreconf -fiv
sed -i -e "s/BUILD_MINGW_TRUE='#'/BUILD_MINGW_TRUE=/g" ./configure
sed -i -e "s/BUILD_MINGW_FALSE=$/BUILD_MINGW_FALSE='#'/g" ./configure
fi

export CPPFLAGS="$(pkg-config --cflags glib-2.0) $(pkg-config --cflags cairo) $(pkg-config --cflags pango) -I$(realpath term)"
export LDFLAGS="-liconv"
./configure --prefix=${prefix} --build=${MACHTYPE} --host=${target}
cd src
make -j${nproc}
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = supported_platforms()

# The products that we will ensure are always built
products = [
ExecutableProduct("gnuplot", :gnuplot),
#ExecutableProduct("gnuplot_qt", :gnuplot_qt, "$libexecdir")
]

# Dependencies that must be installed before this package can be built
dependencies = [
BuildDependency(PackageSpec(name="Xorg_xorgproto_jll", uuid = "c4d99508-4286-5418-9131-c86396af500b")),
Dependency(PackageSpec(name="Libcerf_jll", uuid="af83a40a-c4c4-57a0-81df-2309fbd279e3")),
Dependency(PackageSpec(name="LibGD_jll", uuid="16339573-6216-525a-b38f-30b6f6b71b5f")),
BuildDependency(PackageSpec(name="Qt5Tools_jll", uuid="a9c6e4b1-b2fb-56d5-96a9-25f276f13840")),
Dependency(PackageSpec(name="Qt5Svg_jll", uuid="3af4ccab-a251-578e-a514-ea85a0ba79ee")),
Dependency(PackageSpec(name="Cairo_jll", uuid="83423d85-b0ee-5818-9007-b63ccbeb887a")),
Dependency(PackageSpec(name="Libiconv_jll", uuid="94ce4f54-9a6c-5748-9c1c-f9c7231a4531")),
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"8")
223 changes: 223 additions & 0 deletions G/Gnuplot/bundled/patches/01-gnuplot.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
diff --unified '--color=auto' -r gnuplot-5.4.0.orig/config/mingw/Makefile gnuplot-5.4.0/config/mingw/Makefile
--- gnuplot-5.4.0.orig/config/mingw/Makefile 2020-04-10 09:15:40.000000000 +0530
+++ gnuplot-5.4.0/config/mingw/Makefile 2020-09-06 20:38:04.140186600 +0530
@@ -784,19 +784,19 @@
$(HELPFILE): $(BUILDHELPFILE)
$(CP) $^ $@

-htmlhelp.def: /c/Windows/System32/hhctrl.ocx
-ifndef MINGW64
- pexports $^ > $@
-else
- gendef - $^ > $@
-endif
+#htmlhelp.def: /c/Windows/System32/hhctrl.ocx
+#ifndef MINGW64
+# pexports $^ > $@
+#else
+# gendef - $^ > $@
+#endif

-prntvpt.def: /c/Windows/System32/prntvpt.dll
-ifndef MINGW64
- pexports $^ > $@
-else
- gendef - $^ > $@
-endif
+#prntvpt.def: /c/Windows/System32/prntvpt.dll
+#ifndef MINGW64
+# pexports $^ > $@
+#else
+# gendef - $^ > $@
+#endif

# Working directory for patched Japanese sources
JA = ja/
diff --unified '--color=auto' -r gnuplot-5.4.0.orig/configure.ac gnuplot-5.4.0/configure.ac
--- gnuplot-5.4.0.orig/configure.ac 2020-07-12 05:59:47.000000000 +0530
+++ gnuplot-5.4.0/configure.ac 2020-09-06 20:04:48.475405900 +0530
@@ -37,6 +37,8 @@
AC_C_STRINGIZE
AC_PROG_LN_S

+AC_CANONICAL_HOST
+
if test "${build}" != "${host}"
then
CC=${CC-${host_alias-gcc}}
@@ -50,6 +52,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.
@@ -59,7 +63,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
@@ -955,6 +962,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],
diff --unified '--color=auto' -r gnuplot-5.4.0.orig/demo/plugin/Makefile.am gnuplot-5.4.0/demo/plugin/Makefile.am
--- gnuplot-5.4.0.orig/demo/plugin/Makefile.am 2017-12-22 23:02:30.000000000 +0530
+++ gnuplot-5.4.0/demo/plugin/Makefile.am 2020-09-06 20:05:12.659453700 +0530
@@ -4,7 +4,7 @@
noinst_PROGRAMS = demo_plugin.so

demo_plugin_so_SOURCES = demo_plugin.c gnuplot_plugin.h
-demo_plugin_so_CFLAGS = -rdynamic -fPIC -I$(top_srcdir)/src
+demo_plugin_so_CFLAGS = -fPIC -I$(top_srcdir)/src
demo_plugin_so_LDFLAGS = -shared

# Note: Solaris SunPro C compiler needs these flags instead
diff --unified '--color=auto' -r gnuplot-5.4.0.orig/docs/Makefile.am gnuplot-5.4.0/docs/Makefile.am
--- gnuplot-5.4.0.orig/docs/Makefile.am 2020-04-10 22:24:28.000000000 +0530
+++ gnuplot-5.4.0/docs/Makefile.am 2020-09-06 20:03:02.506859700 +0530
@@ -50,6 +50,11 @@

AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/term

+if BUILD_MINGW
+AM_CPPFLAGS += -DWINDOWS_NO_GUI
+dist_doc_DATA = gnuplot.pdf
+endif
+
# Documentation will be prepared for all terminals in CORETERM
# even if the terminal itself is not included in the build.

diff --unified '--color=auto' -r gnuplot-5.4.0.orig/Makefile.am gnuplot-5.4.0/Makefile.am
--- gnuplot-5.4.0.orig/Makefile.am 2020-03-31 22:58:16.000000000 +0530
+++ gnuplot-5.4.0/Makefile.am 2020-09-06 20:01:49.907467200 +0530
@@ -7,6 +7,8 @@
PATCHLEVEL PGPKEYS README RELEASE_NOTES \
configure.vms win

+dist_doc_DATA = FAQ.pdf README RELEASE_NOTES Copyright NEWS BUGS
+
DISTCLEANFILES = stamp-h

ACLOCAL_AMFLAGS = -I m4
diff --unified '--color=auto' -r gnuplot-5.4.0.orig/src/command.c gnuplot-5.4.0/src/command.c
--- gnuplot-5.4.0.orig/src/command.c 2020-06-11 03:03:34.000000000 +0530
+++ gnuplot-5.4.0/src/command.c 2020-09-06 19:57:28.950915200 +0530
@@ -112,7 +112,7 @@
int thread_rl_RetCode = -1; /* return code from readline in a thread */
#endif /* OS2_IPC */

-#ifndef _WIN32
+#ifndef _MSC_VER
# include "help.h"
#endif

@@ -2839,7 +2839,7 @@


#ifdef NO_GIH
-#ifdef _WIN32
+#ifdef _MSC_VER
void
help_command()
{
diff --unified '--color=auto' -r gnuplot-5.4.0.orig/src/Makefile.am gnuplot-5.4.0/src/Makefile.am
--- gnuplot-5.4.0.orig/src/Makefile.am 2020-03-31 22:58:16.000000000 +0530
+++ gnuplot-5.4.0/src/Makefile.am 2020-09-06 20:06:11.275225300 +0530
@@ -93,6 +93,27 @@
# 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 -ld3d11 -ldwrite \
+ -lwindowscodecs -lole32 -lgobject-2.0
+gnuplot_LDFLAGS = $(AM_LDFLAGS) -mconsole -municode
+
if BUILD_WXWIDGETS
gnuplot_SOURCES += wxterminal/wxt_gui.cpp
endif
@@ -103,6 +122,41 @@

if BUILD_BITMAP
gnuplot_SOURCES += bitmap.c
+
+#wgnuplot section
+bin_PROGRAMS += wgnuplot
+
+menudir = $(prefix)/bin
+menu_DATA = win/wgnuplot.mnu
+
+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 -municode
+
+#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) -mwindows -municode
+
+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

if DEVELOPMENT_VERSION
diff --unified '--color=auto' -r gnuplot-5.4.0.orig/src/win/winmain.c gnuplot-5.4.0/src/win/winmain.c
--- gnuplot-5.4.0.orig/src/win/winmain.c 2020-04-10 22:24:28.000000000 +0530
+++ gnuplot-5.4.0/src/win/winmain.c 2020-09-06 19:58:17.437576400 +0530
@@ -368,7 +368,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);