Opened 13 years ago
Closed 12 years ago
#34423 closed enhancement (fixed)
gnuplot: patch for using -framework AquaTerm instead of -laquaterm
Reported by: | mojca (Mojca Miklavec) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.0.4 |
Keywords: | haspatch | Cc: | persquare@…, MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) |
Port: | gnuplot |
Description
I'm attaching a patch that enables using -framework AquaTerm instead of -laquaterm switch when compiling gnuplot. This eliminates the need for both /opt/local/lib/libaquaterm*.dylib and /opt/local/include/aquaterm (both are replaced by contents of framework) and also enables one not to use AquaTerm (less important since AquaTerm is lightweight anyway) or use a different version.
I'm attaching two variants: one with a simple patch and one that adds an extra default variant +aquaterm (making it possible to disable aquaterm). Currently one advantage of disabling aquaterm would be making qt the default terminal for example.
(The idea is to get the patch upstream eventually, but that might take some extra effort.)
I would be grateful for testing.
See also #34346.
Notes:
- I forgot to increase port revision.
- I removed the condition to only include aquaterm on darwin platform. My interpretation was that "platforms darwin" would have to include other platforms to make the port usable elsewhere, but I might be wrong about that. If I'm wrong, I will happily fix that back.
Attachments (2)
Change History (7)
Changed 13 years ago by mojca (Mojca Miklavec)
Attachment: | gnuplot-use-aqt-framework.patch added |
---|
comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)
Keywords: | haspatch added |
---|---|
Summary: | patch for using -framework AquaTerm instead of -laquaterm inside gnuplot → gnuplot: patch for using -framework AquaTerm instead of -laquaterm |
Changed 12 years ago by mojca (Mojca Miklavec)
Attachment: | gnuplot-use-aqt-framework-extra-option.patch added |
---|
A patch that also adds +aquaterm option (but does the same otherwise)
comment:2 Changed 12 years ago by mojca (Mojca Miklavec)
Here's an explanation in pseudocode of what exactly the attached patch does:
/* * User can set one of the following flags <with_aquaterm_flag>: * --without-aquaterm / --with-aquaterm=no * --with-aquaterm[=yes] (default; uses either /Library/Frameworks/AquaTerm.framework or simply considers CFLAGS/LDFLAGS) * --with-aquaterm=/opt/local/Library/Frameworks */ if (this_is_apple) { // may be {"yes", "no", <arbitrary string that means yes, but specifies PATH>} if (with_aquaterm_flag != NULL) { with_aquaterm = "yes"; } else { with_aquaterm = with_aquaterm_flag; } if (with_aquaterm != "no") { aquaterm_libs = ""; if (with_aquaterm == "yes") { aquaterm_framework_path = "/Library/Frameworks"; } else { aquaterm_framework_path = with_aquaterm_flag; aquaterm_libs = "-F" + aquaterm_framework_path; } if (!file_exists(aquaterm_framework_path + "/AquaTerm.framework")) { warn("Framework '" + aquaterm_framework_path + "/AquaTerm.framework' doesn't exist."); aquaterm_libs = ""; } // now check if the following program compiles: // // #import <AquaTerm/AQTAdapter.h> // int main() { return 0; } // // $CC -c $CFLAGS -ObjC $aquaterm_libs hello.c if (program_compiles) { header_aquaterm_aqtadapter_h = "yes"; } else { header_aquaterm_aqtadapter_h = "no"; } if (header_aquaterm_aqtadapter_h == "no") { with_aquaterm = "no"; } else { // now check if an empty program compiles with: // // $CC $CFLAGS $LIBS -framework AquaTerm $aquaterm_libs hello.c if (program_compiles) { with_aquaterm = "yes"; CFLAGS += "-ObjC " + aquaterm_libs; LIBS += "-framework Foundation -framework AquaTerm " + aquaterm_libs; } else { with_aquaterm = "no"; } } } }
comment:3 Changed 12 years ago by mojca (Mojca Miklavec)
The basic idea is the following. The system first calls GP_APPLE
which only sets $is_apple to yes or no. Later on (you may move the checks to any other place you want), if system is Mac OS X, it checks if user disabled AquaTerm. If yes, it proceeds without AquaTerm, else it checks if user provided any special flag to tell against which AquaTerm gnuplot should be linked and adds one "LDFLAG
" (LIBS=-F/path/to/Frameworks
). So if AquaTerm is not disabled, it checks whether AquaTerm works. In case it does, it includes it.
An Apple user may:
./configure --without-aquaterm
which will disable AquaTerm./configure --with-aquaterm[=yes]
which will keep AquaTerm (default setting anyway)./configure --with-aquaterm=/path/to/Frameworks
which will add-F/path/to/Frameworks to $LIBS
The patch is composed of two parts:
AC_CHECK_FRAMEWORK
(borrowed from other OpenSource project - the same code is in several projects; maybe it should be renamed into AX to follow guidelines of local additions to autotools macros)- the code in
configure.in
that I wrote myself and does what is described above.
The resulting diff in configure
is auto-generated.
What are problems of current (old) approach / why is the patch needed?
- Per (author of AquaTerm) wanted to get rid of
libaquaterm.dylib
and only keep the framework (that is "the Mac way"). The versions of AquaTerm 1.1.x don't ship with libaquaterm.dylib any more, and it's somehow desired to get rid of those files also under MacPorts. - Outside of MacPorts current configuration checks whether "
-laquaterm
" works from system-wide installation, but if at least some other library is included from MacPorts (because of-I/opt/local/include
which wasn't present during the test for AquaTerm), it will useAquaTerm.framework
from MacPorts (not the one that was being checked for) and then again call system-wide AquaTerm.app. In case of incompatibilities (different version in MacPorts than system-wide) this will prevent AquaTerm from working at all. - Patch adds flexibility to use a different AquaTerm framework in case that there are multiple frameworks installed.
- Patch adds ability to disable AquaTerm terminal. That didn't make any sense in past, but now that Qt, wxt and X11 all work satisfactory, there might be people who don't want to have AquaTerm as the default terminal (lack of mouse events) or don't want to have it built at all. Currently the only option to avoid building with AquaTerm support is to remove AquaTerm from the system.
I would eventually like to get this patch (or its improved version) upstream, which is why I would be really grateful for comments/suggestions.
comment:5 Changed 12 years ago by g5pw (Aljaž Srebrnič)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Changes committed in r96897.
A patch to use -framework AquaTerm instead of -laquaterm