Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 167849 - sys-libs/ncurses ada bindings via USE=ada
Summary: sys-libs/ncurses ada bindings via USE=ada
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
: 190478 210615 (view as bug list)
Depends on: 173731
Blocks: 203659
  Show dependency tree
Reported: 2007-02-21 09:15 UTC by Fredrik Klasson
Modified: 2021-11-03 10:59 UTC (History)
10 users (show)

See Also:
Package list:
Runtime testing required: ---

the ebuild (ncurses-5.5-r4.ebuild,5.81 KB, text/plain)
2007-02-21 09:16 UTC, Fredrik Klasson
the install fix (ncurses-5.5-ada-install.patch,1.33 KB, patch)
2007-02-21 09:17 UTC, Fredrik Klasson
Details | Diff
"configure script" (ncurses-5.5-adacurses-config,593 bytes, text/plain)
2007-02-21 09:17 UTC, Fredrik Klasson
the diff for the ebuild (ebuild.diff,1.80 KB, patch)
2007-03-03 10:31 UTC, Fredrik Klasson
Details | Diff
ebuild patch for ncurses-5.6-r2 (ncurses-5.6-r2.ebuild.diff,1.84 KB, patch)
2007-12-23 07:20 UTC, Jon Dowdall
Details | Diff
updated working patch (ncurses-5.6-r2.ebuild.patch,945 bytes, patch)
2008-02-19 17:58 UTC, theroot
Details | Diff
Updated patch. (ncurses-5.6-r2.ebuild-2008-12-31-1.diff,1.35 KB, patch)
2008-12-31 19:13 UTC, Erik
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fredrik Klasson 2007-02-21 09:15:27 UTC
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    - 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)).

Reproducible: Always

Steps to Reproduce:
1.emerge -v ncurses
2.emerges everytime with no problems. (It "Happens every time" ;)
Actual Results:  
Succesfull install

Expected Results:  
Succesfull install
Comment 1 Fredrik Klasson 2007-02-21 09:16:41 UTC
Created attachment 110803 [details]
the ebuild
Comment 2 Fredrik Klasson 2007-02-21 09:17:10 UTC
Created attachment 110805 [details, diff]
the install fix
Comment 3 Fredrik Klasson 2007-02-21 09:17:45 UTC
Created attachment 110807 [details]
"configure script"
Comment 4 Fredrik Klasson 2007-02-21 09:25:07 UTC
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();
end Source;
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" ;)
Comment 5 SpanKY gentoo-dev 2007-02-21 16:11:31 UTC
post a *diff* against the 5.6 ebuild ... as for the -config script, i'd have to say no ...
Comment 6 Fredrik Klasson 2007-03-03 10:31:46 UTC
Created attachment 111897 [details, diff]
the diff for the ebuild

Ok, here's the diff.
Comment 7 Fredrik Klasson 2007-03-03 10:41:25 UTC
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:
 pkg_postinst() {
 	use unicode || preserve_old_lib_notify /$(get_libdir)/
+	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).
Comment 8 Steve Arnold archtester gentoo-dev 2007-06-18 00:32:52 UTC
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...
Comment 9 SpanKY gentoo-dev 2007-08-29 13:52:17 UTC
*** Bug 190478 has been marked as a duplicate of this bug. ***
Comment 10 Jon Dowdall 2007-12-23 07:20:29 UTC
Created attachment 139157 [details, diff]
ebuild patch for ncurses-5.6-r2
Comment 11 Jon Dowdall 2007-12-23 07:25:33 UTC
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
patch <ncurses-5.6-r2.ebuild.diff
# 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
# Build
USE=ada emerge -v ncurses
Comment 12 Jakub Moc (RETIRED) gentoo-dev 2008-02-18 20:27:53 UTC
*** Bug 210615 has been marked as a duplicate of this bug. ***
Comment 13 Jakub Moc (RETIRED) gentoo-dev 2008-02-18 20:44:54 UTC
*** Bug 210615 has been marked as a duplicate of this bug. ***
Comment 14 theroot 2008-02-19 17:58:06 UTC
Created attachment 143994 [details, diff]
updated working patch

old patches were broken, here's a working one.
Comment 15 Erik 2008-12-31 19:13:49 UTC
Created attachment 176966 [details, diff]
Updated patch.

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).
Comment 16 Erik 2009-01-02 18:22:41 UTC
I see that with the fixed ebuild, both /usr/lib/ada/adainclude/ 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
Comment 17 SpanKY gentoo-dev 2009-01-10 12:30:50 UTC
Thomas: any opinion on updating the ada support in ncurses ?
Comment 18 Thomas Dickey 2009-01-10 13:50:48 UTC
I already did (I thought).  If ncurses is built with wide-characters,
the adacurses-config will show -lncursesw (so far no one's commented
on this):

        + 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
Comment 19 Thomas Dickey 2009-01-10 14:04:33 UTC
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.
Comment 20 Thomas Dickey 2009-01-11 16:56:38 UTC
I made changes last night (20090110) to make the adacurses-config
script work properly - report bugs...
Comment 21 SpanKY gentoo-dev 2009-06-20 13:19:27 UTC
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.