refdes_renum: warn of possible number clash with non-conforming values
[geda-gaf/whiteaudio.git] / docs / wiki / geda-gparts_ii.html
blob3e850a449ce29f8dc667f8168724d0072dbbe309
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 <title></title>
6 <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />
7 <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />
8 <link rel="stylesheet" media="print" type="text/css" href="./print.css" />
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 </head>
12 <body>
15 <h1 class="sectionedit1428"><a name="part_manager_installation" id="part_manager_installation">Part Manager Installation</a></h1>
16 <div class="level1">
18 <p>
20 The parts manager is in development. All required functionality is not implemented.
21 </p>
23 </div>
24 <!-- EDIT1428 SECTION "Part Manager Installation" [1-127] -->
25 <h2 class="sectionedit1429"><a name="requirements" id="requirements">Requirements</a></h2>
26 <div class="level2">
28 <p>
30 Building and using the part manager requires the following packages:
32 </p>
33 <div class="table sectionedit1430"><table class="inline">
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 <tr class="row1">
38 <td class="col0 leftalign"> autoconf </td><td class="col1 leftalign"> automatic configure script builder </td><td class="col2"> Required </td>
39 </tr>
40 <tr class="row2">
41 <td class="col0 leftalign"> automake </td><td class="col1"> A tool for generating GNU Standards-compliant Makefiles </td><td class="col2"> Required </td>
42 </tr>
43 <tr class="row3">
44 <td class="col0 leftalign"> gcc </td><td class="col1 leftalign"> The GNU C compiler </td><td class="col2"> Required </td>
45 </tr>
46 <tr class="row4">
47 <td class="col0 leftalign"> geda </td><td class="col1 leftalign"> <acronym title="GNU General Public License">GPL</acronym> EDA – Electronics design software (metapackage) </td><td class="col2"> Required </td>
48 </tr>
49 <tr class="row5">
50 <td class="col0 leftalign"> git-core </td><td class="col1 leftalign"> fast, scalable, distributed revision control system </td><td class="col2"> Required </td>
51 </tr>
52 <tr class="row6">
53 <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>
54 </tr>
55 <tr class="row7">
56 <td class="col0"> guile-1.8-dev </td><td class="col1 leftalign"> Development files for Guile 1.8 </td><td class="col2"> Required </td>
57 </tr>
58 <tr class="row8">
59 <td class="col0"> libgtk2.0-dev </td><td class="col1 leftalign"> Development files for the GTK+ library </td><td class="col2"> Required </td>
60 </tr>
61 <tr class="row9">
62 <td class="col0 leftalign"> libtool </td><td class="col1 leftalign"> Generic library support script </td><td class="col2"> Required </td>
63 </tr>
64 <tr class="row10">
65 <td class="col0 leftalign"> pkg-config </td><td class="col1 leftalign"> Manage compile and link flags for libraries </td><td class="col2"> Required </td>
66 </tr>
67 <tr class="row11">
68 <td class="col0 leftalign"> xsltproc </td><td class="col1 leftalign"> <acronym title="Extensible Stylesheet Language Transformations">XSLT</acronym> command line processor </td><td class="col2"> Required </td>
69 </tr>
70 </table></div>
71 <!-- EDIT1430 TABLE [224-1267] -->
72 <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 <!-- EDIT1429 SECTION "Requirements" [128-1392] -->
80 <h3 class="sectionedit1431"><a name="mysql" id="mysql">MySQL</a></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.
87 </p>
88 <div class="table sectionedit1432"><table class="inline">
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 <tr class="row1">
93 <td class="col0"> libmysqlclient-dev </td><td class="col1"> MySQL database development files </td><td class="col2"> Required </td>
94 </tr>
95 <tr class="row2">
96 <td class="col0 leftalign"> mysql-client </td><td class="col1 leftalign"> MySQL database client </td><td class="col2"> Required </td>
97 </tr>
98 <tr class="row3">
99 <td class="col0 leftalign"> mysql-server </td><td class="col1 leftalign"> MySQL database server </td><td class="col2"> Required </td>
100 </tr>
101 </table></div>
102 <!-- EDIT1432 TABLE [1563-1838] -->
103 </div>
104 <!-- EDIT1431 SECTION "MySQL" [1393-1839] -->
105 <h3 class="sectionedit1433"><a name="postgresql" id="postgresql">PostgreSQL</a></h3>
106 <div class="level3">
110 In order to use PostgreSQL, the following packages must be installed:
111 (TODO: PostgreSQL not supported yet.)
113 </p>
114 <div class="table sectionedit1434"><table class="inline">
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 <tr class="row1">
119 <td class="col0 leftalign"> libpq-dev </td><td class="col1"> Header files for PostgreSQL library </td><td class="col2"> Required </td>
120 </tr>
121 <tr class="row2">
122 <td class="col0 leftalign"> postgresql </td><td class="col1 leftalign"> Object-relational <acronym title="Structured Query Language">SQL</acronym> database </td><td class="col2"> Required </td>
123 </tr>
124 </table></div>
125 <!-- EDIT1434 TABLE [1971-2165] -->
126 </div>
127 <!-- EDIT1433 SECTION "PostgreSQL" [1840-2166] -->
128 <h3 class="sectionedit1435"><a name="sqlite" id="sqlite">SQLite</a></h3>
129 <div class="level3">
133 In order to use SQLite, the following packages must be installed:
135 </p>
136 <div class="table sectionedit1436"><table class="inline">
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 <tr class="row1">
141 <td class="col0 leftalign"> libsqlite3-0 </td><td class="col1 leftalign"> SQLite 3 shared library </td><td class="col2"> Required </td>
142 </tr>
143 <tr class="row2">
144 <td class="col0"> libsqlite3-0-dbg </td><td class="col1 leftalign"> SQLite 3 debugging symbols </td><td class="col2"> Optional </td>
145 </tr>
146 <tr class="row3">
147 <td class="col0 leftalign"> libsqlite3-dev </td><td class="col1 leftalign"> SQLite 3 development files </td><td class="col2"> Required </td>
148 </tr>
149 <tr class="row4">
150 <td class="col0 leftalign"> sqlite3 </td><td class="col1"> A command line interface for SQLite 3 </td><td class="col2"> Required </td>
151 </tr>
152 <tr class="row5">
153 <td class="col0 leftalign"> sqlite3-doc </td><td class="col1 leftalign"> SQLite 3 documentation </td><td class="col2"> Optional </td>
154 </tr>
155 </table></div>
156 <!-- EDIT1436 TABLE [2252-2680] -->
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 <!-- EDIT1435 SECTION "SQLite" [2167-2797] -->
165 <h2 class="sectionedit1437"><a name="building_gparts_from_source" id="building_gparts_from_source">Building GParts from Source</a></h2>
166 <div class="level2">
170 If needed, obtain the source from the source repository.
171 </p>
174 <pre STYLE="background : LightGreen;
175 margin-left : 2em"><font size="+0">$ git clone git:<em>git.gpleda.org/gparts.git
176 Initialized empty Git repository in /home/username/Projects/gparts/.git/
177 remote: Counting objects: 930, done.
178 remote: Compressing objects: 100% (712/712), done.
179 remote: Total 930 (delta 735), reused 269 (delta 207)
180 Receiving objects: 100% (930/930), 745.34 KiB | 283 KiB/s, done.
181 Resolving deltas: 100% (735/735), done.
182 $ cd gparts
183 $ &lt;/xterm&gt;
185 In the top directory of the source package, execute the following commands.
186 Support for PostgreSQL is incomplete, so use the configure option.
188 <pre STYLE="background : LightGreen;
189 margin-left : 2em"><font size="+0">$ ./autogen.sh
190 $ ./configure --without-postgresql
191 $ make</font></pre>
193 The install requires root privileges.
195 <pre STYLE="background : LightGreen;
196 margin-left : 2em"><font size="+0">$ sudo make install</font></pre>
198 Finally, test the executable.
200 <pre STYLE="background : LightGreen;
201 margin-left : 2em"><font size="+0">$ gparts</font></pre>
203 To ensure dynamically loaded modules for database support work, select
204 Database→Connect… from the part manager menu. The combo box Database
205 Type should so options for the various databases supported.
207 <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>
209 If no database modules appear in the combo box, it is likely the parts manager
210 could not find the rc files. The parts manager needs to know the location of
211 system-gafrc file. The parts manager will search for this file, but sometimes
212 cannot locate it. Providing the following environment variable provides better
213 results. For distributions using Debian packages, the system-gafrc file can be
214 located with dpkg.
216 <pre STYLE="background : LightGreen;
217 margin-left : 2em"><font size="+0">$ dpkg -S system-gafrc
218 libgeda-common: /etc/gEDA/system-gafrc
220 $ GEDADATARC=/etc/gEDA
221 $ export GEDADATARC</font></pre>
223 ===== Database Creation =====
226 ==== MySQL ====
228 Install MySQL.
230 * Tested under 5.0.51a-3ubuntu5.1.
232 To create the database, enter MySQL command line mode as root and enter the <acronym title="Structured Query Language">SQL</acronym>
233 commands below. Placing the password in the command line could leave the
234 password in the command line history. Using only the -p option will cause
235 mysql to prompt for the password and avoid this situation. A different
236 database name, other than gparts, can be specified by the user. Using
237 different names, the user can create multiple GPart databases. Additionally,
238 user accounts may need to be created.
240 <pre STYLE="background : LightGreen;
241 margin-left : 2em"><font size="+0">$ mysql -u root -p</font></pre>
243 <pre STYLE="background : LightGreen;
244 margin-left : 2em"><font size="+0">mysql&gt; create database GParts;
245 mysql&gt; use GParts;
246 mysql&gt; grant all privileges on *.* to &#039;user&#039;@&#039;localhost&#039;
247 identified by &#039;password&#039;;</font></pre>
249 After creating the database, the base tables and part-specific tables must be
250 created. All the <acronym title="Structured Query Language">SQL</acronym> commands to perform these operations are included in the
251 distributed files. Enter the following commands at the MySQL command line.
253 <pre STYLE="background : LightGreen;
254 margin-left : 2em"><font size="+0">mysql&gt; source sql/mysql/create-basic.sql
255 mysql&gt; source sql/mysql/create-categories.sql
256 mysql&gt; source sql/mysql/create-discretes.sql
257 mysql&gt; source sql/mysql/create-passives.sql</font></pre>
259 Begin loading the database, starting with package data. The package data must
260 be loaded before any parts.
262 <pre STYLE="background : LightGreen;
263 margin-left : 2em"><font size="+0">mysql&gt; source data/packages.sql</font></pre>
265 The package includes a tool to parse the symbol libraries and generate an
266 <acronym title="Structured Query Language">SQL</acronym> file for import into the database. Run the tool at the shell prompt, then
267 import the file from an MySQL prompt. The tool requires the root gEDA
268 directory as the only parameter. Your gEDA root directory may be different than
269 below. The symbol data must be loaded before any parts.
271 <pre STYLE="background : LightGreen;
272 margin-left : 2em"><font size="+0">$ tools/symbols.py /usr/share/gEDA &gt;tmp/symbols.sql</font></pre>
274 <pre STYLE="background : LightGreen;
275 margin-left : 2em"><font size="+0">mysql&gt; source tmp/symbols.sql</font></pre>
277 The package includes a script to generate some sample part data. Similar to
278 the symbol tool, run the script at the shell prompt, then import the data at
279 the MySQL prompt.
281 <pre STYLE="background : LightGreen;
282 margin-left : 2em"><font size="+0">$ data/parts-bourns.py &gt;tmp/parts-bourns.sql</font></pre>
284 <pre STYLE="background : LightGreen;
285 margin-left : 2em"><font size="+0">mysql&gt; source tmp/parts-bourns.sql</font></pre>
288 ==== PostgreSQL ====
290 TODO: Finish implementation
292 ==== SQLite ====
294 The source package contains a sample database in the location below. This
295 database can be opened from directly within the parts manager.
297 * gparts/sql/sqlite/sample.db
299 If required, use the following command line to create a new database or recreate
300 the sample database. In this example, the present working directory must be
301 gparts/sql/sqlite.
303 <pre STYLE="background : LightGreen;
304 margin-left : 2em"><font size="+0">$ sqlite3 sample.db
305 SQLite version 3.6.22
306 Enter &quot;.help&quot; for instructions
307 Enter SQL statements terminated with a &quot;;&quot;
308 sqlite&gt;</font></pre>
310 After creating the database, read base and part specific tables into the
311 database.
313 <pre STYLE="background : LightGreen;
314 margin-left : 2em"><font size="+0">sqlite&gt; .read create-basic.sql
315 sqlite&gt; .read create-categories.sql
316 sqlite&gt; .read create-discretes.sql
317 sqlite&gt; .read create-passives.sql</font></pre>
319 Read sample symbols into the database.
321 <pre STYLE="background : LightGreen;
322 margin-left : 2em"><font size="+0">sqlite&gt; .read symbols.sql</font></pre>
324 Exit the command line interface.
326 <pre STYLE="background : LightGreen;
327 margin-left : 2em"><font size="+0">sqlite&gt; .exit</font></pre>
329 Read sample companies and packages into the database. The source distribution stores packages in <acronym title="Extensible Markup Language">XML</acronym>. The distribution contains an <acronym title="Extensible Stylesheet Language Transformations">XSLT</acronym> stylesheet to convert <acronym title="Extensible Markup Language">XML</acronym> into <acronym title="Structured Query Language">SQL</acronym> for importing into SQLite. Use the following command line to perform this operation.
331 <pre STYLE="background : LightGreen;
332 margin-left : 2em"><font size="+0">$ xsltproc convert.xml ../../data/companies.xml | sqlite3 sample.db
333 $ xsltproc convert.xml ../../data/packages.xml | sqlite3 sample.db</font></pre>
335 Read sample parts into the database.
337 <pre STYLE="background : LightGreen;
338 margin-left : 2em"><font size="+0">$ ../../data/parts-bourns.py &gt;../../tmp/parts-bourns.xml
339 $ xsltproc convert.xml ../../tmp/parts-bourns.xml | sqlite3 sample.db</font></pre>
341 For other sample parts, the data is not generated with a script.
343 <pre STYLE="background : LightGreen;
344 margin-left : 2em"><font size="+0">$ xsltproc convert.xml ../../tmp/rhom-discretes.xml | sqlite3 sample.db</font></pre>
347 </p>
349 </div>
350 <!-- EDIT1437 SECTION "Building GParts from Source" [2798-] --></body>
351 </html>