ports/devel/adacurses/files/adacurses.gpr.in
John Marino 7e8f632366 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.
2016-07-21 18:31:49 +00:00

57 lines
1.8 KiB
Text

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
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;