Adding USE-flag ada to ncurses. Which will make it build and install the Ada bindings for ncurses.
I'll attach 3 files:
* the ebuild (ncurses-5.5-r4.ebuild)
* files/ncurses-5.5-ada-install.patch - terminal_interface.ads and libAdaCurses.a isn't installed propperly. This patch fixes this.
* files/ncurses-5.5-adacurses-config - described bellow, makes gnatmake happy[*]
I've tested emerging it on my laptop (x86), and on my amd64 machine. I've also run a small test program on my laptop, which ran fine. (further more all the examples build (haven't tried running any of them though)).
I'm also adding a depency: "ada? ( virtual/gnat )".
I'm using these versions/packages:
=virtual/gnat-4.1 ~x86 (~amd64 on the big machine)
=dev-lang/gnat-gcc-4.1.1 ~x86 (~amd64 on the big machine)
[*] notice: don't remember where I found this (in some ncurses package, found no copyright notice, but I guess it was part of the binding once (and as such fall under Ada's)).
Steps to Reproduce:
1.emerge -v ncurses
2.emerges everytime with no problems. (It "Happens every time" ;)
Created attachment 110803 [details]
Created attachment 110805 [details, diff]
the install fix
Created attachment 110807 [details]
Oh, I fogot to mention how to build with curses:
$ gnatmake source.adb `adacurses-config`
# Note `adacurses-config` must be *after* the source file!
an example file:
with Terminal_Interface.Curses; with Terminal_Interface.Curses;
procedure Source is
Init_Screen; -- init_scr();
Refresh; -- refresh();
End_Windows; -- end_win();
The MegaCool(tm) example above file is a ncurses based drop-in replacement for "clear", (though, you'd have to rename from "source" to "clear" ;)
post a *diff* against the 5.6 ebuild ... as for the -config script, i'd have to say no ...
Created attachment 111897 [details, diff]
the diff for the ebuild
Ok, here's the diff.
About the adacurses-config script, the alternative to having it would be forcing th e user to type "-I/usr/lib/ada/adainclude -L/usr/lib/ada/adainclude -largs -L/usr/lib/ada/adalib -lAdaCurses" manually on every gnatmake, instead of `adacurses-config`.
adasockets have an adasockets-config (though it's shipped with the sources), and afaik other distros ship an adacurses-config (based on my google searches).
If adacurses-config is axed then something like this probably should be added to the ebuild:
use unicode || preserve_old_lib_notify /$(get_libdir)/libncursesw.so.5
+ einfo "In order to build your ada sources with ncurses bindings you must add the following arguments after the source file:"
+ einfo " -I/usr/lib/ada/adainclude -L/usr/lib/ada/adainclude -largs -L/usr/lib/ada/adalib -lAdaCurses"
+ einfo "in other words, instead of typing: gnatmate your_source.abd"
+ einfo "you must type: gnatmate your_source.abd -I/usr/lib/ada/adainclude -L/usr/lib/ada/adainclude -largs -L/usr/lib/ada/adalib -lAdaCurses"
which ihmo is a bad solution, where as a propper adacurses-config would make it easy. Though, otho, it might be best to somehow generate the file (wrt the paths which now are hard coded).
Hmm... I've had gnat-gcc and ncurses installed for quite a while, but this is the first time I've had this build failure with ncurses (ie, an inconsistent Ada installation error on a *.ali file). Since gcc and gnat-gcc are both version 4.1.2, I'm not sure what to say other than: I'd say this could definitely use a USE flag fix, no pun intended...
*** Bug 190478 has been marked as a duplicate of this bug. ***
Created attachment 139157 [details, diff]
ebuild patch for ncurses-5.6-r2
Comment on attachment 139157 [details, diff]
ebuild patch for ncurses-5.6-r2
Added a diff against 5.6-r2.
To build ncurses-5.6-r2, most may know this but I only learned it today :-)
# Apply ebuild patch
# Copy the ncurses-5.5-adacurses-config file
cp ncurses-5.5-adacurses-config /usr/portage/sys-libs/ncurses/files/
# Update digest
ebuild /usr/portage/sys-libs/ncurses/ncurses-5.6-r2.ebuild digest
USE=ada emerge -v ncurses
*** Bug 210615 has been marked as a duplicate of this bug. ***
Created attachment 143994 [details, diff]
updated working patch
old patches were broken, here's a working one.
Created attachment 176966 [details, diff]
The previous patches failed to apply. This one works for me, until it tries to install adacurses-config:
install: cannot change ownership of "/portage_tmpdir/portage/sys-libs/ncurses-5.6-r2/image//usr/bin/adacurses-config": Operation not permitted
I also tried "chmod +x /usr/portage/sys-libs/ncurses/files/ncurses-5.5-adacurses-config" and emerged again but same error happened.
Finally I just removed the adacurses-config part from the ebuild. Then I was able to emerge the package and actually build programs against ncurses, so it solved the immediate problem for me (although it would of course be convenient to have the adacurses-config, just like we have for example sdl-config).
I see that with the fixed ebuild, both /usr/lib/ada/adainclude/terminal_interface-curses.ads and /usr/doc/ncurses-5.6-r2/html/ada/terminal_interface-curses__ads.htm are installed. But it seems like the HTML-version is outdated it has
pragma Linker_Options ("-lncurses");
NC_Version : constant String := "5.5"; -- Version of library
while the actual specification file has
pragma Linker_Options ("-lncursesw");
NC_Version : constant String := "5.6"; -- Version of library
Thomas: any opinion on updating the ada support in ncurses ?
I already did (I thought). If ncurses is built with wide-characters,
the adacurses-config will show -lncursesw (so far no one's commented
+ add adacurses-config to the Ada95 install, based on version from
FreeBSD port, in turn by Juergen Pfeifer in 2000 (prompted by
comment on comp.lang.ada newsgroup).
On the other hand, the binding doesn't expose the wide-character specific
calls (that is, you can display wide-characters, but reading them is
hmm - checking now, the script is only showing me the options for the
Ada95 binding (not the underlying C flags). I'll look into this and
see what improvements I can make.
I made changes last night (20090110) to make the adacurses-config
script work properly - report bugs...
if someone feels like extracting the relevant changes from the upstream updates, we can look at adding to ncurses-5.7. otherwise we'll wait until the next release.