236 lines
		
	
	
	
		
			8.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			236 lines
		
	
	
	
		
			8.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" [
 | |
| <!ENTITY base CDATA "../..">
 | |
| <!ENTITY date "$FreeBSD: www/en/gnome/docs/porting.sgml,v 1.17 2002/04/07 16:00:11 marcus Exp $">
 | |
| <!ENTITY title "FreeBSD GNOME Project: How To Make a Port">
 | |
| <!ENTITY % gnomeincludes SYSTEM "../includes.sgml"> %gnomeincludes;
 | |
| <!ENTITY % includes SYSTEM "../../includes.sgml"> %includes;
 | |
| ]>
 | |
| <html>
 | |
|   &header;
 | |
| 
 | |
|     <table border="0">
 | |
|       <tr>
 | |
|         <td>
 | |
|           <p>This document assumes that you already know how port system works,
 | |
| 	    and therefore only provides GNOME-specific hints and tips.  General
 | |
| 	    instructions can be found in the 
 | |
| 	    <a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/index.html">FreeBSD Porter's Handbook</a>.
 | |
| 	  </p>
 | |
| 	  <h2>GNOME Makefile Macros</h2>
 | |
|           <p>For ports that <i>require</i> GNOME, you should define the following
 | |
| 	    in your port's Makefile:</p>
 | |
| 
 | |
|           <pre>
 | |
| USE_GNOME=	yes
 | |
| USE_X_PREFIX=	yes
 | |
|           </pre>
 | |
| 
 | |
|           <p>These will take care of the install prefix and requiring all the 
 | |
| 	    core GNOME dependencies.  If your port can use GNOME, but it isn't 
 | |
| 	    required, you can define the following in your Makefile:</p>
 | |
| 
 | |
|           <pre>
 | |
| WANT_GNOME=	yes
 | |
|           </pre>
 | |
| 
 | |
|           <p>If the ports system detects GNOME installed on the system
 | |
| 	    then GNOME components will be built.  Other useful GNOME-related 
 | |
| 		macros that can be define in your port's Makefile include:</p>
 | |
| 
 | |
| <!-- Begin GNOME-related Makefile macros -->
 | |
|           <ul>
 | |
|             <li><p><tt>USE_GLIB (WANT_GLIB)</tt> : The application requires 
 | |
| 	      (can use) Glib.  Defining <tt>USE_GNOME</tt> or <tt>USE_GTK</tt> 
 | |
| 	      takes care of this option automatically.</p></li>
 | |
| 
 | |
|             <li><p><tt>USE_GTK (WANT_GTK)</tt> : The application may not be 
 | |
| 	      GNOME-compliant, but requires GTK+ widgets.  This will take care of 
 | |
| 	      those dependencies.  Note, this option should <b>not</b> be defined 
 | |
| 	      if <tt>USE_GNOME</tt> is defined.</p></li>
 | |
| 
 | |
|             <li><p><tt>USE_ESOUND (WANT_ESOUND)</tt> : The application requires 
 | |
| 	      (can use) esound.  Normally, esound support is added by specifying 
 | |
| 	      <tt>USE_GNOME</tt>.</p></li>
 | |
| 
 | |
|             <li><p><tt>USE_IMLIB (WANT_IMLIB)</tt> : The application requires 
 | |
| 	      (can use) the Imlib image library.  This is not needed if 
 | |
| 	      <tt>USE_GNOME</tt> is defined.</p></li>
 | |
| 
 | |
|             <li><p><tt>USE_GNOMELIBS (WANT_GNOMELIBS)</tt> : The application 
 | |
| 	      requires (can use) GNOME libraries.  This does not import as many 
 | |
| 	      dependencies as <tt>USE_GNOME</tt> and should be used for 
 | |
| 	      applications that use GNOME, but do not need the GNOME Control 
 | |
| 	      Center, the GNOME capplet library, or anything from the GNOME 
 | |
| 	      Core.</p></li>
 | |
| 
 | |
|             <li><p><tt>USE_GNOMECTRL (WANT_GNOMECTRL)</tt> : The application 
 | |
| 	      requires (can use) all the GNOME libraries and the GNOME Control 
 | |
| 	      Center, but does not use anything from GNOME Core.  This option is 
 | |
| 	      usually used for backend APIs.</p></li>
 | |
|           </ul>
 | |
| 
 | |
| 		  <p>If your port can optionally use GNOME, you must set 
 | |
| 		  <tt>WANT_GNOME= yes</tt> in your Makefile, then check to see if
 | |
| 		  <tt>HAVE_GNOME</tt> is set.  Since this is a conditional
 | |
| 		  evaluation, you need to stick it between <tt>bsd.port.pre.mk</tt>
 | |
| 		  and <tt>bsd.port.post.mk</tt>.  For example:</p>
 | |
| 
 | |
| 		  <pre>
 | |
| WANT_GNOME=	yes
 | |
| 
 | |
| .include <bsd.port.pre.mk>
 | |
| 
 | |
| .if defined(HAVE_GNOME)
 | |
| USE_GNOME=	yes
 | |
| CONFIGURE_ARGS+=	--with-gnome
 | |
| .else
 | |
| CONFIGURE_ARGS+=	--without-gnome
 | |
| .endif
 | |
| 
 | |
| .include <bsd.port.post.mk>
 | |
|           </pre>
 | |
| 
 | |
| 		  <p>What happens here is <tt>WANT_GNOME</tt> tells the ports system
 | |
| 		  to check for the existence of <tt>gnome-config</tt>.  If it 
 | |
| 		  exists, <tt>HAVE_GNOME</tt> is set.  If not, <tt>HAVE_GNOME</tt>
 | |
| 		  remains unset.  By setting <tt>USE_GNOME</tt> after checking for
 | |
| 		  <tt>HAVE_GNOME</tt> the port will register all the GNOME
 | |
| 		  dependencies properly.</p>
 | |
| 
 | |
|           <p>When building GNOME ports, remember that many applications 
 | |
| 		  require shared directories in <tt>${PREFIX}/share/gnome</tt>.  Ports
 | |
| 		  should be constructed in a way such that files placed in these 
 | |
| 		  directories are removed before the package which created the
 | |
| 		  directories (i.e. the package that has an appropriate 
 | |
| 		  <tt>@dirrm</tt> in its pkg-plist).  For GNOME, the principle
 | |
| 		  parent port is <tt>gnomecore</tt>.  If your port incudes
 | |
| 		  <tt>USE_GNOME= yes</tt> you should be fine.  If you're 
 | |
| 		  uncertain if you need to require any other packages, you can use
 | |
| 		  the script <tt>${PORTSDIR}/Tools/scripts/gnomedepends.py</tt> 
 | |
| 		  to examine your port's pkg-plist:</p>
 | |
| 
 | |
| 		  <pre>
 | |
| # cd /usr/ports/x11/mygnomeport
 | |
| # /usr/ports/Tools/scripts/gnomedepends.py
 | |
| According to the contents of pkg-plist the port depends on the following GNOME
 | |
| port(s):
 | |
| 
 | |
| /usr/ports/mail/gmail, for directories:
 | |
| 	share/gnome/help
 | |
| 	share/gnome/apps
 | |
| 	share/gnome
 | |
| 
 | |
| /usr/ports/sysutils/gnomecontrolcenter, for directories:
 | |
| 	share/gnome/apps/Settings
 | |
| 	share/gnome/apps
 | |
| 
 | |
| /usr/ports/textproc/scrollkeeper, for directories:
 | |
| 	share/gnome/omf
 | |
| 	share/gnome
 | |
| 
 | |
| /usr/ports/x11/gnomecore, for directories:
 | |
| 	share/gnome/apps/System
 | |
| 
 | |
| /usr/ports/x11/gnomelibs, for directories:
 | |
| 	share/gnome/pixmaps
 | |
| 	share/gnome/help
 | |
|           </pre>
 | |
| 
 | |
| 		  <p>To see a list of what packages your port will actually require,
 | |
| 		  use the command <tt>make package-depends</tt>.</p>
 | |
| <!-- End GNOME-related Makefile macros -->
 | |
| 
 | |
| <!-- Begine GNOME I18N -->
 | |
|           <h2>GNOME Internationalization</h2>
 | |
|           <p>GNOME relies on the <tt>gettext</tt> port to do
 | |
| 	    internationalization (I18N).  FreeBSD currently supports two 
 | |
| 	    versions of <tt>gettext</tt>: 0.10.35 and 0.11.1.  Most ports can 
 | |
| 	    use 0.11.1.  However, if, when compiling your port, you get an 
 | |
| 	    error building the .po translation files need to use the older 
 | |
| 	    version of <tt>gettext</tt>.</p>
 | |
| 		
 | |
| 	  <p>To use the older <tt>gettext</tt>, add the following to your 
 | |
| 	    port's Makefile:</p>
 | |
| 
 | |
| 	  <pre>
 | |
| BUILD_DEPENDS=  msgfmt-old:${PORTSDIR}/devel/gettext-old
 | |
| CONFIGURE_ENV+= MSGFMT=${LOCALBASE}/bin/msgfmt-old \
 | |
| 	XGETTEXT=${LOCALBASE}/bin/xgettext-old
 | |
| 	  </pre>
 | |
| 
 | |
| 	  <p>When installing GNOME applications, make sure the translation
 | |
| 	    files are put in <tt>/usr/X11R6/share/locale</tt> and
 | |
| 	    not <tt>/usr/X11R6/share/gnome/locale</tt>.  To do this, add the
 | |
| 	    following to your port's Makefile's <tt>pre-patch:</tt> section:</p>
 | |
| 
 | |
| 	  <pre>
 | |
| pre-patch:
 | |
| 	@find ${WRKSRC} -name "Makefile.in*" | xargs ${PERL} -pi -e \
 | |
| 		's|\$\(datadir\)/gnome/|\$\(datadir\)/|g ; \
 | |
| 		 s|\$\(datadir\)/locale|\$\(prefix\)/share/locale|g'
 | |
|           </pre>
 | |
| 
 | |
| 	  <p>Also, make sure the translation files are installed as .mo files and 
 | |
| 	    not .gmo files.  To do this, you can generally use this
 | |
| 	    <a href="../patches/patch-po::Makefile.in.in">patch</a>.</p>
 | |
| 
 | |
| <!-- End GNOME I18N -->
 | |
| 
 | |
| <!-- Begin GNOME libtool -->
 | |
|           <h2>Libtool Issues</h2>
 | |
| 
 | |
| 	  <p>Most if not all GNOME applications depend on GNU's libtool.  They
 | |
| 	    also use the GNU configure system.  Newer versions of libtool have
 | |
| 	    a problem with FreeBSD's <tt>USE_LIBTOOL</tt> macro.  Use of this
 | |
| 	    macro should be avoided.  Instead, set <tt>GNU_CONFIGURE= yes</tt>,
 | |
| 	    and use the following <a href="../patches/patch-ltmain.sh">patch</a>.
 | |
| 	    This patch prevents the installation of .la files, prevents
 | |
| 		the building and installation of static archive libraries, and
 | |
| 		ensures that -pthread will be passed to the linker.</p>
 | |
| <!-- End GNOME libtool -->
 | |
| 
 | |
| <!-- Begin GNOME distfiles -->
 | |
|           <h2>Distfiles</h2>
 | |
| 
 | |
|           <p>As GNOME 2.0 gains developer momentum, things must be done to sort
 | |
| 	    out the new GNOME 2.0 distfiles from the GNOME 1.0 distfiles, as well 
 | |
| 	    as do our part to keep the distfiles directory clean.  To do
 | |
| 	    this, GNOME 1.0 ports that download their distfiles from 
 | |
| 	    <tt>${MASTER_SITE_GNOME}</tt> must add the following to their
 | |
| 	    Makefile:</p>
 | |
| 
 | |
|       <pre>
 | |
| DIST_SUBDIR=    gnome
 | |
|       </pre>
 | |
| 
 | |
| 	  <p>GNOME 2.0 ports that download their distfiles from 
 | |
| 	    <tt>${MASTER_SITE_GNOME}</tt> must include the following in their
 | |
| 	    Makefile:</p>
 | |
| 	
 | |
| 	  <pre>
 | |
| DIST_SUBDIR=    gnome2
 | |
| 	  </pre>
 | |
| 
 | |
| 	  <p>Some GNOME distfiles come in both tar gzip as well as tar bzip2 
 | |
| 	    format.  To save time when downloading distfiles over slow links,
 | |
| 	    you should use the bzip2 distfiles whenever possible.  To do this,
 | |
| 	    add the following to your port's Makefile:</p>
 | |
| 
 | |
| 	  <pre>
 | |
| USE_BZIP2=  yes
 | |
| 	  </pre>
 | |
| 
 | |
| <!-- End GNOME distfiles -->
 | |
| 
 | |
| 
 | |
|           <p>If you still need help with your port, have a look at some of
 | |
| 		    the <a href="/ports/gnome.html">existing ports</a> for examples.
 | |
| 			The <a href="mailto:&email;@FreeBSD.org">freebsd-gnome mailing
 | |
| 			list</a> is also there for you.</p>
 | |
|         </td>
 | |
|       </tr>
 | |
|     </table>
 | |
| 
 | |
|   &footer;
 | |
|   </body>
 | |
| </html>
 |