svn commit: r418888 - in head/devel/adacurses: . files
John Marino
marino at FreeBSD.org
Thu Jul 21 18:31:51 UTC 2016
Author: marino
Date: Thu Jul 21 18:31:49 2016
New Revision: 418888
URL: https://svnweb.freebsd.org/changeset/ports/418888
Log:
devel/adacurses: Remove hardcoded dynamic linking, plus ...
The AdaCurses source contains "pragma Linking_Options" which hardcodes
linking flags like "-lncurses" and "-lmenu". This makes it very hard
to statically link libncurses because the pragma flags come at the
end causing the linker to include these libraries. Fix it by removing
the pragmas and require the user to specify the flags themselves.
Related: the provided adacurses.gpr was also hardcoded for dynamic linking
but it only included the base library (excluding menu, form, and panel).
Rework this gpr file to continue to link dynamically by default, and
continue to exclude menu, for, and panel by default, but add environment
variables that easily allow static linking and adding of menu/form/panel
individually as required.
Modified:
head/devel/adacurses/Makefile
head/devel/adacurses/files/adacurses.gpr.in
Modified: head/devel/adacurses/Makefile
==============================================================================
--- head/devel/adacurses/Makefile Thu Jul 21 18:25:22 2016 (r418887)
+++ head/devel/adacurses/Makefile Thu Jul 21 18:31:49 2016 (r418888)
@@ -3,7 +3,7 @@
PORTNAME= adacurses
PORTVERSION= 20150808
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
MASTER_SITES= ftp://invisible-island.net/AdaCurses/
DISTNAME= AdaCurses-${PORTVERSION}
@@ -41,6 +41,13 @@ USES+= ncurses
post-patch:
@${REINPLACE_CMD} -e '/(INSTALL_PROG)/d' -e 's|@ADAGEN_LDFLAGS@||' \
${WRKSRC}/gen/Makefile.in
+ @${REINPLACE_CMD} -e '/pragma Linker_Options/d' \
+ ${WRKSRC}/gen/terminal_interface-curses.ads.m4 \
+ ${WRKSRC}/gen/terminal_interface-curses-menus.ads.m4 \
+ ${WRKSRC}/gen/terminal_interface-curses-forms.ads.m4 \
+ ${WRKSRC}/gen/terminal_interface-curses-panels.ads.m4
+ @${REINPLACE_CMD} -e 's|@LIBS@|@LIBS@ -lmenu -lform -lpanel|' \
+ ${WRKSRC}/samples/Makefile.in
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/gen/adacurses-config \
@@ -48,9 +55,9 @@ post-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/lib/gnat
${SED} "s|@PREFIX@|${PREFIX}|g" ${FILESDIR}/adacurses.gpr.in > \
${STAGEDIR}${PREFIX}/lib/gnat/adacurses.gpr
-.if ${PORT_OPTIONS:MDOCS}
+
+do-install-DOCS-on:
(cd ${WRKSRC}/doc && ${SETENV} ${MAKE_ENV} \
${MAKE_CMD} ${MAKE_ARGS} THIS=${PORTNAME} install.html)
-.endif
.include <bsd.port.mk>
Modified: head/devel/adacurses/files/adacurses.gpr.in
==============================================================================
--- head/devel/adacurses/files/adacurses.gpr.in Thu Jul 21 18:25:22 2016 (r418887)
+++ head/devel/adacurses/files/adacurses.gpr.in Thu Jul 21 18:31:49 2016 (r418888)
@@ -2,14 +2,56 @@ library project ADACURSES is
for Languages use ("Ada");
+ type Link_Style is ("dynamic", "static");
+ type Capability is ("yes", "no");
+
+ Ncurses_Link : Link_Style := external ("NCURSES_LINK", "dynamic");
+ Add_Menu : Capability := external ("NCURSES_MENU", "no");
+ Add_Form : Capability := external ("NCURSES_FORM", "no");
+ Add_Panel : Capability := external ("NCURSES_PANEL", "no");
+
for Source_Dirs use ("../../include/adacurses");
for Library_Dir use "../../lib/adacurses";
for Library_Name use "AdaCurses";
for Library_Kind use "static";
for Externally_Built use "True";
+ D_Base_Flags := ("-L at PREFIX@/lib", "-Wl,-R, at PREFIX@/lib",
+ "-lncurses", "-ltinfo");
+ S_Base_Flags := ("@PREFIX@/lib/libncurses.a", "@PREFIX@/lib/libtinfo.a");
+
+ D_Menu_Flags := ();
+ S_Menu_Flags := ();
+ D_Form_Flags := ();
+ S_Form_Flags := ();
+ D_Panel_Flags := ();
+ S_Panel_Flags := ();
+
+ case Add_Menu is
+ when "no" => null;
+ when "yes" => D_Menu_Flags := ("-lmenu");
+ S_Menu_Flags := ("@PREFIX@/lib/libmenu.a");
+ end case;
+ case Add_Form is
+ when "no" => null;
+ when "yes" => D_Form_Flags := ("-lform");
+ S_Form_Flags := ("@PREFIX@/lib/libform.a");
+ end case;
+ case Add_Panel is
+ when "no" => null;
+ when "yes" => D_Panel_Flags := ("-lpanel");
+ S_Panel_Flags := ("@PREFIX@/lib/libpanel.a");
+ end case;
+
package Linker is
- for Linker_Options use ("-L at PREFIX@/lib", "-Wl,-R, at PREFIX@/lib");
+ case Ncurses_Link is
+ when "dynamic" =>
+ for Linker_Options use
+ D_Base_Flags & D_Menu_Flags & D_Form_Flags & D_Panel_Flags;
+ when "static" =>
+ for Linker_Options use
+ S_Base_Flags & S_Menu_Flags & S_Form_Flags & S_Panel_Flags;
+ end case;
end Linker;
end ADACURSES;
More information about the svn-ports-all
mailing list