aboutsummaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authormarino <marino@FreeBSD.org>2016-07-22 02:31:49 +0800
committermarino <marino@FreeBSD.org>2016-07-22 02:31:49 +0800
commit11b6e4d3b1e55399cf3c5509fc8bf14de60162e0 (patch)
treeb63f55866677b433825d82d4a62a8ccacc1decc7 /devel
parentfe8df385ac342d29f3f4d331d6300d378decb7fc (diff)
downloadfreebsd-ports-gnome-11b6e4d3b1e55399cf3c5509fc8bf14de60162e0.tar.gz
freebsd-ports-gnome-11b6e4d3b1e55399cf3c5509fc8bf14de60162e0.tar.zst
freebsd-ports-gnome-11b6e4d3b1e55399cf3c5509fc8bf14de60162e0.zip
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.
Diffstat (limited to 'devel')
-rw-r--r--devel/adacurses/Makefile13
-rw-r--r--devel/adacurses/files/adacurses.gpr.in44
2 files changed, 53 insertions, 4 deletions
diff --git a/devel/adacurses/Makefile b/devel/adacurses/Makefile
index 6735373ab0a4..237f3194ded3 100644
--- a/devel/adacurses/Makefile
+++ b/devel/adacurses/Makefile
@@ -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>
diff --git a/devel/adacurses/files/adacurses.gpr.in b/devel/adacurses/files/adacurses.gpr.in
index 083fcb92836c..44aa935830f5 100644
--- a/devel/adacurses/files/adacurses.gpr.in
+++ b/devel/adacurses/files/adacurses.gpr.in
@@ -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@PREFIX@/lib", "-Wl,-R,@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@PREFIX@/lib", "-Wl,-R,@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;