missing NULL terminator in set_config_x
[geda-gaf.git] / docs / wiki / geda-gparts_ii.html
blobe520b7d5a8b7f076828e42c60a620a1e8ca227b4
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <head>
5 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
6 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
7 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
9 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10 </head>
11 <body>
13 <p>
14 <a href="start.html" class="wikilink1" title="start.html">gEDA</a> » <a href="geda-developer.html" class="wikilink1" title="geda-developer.html">Development</a> » <a href="geda-gparts_tc.html" class="wikilink1" title="geda-gparts_tc.html">Parts Manager</a> » <a href="geda-gparts_ii.html" class="wikilink1" title="geda-gparts_ii.html">Installation Instructions</a>
15 </p>
17 <h1 class="sectionedit1" id="part_manager_installation">Part Manager Installation</h1>
18 <div class="level1">
20 <p>
21 The parts manager is in development. All required functionality is not implemented.
22 </p>
24 </div>
25 <!-- EDIT1 SECTION "Part Manager Installation" [116-242] -->
26 <h2 class="sectionedit2" id="requirements">Requirements</h2>
27 <div class="level2">
29 <p>
30 Building and using the part manager requires the following packages:
31 </p>
32 <div class="table sectionedit3"><table class="inline">
33 <thead>
34 <tr class="row0">
35 <th class="col0 leftalign"> PackageName </th><th class="col1 leftalign"> Description </th><th class="col2 leftalign"> Use </th>
36 </tr>
37 </thead>
38 <tr class="row1">
39 <td class="col0 leftalign"> autoconf </td><td class="col1 leftalign"> automatic configure script builder </td><td class="col2"> Required </td>
40 </tr>
41 <tr class="row2">
42 <td class="col0 leftalign"> automake </td><td class="col1"> A tool for generating GNU Standards-compliant Makefiles </td><td class="col2"> Required </td>
43 </tr>
44 <tr class="row3">
45 <td class="col0 leftalign"> gcc </td><td class="col1 leftalign"> The GNU C compiler </td><td class="col2"> Required </td>
46 </tr>
47 <tr class="row4">
48 <td class="col0 leftalign"> geda </td><td class="col1 leftalign"> <abbr title="GNU General Public License">GPL</abbr> EDA – Electronics design software (metapackage) </td><td class="col2"> Required </td>
49 </tr>
50 <tr class="row5">
51 <td class="col0 leftalign"> git-core </td><td class="col1 leftalign"> fast, scalable, distributed revision control system </td><td class="col2"> Required </td>
52 </tr>
53 <tr class="row6">
54 <td class="col0 leftalign"> guile-1.8 </td><td class="col1 leftalign"> The GNU extension language and Scheme interpreter </td><td class="col2"> Required </td>
55 </tr>
56 <tr class="row7">
57 <td class="col0"> guile-1.8-dev </td><td class="col1 leftalign"> Development files for Guile 1.8 </td><td class="col2"> Required </td>
58 </tr>
59 <tr class="row8">
60 <td class="col0"> libgtk2.0-dev </td><td class="col1 leftalign"> Development files for the GTK+ library </td><td class="col2"> Required </td>
61 </tr>
62 <tr class="row9">
63 <td class="col0 leftalign"> libtool </td><td class="col1 leftalign"> Generic library support script </td><td class="col2"> Required </td>
64 </tr>
65 <tr class="row10">
66 <td class="col0 leftalign"> pkg-config </td><td class="col1 leftalign"> Manage compile and link flags for libraries </td><td class="col2"> Required </td>
67 </tr>
68 <tr class="row11">
69 <td class="col0 leftalign"> xsltproc </td><td class="col1 leftalign"> XSLT command line processor </td><td class="col2"> Required </td>
70 </tr>
71 </table></div>
72 <!-- EDIT3 TABLE [339-1382] -->
73 <p>
74 Additionally, GParts requires a database for the back-end. Currently, GParts
75 can use either MySQL, PostgreSQL, or SQLite.
76 </p>
78 </div>
79 <!-- EDIT2 SECTION "Requirements" [243-1507] -->
80 <h3 class="sectionedit4" id="mysql">MySQL</h3>
81 <div class="level3">
83 <p>
84 In order to use MySQL, the packages listed below must be installed. The
85 mysql-server package may not be required if configured to use a remote server.
86 </p>
87 <div class="table sectionedit5"><table class="inline">
88 <thead>
89 <tr class="row0">
90 <th class="col0 leftalign"> PackageName </th><th class="col1 leftalign"> Description </th><th class="col2 leftalign"> Use </th>
91 </tr>
92 </thead>
93 <tr class="row1">
94 <td class="col0"> libmysqlclient-dev </td><td class="col1"> MySQL database development files </td><td class="col2"> Required </td>
95 </tr>
96 <tr class="row2">
97 <td class="col0 leftalign"> mysql-client </td><td class="col1 leftalign"> MySQL database client </td><td class="col2"> Required </td>
98 </tr>
99 <tr class="row3">
100 <td class="col0 leftalign"> mysql-server </td><td class="col1 leftalign"> MySQL database server </td><td class="col2"> Required </td>
101 </tr>
102 </table></div>
103 <!-- EDIT5 TABLE [1677-1952] -->
104 </div>
105 <!-- EDIT4 SECTION "MySQL" [1508-1953] -->
106 <h3 class="sectionedit6" id="postgresql">PostgreSQL</h3>
107 <div class="level3">
110 In order to use PostgreSQL, the following packages must be installed:
111 (TODO: PostgreSQL not supported yet.)
112 </p>
113 <div class="table sectionedit7"><table class="inline">
114 <thead>
115 <tr class="row0">
116 <th class="col0"> PackageName </th><th class="col1 leftalign"> Description </th><th class="col2 leftalign"> Use </th>
117 </tr>
118 </thead>
119 <tr class="row1">
120 <td class="col0 leftalign"> libpq-dev </td><td class="col1"> Header files for PostgreSQL library </td><td class="col2"> Required </td>
121 </tr>
122 <tr class="row2">
123 <td class="col0 leftalign"> postgresql </td><td class="col1 leftalign"> Object-relational SQL database </td><td class="col2"> Required </td>
124 </tr>
125 </table></div>
126 <!-- EDIT7 TABLE [2085-2279] -->
127 </div>
128 <!-- EDIT6 SECTION "PostgreSQL" [1954-2280] -->
129 <h3 class="sectionedit8" id="sqlite">SQLite</h3>
130 <div class="level3">
133 In order to use SQLite, the following packages must be installed:
134 </p>
135 <div class="table sectionedit9"><table class="inline">
136 <thead>
137 <tr class="row0">
138 <th class="col0 leftalign"> PackageName </th><th class="col1 leftalign"> Description </th><th class="col2 leftalign"> Use </th>
139 </tr>
140 </thead>
141 <tr class="row1">
142 <td class="col0 leftalign"> libsqlite3-0 </td><td class="col1 leftalign"> SQLite 3 shared library </td><td class="col2"> Required </td>
143 </tr>
144 <tr class="row2">
145 <td class="col0"> libsqlite3-0-dbg </td><td class="col1 leftalign"> SQLite 3 debugging symbols </td><td class="col2"> Optional </td>
146 </tr>
147 <tr class="row3">
148 <td class="col0 leftalign"> libsqlite3-dev </td><td class="col1 leftalign"> SQLite 3 development files </td><td class="col2"> Required </td>
149 </tr>
150 <tr class="row4">
151 <td class="col0 leftalign"> sqlite3 </td><td class="col1"> A command line interface for SQLite 3 </td><td class="col2"> Required </td>
152 </tr>
153 <tr class="row5">
154 <td class="col0 leftalign"> sqlite3-doc </td><td class="col1 leftalign"> SQLite 3 documentation </td><td class="col2"> Optional </td>
155 </tr>
156 </table></div>
157 <!-- EDIT9 TABLE [2366-2794] -->
159 Of course, installing all packages before building allows the application to
160 use either database for the back-end.
161 </p>
163 </div>
164 <!-- EDIT8 SECTION "SQLite" [2281-2911] -->
165 <h2 class="sectionedit10" id="building_gparts_from_source">Building GParts from Source</h2>
166 <div class="level2">
169 If needed, obtain the source from the source repository.
170 </p>
171 <pre class="code">$ git clone git://git.geda-project.org/gparts
172 Initialized empty Git repository in /home/username/Projects/gparts/.git/
173 remote: Counting objects: 930, done.
174 remote: Compressing objects: 100% (712/712), done.
175 remote: Total 930 (delta 735), reused 269 (delta 207)
176 Receiving objects: 100% (930/930), 745.34 KiB | 283 KiB/s, done.
177 Resolving deltas: 100% (735/735), done.
178 $ cd gparts
179 $</pre>
182 In the top directory of the source package, execute the following commands.
183 Support for PostgreSQL is incomplete, so use the configure option.
184 </p>
185 <pre class="code">$ ./autogen.sh
186 $ ./configure --without-postgresql
187 $ make</pre>
190 The install requires root privileges.
191 </p>
192 <pre class="code">$ sudo make install</pre>
195 Finally, test the executable.
196 </p>
197 <pre class="code">$ gparts</pre>
200 To ensure dynamically loaded modules for database support work, select
201 Database→Connect… from the part manager menu. The combo box Database
202 Type should so options for the various databases supported.
203 </p>
206 <a href="media/geda/gparts-ss-connect-types.png" class="media" target="_blank" title="geda:gparts-ss-connect-types.png"><img src="media/geda/gparts-ss-connect-types.png" class="media" title="" alt="" /></a>
207 </p>
210 If no database modules appear in the combo box, it is likely the parts manager
211 could not find the rc files. The parts manager needs to know the location of
212 system-gafrc file. The parts manager will search for this file, but sometimes
213 cannot locate it. Providing the following environment variable provides better
214 results. For distributions using Debian packages, the system-gafrc file can be
215 located with dpkg.
216 </p>
217 <pre class="code">$ dpkg -S system-gafrc
218 libgeda-common: /etc/gEDA/system-gafrc</pre>
219 <pre class="code">$ GEDADATARC=/etc/gEDA
220 $ export GEDADATARC</pre>
223 Additionally, the parts manager needs to know the location of the symbol
224 library and scheme files.
225 </p>
226 <pre class="code">$ dpkg -S gschem.scm
227 geda-gschem: /usr/share/gEDA/scheme/gschem.scm</pre>
228 <pre class="code">$ GEDADATADIR=/usr/share/gEDA
229 $ export GEDADATADIR</pre>
231 </div>
232 <!-- EDIT10 SECTION "Building GParts from Source" [2912-4720] -->
233 <h2 class="sectionedit11" id="database_creation">Database Creation</h2>
234 <div class="level2">
236 </div>
237 <!-- EDIT11 SECTION "Database Creation" [4721-4752] -->
238 <h3 class="sectionedit12" id="mysql1">MySQL</h3>
239 <div class="level3">
242 Install MySQL.
243 </p>
244 <ul>
245 <li class="level1"><div class="li"> Tested under 5.0.51a-3ubuntu5.1.</div>
246 </li>
247 </ul>
250 To create the database, enter MySQL command line mode as root and enter the SQL
251 commands below. Placing the password in the command line could leave the
252 password in the command line history. Using only the -p option will cause
253 mysql to prompt for the password and avoid this situation. A different
254 database name, other than gparts, can be specified by the user. Using
255 different names, the user can create multiple GPart databases. Additionally,
256 user accounts may need to be created.
257 </p>
258 <pre class="code">$ mysql -u root -p</pre>
259 <pre class="code">mysql&gt; create database GParts;
260 mysql&gt; use GParts;
261 mysql&gt; grant all privileges on *.* to &#039;user&#039;@&#039;localhost&#039; identified by &#039;password&#039;;</pre>
264 After creating the database, the base tables and part-specific tables must be
265 created. All the SQL commands to perform these operations are included in the
266 distributed files. Enter the following commands at the MySQL command line.
267 </p>
268 <pre class="code">mysql&gt; source sql/mysql/create-basic.sql
269 mysql&gt; source sql/mysql/create-categories.sql
270 mysql&gt; source sql/mysql/create-discretes.sql
271 mysql&gt; source sql/mysql/create-passives.sql</pre>
274 Begin loading the database, starting with package data. The package data must
275 be loaded before any parts.
276 </p>
277 <pre class="code">mysql&gt; source data/packages.sql</pre>
280 The package includes a tool to parse the symbol libraries and generate an
281 SQL file for import into the database. Run the tool at the shell prompt, then
282 import the file from an MySQL prompt. The tool requires the root gEDA
283 directory as the only parameter. Your gEDA root directory may be different than
284 below. The symbol data must be loaded before any parts.
285 </p>
286 <pre class="code">$ tools/symbols.py /usr/share/gEDA &gt;tmp/symbols.sql</pre>
287 <pre class="code">mysql&gt; source tmp/symbols.sql</pre>
290 The package includes a script to generate some sample part data. Similar to
291 the symbol tool, run the script at the shell prompt, then import the data at
292 the MySQL prompt.
293 </p>
294 <pre class="code">$ data/parts-bourns.py &gt;tmp/parts-bourns.sql</pre>
295 <pre class="code">mysql&gt; source tmp/parts-bourns.sql</pre>
297 </div>
298 <!-- EDIT12 SECTION "MySQL" [4753-6746] -->
299 <h3 class="sectionedit13" id="postgresql1">PostgreSQL</h3>
300 <div class="level3">
303 TODO: Finish implementation
304 </p>
306 </div>
307 <!-- EDIT13 SECTION "PostgreSQL" [6747-6797] -->
308 <h3 class="sectionedit14" id="sqlite1">SQLite</h3>
309 <div class="level3">
312 The source package contains a sample database in the location below. This
313 database can be opened from directly within the parts manager.
314 </p>
315 <ul>
316 <li class="level1"><div class="li"> gparts/sql/sqlite/sample.db</div>
317 </li>
318 </ul>
321 If required, use the following command line to create a new database or recreate
322 the sample database. In this example, the present working directory must be
323 gparts/sql/sqlite.
324 </p>
325 <pre class="code">$ sqlite3 sample.db
326 SQLite version 3.6.22
327 Enter &quot;.help&quot; for instructions
328 Enter SQL statements terminated with a &quot;;&quot;
329 sqlite&gt;</pre>
332 After creating the database, read base and part specific tables into the
333 database.
334 </p>
335 <pre class="code">sqlite&gt; .read create-basic.sql
336 sqlite&gt; .read create-categories.sql
337 sqlite&gt; .read create-discretes.sql
338 sqlite&gt; .read create-passives.sql</pre>
341 Read sample symbols into the database.
342 </p>
343 <pre class="code">sqlite&gt; .read symbols.sql</pre>
346 Exit the command line interface.
347 </p>
348 <pre class="code">sqlite&gt; .exit</pre>
351 Read sample companies and packages into the database. The source distribution stores packages in XML. The distribution contains an XSLT stylesheet to convert XML into SQL for importing into SQLite. Use the following command line to perform this operation.
352 </p>
353 <pre class="code">$ xsltproc convert.xml ../../data/companies.xml | sqlite3 sample.db
354 $ xsltproc convert.xml ../../data/packages.xml | sqlite3 sample.db</pre>
357 Read sample parts into the database.
358 </p>
359 <pre class="code">$ ../../data/parts-bourns.py &gt;../../tmp/parts-bourns.xml
360 $ xsltproc convert.xml ../../tmp/parts-bourns.xml | sqlite3 sample.db</pre>
363 For other sample parts, the data is not generated with a script.
364 </p>
365 <pre class="code">$ xsltproc convert.xml ../../tmp/rhom-discretes.xml | sqlite3 sample.db</pre>
367 </div>
368 <!-- EDIT14 SECTION "SQLite" [6798-] --></body>
369 </html>