1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML
><HEAD
><TITLE
>Packaging and Distributing Code</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.54"/><LINK
REL="HOME"
TITLE="KDE 2.0 Development"
HREF="index.html"/><LINK
REL="UP"
TITLE="Developer Tools and Support"
HREF="p04.html"/><LINK
REL="PREVIOUS"
TITLE="Summary"
HREF="ch15lev1sec3.html"/><LINK
REL="NEXT"
TITLE="Administrative Files"
HREF="ch16lev1sec2.html"/><META
HTTP-EQUIV="Content-Style-Type"
CONTENT="text/css"/><LINK
REL="stylesheet"
HREF="kde-common.css"
TYPE="text/css"/><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=iso-8859-1"/><META
HTTP-EQUIV="Content-Language"
CONTENT="en"/><LINK
REL="stylesheet"
HREF="kde-localised.css"
TYPE="text/css"
TITLE="KDE-English"/><LINK
REL="stylesheet"
HREF="kde-default.css"
TYPE="text/css"
TITLE="KDE-Default"/></HEAD
><BODY
CLASS="chapter"
LINK="#336699"
VLINK="#336699"
ALINK="#336699"
BGCOLOR="#FFFFFF"
><DIV
ALIGN="RIGHT"
CLASS="NAVBAR"
><P
><A
HREF="ch15lev1sec3.html"
>Prev</A
> <A
HREF="ch16lev1sec2.html"
>Next</A
> <A
HREF="index.html"
>Table of Contents</A
></P
></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="ch16"
>Chapter 16. Packaging and Distributing Code</A
></H1
><P
><I
CLASS="emphasis"
>by David Sweet</I
></P
><DIV
CLASS="highlights"
><A
NAME="AEN23623"
></A
><P
><B
>In This Chapter</B
></P
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
><I
CLASS="emphasis"
><A
HREF="ch16.html#ch16lev1sec1"
>The Structure of a Package</A
></I
></P
></LI
><LI
STYLE="list-style-type: disc"
><P
><I
CLASS="emphasis"
><A
HREF="ch16lev1sec2.html"
>Administrative Files</A
></I
></P
></LI
><LI
STYLE="list-style-type: disc"
><P
><I
CLASS="emphasis"
><A
HREF="ch16lev1sec3.html"
>Distributing Your Application</A
></I
></P
></LI
></UL
></DIV
><P
>By now you have probably become familiar with the standard form in which KDE applications and libraries are distributed. The source code is bound in a single directory in a gzipped tar file, and the program is made and installed with the commands <TT
CLASS="literal"
>./configure; make; make install</TT
>. In this chapter, you learn how to create packages like this for your own applications.</P
><P
>The advantages to using this standard packaging method include</P
><UL
COMPACT="COMPACT"
><LI
STYLE="list-style-type: disc"
><P
>An easy and familiar compilation and installation procedure for end users.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
>A simple way to construct makefiles and manage dependencies (including .moc files).</P
></LI
><LI
STYLE="list-style-type: disc"
><P
>A convenient way to adapt your source code to the system on which it is being compiled. These advantages occur because of the use of Autoconf and Automake, as well as the hard work of Stephan Kulow (who maintains the KDE packaging software) and other contributors. To use this packaging system, you need Autoconf version 2.13 or better and Automake version 1.4a or better. You will also need to have Perl installed.</P
></LI
></UL
><DIV
CLASS="note"
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="note.png"
HSPACE="5"
ALT="Note"/></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>You can find out about Autoconf, Automake and Perl at the following URLs:</P
><DIV
CLASS="informalexample"
><HR/><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
> 1
2 http://sourceware.cygnus.com/autoconf/
3 http://sourceware.cygnus.com/automake/
4 http://www.perl.org
5 </PRE
></TD
></TR
></TABLE
><HR/></DIV
></TD
></TR
></TABLE
></DIV
><P
>After you've created a working package for your application, you'll want to distribute it and get the word out to potential users. This chapter will show you how.</P
><DIV
CLASS="section"
><TABLE
WIDTH="100%"
CELLPADDING="0"
CELLSPACING="0"
BORDER="0"
ALIGN="CENTER"
><TR
><TD
WIDTH="90%"
><H1
CLASS="section"
><A
NAME="ch16lev1sec1"
>16.1. The Structure of a Package</A
></H1
><P
>A package contains several files in addition to your source code, such as makefiles, scripts, and sources for the makefiles and scripts. A typical layout is shown in <A
HREF="ch16.html#ch16fig01"
>Figure 16.1</A
>.</P
><P
>This layout is taken from the package kexample.tar.gz. In this chapter, you will examine it and develop it into a package for KSimpleApp, the application written in <A
HREF="ch02.html"
>Chapter 2, <SPAN
CLASS="QUOTE"
>"A Simple KDE Application."</SPAN
></A
></P
><P
>The top-level directory of a package contains some administrative scripts, including the script configure, and a makefile. The script configure runs several tests to learn about the system before the software is compiled. These tests include checking for the appropriate versions of KDE and Qt; checking for the locations of KDE, Qt, and X; checking for the presence of various utility programs; and checking for various system-dependent behaviors of programs and library functions. The file Makefile is used by the <TT
CLASS="literal"
>make</TT
> utility to build and install the software, to remove files not needed for distribution, and to regenerate automatically generated files when they are needed. The script configure is generated automatically by the Autoconf from a file called configure.in and Makefile is generated by configure from the file Makefile.in. You will see how to create these files later in the section <A
HREF="ch16lev1sec2.html#ch16lev2sec1"
><SPAN
CLASS="QUOTE"
>"Configuring the Top-Level Directory."</SPAN
></A
></P
><DIV
CLASS="figure"
><HR/><A
NAME="ch16fig01"
></A
><P
><B
>Figure 16.1. The layout of a typical KDE source code package.</B
></P
><DIV
CLASS="mediaobject"
><P
><IMG
SRC="graphics/16fig01.gif"
></IMG
></P
></DIV
><HR/></DIV
><P
>There are two important subdirectories. One is given the name of your application in all lowercase letters (the subdirectory for KSimpleApp, for example, is <TT
CLASS="literal"
>ksimpleapp)</TT
>, and the other is called <TT
CLASS="literal"
>po</TT
>. The first subdirectory contains all the application's source code, and <TT
CLASS="literal"
>po</TT
> holds translations of the string literals that are passed to the <TT
CLASS="literal"
>i18n()</TT
> function.</P
></TD
><TD
WIDTH="10%"
VALIGN="BOTTOM"
ALIGN="CENTER"
><ANNMARK
NAME="ch16lev1sec1"/></TD
></TR
><ANNOTATION
NAME="ch16lev1sec1"
TITLE="The Structure of a Package"/></TABLE
></DIV
></DIV
><DIV
ALIGN="RIGHT"
CLASS="NAVBAR"
><P
><A
HREF="ch15lev1sec3.html"
>Prev</A
> <A
HREF="ch16lev1sec2.html"
>Next</A
> <A
HREF="index.html"
>Table of Contents</A
></P
></DIV
><HR
WIDTH="100%"
SIZE="2"
ALIGN="CENTER"
NOSHADE="NOSHADE"/></BODY
></HTML
>
|