Re: Beginner's struggle to make a real gnome application (and be an educated mantainer)



On Thu, Apr 08, 1999 at 12:43:57AM +0200, Enrico Zini was heard to say:
> Hello,
> 
> I wanted to learn gtk and gnome programming, so I've written a nice and smart
> GTK+ application to manage a collection of mp3 cds, make playlists, ask for the
> cds to play them, caching frequently listened songs to hard disk, and allowing
> for infinite new features like making and printing cd or cassette cover from a
> playlist and such. It has already received good feedback from another user.

  Nifty!

> Lastly I came to autoconf and I haven't found my way in.  I consulted the
> autoconf tutorial linked by the gnome site
> (http://nis-www.lanl.gov/~rosalia/mydocs/autoconf_tutorial_toc.html), but I

  You might want to try the autoconf/automake info pages also.  You are
using automake, aren't you?  Anyway, they're probably less nice than a tutorial
but are fairly readable (IMO) and have a number of examples.

> still don't know where to start from. I downloaded the sources of
> gnome-standalone, but:
> 
> enrico@marvin:/tmp$ tar zxvf ~/programmi/gnome/automake/gnome-standalone.tgz
> enrico@marvin:/tmp$ cd gnomestandalone-0.01/
> enrico@marvin:/tmp/gnomestandalone-0.01$ ./configure
> configure: error: can not find sources in . or ..
> enrico@marvin:/tmp/gnomestandalone-0.01$ # And now?

  When you do AC_INIT(somefile), you have to give a relative path to some
source file.  For example, in my AIM client I use AC_INIT(clock/gtkmclock.c).

> The system is a Debian Slink on i386 with the gnome-stage-slink Gnome system.
> It compiles my gnome application fine, and gedit 0.5.1 ./configures and
> compiles fine.
> 
> So much for it, I resorted to the list: I have now this application that links
> to gtk, gnome and libmysqlclient (hopefully also postgres support in the
> future); it includes a couple of perl files it exec()s to scan CDs; it is
> internationalized.
> 
> I would like to know:
> 
>  1) How do I organize the directory layout of the distribution?
> 
> mp3i-<version>/	the package directory (package-version, right?)
>  ./		autoconf stuff, README, Changelog, TODO, INSTALL and?
>  doc/		still empty (I'll fill it, I swear! :) )
>  include/	.h stuff (should go in .c ?)
>  macros/	autoconf macros ??
>  perl/		perl scripts (where should I put them?)
>  po/		i18n stuff
>  src/		.c stuff

  Looks like a good organization to me.  I don't know whether macros/ is
necessary, though; I think it depends on whether people will be getting your
program from Gnome CVS??  Anyway, I don't use it, but then I haven't
Gnomified yet. (*ducks*) And I personally don't put my include files in a
separate directory, although I think that's just a matter of choice. ;-)

>  2) What files do I need to write, and what do I need to write in them to 
>     make autoconf make a Makefile that compiles (makes) my application?

  Makefile.am:

  This is just a list of your sources for the most part.  'info automake' is
your friend. :-)  In the top level, you do:

----------
   SUBDIRS=doc include perl po src
------------

  and then in, say, the src directory:

----------
  bin_PROGRAMS=myapp

  myapp_SOURCES=foo.c foo.h ....
--------------

  automake will take these (and configure.in) and generate a Makefile.in when
you run it.  (You'll have to run it for each subdirectory explicitly :-(, so
for i in . doc include perl po src; do automake $i/Makefile; done

  aclocal creates a file, 'aclocal.m4', which contains a bunch of random
autoconf macros that your system defines.

  autoconf then takes these things and uses them to generate Makefiles,
config.h, and possibly other things (although I think only a few weird people
like the gnome-libs authors do this.. :-) )  configure.in is the trickiest part.
See if you can slog through the info manual, especially the 'Existing Tests'
section.  There's a program called 'autoscan' which is marginally helpful
in creating a skeletal configure.in, although I've found that it has trouble
with this.

>  3) What's the standard syntax for a Changelog? What's The Right Way to mantain
>     one?

  I don't know.  Personally I create a dummy Changelog ('touch Changelog') and
then include a segment in my Makefile.am:
dist-hook:
	rcs2log > $(distdir)/ChangeLog

  to generate the ChangeLog from the CVS changes.  If you aren't storing
stuff in CVS this doesn't help, though.  And this might be horribly incorrect.

>  4) What else do I need to make it a Good Gnome application? What's The Right
>     Way of providing an entry in the panel menu for it?

  Drop something in /usr/lib/menu. :-)

  Seriously..you have to install a .desktop file in
GNOME_PREFIX/share/apps/(section)/wherever.  Don't know how to write one
specifically but I've glanced at a few and the syntax seems pretty transparent.
Cut-and-paste may be the answer here.

  If you've Debianized it, the .desktop file become irrelevant for the .deb
package if I remember correctly--update-menus uses menu files to generate
the Gnome menus.  (I don't use the Debian packages at the moment because I
do CVS compiles.  Not knowing whether everything's going to blow up when I
touch the computer is *fun*! :-) )

>  5) What's The Right Way of sharing it? License is GPL and contributions
>     will surely be welcome when the source tarball becomes presentable.

  Hmm.  No idea.  I'd like to know this too, actually. :-)  Freshmeat allows
submissions from everyone I believe but I'm don't remember all their policies
offhand.  eg, do they post all submissions on the front page or do you have
to be famous?

> 
> Now I :wq and hope for the best.

  Hmm, that's funny, I use ZZ. :-)

  I can email you some sample Makefile.am/configure.ins if you want, I've got
them lying around here somewhere...

  Daniel

-- 
  After the game, the king and the pawn go in the same box.
    -- Italian proverb



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]