Browse Source

Added KDE3 version of wlassistant


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/wlassistant@1097621 283d02a7-25f6-0310-bc7c-ecb5cbfe19
tags/v3.5.13
tpearson 9 years ago
commit
e0311ffdf8
47 changed files with 19708 additions and 0 deletions
  1. 588
    0
      ChangeLog
  2. 35
    0
      SConstruct
  3. 1
    0
      VERSION
  4. 644
    0
      bksys/generic.py
  5. 884
    0
      bksys/kde.py
  6. 142
    0
      bksys/parser.py
  7. BIN
      bksys/scons-mini.tar.bz2
  8. 28
    0
      config.bks
  9. 87
    0
      configure
  10. 2
    0
      description-pak
  11. 25
    0
      doc/AUTHORS
  12. 340
    0
      doc/COPYING
  13. 97
    0
      doc/NEWS
  14. 9
    0
      doc/README
  15. 364
    0
      doc/TODO
  16. BIN
      icons/hi16-app-wlassistant.png
  17. BIN
      icons/hi32-app-wlassistant.png
  18. 969
    0
      po/ar.po
  19. 997
    0
      po/ca.po
  20. 983
    0
      po/es.po
  21. 987
    0
      po/fr.po
  22. 973
    0
      po/nb.po
  23. 980
    0
      po/pl.po
  24. 976
    0
      po/pt_BR.po
  25. 978
    0
      po/sv.po
  26. 860
    0
      po/wlassistant.pot
  27. 960
    0
      po/zh_CN.po
  28. 963
    0
      po/zh_TW.po
  29. 26
    0
      src/SConscript
  30. 56
    0
      src/main.cpp
  31. 239
    0
      src/netlistviewitem.cpp
  32. 176
    0
      src/netlistviewitem.h
  33. 289
    0
      src/netparams.h
  34. 1111
    0
      src/ui_NetParamsEdit.ui
  35. 892
    0
      src/ui_NetParamsWizard.ui
  36. 759
    0
      src/ui_main.ui
  37. 174
    0
      src/ui_netparamsedit.cpp
  38. 53
    0
      src/ui_netparamsedit.h
  39. 107
    0
      src/ui_netparamswizard.cpp
  40. 53
    0
      src/ui_netparamswizard.h
  41. 29
    0
      src/waconfig.cpp
  42. 45
    0
      src/waconfig.h
  43. 312
    0
      src/watools.cpp
  44. 76
    0
      src/watools.h
  45. 1264
    0
      src/wlassistant.cpp
  46. 55
    0
      src/wlassistant.desktop
  47. 120
    0
      src/wlassistant.h

+ 588
- 0
ChangeLog View File

@@ -0,0 +1,588 @@
1
+2007-04-03  Paweł Nawrocki  <pnawrocki@gmail.com>
2
+
3
+	* WPA-PSK support, UI cleanup and much more.
4
+
5
+2007-02-27  Paweł Nawrocki  <pnawrocki@gmail.com>
6
+
7
+	* dhclient connection: get gateway from stdout, so there's no need to check later.
8
+
9
+2007-02-27  Paweł Nawrocki  <pnawrocki@gmail.com>
10
+
11
+	* get rid of many external proc calls in favor of ioctls, WATools cleanup
12
+
13
+2007-02-27  Paweł Nawrocki  <pnawrocki@gmail.com>
14
+
15
+	* Don't check for active connection while wizard is running
16
+
17
+2007-02-27  Paweł Nawrocki  <pnawrocki@gmail.com>
18
+
19
+	* Fixed connection success detection
20
+
21
+2007-02-27  Paweł Nawrocki  <pnawrocki@gmail.com>
22
+
23
+	* Beginnings of WPA-PSK support
24
+
25
+2007-02-09  Paweł Nawrocki  <pnawrocki@gmail.com>
26
+
27
+	* Got rid of "iwconfig_status" action. Get essid with iwlib calls.
28
+
29
+2007-02-03  Paweł Nawrocki  <pnawrocki@gmail.com>
30
+
31
+	* Added option to group APs with the same ESSID
32
+
33
+2007-02-03  Paweł Nawrocki  <pnawrocki@gmail.com>
34
+
35
+	* Hide security keys in dialogs and console output
36
+
37
+2006-11-22 RELEASE 0.5.6
38
+
39
+2006-11-22  Pawel Nawrocki  <pnawrocki@gmail.com>
40
+
41
+	* Added an option to wait before getting scan results - fixes a problem when some networks were not visible after initial scan.
42
+
43
+2006-11-22  Pawel Nawrocki  <pnawrocki@gmail.com>
44
+
45
+	* Added option to automatically connect to best network at startup.
46
+
47
+2006-11-22  Pawel Nawrocki  <pnawrocki@gmail.com>
48
+
49
+	* Added customizable per-network commands before/after connection/disconnection.
50
+
51
+2006-11-14  Pawel Nawrocki  <pnawrocki@gmail.com>
52
+
53
+	* Removed the '-q' option from dhclient execution (problem reported by marshallbanana) 
54
+
55
+2006-11-14  Pawel Nawrocki  <pnawrocki@gmail.com>
56
+
57
+	* Added Arabic translation (by Mohammed Gamal)
58
+
59
+2006-11-14  Pawel Nawrocki  <pnawrocki@gmail.com>
60
+
61
+	* Added Norwegian Bokm� translation (by Alexander Nicolaysen S?rnes)
62
+
63
+2006-11-14  Pawel Nawrocki  <pnawrocki@gmail.com>
64
+
65
+	* Added Swedish translation (by Daniel Nylander)
66
+
67
+2006-11-14  Pawel Nawrocki  <pnawrocki@gmail.com>
68
+
69
+	* Updated Spanish translation (by Enrique Mat�s S�chez)
70
+
71
+2006-11-14  Pawel Nawrocki  <pnawrocki@gmail.com>
72
+
73
+	* Made automatic reconnection option more visible (modified patch by Henry Kay)
74
+
75
+2006-03-11  Pawel Nawrocki  <pnawrocki@gmail.com>
76
+
77
+	* Fix bug 1447119 - ignore hostap's wifi0 interface (reported and patched by Andreas Nolda)
78
+
79
+2006-03-09  Pawel Nawrocki  <pnawrocki@gmail.com>
80
+
81
+	* Wait a little bit before checking if connection was successful (a working connection was sometimes not detected)
82
+
83
+2006-03-09  Pawel Nawrocki  <pnawrocki@gmail.com>
84
+
85
+	* Fixed detection of a running DHCP client (patch by James Ots)
86
+	* Fixed gateway detection for SUSE10  (patch by James Ots)
87
+
88
+2006-03-04  Pawel Nawrocki  <pnawrocki@gmail.com>
89
+
90
+	* Added .info files path for SUSE10
91
+
92
+2006-03-01  Pawel Nawrocki  <pnawrocki@gmail.com>
93
+
94
+	* Skip channel setting if not supported (fixes bug 1349228)
95
+
96
+2006-02-16  Pawel Nawrocki  <pnawrocki@gmail.com>
97
+
98
+	* Revised and completed Portugese (Brazil) translation (by BRUNO GON�LVES)
99
+
100
+2006-02-13  RELEASE 0.5.5
101
+
102
+2006-02-13  Pawel Nawrocki  <pnawrocki@gmail.com>
103
+
104
+	* Get device list from iwconfig
105
+
106
+2006-02-13  Pawel Nawrocki  <pnawrocki@gmail.com>
107
+
108
+	* Added AUTHORS file
109
+
110
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
111
+
112
+	* Updated to latest bksys (based on kdissert)
113
+
114
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
115
+
116
+	* Show system tray icon by default. Added categories. (wlassistant.desktop)
117
+
118
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
119
+
120
+	* Always try to kill stale dhcp client before connecting (fixes bug #1305952)
121
+
122
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
123
+
124
+	* New quality level indication. Fixes bug #1323274 "Link quality seems strangefully low..."
125
+
126
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
127
+
128
+	* Updated Portugese (Brazilian) translation (changes by Wintceas Godois)
129
+
130
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
131
+
132
+	* Added Chinese (Simplified and Traditional) translations (by Peter Zhang)
133
+
134
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
135
+
136
+	* Fixed "unknown escape sequence" warning (thanks to Achim Bohnet)
137
+
138
+2006-02-12  Pawel Nawrocki  <pnawrocki@gmail.com>
139
+
140
+	* Return to iwlist scan results parsing
141
+	* Pass essid as the last argument - fixes bug #1366531
142
+
143
+2006-01-14  Pawel Nawrocki  <pnawrocki@gmail.com>
144
+
145
+	* Added license to src/waconfig.h
146
+
147
+2005-10-24  Pawel Nawrocki  <pnawrocki@gmail.com>
148
+
149
+	* Automatically detect paths to .pid and .info/.leases files. Fixes bug #1323263
150
+
151
+2005-10-07  Pawel Nawrocki  <pnawrocki@gmail.com>
152
+
153
+	* No concole output if radio ok
154
+	* Added missing i18n(...) (wlassistant.cpp line 382)
155
+
156
+2005-10-07  Pawel Nawrocki  <pnawrocki@gmail.com>
157
+
158
+	* Added Catalan translation (by Adonay Sanz Alsina)
159
+
160
+2005-09-30  Pawel Nawrocki  <pnawrocki@gmail.com>
161
+
162
+	* Normalize quality returned by scan results (range 0-100)
163
+
164
+2005-09-30  Pawel Nawrocki  <pnawrocki@gmail.com>
165
+
166
+	* Open kernel socket once, reuse it till program exits.
167
+
168
+2005-09-29  Pawel Nawrocki  <pnawrocki@gmail.com>
169
+
170
+	* Fixed possible division by zero problem.
171
+
172
+2005-09-27  Pawel Nawrocki  <pnawrocki@gmail.com>
173
+
174
+	* FIxed initialization of some variables in WATools.
175
+
176
+2005-09-27  Pawel Nawrocki  <pnawrocki@gmail.com>
177
+
178
+	* WATools::scanResults does not freeze UI anymore (using callback function to update UI)
179
+
180
+2005-09-23  Pawel Nawrocki  <pnawrocki@gmail.com>
181
+
182
+	* Small fixes to the WATools::scanResults parsing. (wlassistant.cpp)
183
+	* Migrated to bksys/scons
184
+
185
+2005-09-20  Pawel Nawrocki  <pnawrocki@gmail.com>
186
+
187
+	* Get Wireless Extensions version from iw_get_kernel_we_version() (watools.cpp)
188
+
189
+2005-09-14  Pawel Nawrocki  <pnawrocki@gmail.com>
190
+
191
+	* Added configure check for iwlib.h (patch by Sheldon Lee-Wen)
192
+
193
+2005-09-13  Pawel Nawrocki  <pnawrocki@gmail.com>
194
+
195
+	* Migrated from iwlist scan results parsing to direct iwlib calls.
196
+
197
+2005-09-11  Pawel Nawrocki  <pnawrocki@gmail.com>
198
+
199
+	* Added version number in window title (main.cpp)
200
+
201
+2005-09-11  Pawel Nawrocki  <pnawrocki@gmail.com>
202
+
203
+	* Removed redundant <string> include (watools.h)
204
+	* Default (fallback) interface in WATools
205
+	* Auto set fallback interface in WATools::interfaceList() if none set.
206
+	* Made returned variables static in WATools functions
207
+	* Renamed devices() to interfaceList() in WATools, adjusted references.
208
+
209
+2005-09-06  Pawel Nawrocki  <pnawrocki@gmail.com>
210
+
211
+	* Added French translation (by Olivier Butler)
212
+
213
+2005-09-06  Pawel Nawrocki  <pnawrocki@gmail.com>
214
+
215
+	* Added 'ASCII' checkbox next to WEP key fields.
216
+
217
+2005-09-02  RELEASE 0.5.4a
218
+
219
+2005-09-01  Pawel Nawrocki  <pnawrocki@gmail.com>
220
+
221
+	* Made WATools::txpower return -1 if radio is disabled.
222
+	* Use WATools::txpower instead of output parsing to check if radio is enabled.
223
+
224
+2005-09-01  Pawel Nawrocki  <pnawrocki@gmail.com>
225
+
226
+	* List only managed (& master) networks
227
+
228
+2005-09-01  Pawel Nawrocki  <pnawrocki@gmail.com>
229
+
230
+	* Removed setIfname and ifname from WATools, made 'iface' argument in functions mandatory..
231
+	* Don't check for active connection when no scan results.
232
+	* Changed linux/socket.h to sys/socket.h (watools.cpp)
233
+	* Only bring interface up (before scanning) if it is down. ('no scan results' fix, part 1)
234
+	* Don't bring interface down if there were no scan results. ('no scan results' fix, part 2)
235
+	* added "ifconfig_status" action (output to check if interface is up) (netparams.cpp)
236
+
237
+2005-08-30  Pawel Nawrocki  <pnawrocki@gmail.com>
238
+
239
+	* Removed double #include for qcursor
240
+
241
+2005-08-27  Pawel Nawrocki  <pnawrocki@gmail.com>
242
+
243
+	* Changed linux/socket.h include to sys/socket.h (watools.cpp)
244
+	* Don't check for active connection if there are no scan results (wlassistant.cpp)
245
+
246
+2005-08-20 RELEASE 0.5.4
247
+
248
+2005-08-20  Pawel Nawrocki  <pnawrocki@gmail.com>
249
+
250
+	* Reviewed 'timerConnectionCheck' occurences. Make it work regardless of connectedItem presence (to detect if connected from an outside app)
251
+	* Fixed 'wlassistant crashes when pressing 'scan' a lot' bug.
252
+	* Set config groups
253
+	* Created README with usage hints
254
+	* Changed 'restricted' to 'shared key'
255
+	* Changed 'open' to 'open system' (WEP mode)
256
+	* Fixed 'connect from selected network' to 'connect to connected network'
257
+	* Added Portugese Brazilian translation (by Daniel Nascimento)
258
+	* Added Polish translation
259
+	* Added Polish description to .desktop file (Comment[pl])
260
+
261
+2005-08-16  Pawel Nawrocki  <pnawrocki@gmail.com>
262
+
263
+	* Added WATools:: txpower, ap, iface, setIface. (watools.h/.cpp)
264
+	* Added getGateway() function. (wlassistant.h/.cpp)
265
+
266
+2005-08-15  Pawel Nawrocki  <pnawrocki@gmail.com>
267
+
268
+	* Pressing 'Quit' kills all background processes. (wlassistant.cpp)
269
+
270
+2005-08-15  Pawel Nawrocki  <pnawrocki@gmail.com>
271
+
272
+	* Changed 'Scan' to 'Refresh' (ui_main.ui)
273
+
274
+2005-08-13  Pawel Nawrocki  <pnawrocki@gmail.com>
275
+
276
+	* Fix: if no gateway (manual config or DHCP) - report that connection failed.
277
+	* Properly detect connection on startup, if only gateway accessible.
278
+	* Wait 2sec before checking for internet after establishing connection.
279
+	* Wait 150ms after DHCP client finishes before getting gateway from route.
280
+	* Added more detailed output to stdout.
281
+
282
+2005-08-13  Pawel Nawrocki  <pnawrocki@gmail.com>
283
+
284
+	* Changed host to ping to www.ibiblio.org
285
+
286
+2005-08-13  Pawel Nawrocki  <pnawrocki@gmail.com>
287
+
288
+	* Fix: set mInternet to false when mConnected is false.
289
+
290
+2005-08-11  Pawel Nawrocki  <pnawrocki@gmail.com>
291
+
292
+	* Reworked connection status monitoring & indication.
293
+
294
+2005-08-09  Pawel Nawrocki  <pnawrocki@gmail.com>
295
+
296
+	* Added WATools::devices that returns comma separated list of wireless devices.
297
+	* Migrated to WATools::devices (wlassistant.cpp)
298
+
299
+2005-08-08  Pawel Nawrocki  <pnawrocki@gmail.com>
300
+
301
+	* Added WATools::isWireless to determine if interface supports wireless extensions.
302
+
303
+2005-08-08  Pawel Nawrocki  <pnawrocki@gmail.com>
304
+
305
+	* Removed KConfigXT, .kcfg & .kcfgc files. Variables to store are added in wlassistant.cpp files.
306
+	* Changed 'WaSettings' to WAConfig.
307
+
308
+2005-08-08  Pawel Nawrocki  <pnawrocki@gmail.com>
309
+
310
+	* Introduced helper class WATools (uses iwlib directly).
311
+	* Get currentItem quality with WATools::quality instead of parsing iwconfig output.
312
+
313
+2005-08-07 RELEASE 0.5.3
314
+
315
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
316
+
317
+	* Removed redundant includes.
318
+
319
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
320
+
321
+	* Removed "ui_confgeneral.h" dependancy (wlassistant.cpp).
322
+
323
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
324
+
325
+	* Removed KDE version dependancy (ui_main.ui).
326
+
327
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
328
+
329
+	* Added ToolTips and 'What's This' help to all elements.
330
+	* Changed 'Close' to 'Quit'.
331
+
332
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
333
+
334
+	* Change 'Settings' to 'Options' where appropriate.
335
+
336
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
337
+
338
+	* Added formatting to message boxes.
339
+	* Change 'Close' to 'Stop' only if process runs longer than 1.5sec
340
+
341
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
342
+
343
+	* Last used interface is saved in config file and reused next time the app is run.
344
+
345
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
346
+
347
+	* While running external executables, 'Close' button changes to 'Stop' that terminates current process.
348
+
349
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
350
+
351
+	* Added DHCP client timeout and GUI to configure it.
352
+
353
+2005-08-07  Pawel Nawrocki  <pnawrocki@gmail.com>
354
+
355
+	* New settings GUI (wlassistant.h/.cpp, ui_main.ui).
356
+	* Droppen kconfigdialog.h dependancy.
357
+	* Fixed item height with the new settings GUI (netlistviewitem.h/.cpp).
358
+
359
+2005-08-06  Pawel Nawrocki  <pnawrocki@gmail.com>
360
+
361
+	* Removed 'netReconnect()' function.
362
+	* Reduced CPU usage while running external executables. Thanks to Remco Treffkorn.
363
+
364
+2005-08-05  Pawel Nawrocki  <pnawrocki@gmail.com>
365
+
366
+	* Removed 'Honor KDE single click' UI.
367
+	* Removed 'Honor KDE single click' from kcfg.
368
+	* Connect signal/slots in wlassistant.cpp, not in the .ui files.
369
+	* Removed 'Reconnect' context menu action. (sometimes froze the app for unknown reasons).
370
+
371
+2005-08-05  Pawel Nawrocki  <pnawrocki@gmail.com>
372
+
373
+	* Changes to global KDE settings take immediate effect in wlassistant.
374
+
375
+2005-08-05  Pawel Nawrocki  <pnawrocki@gmail.com>
376
+
377
+	* If encryption is "off" - disable it, enable if anything else. This fixes encryption detection for drivers that return '****-****-****-**' instead of just 'on'
378
+
379
+2005-08-05  Pawel Nawrocki  <pnawrocki@gmail.com>
380
+
381
+	* Changed connected item's context menu (part II) so that default action is listed first.
382
+	* Make mouse behaviour (Single- or Double-Click) consistent with KDE global settings.
383
+	* 'Connect' button caption changes to 'Disconnect' when connected item is selected.
384
+	* Double clicking on an item connects/disconnects (when mouse settings require this behaviour).
385
+
386
+2005-08-04 RELEASE 0.5.2f
387
+
388
+2005-08-04  Pawel Nawrocki  <pnawrocki@gmail.com>
389
+
390
+	* Fixed sorting by channel number (e.g. 11 is now after 10, not after 1)
391
+	* #ifdef to check for KDE 3.4 - this should make wlassistant compile on KDE 3.3
392
+
393
+2005-08-04  Pawel Nawrocki  <pnawrocki@gmail.com>
394
+
395
+	* Fixed recognition of '<hidden>' ESSID.
396
+
397
+2005-08-04 RELEASE 0.5.2e
398
+
399
+2005-08-04  Pawel Nawrocki  <pnawrocki@gmail.com>
400
+
401
+	* Try to kill stale DHCP client instance (if any) when connection fails.
402
+
403
+2005-08-04  Pawel Nawrocki  <pnawrocki@gmail.com>
404
+
405
+	* Try to kill any stale DHCP client if connection fails. This seems to be dhclient only.
406
+
407
+2005-08-03  Pawel Nawrocki  <pnawrocki@gmail.com>
408
+
409
+	* Bring interface up before setting network parameters (esp. wep key) - this fixes problems with connecting to encrypted networks using a DHCP client.
410
+
411
+2005-08-03  Pawel Nawrocki  <pnawrocki@gmail.com>
412
+
413
+	* Fixed network encryption and frequency (if no channel info available) detection.
414
+
415
+2005-08-03  Pawel Nawrocki  <pnawrocki@gmail.com>
416
+
417
+	* Changed connected item's context menu so that default action is listed first.
418
+
419
+2005-08-03  Pawel Nawrocki  <pnawrocki@gmail.com>
420
+
421
+	* automatically disconnect from current network when connecting to a different one.
422
+
423
+2005-08-02  Pawel Nawrocki  <pnawrocki@gmail.com>
424
+
425
+	* Try to kill running instance of DHCP client (if any) before connecting.
426
+
427
+2005-08-02  Pawel Nawrocki  <pnawrocki@gmail.com>
428
+
429
+	* Added semicolons to DNS labels in the 'Edit Settings' dialog.
430
+
431
+*** version 0.5.2d:
432
+* FIX: Wait 1.5sec for dhcp client to quit. This fixes reconnecting problems.
433
+* FIX: Default action when clicking on a connected item is "Disconnect..." again.
434
+
435
+*** version 0.5.2c:
436
+* FIX: On some systems user got disconnected on app startup.
437
+
438
+*** version 0.5.2b:
439
+* FIX: Network status monitoring.
440
+* FIX: Wrong WEP indication
441
+* FIX: Few more fixes of ridiculous bugs.
442
+
443
+*** version 0.5.2a:
444
+* FIX: uncommented lines that were commented out for testing only.
445
+
446
+*** version 0.5.2:
447
+* NEW: Connection status monitoring, ask to reconnect when connection lost.
448
+* NEW: If no scan results returned - check if external radio switch (laptops) is turned on.
449
+*      The above feature is tested with madwifi driver only. Please let me know if it works with different ones.
450
+* NEW: Connected network marked with an icon.
451
+* NEW: 'Don't ask again' checkboxes for some dialogs (No GUI to switch them back on yet, you will need to edit 'wlassistantrc' manually)
452
+* FIX: Fixed crash on startup/scan (thanks go to Remco Treffkorn for reporting this).
453
+* FIX: No not report half a star when quality is 0.
454
+* FIX: Reduced flicker when populating network list.
455
+* FIX: Workaround for some drivers wrongly reporting that connection is available when it is not.
456
+* FIX: Workaround for drivers overusing cache when returning scan results/errors (works with madwifi at least).
457
+* Lots of other fixes and internal improvements, code cleanup.
458
+
459
+*** version 0.5.1a (BUGFIX RELEASE):
460
+* NEW: Actions for a network that is connected but not configured.
461
+* FIX: Network is no longer shown as 'connected' if link quality is 0.
462
+* FIX: Tab order in "Edit Settings..." dialog.
463
+* FIX/ADD: The AP column is back :)
464
+* FIX: Changed default action of connected item to 'Reconnect'.
465
+
466
+*** version 0.5.1:
467
+* NEW: Dialog to edit existing network settings.
468
+* NEW: Basic network settings change monitoring, proper actions if needed (e.g. if an ESSID of a configured network (AP) is no longer broadcasted, you will be asked what to do).
469
+* NEW: connected network item always first and highlighted and bold and whatnot.
470
+* NEW: Dynamic quality indication for the connected network.
471
+* NEW: Disconnect functionality.
472
+* NEW: Moved to i18n strings.
473
+* NEW: If radio is off, user is asked if it should be switched on.
474
+* NEW/FIX: '<hidden>' gets replaced by ESSID if network configured (code was there in 0.5.0 but it only worked for older wireless-tools).
475
+* NEW: If connection fails, user is asked whether to review settings. Comment if it annoys you...
476
+* FIX: Rewritten item drawing code. Reduced flicker.
477
+* FIX: Changed dhclient command arguments. Does this one work for everybody?
478
+* FIX: UI refinements (thanks to Stephan Binner for pointing these out)
479
+* FIX: Couldn't connect after channel/frequency of a network changed.
480
+* FIX: Hack to prevent wrong column width setting.
481
+* FIX/REM: AP column removed.
482
+* Changed scan results parsing to use qregexp and optimised.
483
+* Quite a few other bug fixes, some code cleanup.
484
+
485
+* NEW: Wireless Assistant now has a CVS repository. You can find instructions on how to use it at: http://sourceforge.net/cvs/?group_id=134488
486
+* THANKS go to Stephan Binner for giving me some valuable hints.
487
+
488
+*** version 0.5.0:
489
+*** This release is a major rewrite. Loads of under-the-hood changes. Huge part of the code has been rewritten, reimplemented, organised, cleaned up, optimised and made easier to extend in the future. 
490
+* NEW: Network profiles (finally!). Comments please!
491
+* NEW: Automatic path detection. No manual config.
492
+* NEW: Support for networks with hidden ESSIDs.
493
+* NEW: Context menu for each found network.
494
+* NEW: Sysfs based device detection (kernel 2.6.x required!).
495
+* NEW: Device selection combo is hidden if only one interface is found.
496
+* NEW: wlassistant runs using sudo to avoid permissions mess in different distros.
497
+* FIX: Much shorter startup time.
498
+* FIX: Proper connection checking.
499
+* REM: Real interface name lookup removed.
500
+* REM: Only managed networks supported (Ad-Hoc & other didn't work most of the time anyway. Will rewrite it sometime later, depending on how badly the users want it. Comment pls.).
501
+* REM: Removed "Scan upon startup" option - it is the default behaviour now.
502
+* REM: Removed "Skip encrypted networks" scanning option.
503
+* REM: Removed "Connection timeout" option for dhcpcd. Hardcoded to 25s.
504
+
505
+* NOTE: As for now, per network profiles can not be edited. You have to delete one and re-enter all the settings. It might be an inconvenience if you are using networks that change their parameters often, but I wanted to release and get early feedback on the whole profiles implementation.
506
+* NOTE: You might encounter some annoying "This function is not yet implemented" messages. Reason? See above.
507
+* NOTE: I am well aware that the configuration dialog needs redesigning. I'm actually considering removing it completely and implementing more per network options. Comments pls!
508
+* NOTE: See TODO before giving ideas or feature requests to get an overview of what is already planned for the next releases.
509
+
510
+*** 0.3.9:
511
+* NEW: the long-awaited dhclient support
512
+* NEW: button to terminate current process
513
+* some bugfixes and ui changes
514
+
515
+*** 0.3.8a BUGFIX RELEASE:
516
+* FIX: Quality detection (again, last time, hopefully)
517
+* FIX: some cards reported 'Managed' as 'Master'
518
+* FIX: ESSIDs including space now are correctly set
519
+* FIX: no more unnecessary errors from iwlist & others
520
+* FIX: kcfg file now installed in the proper location
521
+* FIX: path detection (now only accepts files in /usr/.. or /sbin or /bin)
522
+* FIX: existing dhcpcd instance now properly quits if necessary
523
+* some code cleanup
524
+
525
+*** version 0.3.8:
526
+* NEW: manual interface configuration (not DHCP)
527
+* NEW: Option to run custom command upon connection
528
+* NEW: use frequency if channel number not available
529
+* NEW: honor KDE single-click behaviour (option)
530
+* NEW: Quit upon successful connection (option)
531
+* NEW: Use ping to verify that connection is successfully established.
532
+* NEW: Case-sensitive essid matching option
533
+* FIX: Support for dhcpcd .pid files
534
+* FIX: Column width set correctly
535
+* FIX: Removed "Auto mode" option (shouldn't be needed)
536
+* FIX: All columns now movable & resizable
537
+* FIX: Proper quality detection / estimation (if no noise level reported)
538
+* FIX: Icon
539
+
540
+*** version 0.3.7:
541
+* NEW: app now aware of channel number (thanks to Michael Long)
542
+* FIX: network list is sorted properly now
543
+* FIX: interfaces should be now detected properly if more than 1 is present (feedback pls!)
544
+* FIX: 'Detect' and 'Configure...' buttons disabled while connecting
545
+* FIX: quality should be now reported properly on all cards (with help of Michael Long, feedback pls!)
546
+* FIX: mode changed to 'Managed' before scanning to ensure proper results
547
+* other minor fixes
548
+
549
+*** version 0.3.6:
550
+* NEW: Encryption status shown using an icon
551
+* NEW: Graphical link quality indicator
552
+* NEW: automatic key selection if name matches ESSID.
553
+* FIX: revert cursor after setting ad-hoc parameters
554
+* some UI refinements
555
+* status info if ad-hoc and/or encrypted networks skipped during scanning
556
+* other small fixes I don't remember.
557
+
558
+
559
+*** version 0.3.5:
560
+* NEW: WEP support (please test it, I have no wlan with WEP atm)
561
+* FIX: compile problem fixed, thanks to elitecodex (& his friend)
562
+* FIX: do not try to get info from dhcp when in ad-hoc mode.
563
+* changed binary name to wlassistant (shorter), so make sure to uninstall any previous version!
564
+* changed defaults.
565
+
566
+
567
+*** version 0.3.1:
568
+* NEW: human-readable interface names (PCI devices only, udev required).
569
+* NEW: option to automatically scan at startup (using first detected device)
570
+* FIX: signal quality now shown correctly.
571
+* FIX: other small fixes.
572
+
573
+****** DESCRIPTION ******
574
+
575
+Wireless Assistant (wlassistant) is a small application that allows you to connect to wireless networks.
576
+
577
+* MAIN FEATURES:
578
+- Managed Networks Support
579
+- WEP Encryption Support
580
+- Not Broadcasted ("hidden") ESSIDs Support
581
+- Per Network (AP) Configuration Profiles
582
+- Automatic (DHCP, both dhcpcd and dhclient) and manual configuration options.
583
+
584
+The program uses wireless-tools, route, ifconfig, dhcpcd/dhclient as its backends so they need to be installed.
585
+
586
+*** IMPORTANT: As of this release wlassistant is run using 'sudo'. As a result no 'permission denied' errors are handled. Make sure your sudo is configured properly so you can run wlassistant.
587
+EXAMPLE: If you want to create a e.x. 'wifi' group wich users should be allowed to use wlassistant, add the following line to your /etc/sudoers:
588
+    %wifi  ALL=NOPASSWD: <your_kde_dir>/bin/wlassistant

+ 35
- 0
SConstruct View File

@@ -0,0 +1,35 @@
1
+#! /usr/bin/env python
2
+
3
+"""
4
+help       -> scons -h
5
+compile    -> scons
6
+clean      -> scons -c
7
+install    -> scons install
8
+uninstall  -> scons -c install
9
+configure  -> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local
10
+
11
+Run from a subdirectory -> scons -u
12
+The variables are saved automatically after the first run (look at cache/kde.cache.py, ..)
13
+"""
14
+
15
+###################################################################
16
+# LOAD THE ENVIRONMENT AND SET UP THE TOOLS
17
+###################################################################
18
+
19
+## Load the builders in config
20
+env = Environment(tools=['default', 'generic', 'kde', 'parser'], toolpath=['./', './bksys'])
21
+env.KDEuse("environ")
22
+
23
+#env['DUMPCONFIG']=1
24
+
25
+###################################################################
26
+# SCRIPTS FOR BUILDING THE TARGETS
27
+###################################################################
28
+env.set_build_dir('src po', 'build')
29
+env.xmlfile('config.bks')
30
+
31
+###################################################################
32
+# CONVENIENCE FUNCTIONS TO EMULATE 'make dist' and 'make distclean'
33
+###################################################################
34
+env.dist('wlassistant', '0.5.7')
35
+

+ 1
- 0
VERSION View File

@@ -0,0 +1 @@
1
+0.5.7

+ 644
- 0
bksys/generic.py View File

@@ -0,0 +1,644 @@
1
+## Thomas Nagy, 2005
2
+""" Run scons -h to display the associated help, or look below """
3
+
4
+import os, re, types, sys, string, shutil, stat, glob
5
+import SCons.Defaults
6
+import SCons.Tool
7
+import SCons.Util
8
+from SCons.Script.SConscript import SConsEnvironment
9
+from SCons.Options import Options, PathOption
10
+
11
+def getreldir(lenv):
12
+	cwd=os.getcwd()
13
+	root=SCons.Node.FS.default_fs.Dir('#').abspath
14
+	return cwd.replace(root,'').lstrip('/')
15
+
16
+def dist(env, appname, version=None):
17
+	### To make a tarball of your masterpiece, use 'scons dist'
18
+	import os
19
+	if 'dist' in sys.argv:
20
+		if not version: VERSION=os.popen("cat VERSION").read().rstrip()
21
+		else: VERSION=version
22
+		FOLDER  = appname+'-'+VERSION
23
+		TMPFOLD = ".tmp"+FOLDER
24
+		ARCHIVE = FOLDER+'.tar.bz2'
25
+
26
+		## check if the temporary directory already exists
27
+		os.popen('rm -rf %s %s %s' % (FOLDER, TMPFOLD, ARCHIVE) )
28
+
29
+		## create a temporary directory
30
+		startdir = os.getcwd()
31
+	
32
+		os.popen("mkdir -p "+TMPFOLD)	
33
+		os.popen("cp -R * "+TMPFOLD)
34
+		os.popen("mv "+TMPFOLD+" "+FOLDER)
35
+
36
+		## remove scons-local if it is unpacked
37
+		os.popen("rm -rf "+FOLDER+"/scons "+FOLDER+"/sconsign "+FOLDER+"/scons-local-0.96.1")
38
+
39
+		## remove our object files first
40
+		os.popen("find "+FOLDER+" -name \"cache\" | xargs rm -rf")
41
+		os.popen("find "+FOLDER+" -name \"build\" | xargs rm -rf")
42
+		os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f")
43
+
44
+		## CVS cleanup
45
+		os.popen("find "+FOLDER+" -name \"CVS\" | xargs rm -rf")
46
+		os.popen("find "+FOLDER+" -name \".cvsignore\" | xargs rm -rf")
47
+
48
+		## Subversion cleanup
49
+		os.popen("find %s -name .svn -type d | xargs rm -rf" % FOLDER)
50
+
51
+		## GNU Arch cleanup
52
+		os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf")
53
+		os.popen("find "+FOLDER+" -name \".arch-i*\" | xargs rm -rf")
54
+
55
+		## Create the tarball (coloured output)
56
+		print "\033[92m"+"Writing archive "+ARCHIVE+"\033[0m"
57
+		os.popen("tar cjf "+ARCHIVE+" "+FOLDER)
58
+
59
+		## Remove the temporary directory
60
+		os.popen('rm -rf '+FOLDER)
61
+		env.Exit(0)
62
+
63
+	if 'distclean' in sys.argv:
64
+		## Remove the cache directory
65
+		import os, shutil
66
+		if os.path.isdir(env['CACHEDIR']): shutil.rmtree(env['CACHEDIR'])
67
+		os.popen("find . -name \"*.pyc\" | xargs rm -rf")
68
+		env.Exit(0)
69
+
70
+colors= {
71
+'BOLD'  :"\033[1m",
72
+'RED'   :"\033[91m",
73
+'GREEN' :"\033[92m",
74
+'YELLOW':"\033[1m", #"\033[93m" # unreadable on white backgrounds
75
+'CYAN'  :"\033[96m",
76
+'NORMAL':"\033[0m",
77
+}
78
+
79
+def pprint(env, col, str, label=''):
80
+	if env.has_key('NOCOLORS'):
81
+		print "%s %s" % (str, label)
82
+		return
83
+	try: mycol=colors[col]
84
+	except: mycol=''
85
+	print "%s%s%s %s" % (mycol, str, colors['NORMAL'], label)
86
+
87
+class genobj:
88
+	def __init__(self, val, env):
89
+		if not val in "program shlib kioslave staticlib".split():
90
+			print "unknown genobj given: "+val
91
+			env.Exit(1)
92
+
93
+		self.type = val
94
+		self.orenv = env
95
+		self.env   = None
96
+		self.executed = 0
97
+
98
+		self.target=''
99
+		self.src=None
100
+
101
+		self.cxxflags=''
102
+		self.cflags=''
103
+		self.includes=''
104
+
105
+		self.linkflags=''
106
+		self.libpaths=''
107
+		self.libs=''
108
+
109
+		# vars used by shlibs
110
+		self.vnum=''
111
+		self.libprefix=''
112
+
113
+		# a directory where to install the targets (optional)
114
+		self.instdir=''
115
+
116
+		# change the working directory before reading the targets
117
+		self.chdir=''
118
+
119
+		# unix permissions
120
+		self.perms=''
121
+
122
+		# these members are private
123
+		self.chdir_lock=None
124
+		self.dirprefix='./'
125
+		self.old_os_dir=''
126
+		self.old_fs_dir=''
127
+		self.p_local_shlibs=[]
128
+		self.p_local_staticlibs=[]
129
+		self.p_global_shlibs=[]
130
+
131
+		self.p_localsource=None
132
+		self.p_localtarget=None
133
+
134
+		# work directory
135
+		self.workdir_lock=None
136
+		self.orig_fs_dir=SCons.Node.FS.default_fs.getcwd()
137
+		self.not_orig_fs_dir=''
138
+		self.not_orig_os_dir=''
139
+
140
+		if not env.has_key('USE_THE_FORCE_LUKE'): env['USE_THE_FORCE_LUKE']=[self]
141
+		else: env['USE_THE_FORCE_LUKE'].append(self)
142
+
143
+	def joinpath(self, val):
144
+		if len(self.dirprefix)<3: return val
145
+		dir=self.dirprefix
146
+		thing=self.orenv.make_list(val)
147
+		files=[]
148
+		bdir="./"
149
+		if self.orenv.has_key('_BUILDDIR_'): bdir=self.orenv['_BUILDDIR_']
150
+		for v in thing: files.append( self.orenv.join(bdir, dir, v) )
151
+		return files
152
+
153
+	# a list of paths, with absolute and relative ones
154
+	def fixpath(self, val):
155
+		def reldir(dir):
156
+			ndir    = SCons.Node.FS.default_fs.Dir(dir).srcnode().abspath
157
+			rootdir = SCons.Node.FS.default_fs.Dir('#').abspath
158
+			return ndir.replace(rootdir, '').lstrip('/')
159
+
160
+		dir=self.dirprefix
161
+		if not len(dir)>2: dir=reldir('.')
162
+
163
+		thing=self.orenv.make_list(val)
164
+		ret=[]
165
+		bdir="./"
166
+		if self.orenv.has_key('_BUILDDIR_'): bdir=self.orenv['_BUILDDIR_']
167
+		for v in thing:
168
+			#if v[:2] == "./" or v[:3] == "../":
169
+			#	ret.append( self.orenv.join('#', bdir, dir, v) )
170
+			#elif v[:1] == "#" or v[:1] == "/":
171
+			#	ret.append( v )
172
+			#else:
173
+			#	ret.append( self.orenv.join('#', bdir, dir, v) )
174
+			if v[:1] == "#" or v[:1] == "/":
175
+				ret.append(v)
176
+			else:
177
+				ret.append( self.orenv.join('#', bdir, dir, v) )
178
+
179
+		return ret
180
+
181
+	def lockworkdir(self):
182
+		if self.workdir_lock: return
183
+		self.workdir_lock=1
184
+		self.not_orig_fs_dir=SCons.Node.FS.default_fs.getcwd()
185
+		self.not_orig_os_dir=os.getcwd()
186
+		SCons.Node.FS.default_fs.chdir( self.orig_fs_dir, change_os_dir=1)
187
+
188
+	def unlockworkdir(self):
189
+		if not self.workdir_lock: return
190
+		SCons.Node.FS.default_fs.chdir( self.not_orig_fs_dir, change_os_dir=0)
191
+		os.chdir(self.not_orig_os_dir)
192
+		self.workdir_lock=None
193
+
194
+	def execute(self):
195
+		if self.executed: return
196
+
197
+		if self.orenv.has_key('DUMPCONFIG'):
198
+			self.xml()
199
+			self.executed=1
200
+			return
201
+
202
+		self.env = self.orenv.Copy()
203
+
204
+		if not self.p_localtarget: self.p_localtarget = self.joinpath(self.target)
205
+		if not self.p_localsource: self.p_localsource = self.joinpath(self.src)
206
+
207
+		if (not self.src or len(self.src) == 0) and not self.p_localsource:
208
+			self.env.pprint('RED',"no source file given to object - self.src")
209
+			self.env.Exit(1)
210
+		if not self.target:
211
+			self.env.pprint('RED',"no target given to object - self.target")
212
+			self.env.Exit(1)
213
+		if not self.env.has_key('nosmart_includes'): self.env.AppendUnique(CPPPATH=['./'])
214
+		if self.type == "kioslave": self.libprefix=''
215
+
216
+		if len(self.includes)>0: self.env.AppendUnique(CPPPATH=self.fixpath(self.includes))
217
+		if len(self.cxxflags)>0: self.env.AppendUnique(CXXFLAGS=self.env.make_list(self.cxxflags))
218
+		if len(self.cflags)>0: self.env.AppendUnique(CCFLAGS=self.env.make_list(self.cflags))
219
+
220
+		llist=self.env.make_list(self.libs)
221
+		lext=['.so', '.la']
222
+		sext='.a'.split()
223
+		for l in llist:
224
+			sal=SCons.Util.splitext(l)
225
+			if len(sal)>1:
226
+				if sal[1] in lext: self.p_local_shlibs.append(self.fixpath(sal[0]+'.so')[0])
227
+				elif sal[1] in sext: self.p_local_staticlibs.append(self.fixpath(sal[0]+'.a')[0])
228
+				else: self.p_global_shlibs.append(l)
229
+
230
+		if len(self.p_global_shlibs)>0: self.env.AppendUnique(LIBS=self.p_global_shlibs)
231
+		if len(self.libpaths)>0:   self.env.PrependUnique(LIBPATH=self.fixpath(self.libpaths))
232
+		if len(self.linkflags)>0:  self.env.PrependUnique(LINKFLAGS=self.env.make_list(self.linkflags))
233
+		if len(self.p_local_shlibs)>0:
234
+			self.env.link_local_shlib(self.p_local_shlibs)
235
+		if len(self.p_local_staticlibs)>0:
236
+			self.env.link_local_staticlib(self.p_local_staticlibs)
237
+
238
+		# the target to return - no more self.env modification is allowed after this part
239
+		ret=None
240
+		if self.type=='shlib' or self.type=='kioslave':
241
+			ret=self.env.bksys_shlib(self.p_localtarget, self.p_localsource, self.instdir, 
242
+				self.libprefix, self.vnum)
243
+		elif self.type=='program':
244
+			ret=self.env.Program(self.p_localtarget, self.p_localsource)
245
+			if not self.env.has_key('NOAUTOINSTALL'):
246
+				ins=self.env.bksys_install(self.instdir, ret)
247
+				if ins and self.perms:
248
+					for i in ins: self.env.AddPostAction(ins, self.env.Chmod(str(i), self.perms))
249
+		elif self.type=='staticlib':
250
+			ret=self.env.StaticLibrary(self.p_localtarget, self.p_localsource)
251
+
252
+		# we link the program against a shared library made locally, add the dependency
253
+		if len(self.p_local_shlibs)>0:
254
+			if ret: self.env.Depends( ret, self.p_local_shlibs )
255
+		if len(self.p_local_staticlibs)>0:
256
+			if ret: self.env.Depends( ret, self.p_local_staticlibs )
257
+
258
+		self.executed=1
259
+
260
+## Copy function that honors symlinks
261
+def copy_bksys(dest, source, env):
262
+        if os.path.islink(source):
263
+		#print "symlinking "+source+" "+dest
264
+		if os.path.islink(dest):
265
+			os.unlink(dest)
266
+		os.symlink(os.readlink(source), dest)
267
+	else:
268
+		shutil.copy2(source, dest)
269
+		st=os.stat(source)
270
+		os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
271
+	return 0
272
+
273
+## Return a list of things
274
+def make_list(env, s):
275
+	if type(s) is types.ListType: return s
276
+	else:
277
+		try: return s.split()
278
+		except AttributeError: return s
279
+
280
+def join(lenv, s1, s2, s3=None, s4=None):
281
+	if s4 and s3: return lenv.join(s1, s2, lenv.join(s3, s4))
282
+	if s3 and s2: return lenv.join(s1, lenv.join(s2, s3))
283
+	elif not s2: return s1
284
+	# having s1, s2
285
+	#print "path1 is "+s1+" path2 is "+s2+" "+os.path.join(s1,string.lstrip(s2,'/'))
286
+	if not s1: s1="/"
287
+	return os.path.join(s1,string.lstrip(s2,'/'))
288
+
289
+def exists(env):
290
+	return true
291
+
292
+# record a dump of the environment
293
+bks_dump='<?xml version="1.0" encoding="UTF-8"?>\n<bksys version="1">\n'
294
+def add_dump(nenv, str):
295
+	global bks_dump
296
+	if str: bks_dump+=str
297
+def get_dump(nenv):
298
+	if not nenv.has_key('DUMPCONFIG'):
299
+		nenv.pprint('RED','WARNING: trying to get a dump while DUMPCONFIG is not set - this will not work')
300
+	global bks_dump
301
+	return bks_dump+"</bksys>\n"
302
+
303
+def generate(env):
304
+	## Bksys requires scons 0.96
305
+	env.EnsureSConsVersion(0, 96)
306
+
307
+	SConsEnvironment.pprint = pprint
308
+	SConsEnvironment.make_list = make_list
309
+	SConsEnvironment.join = join
310
+	SConsEnvironment.dist = dist
311
+	SConsEnvironment.getreldir = getreldir
312
+	SConsEnvironment.add_dump = add_dump
313
+	SConsEnvironment.get_dump = get_dump
314
+
315
+	env['HELP']=0
316
+	if '--help' in sys.argv or '-h' in sys.argv or 'help' in sys.argv: env['HELP']=1
317
+	if env['HELP']:
318
+		p=env.pprint
319
+		p('BOLD','*** Instructions ***')
320
+		p('BOLD','--------------------')
321
+		p('BOLD','* scons           ','to compile')
322
+		p('BOLD','* scons -j4       ','to compile with several instances')
323
+		p('BOLD','* scons install   ','to compile and install')
324
+		p('BOLD','* scons -c install','to uninstall')
325
+		p('BOLD','\n*** Generic options ***')
326
+		p('BOLD','--------------------')
327
+		p('BOLD','* debug        ','debug=1 (-g) or debug=full (-g3, slower) else use environment CXXFLAGS, or -O2 by default')
328
+		p('BOLD','* prefix       ','the installation path')
329
+		p('BOLD','* extraincludes','a list of paths separated by ":"')
330
+		p('BOLD','* scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local')
331
+		p('BOLD','* scons install prefix=/opt/local DESTDIR=/tmp/blah\n')
332
+		return
333
+	
334
+	## Global cache directory
335
+	# Put all project files in it so a rm -rf cache will clean up the config
336
+	if not env.has_key('CACHEDIR'): env['CACHEDIR'] = env.join(os.getcwd(),'/cache/')
337
+	if not os.path.isdir(env['CACHEDIR']): os.mkdir(env['CACHEDIR'])
338
+	
339
+	## SCons cache directory
340
+	# This avoids recompiling the same files over and over again: 
341
+	# very handy when working with cvs
342
+	if os.getuid() != 0: env.CacheDir(os.getcwd()+'/cache/objects')
343
+
344
+	#  Avoid spreading .sconsign files everywhere - keep this line
345
+	env.SConsignFile(env['CACHEDIR']+'/scons_signatures')
346
+	
347
+	def makeHashTable(args):
348
+		table = { }
349
+		for arg in args:
350
+			if len(arg) > 1:
351
+				lst=arg.split('=')
352
+				if len(lst) < 2: continue
353
+				key=lst[0]
354
+				value=lst[1]
355
+				if len(key) > 0 and len(value) >0: table[key] = value
356
+ 		return table
357
+
358
+	env['ARGS']=makeHashTable(sys.argv)
359
+
360
+	SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod, lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
361
+
362
+	## Special trick for installing rpms ...
363
+	env['DESTDIR']=''
364
+	if 'install' in sys.argv:
365
+		dd=''
366
+		if os.environ.has_key('DESTDIR'): dd=os.environ['DESTDIR']
367
+		if not dd:
368
+			if env['ARGS'] and env['ARGS'].has_key('DESTDIR'): dd=env['ARGS']['DESTDIR']
369
+		if dd:
370
+			env['DESTDIR']=dd
371
+			env.pprint('CYAN','** Enabling DESTDIR for the project ** ',env['DESTDIR'])
372
+
373
+	## install symlinks for shared libraries properly
374
+	env['INSTALL'] = copy_bksys
375
+
376
+	## Use the same extension .o for all object files
377
+	env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
378
+
379
+	## no colors
380
+	if os.environ.has_key('NOCOLORS'): env['NOCOLORS']=1
381
+
382
+	## load the options
383
+	cachefile=env['CACHEDIR']+'generic.cache.py'
384
+	opts = Options(cachefile)
385
+	opts.AddOptions(
386
+		( 'GENCCFLAGS', 'C flags' ),
387
+		( 'BKS_DEBUG', 'debug level: full, trace, or just something' ),
388
+                ( 'GENCXXFLAGS', 'additional cxx flags for the project' ),
389
+		( 'GENLINKFLAGS', 'additional link flags' ),
390
+		( 'PREFIX', 'prefix for installation' ),
391
+		( 'EXTRAINCLUDES', 'extra include paths for the project' ),
392
+		( 'ISCONFIGURED', 'is the project configured' ),
393
+	)
394
+	opts.Update(env)
395
+	
396
+	# Use this to avoid an error message 'how to make target configure ?'
397
+	env.Alias('configure', None)
398
+
399
+	# Check if the following command line arguments have been given
400
+	# and set a flag in the environment to show whether or not it was
401
+	# given.
402
+	if 'install' in sys.argv: env['_INSTALL']=1
403
+	else: env['_INSTALL']=0
404
+	if 'configure' in sys.argv: env['_CONFIGURE']=1
405
+	else: env['_CONFIGURE']=0
406
+
407
+	# Configure the environment if needed
408
+	if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('ISCONFIGURED')):
409
+		# be paranoid, unset existing variables
410
+		for var in ['BKS_DEBUG', 'GENCXXFLAGS', 'GENCCFLAGS', 'GENLINKFLAGS', 'PREFIX', 'EXTRAINCLUDES', 'ISCONFIGURED', 'EXTRAINCLUDES']:
411
+			if env.has_key(var): env.__delitem__(var)
412
+
413
+		if env['ARGS'].get('debug', None):
414
+			env['BKS_DEBUG'] = env['ARGS'].get('debug', None)
415
+			env.pprint('CYAN','** Enabling debug for the project **')
416
+		else:
417
+			if os.environ.has_key('CXXFLAGS'):
418
+				# user-defined flags (gentooers will be elighted)
419
+				env['GENCXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] )
420
+				env.Append( GENCXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] )
421
+			else:
422
+				env.Append(GENCXXFLAGS = ['-O2', '-DNDEBUG', '-DNO_DEBUG'])
423
+
424
+		if os.environ.has_key('CFLAGS'): env['GENCCFLAGS'] = SCons.Util.CLVar( os.environ['CFLAGS'] )
425
+
426
+		## FreeBSD settings (contributed by will at freebsd dot org)
427
+		if os.uname()[0] == "FreeBSD":
428
+			if os.environ.has_key('PTHREAD_LIBS'):
429
+				env.AppendUnique( GENLINKFLAGS = SCons.Util.CLVar( os.environ['PTHREAD_LIBS'] ) )
430
+		        else:
431
+				syspf = os.popen('/sbin/sysctl kern.osreldate')
432
+				osreldate = int(syspf.read().split()[1])
433
+				syspf.close()
434
+				if osreldate < 500016:
435
+					env.AppendUnique( GENLINKFLAGS = ['-pthread'])
436
+					env.AppendUnique( GENCXXFLAGS = ['-D_THREAD_SAFE'])
437
+				elif osreldate < 502102:
438
+					env.AppendUnique( GENLINKFLAGS = ['-lc_r'])
439
+					env.AppendUnique( GENCXXFLAGS = ['-D_THREAD_SAFE'])
440
+				else:
441
+					env.AppendUnique( GENLINKFLAGS = ['-pthread'])
442
+
443
+		# User-specified prefix
444
+		if env['ARGS'].has_key('prefix'):
445
+			env['PREFIX'] = os.path.abspath( env['ARGS'].get('prefix', '') )
446
+			env.pprint('CYAN','** installation prefix for the project set to:',env['PREFIX'])
447
+
448
+		# User-specified include paths
449
+		env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None)
450
+		if env['EXTRAINCLUDES']:
451
+			env.pprint('CYAN','** extra include paths for the project set to:',env['EXTRAINCLUDES'])
452
+
453
+		env['ISCONFIGURED']=1
454
+
455
+		# And finally save the options in the cache
456
+		opts.Save(cachefile, env)
457
+
458
+	def bksys_install(lenv, subdir, files, destfile=None, perms=None):
459
+		""" Install files on 'scons install' """
460
+		if not env['_INSTALL']: return
461
+		basedir = env['DESTDIR']
462
+		install_list=None
463
+		if not destfile: install_list = env.Install(lenv.join(basedir,subdir), lenv.make_list(files))
464
+		elif subdir:     install_list = env.InstallAs(lenv.join(basedir,subdir,destfile), lenv.make_list(files))
465
+		else:            install_list = env.InstallAs(lenv.join(basedir,destfile), lenv.make_list(files))
466
+		if perms and install_list: lenv.AddPostAction(install_list, lenv.Chmod(install_list, perms))
467
+		env.Alias('install', install_list)
468
+		return install_list
469
+
470
+	def build_la_file(target, source, env):
471
+		""" Writes a .la file, used by libtool """
472
+		dest=open(target[0].path, 'w')
473
+		sname=source[0].name
474
+		dest.write("# Generated by ltmain.sh - GNU libtool 1.5.18 - (pwn3d by bksys)\n#\n#\n")
475
+		if len(env['BKSYS_VNUM'])>0:
476
+			vnum=env['BKSYS_VNUM']
477
+			nums=vnum.split('.')
478
+			src=source[0].name
479
+			name = src.split('so.')[0] + 'so'
480
+			strn = src+" "+name+"."+str(nums[0])+" "+name
481
+			dest.write("dlname='%s'\n" % (name+'.'+str(nums[0])) )
482
+			dest.write("library_names='%s'\n" % (strn) )
483
+		else:
484
+			dest.write("dlname='%s'\n" % sname)
485
+			dest.write("library_names='%s %s %s'\n" % (sname, sname, sname) )
486
+		dest.write("old_library=''\ndependency_libs=''\ncurrent=0\n")
487
+		dest.write("age=0\nrevision=0\ninstalled=yes\nshouldnotlink=no\n")
488
+		dest.write("dlopen=''\ndlpreopen=''\n")
489
+		dest.write("libdir='%s'" % env['BKSYS_DESTDIR'])
490
+		dest.close()
491
+		return 0
492
+
493
+	def string_la_file(target, source, env):
494
+		print "building '%s' from '%s'" % (target[0].name, source[0].name)
495
+	la_file = env.Action(build_la_file, string_la_file, ['BKSYS_VNUM', 'BKSYS_DESTDIR'])
496
+	env['BUILDERS']['LaFile'] = env.Builder(action=la_file,suffix='.la',src_suffix=env['SHLIBSUFFIX'])
497
+
498
+	## Function for building shared libraries
499
+	def bksys_shlib(lenv, ntarget, source, libdir, libprefix='lib', vnum='', noinst=None):
500
+		""" Install a shared library.
501
+		
502
+		Installs a shared library, with or without a version number, and create a
503
+		.la file for use by libtool.
504
+		
505
+		If library version numbering is to be used, the version number
506
+		should be passed as a period-delimited version number (e.g.
507
+		vnum = '1.2.3').  This causes the library to be installed
508
+		with its full version number, and with symlinks pointing to it.
509
+		
510
+		For example, for libfoo version 1.2.3, install the file
511
+		libfoo.so.1.2.3, and create symlinks libfoo.so and
512
+		libfoo.so.1 that point to it.
513
+		"""
514
+		# parameter can be a list
515
+		if type(ntarget) is types.ListType: target=ntarget[0]
516
+		else: target=ntarget
517
+
518
+		thisenv = lenv.Copy() # copying an existing environment is cheap
519
+		thisenv['BKSYS_DESTDIR']=libdir
520
+		thisenv['BKSYS_VNUM']=vnum
521
+		thisenv['SHLIBPREFIX']=libprefix
522
+
523
+		if len(vnum)>0:
524
+			thisenv['SHLIBSUFFIX']='.so.'+vnum
525
+			thisenv.Depends(target, thisenv.Value(vnum))
526
+			num=vnum.split('.')[0]
527
+			lst=target.split('/')
528
+			tname=lst[len(lst)-1]
529
+			libname=tname.split('.')[0]
530
+			thisenv.AppendUnique(LINKFLAGS = ["-Wl,--soname=%s.so.%s" % (libname, num)] )
531
+
532
+		# Fix against a scons bug - shared libs and ordinal out of range(128)
533
+		if type(source) is types.ListType:
534
+			src2=[]
535
+			for i in source: src2.append( str(i) )
536
+			source=src2
537
+
538
+		library_list = thisenv.SharedLibrary(target, source)
539
+		lafile_list  = thisenv.LaFile(target, library_list)
540
+
541
+		## Install the libraries automatically
542
+		if not thisenv.has_key('NOAUTOINSTALL') and not noinst:
543
+			thisenv.bksys_install(libdir, library_list)
544
+			thisenv.bksys_install(libdir, lafile_list)	
545
+
546
+		## Handle the versioning
547
+		if len(vnum)>0:
548
+			nums=vnum.split('.')
549
+			symlinkcom = ('cd $TARGET.dir && rm -f $TARGET.name && ln -s $SOURCE.name $TARGET.name')
550
+			tg = target+'.so.'+vnum
551
+			nm1 = target+'.so'
552
+			nm2 = target+'.so.'+nums[0]
553
+			thisenv.Command(nm1, tg, symlinkcom)
554
+			thisenv.Command(nm2, tg, symlinkcom)
555
+			thisenv.bksys_install(libdir, nm1)
556
+			thisenv.bksys_install(libdir, nm2)
557
+		return library_list
558
+
559
+	# Declare scons scripts to process
560
+	def subdirs(lenv, folderlist):
561
+		flist=lenv.make_list(folderlist)
562
+		for i in flist:
563
+			lenv.SConscript(lenv.join(i, 'SConscript'))
564
+		# take all objects - warn those who are not already executed
565
+		if lenv.has_key('USE_THE_FORCE_LUKE'):
566
+			for ke in lenv['USE_THE_FORCE_LUKE']:
567
+				if ke.executed: continue
568
+				#lenv.pprint('GREEN',"you forgot to execute object "+ke.target)
569
+				ke.lockworkdir()
570
+				ke.execute()
571
+				ke.unlockworkdir()
572
+
573
+        def link_local_shlib(lenv, str):
574
+                """ Links against a shared library made in the project """
575
+                lst = lenv.make_list(str)
576
+		for file in lst:
577
+			import re
578
+			reg=re.compile("(.*)/lib(.*).(la|so)$")
579
+			result=reg.match(file)
580
+			if not result:
581
+				reg = re.compile("(.*)/lib(.*).(la|so)\.(.)")
582
+				result=reg.match(file)
583
+				if not result:
584
+					print "Unknown la file given "+file
585
+					continue
586
+				dir  = result.group(1)
587
+				link = result.group(2)
588
+			else:
589
+				dir  = result.group(1)
590
+				link = result.group(2)
591
+
592
+			lenv.AppendUnique(LIBS = [link])
593
+			lenv.PrependUnique(LIBPATH = [dir])
594
+
595
+        def link_local_staticlib(lenv, str):
596
+                """ Links against a shared library made in the project """
597
+                lst = lenv.make_list(str)
598
+		for file in lst:
599
+			import re
600
+			reg = re.compile("(.*)/(lib.*.a)")
601
+			result = reg.match(file)
602
+			if not result:
603
+				print "Unknown archive file given "+file
604
+				continue
605
+			f=SCons.Node.FS.default_fs.File(file)
606
+			lenv.Append(LINKFLAGS=[f.path])
607
+
608
+	def set_build_dir(lenv, dirs, buildto):
609
+		lenv.SetOption('duplicate', 'soft-copy')
610
+		lenv['_BUILDDIR_']=buildto
611
+		ldirs=lenv.make_list(dirs)
612
+		for dir in ldirs:
613
+			lenv.BuildDir(buildto+os.path.sep+dir, dir)
614
+
615
+	#valid_targets = "program shlib kioslave staticlib".split()
616
+        SConsEnvironment.bksys_install = bksys_install
617
+	SConsEnvironment.bksys_shlib   = bksys_shlib
618
+	SConsEnvironment.subdirs       = subdirs
619
+	SConsEnvironment.link_local_shlib = link_local_shlib
620
+	SConsEnvironment.link_local_staticlib = link_local_staticlib
621
+	SConsEnvironment.genobj=genobj
622
+	SConsEnvironment.set_build_dir=set_build_dir
623
+
624
+	if env.has_key('GENCXXFLAGS'):  env.AppendUnique( CPPFLAGS = env['GENCXXFLAGS'] )
625
+	if env.has_key('GENCCFLAGS'):   env.AppendUnique( CCFLAGS = env['GENCCFLAGS'] )
626
+	if env.has_key('GENLINKFLAGS'): env.AppendUnique( LINKFLAGS = env['GENLINKFLAGS'] )
627
+
628
+        if env.has_key('BKS_DEBUG'):
629
+                if (env['BKS_DEBUG'] == "full"):
630
+                        env.AppendUnique(CXXFLAGS = ['-DDEBUG', '-g3', '-Wall'])
631
+                elif (env['BKS_DEBUG'] == "trace"):
632
+                        env.AppendUnique(
633
+                                LINKFLAGS=env.Split("-lmrwlog4cxxconfiguration -lmrwautofunctiontracelog4cxx -finstrument-functions"),
634
+                                CXXFLAGS=env.Split("-DDEBUG -Wall -finstrument-functions -g3 -O0"))
635
+                else:
636
+                        env.AppendUnique(CXXFLAGS = ['-DDEBUG', '-g', '-Wall'])
637
+
638
+	if env.has_key('EXTRAINCLUDES'):
639
+		if env['EXTRAINCLUDES']:
640
+			incpaths = []
641
+			for dir in str(env['EXTRAINCLUDES']).split(':'): incpaths.append( dir )
642
+			env.Append(CPPPATH = incpaths)
643
+
644
+	env.Export('env')

+ 884
- 0
bksys/kde.py View File

@@ -0,0 +1,884 @@
1
+# Thomas Nagy, 2005 <tnagy2^8@yahoo.fr>
2
+""" Run scons -h to display the associated help, or look below """
3
+
4
+import os, re, types
5
+from SCons.Script.SConscript import SConsEnvironment
6
+
7
+# Returns the name of the shared object (eg: libkdeui.so.4)
8
+# referenced by a libtool archive (like libkdeui.la)
9
+def getSOfromLA(lafile):
10
+	contents = open(lafile, 'r').read()
11
+	match = re.search("^dlname='([^']*)'$", contents, re.M)
12
+	if match: return match.group(1)
13
+	return None
14
+
15
+# A helper, needed .. everywhere
16
+def KDEuse(lenv, flags):
17
+	if lenv['HELP']: lenv.Exit(0)
18
+
19
+	_flags=lenv.make_list(flags)
20
+	if 'environ' in _flags:
21
+		## The scons developers advise against using this but it is mostly innocuous :)
22
+		lenv.AppendUnique( ENV = os.environ )
23
+	if not 'lang_qt' in _flags:
24
+		## Use this define if you are using the kde translation scheme (.po files)
25
+		lenv.Append( CPPFLAGS = '-DQT_NO_TRANSLATION' )
26
+	if 'rpath' in _flags:
27
+		## Use this to set rpath - this may cause trouble if folders are moved (chrpath)
28
+		kdelibpaths=[]
29
+		if lenv['KDELIBPATH'] == lenv['KDELIB']: kdelibpaths = [lenv['KDELIB']]
30
+		else: kdelibpaths = [lenv['KDELIBPATH'],  lenv['KDELIB']]
31
+		lenv.Append( RPATH = [lenv['QTLIBPATH'], lenv['KDEMODULE']]+kdelibpaths )
32
+	if 'thread' in _flags:
33
+		## Uncomment the following if you need threading support
34
+		lenv.KDEaddflags_cxx( ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] )
35
+	if 'fastmoc' in _flags:
36
+		lenv['BKSYS_FASTMOC']=1
37
+	if 'dump' in _flags:
38
+		lenv['DUMPCONFIG']=1
39
+	if not 'nohelp' in _flags:
40
+		if lenv['_CONFIGURE'] or lenv['HELP']: lenv.Exit(0)
41
+	if not 'nosmart' or not lenv.has_key('nosmart_includes'):
42
+		lenv.AppendUnique(CPPPATH=['#/'])
43
+		lst=[]
44
+		if lenv.has_key('USE_THE_FORCE_LUKE'):
45
+			lst=lenv['USE_THE_FORCE_LUKE']
46
+			lenv.__delitem__('USE_THE_FORCE_LUKE')
47
+		for v in lst: v.execute()
48
+	else: lenv['nosmart_includes']=1
49
+
50
+	## To use kdDebug(intvalue)<<"some trace"<<endl; you need to define -DDEBUG
51
+	## it is done in admin/generic.py automatically when you do scons configure debug=1
52
+
53
+def exists(env):
54
+	return True
55
+
56
+def detect_kde(env):
57
+	""" Detect the qt and kde environment using kde-config mostly """
58
+	def getpath(varname):
59
+		if not env.has_key('ARGS'): return None
60
+		v=env['ARGS'].get(varname, None)
61
+		if v: v=os.path.abspath(v)
62
+		return v
63
+
64
+	def getstr(varname):
65
+		if env.has_key('ARGS'): return env['ARGS'].get(varname, '')
66
+		return ''
67
+
68
+	prefix      = getpath('prefix')
69
+	execprefix  = getpath('execprefix')
70
+	datadir     = getpath('datadir')
71
+	libdir      = getpath('libdir')
72
+
73
+	kdedir      = getstr('kdedir')
74
+	kdeincludes = getpath('kdeincludes')
75
+	kdelibs     = getpath('kdelibs')
76
+
77
+	qtdir       = getstr('qtdir')
78
+	qtincludes  = getpath('qtincludes')
79
+	qtlibs      = getpath('qtlibs')
80
+	libsuffix   = getstr('libsuffix')
81
+
82
+	p=env.pprint
83
+
84
+	if libdir: libdir = libdir+libsuffix
85
+
86
+	## Detect the kde libraries
87
+	print "Checking for kde-config           : ",
88
+	str="which kde-config 2>/dev/null"
89
+	if kdedir: str="which %s 2>/dev/null" % (kdedir+'/bin/kde-config')
90
+	kde_config = os.popen(str).read().strip()
91
+	if len(kde_config):
92
+		p('GREEN', 'kde-config was found as '+kde_config)
93
+	else:
94
+		if kdedir: p('RED','kde-config was NOT found in the folder given '+kdedir)
95
+		else: p('RED','kde-config was NOT found in your PATH')
96
+		print "Make sure kde is installed properly"
97
+		print "(missing package kdebase-devel?)"
98
+		env.Exit(1)
99
+	if kdedir: env['KDEDIR']=kdedir
100
+	else: env['KDEDIR'] = os.popen(kde_config+' -prefix').read().strip()
101
+
102
+	print "Checking for kde version          : ",
103
+	kde_version = os.popen(kde_config+" --version|grep KDE").read().strip().split()[1]
104
+	if int(kde_version[0]) != 3 or int(kde_version[2]) < 2:
105
+		p('RED', kde_version)
106
+		p('RED',"Your kde version can be too old")
107
+		p('RED',"Please make sure kde is at least 3.2")
108
+	else:
109
+		p('GREEN',kde_version)
110
+
111
+	## Detect the qt library
112
+	print "Checking for the qt library       : ",
113
+	if not qtdir: qtdir = os.getenv("QTDIR")
114
+	if qtdir:
115
+		p('GREEN',"qt is in "+qtdir)
116
+	else:
117
+		try:
118
+			tmplibdir = os.popen(kde_config+' --expandvars --install lib').read().strip()
119
+			libkdeuiSO = env.join(tmplibdir, getSOfromLA(env.join(tmplibdir,'/libkdeui.la')) )
120
+			m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2])
121
+		except: m=None
122
+		if m:
123
+			qtdir = m.group(1)
124
+			p('YELLOW',"qt was found as "+m.group(1))
125
+		else:
126
+			p('RED','qt was not found')
127
+			p('RED','Please set QTDIR first (/usr/lib/qt3?) or try scons -h for more options')
128
+			env.Exit(1)
129
+	env['QTDIR'] = qtdir.strip()
130
+
131
+	## Find the necessary programs uic and moc
132
+	print "Checking for uic                  : ",
133
+	uic = qtdir + "/bin/uic"
134
+	if os.path.isfile(uic):
135
+		p('GREEN',"uic was found as "+uic)
136
+	else:
137
+		uic = os.popen("which uic 2>/dev/null").read().strip()
138
+		if len(uic):
139
+			p('YELLOW',"uic was found as "+uic)
140
+		else:
141
+			uic = os.popen("which uic 2>/dev/null").read().strip()
142
+			if len(uic):
143
+				p('YELLOW',"uic was found as "+uic)
144
+			else:
145
+				p('RED',"uic was not found - set QTDIR put it in your PATH ?")
146
+				env.Exit(1)
147
+	env['QT_UIC'] = uic
148
+
149
+	print "Checking for moc                  : ",
150
+	moc = qtdir + "/bin/moc"
151
+	if os.path.isfile(moc):
152
+		p('GREEN',"moc was found as "+moc)
153
+	else:
154
+		moc = os.popen("which moc 2>/dev/null").read().strip()
155
+		if len(moc):
156
+			p('YELLOW',"moc was found as "+moc)
157
+		elif os.path.isfile("/usr/share/qt3/bin/moc"):
158
+			moc = "/usr/share/qt3/bin/moc"
159
+			p('YELLOW',"moc was found as "+moc)
160
+		else:
161
+			p('RED',"moc was not found - set QTDIR or put it in your PATH ?")
162
+			env.Exit(1)
163
+	env['QT_MOC'] = moc
164
+
165
+	## check for the qt and kde includes
166
+	print "Checking for the qt includes      : ",
167
+	if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"):
168
+		# The user told where to look for and it looks valid
169
+		p('GREEN',"ok "+qtincludes)
170
+	else:
171
+		if os.path.isfile(qtdir + "/include/qlayout.h"):
172
+			# Automatic detection
173
+			p('GREEN',"ok "+qtdir+"/include/")
174
+			qtincludes = qtdir + "/include/"
175
+		elif os.path.isfile("/usr/include/qt3/qlayout.h"):
176
+			# Debian probably
177
+			p('YELLOW','the qt headers were found in /usr/include/qt3/')
178
+			qtincludes = "/usr/include/qt3"
179
+		else:
180
+			p('RED',"the qt headers were not found")
181
+			env.Exit(1)
182
+
183
+	print "Checking for the kde includes     : ",
184
+	kdeprefix = os.popen(kde_config+" --prefix").read().strip()
185
+	if not kdeincludes:
186
+		kdeincludes = kdeprefix+"/include/"
187
+	if os.path.isfile(kdeincludes + "/klineedit.h"):
188
+		p('GREEN',"ok "+kdeincludes)
189
+	else:
190
+		if os.path.isfile(kdeprefix+"/include/kde/klineedit.h"):
191
+			# Debian, Fedora probably
192
+			p('YELLOW',"the kde headers were found in %s/include/kde/"%kdeprefix)
193
+			kdeincludes = kdeprefix + "/include/kde/"
194
+		else:
195
+			p('RED',"The kde includes were NOT found")
196
+			env.Exit(1)
197
+
198
+	# kde-config options
199
+	kdec_opts = {'KDEBIN'    : 'exe',     'KDEAPPS'      : 'apps',
200
+		     'KDEDATA'   : 'data',    'KDEICONS'     : 'icon',
201
+		     'KDEMODULE' : 'module',  'KDELOCALE'    : 'locale',
202
+		     'KDEKCFG'   : 'kcfg',    'KDEDOC'       : 'html',
203
+		     'KDEMENU'   : 'apps',    'KDEXDG'       : 'xdgdata-apps',
204
+		     'KDEMIME'   : 'mime',    'KDEXDGDIR'    : 'xdgdata-dirs',
205
+		     'KDESERV'   : 'services','KDESERVTYPES' : 'servicetypes',
206
+		     'KDEINCLUDE': 'include' }
207
+
208
+	if prefix:
209
+		## use the user-specified prefix
210
+		if not execprefix: execprefix=prefix
211
+		if not datadir: datadir=env.join(prefix,'share')
212
+		if not libdir: libdir=env.join(execprefix, "lib"+libsuffix)
213
+
214
+		subst_vars = lambda x: x.replace('${exec_prefix}', execprefix)\
215
+				.replace('${datadir}', datadir)\
216
+				.replace('${libdir}', libdir)\
217
+				.replace('${prefix}', prefix)
218
+		debian_fix = lambda x: x.replace('/usr/share', '${datadir}')
219
+		env['PREFIX'] = prefix
220
+		env['KDELIB'] = libdir
221
+		for (var, option) in kdec_opts.items():
222
+			dir = os.popen(kde_config+' --install ' + option).read().strip()
223
+			if var == 'KDEDOC': dir = debian_fix(dir)
224
+			env[var] = subst_vars(dir)
225
+
226
+	else:
227
+		env['PREFIX'] = os.popen(kde_config+' --expandvars --prefix').read().strip()
228
+		env['KDELIB'] = os.popen(kde_config+' --expandvars --install lib').read().strip()
229
+		for (var, option) in kdec_opts.items():
230
+			dir = os.popen(kde_config+' --expandvars --install ' + option).read().strip()
231
+			env[var] = dir
232
+
233
+	env['QTPLUGINS']=os.popen(kde_config+' --expandvars --install qtplugins').read().strip()
234
+
235
+	## kde libs and includes
236
+	env['KDEINCLUDEPATH']=kdeincludes
237
+	if not kdelibs:
238
+		kdelibs=os.popen(kde_config+' --expandvars --install lib').read().strip()
239
+	env['KDELIBPATH']=kdelibs
240
+
241
+	## qt libs and includes
242
+	env['QTINCLUDEPATH']=qtincludes
243
+	if not qtlibs:
244
+		qtlibs=qtdir+"/lib"+libsuffix
245
+	env['QTLIBPATH']=qtlibs
246
+
247
+def generate(env):
248
+	""""Set up the qt and kde environment and builders - the moc part is difficult to understand """
249
+
250
+	# attach this function immediately
251
+	SConsEnvironment.KDEuse=KDEuse
252
+
253
+	if env['HELP']:
254
+                p=env.pprint
255
+                p('BOLD','*** KDE options ***')
256
+                p('BOLD','--------------------')
257
+                p('BOLD','* prefix     ','base install path,         ie: /usr/local')
258
+                p('BOLD','* execprefix ','install path for binaries, ie: /usr/bin')
259
+                p('BOLD','* datadir    ','install path for the data, ie: /usr/local/share')
260
+                p('BOLD','* libdir     ','install path for the libs, ie: /usr/lib')
261
+
262
+		p('BOLD','* qtdir      ','base of the kde libraries')
263
+		p('BOLD','* kdedir     ','base of the qt libraries')
264
+
265
+		p('BOLD','* libsuffix  ','suffix of libraries on amd64, ie: 64, 32')
266
+		p('BOLD','* kdeincludes','kde includes path (/usr/include/kde on debian, ..)')
267
+		p('BOLD','* qtincludes ','qt includes path (/usr/include/qt on debian, ..)')
268
+		p('BOLD','* kdelibs    ','kde libraries path, for linking the programs')
269
+		p('BOLD','* qtlibs     ','qt libraries path, for linking the program')
270
+
271
+                p('BOLD','* scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt\n')
272
+		return
273
+
274
+	import SCons.Defaults
275
+	import SCons.Tool
276
+	import SCons.Util
277
+	import SCons.Node
278
+
279
+	def reldir(dir):
280
+		ndir    = SCons.Node.FS.default_fs.Dir(dir).srcnode().abspath
281
+		rootdir = SCons.Node.FS.default_fs.Dir('#').abspath
282
+		return ndir.replace(rootdir, '').lstrip('/')
283
+
284
+	def relfile(file):
285
+		nfile   = SCons.Node.FS.default_fs.File(file).srcnode().abspath
286
+		rootdir = SCons.Node.FS.default_fs.Dir('#').abspath
287
+		return nfile.replace(rootdir, '').lstrip('/')
288
+
289
+	CLVar = SCons.Util.CLVar
290
+	splitext = SCons.Util.splitext
291
+	Builder = SCons.Builder.Builder
292
+	
293
+	# Detect the environment - replaces ./configure implicitely and store the options into a cache
294
+	from SCons.Options import Options
295
+	cachefile=env['CACHEDIR']+'kde.cache.py'
296
+	opts = Options(cachefile)
297
+	opts.AddOptions(
298
+		('PREFIX', 'root of the program installation'),
299
+
300
+		('QTDIR', ''),
301
+		('QTLIBPATH', 'path to the qt libraries'),
302
+		('QTINCLUDEPATH', 'path to the qt includes'),
303
+		('QT_UIC', 'uic command'),
304
+		('QT_MOC', 'moc command'),
305
+		('QTPLUGINS', 'uic executable command'),
306
+
307
+		('KDEDIR', ''),
308
+		('KDELIBPATH', 'path to the installed kde libs'),
309
+		('KDEINCLUDEPATH', 'path to the installed kde includes'),
310
+
311
+		('KDEBIN', 'inst path of the kde binaries'),
312
+		('KDEINCLUDE', 'inst path of the kde include files'),
313
+		('KDELIB', 'inst path of the kde libraries'),
314
+		('KDEMODULE', 'inst path of the parts and libs'),
315
+		('KDEDATA', 'inst path of the application data'),
316
+		('KDELOCALE', ''), ('KDEDOC', ''), ('KDEKCFG', ''),
317
+		('KDEXDG', ''), ('KDEXDGDIR', ''), ('KDEMENU', ''),
318
+		('KDEMIME', ''), ('KDEICONS', ''), ('KDESERV', ''),
319
+		('KDESERVTYPES', ''), ('KDEAPPS', ''),
320
+	)
321
+	opts.Update(env)
322
+
323
+	def getInstDirForResType(lenv,restype):
324
+		if len(restype) == 0 or not lenv.has_key(restype):
325
+			lenv.pprint('RED',"unknown resource type "+restype)
326
+			lenv.Exit(1)
327
+		else: instdir = lenv[restype]
328
+
329
+		if env['ARGS'] and env['ARGS'].has_key('prefix'):
330
+			instdir = instdir.replace(lenv['PREFIX'], env['ARGS']['prefix'])
331
+		return instdir
332
+
333
+	# reconfigure when things are missing
334
+	if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('QTDIR') or not env.has_key('KDEDIR')):
335
+		detect_kde(env)
336
+		opts.Save(cachefile, env)
337
+
338
+	## set default variables, one can override them in sconscript files
339
+	env.Append(CXXFLAGS = ['-I'+env['KDEINCLUDEPATH'], '-I'+env['QTINCLUDEPATH'] ],
340
+			LIBPATH = [env['KDELIBPATH'], env['QTLIBPATH'] ])
341
+	
342
+	env['QT_AUTOSCAN'] = 1
343
+	env['QT_DEBUG']    = 0
344
+
345
+	env['MEINPROC'] = 'meinproc'
346
+	env['MSGFMT']   = 'msgfmt'
347
+
348
+	## ui file processing
349
+	def uic_processing(target, source, env):
350
+		inc_kde  ='#include <klocale.h>\n#include <kdialog.h>\n'
351
+		inc_moc  ='#include "%s"\n' % target[2].name
352
+		comp_h   ='$QT_UIC -L $QTPLUGINS -nounload -o %s %s' % (target[0].path, source[0].path)
353
+		comp_c   ='$QT_UIC -L $QTPLUGINS -nounload -tr tr2i18n -impl %s %s' % (target[0].path, source[0].path)
354
+		comp_moc ='$QT_MOC -o %s %s' % (target[2].path, target[0].path)
355
+		if env.Execute(comp_h): return ret
356
+		dest = open( target[1].path, "w" )
357
+		dest.write(inc_kde)
358
+		dest.close()
359
+		if env.Execute( comp_c+" >> "+target[1].path ): return ret
360
+		dest = open( target[1].path, "a" )
361
+		dest.write(inc_moc)
362
+		dest.close()
363
+		ret = env.Execute( comp_moc )
364
+		return ret
365
+	def uicEmitter(target, source, env):
366
+		adjustixes = SCons.Util.adjustixes
367
+		bs = SCons.Util.splitext(str(source[0].name))[0]
368
+		bs = env.join(str(target[0].get_dir()),bs)
369
+		target.append(bs+'.cpp')
370
+		target.append(bs+'.moc')
371
+		return target, source
372
+	env['BUILDERS']['Uic']=Builder(action=uic_processing,emitter=uicEmitter,suffix='.h',src_suffix='.ui')
373
+
374
+	def kcfg_buildit(target, source, env):
375
+		comp='kconfig_compiler -d%s %s %s' % (str(source[0].get_dir()), source[1].path, source[0].path)
376
+		return env.Execute(comp)
377
+	def kcfg_stringit(target, source, env):
378
+		print "processing %s to get %s and %s" % (source[0].name, target[0].name, target[1].name)
379
+	def kcfgEmitter(target, source, env):
380
+		adjustixes = SCons.Util.adjustixes
381
+		file=str(source[0].srcnode().name)
382
+		bs = SCons.Util.splitext(str(source[0].name))[0]
383
+		bs = env.join(str(target[0].get_dir()),bs)
384
+		# .h file is already there
385
+		target.append( bs+'.cpp' )
386
+		
387
+		content=source[0].srcnode().get_contents()
388
+
389
+		kcfgfilename=""
390
+		kcfgFileDeclRx = re.compile("[fF]ile\s*=\s*(.+)\s*")
391
+		match = kcfgFileDeclRx.search(content)
392
+		if match: kcfgfilename = match.group(1)
393
+
394
+		if not kcfgfilename:
395
+			env.pprint('RED','invalid kcfgc file '+source[0].srcnode().abspath)
396
+			env.Exit(1)
397
+		source.append( env.join( str(source[0].get_dir()), kcfgfilename) )
398
+		return target, source
399
+
400
+	env['BUILDERS']['Kcfg']=Builder(action=env.Action(kcfg_buildit, kcfg_stringit),
401
+			emitter=kcfgEmitter, suffix='.h', src_suffix='.kcfgc')
402
+	
403
+	## MOC processing
404
+	env['BUILDERS']['Moc']=Builder(action='$QT_MOC -o $TARGET $SOURCE',suffix='.moc',src_suffix='.h')
405
+	env['BUILDERS']['Moccpp']=Builder(action='$QT_MOC -o $TARGET $SOURCE',suffix='_moc.cpp',src_suffix='.h')
406
+
407
+	## KIDL file
408
+	env['BUILDERS']['Kidl']=Builder(action= 'dcopidl $SOURCE > $TARGET || (rm -f $TARGET ; false)',
409
+			suffix='.kidl', src_suffix='.h')
410
+	## DCOP
411
+	env['BUILDERS']['Dcop']=Builder(action='dcopidl2cpp --c++-suffix cpp --no-signals --no-stub $SOURCE',
412
+			suffix='_skel.cpp', src_suffix='.kidl')
413
+	## STUB
414
+	env['BUILDERS']['Stub']=Builder(action= 'dcopidl2cpp --c++-suffix cpp --no-signals --no-skel $SOURCE',
415
+			suffix='_stub.cpp', src_suffix='.kidl')
416
+	## DOCUMENTATION
417
+	env['BUILDERS']['Meinproc']=Builder(action='cd $TARGET.dir && $MEINPROC --check --cache $TARGET.name $SOURCE.name',
418
+			suffix='.cache.bz2')
419
+	## TRANSLATIONS
420
+	env['BUILDERS']['Transfiles']=Builder(action='$MSGFMT $SOURCE -o $TARGET',suffix='.gmo',src_suffix='.po')
421
+
422
+	## Handy helpers for building kde programs
423
+	## You should not have to modify them ..
424
+
425
+	ui_ext = [".ui"]
426
+	kcfg_ext = ['.kcfgc']
427
+	header_ext = [".h", ".hxx", ".hpp", ".hh"]
428
+	cpp_ext = [".cpp", ".cxx", ".cc"]
429
+	skel_ext = [".skel", ".SKEL"]
430
+	stub_ext = [".stub", ".STUB"]
431
+
432
+	def KDEfiles(lenv, target, source):
433
+		""" Returns a list of files for scons (handles kde tricks like .skel) 
434
+		It also makes custom checks against double includes like : ['file.ui', 'file.cpp']
435
+		(file.cpp is already included because of file.ui) """
436
+
437
+		# ITA
438
+		#print "kdefiles"
439
+
440
+		q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')
441
+		def scan_moc(cppfile):
442
+			addfile=None
443
+
444
+			# try to find the header
445
+			orifile=cppfile.srcnode().name
446
+			bs=SCons.Util.splitext(orifile)[0]
447
+
448
+			h_file=''
449
+			dir=cppfile.dir
450
+			for n_h_ext in header_ext:
451
+				afile=dir.File(bs+n_h_ext)
452
+				if afile.rexists():
453
+					#h_ext=n_h_ext
454
+					h_file=afile
455
+					break
456
+			# We have the header corresponding to the cpp file
457
+			if h_file:
458
+				h_contents = h_file.get_contents()
459
+				if q_object_search.search(h_contents):
460
+					# we know now there is Q_OBJECT macro
461
+					reg = '\n\s*#include\s*("|<)'+str(bs)+'.moc("|>)'
462
+					meta_object_search = re.compile(reg)
463
+					#cpp_contents = open(file_cpp, 'rb').read()
464
+					cpp_contents=cppfile.get_contents()
465
+					if meta_object_search.search(cpp_contents):
466
+						lenv.Moc(h_file)
467
+					else:
468
+						lenv.Moccpp(h_file)
469
+						addfile=bs+'_moc.cpp'
470
+						print "WARNING: moc.cpp for "+h_file.name+" consider using #include <file.moc> instead"
471
+			return addfile
472
+
473
+		src=[]
474
+		ui_files=[]
475
+		kcfg_files=[]
476
+		other_files=[]
477
+		kidl=[]
478
+
479
+		source_=lenv.make_list(source)
480
+
481
+		# For each file, check wether it is a dcop file or not, and create the complete list of sources
482
+		for file in source_:
483
+
484
+			sfile=SCons.Node.FS.default_fs.File(str(file)) # why str(file) ? because ordinal not in range issues
485
+			bs  = SCons.Util.splitext(file)[0]
486
+			ext = SCons.Util.splitext(file)[1]
487
+			if ext in skel_ext:
488
+				if not bs in kidl:
489
+					kidl.append(bs)
490
+				lenv.Dcop(bs+'.kidl')
491
+				src.append(bs+'_skel.cpp')
492
+			elif ext in stub_ext:
493
+				if not bs in kidl:
494
+					kidl.append(bs)
495
+				lenv.Stub(bs+'.kidl')
496
+				src.append(bs+'_stub.cpp')
497
+			elif ext == ".moch":
498
+				lenv.Moccpp(bs+'.h')
499
+				src.append(bs+'_moc.cpp')
500
+			elif ext in cpp_ext:
501
+				src.append(file)
502
+				if not env.has_key('NOMOCFILE'):
503
+					ret = scan_moc(sfile)
504
+					if ret: src.append( sfile.dir.File(ret) )
505
+			elif ext in ui_ext:
506
+				lenv.Uic(file)
507
+				src.append(bs+'.cpp')
508
+			elif ext in kcfg_ext:
509
+				name=SCons.Util.splitext(sfile.name)[0]
510
+				hfile=lenv.Kcfg(file)
511
+				cppkcfgfile=sfile.dir.File(bs+'.cpp')
512
+				src.append(bs+'.cpp')
513
+			else:
514
+				src.append(file)
515
+
516
+		for base in kidl: lenv.Kidl(base+'.h')
517
+		
518
+		# Now check against typical newbie errors
519
+		for file in ui_files:
520
+			for ofile in other_files:
521
+				if ofile == file:
522
+					env.pprint('RED',"WARNING: You have included %s.ui and another file of the same prefix"%file)
523
+					print "Files generated by uic (file.h, file.cpp must not be included"
524
+		for file in kcfg_files:
525
+			for ofile in other_files:
526
+				if ofile == file:
527
+					env.pprint('RED',"WARNING: You have included %s.kcfg and another file of the same prefix"%file)
528
+					print "Files generated by kconfig_compiler (settings.h, settings.cpp) must not be included"
529
+		# ITA
530
+		#print "end kdefiles"
531
+		return src
532
+
533
+
534
+	""" In the future, these functions will contain the code that will dump the
535
+	configuration for re-use from an IDE """
536
+	def KDEinstall(lenv, restype, subdir, files, perms=None):
537
+		if env.has_key('DUMPCONFIG'):
538
+			ret= "<install type=\"%s\" subdir=\"%s\">\n" % (restype, subdir)
539
+			for i in lenv.make_list(files):
540
+				ret += "    <file name=\"%s\"/>\n" % (relfile(i))
541
+			ret += "</install>\n"
542
+			lenv.add_dump(ret)
543
+			return None
544
+
545
+		if not env['_INSTALL']: return None
546
+		dir = getInstDirForResType(lenv, restype)
547
+
548
+		p=None
549
+		if not perms:
550
+			if restype=='KDEBIN': p=0755
551
+		else: p=perms
552
+		install_list = lenv.bksys_install(lenv.join(dir, subdir), files, perms=p)
553
+		return install_list
554
+
555
+	def KDEinstallas(lenv, restype, destfile, file):
556
+		if not env['_INSTALL']: return
557
+		dir = getInstDirForResType(lenv, restype)
558
+		install_list = lenv.InstallAs(lenv.join(dir, destfile), file)
559
+                env.Alias('install', install_list)
560
+		return install_list
561
+
562
+	def KDEprogram(lenv, target, source, 
563
+			includes='', localshlibs='', globallibs='', globalcxxflags=''):
564
+		""" Makes a kde program 
565
+		The program is installed except if one sets env['NOAUTOINSTALL'] """
566
+		src = KDEfiles(lenv, target, source)
567
+		program_list = lenv.Program(target, src)
568
+
569
+		# we link the program against a shared library done locally, add the dependency
570
+		if not lenv.has_key('nosmart_includes'):
571
+			lenv.AppendUnique(CPPPATH=['./'])
572
+		if len(localshlibs)>0:
573
+			lst=lenv.make_list(localshlibs)
574
+			lenv.link_local_shlib(lst)
575
+			lenv.Depends( program_list, lst )
576
+			
577
+		if len(includes)>0:       lenv.KDEaddpaths_includes(includes)
578
+		if len(globallibs)>0:     lenv.KDEaddlibs(globallibs)
579
+		if len(globalcxxflags)>0: lenv.KDEaddflags_cxx(globalcxxflags)
580
+		
581
+		if not lenv.has_key('NOAUTOINSTALL'):
582
+			KDEinstall(lenv, 'KDEBIN', '', target)
583
+		return program_list
584
+
585
+	def KDEshlib(lenv, target, source, kdelib=0, libprefix='lib', 
586
+			includes='', localshlibs='', globallibs='', globalcxxflags='', vnum=''):
587
+		""" Makes a shared library for kde (.la file for klibloader)
588
+		The library is installed except if one sets env['NOAUTOINSTALL'] """
589
+		src = KDEfiles(lenv, target, source)
590
+
591
+		if not lenv.has_key('nosmart_includes'):
592
+			lenv.AppendUnique(CPPPATH=['./'])
593
+		# we link the program against a shared library done locally, add the dependency
594
+		lst=[]
595
+		if len(localshlibs)>0:
596
+			lst=lenv.make_list(localshlibs)
597
+			lenv.link_local_shlib(lst)
598
+		if len(includes)>0:       lenv.KDEaddpaths_includes(includes)
599
+		if len(globallibs)>0:     lenv.KDEaddlibs(globallibs)
600
+		if len(globalcxxflags)>0: lenv.KDEaddflags_cxx(globalcxxflags)
601
+
602
+		restype='KDEMODULE'
603
+		if kdelib==1: restype='KDELIB'
604
+
605
+		library_list = lenv.bksys_shlib(target, src, getInstDirForResType(lenv, restype), libprefix, vnum)
606
+		if len(lst)>0: lenv.Depends( library_list, lst )
607
+
608
+		return library_list
609
+
610
+	def KDEstaticlib(lenv, target, source):
611
+		""" Makes a static library for kde - in practice you should not use static libraries 
612
+		1. they take more memory than shared ones
613
+		2. makefile.am needed it because of limitations
614
+		(cannot handle sources in separate folders - takes extra processing) """
615
+		if not lenv.has_key('nosmart_includes'): lenv.AppendUnique(CPPPATH=['./'])
616
+		src=KDEfiles(lenv, target, source)
617
+		return lenv.StaticLibrary(target, src)
618
+		# do not install static libraries by default
619
+
620
+	def KDEaddflags_cxx(lenv, fl):
621
+		""" Compilation flags for C++ programs """
622
+		lenv.AppendUnique(CXXFLAGS = lenv.make_list(fl))
623
+	
624
+	def KDEaddflags_c(lenv, fl):
625
+		""" Compilation flags for C programs """
626
+		lenv.AppendUnique(CFLAGS = lenv.make_list(fl))
627
+
628
+	def KDEaddflags_link(lenv, fl):
629
+		""" Add link flags - Use this if KDEaddlibs below is not enough """
630
+		lenv.PrependUnique(LINKFLAGS = lenv.make_list(fl))
631
+
632
+	def KDEaddlibs(lenv, libs):
633
+		""" Helper function """
634
+		lenv.AppendUnique(LIBS = lenv.make_list(libs))
635
+
636
+	def KDEaddpaths_includes(lenv, paths):
637
+		""" Add new include paths """
638
+		lenv.AppendUnique(CPPPATH = lenv.make_list(paths))
639
+
640
+	def KDEaddpaths_libs(lenv, paths):
641
+		""" Add paths to libraries """
642
+		lenv.PrependUnique(LIBPATH = lenv.make_list(paths))
643
+
644
+	def KDElang(lenv, folder, appname):
645
+		""" Process translations (.po files) in a po/ dir """
646
+		import glob
647
+		dir=SCons.Node.FS.default_fs.Dir(folder).srcnode()
648
+		fld=dir.srcnode()
649
+		tmptransfiles = glob.glob(str(fld)+'/*.po')
650
+
651
+		if lenv.has_key('DUMPCONFIG'):
652
+			lenv.add_dump( "<podir dir=\"%s\" name=\"%s\"/>\n" % (reldir(dir), appname) )
653
+			return
654
+
655
+		transfiles=[]
656
+		if lenv.has_key('_BUILDDIR_'):
657
+			bdir=lenv['_BUILDDIR_']
658
+			for pof in lenv.make_list(tmptransfiles):
659
+				# ITA
660
+				d=relfile(pof)
661
+				d2=d.replace(bdir,'').lstrip('/')
662
+				d3=lenv.join(bdir, d2)
663
+				#print d2
664
+				#print d3
665
+				transfiles.append( lenv.join('#', bdir, d2) )
666
+		else: transfiles=tmptransfiles
667
+
668
+		languages=None
669
+		if lenv['ARGS'] and lenv['ARGS'].has_key('languages'):
670
+			languages=lenv.make_list(lenv['ARGS']['languages'])
671
+		mydir=SCons.Node.FS.default_fs.Dir('.')
672
+		for f in transfiles:
673
+			#fname=f.replace(mydir.abspath, '')
674
+			fname=f
675
+			file=SCons.Node.FS.default_fs.File(fname)
676
+			country = SCons.Util.splitext(file.name)[0]
677
+			if not languages or country in languages:
678
+				result = lenv.Transfiles(file)
679
+				dir=lenv.join( getInstDirForResType(lenv, 'KDELOCALE'), country)
680
+				lenv.bksys_install(lenv.join(dir, 'LC_MESSAGES'), result, destfile=appname+'.mo')
681
+
682
+	def KDEicon(lenv, icname='*', path='./', restype='KDEICONS', subdir=''):
683
+		"""Contributed by: "Andrey Golovizin" <grooz()gorodok()net>
684
+		modified by "Martin Ellis" <m.a.ellis()ncl()ac()uk>
685
+
686
+		Installs icons with filenames such as cr22-action-frame.png into 
687
+		KDE icon hierachy with names like icons/crystalsvg/22x22/actions/frame.png.
688
+		
689
+		Global KDE icons can be installed simply using env.KDEicon('name').
690
+		The second parameter, path, is optional, and specifies the icons
691
+		location in the source, relative to the SConscript file.
692
+
693
+		To install icons that need to go under an applications directory (to
694
+		avoid name conflicts, for example), use e.g.
695
+		env.KDEicon('name', './', 'KDEDATA', 'appname/icons')"""
696
+
697
+		if lenv.has_key('DUMPCONFIG'):
698
+			lenv.add_dump( "<icondir>\n" )
699
+			lenv.add_dump( "    <icondirent dir=\"%s\" subdir=\"%s\"/>\n" % (reldir(path), subdir) )
700
+			lenv.add_dump( "</icondir>\n" )
701
+			return
702
+
703
+		type_dic = { 'action':'actions', 'app':'apps', 'device':'devices',
704
+			'filesys':'filesystems', 'mime':'mimetypes' } 
705
+		dir_dic = {
706
+		'los'  :'locolor/16x16', 'lom'  :'locolor/32x32',
707
+		'him'  :'hicolor/32x32', 'hil'  :'hicolor/48x48',
708
+		'lo16' :'locolor/16x16', 'lo22' :'locolor/22x22', 'lo32' :'locolor/32x32',
709
+		'hi16' :'hicolor/16x16', 'hi22' :'hicolor/22x22', 'hi32' :'hicolor/32x32',
710
+		'hi48' :'hicolor/48x48', 'hi64' :'hicolor/64x64', 'hi128':'hicolor/128x128',
711
+		'hisc' :'hicolor/scalable',
712
+		'cr16' :'crystalsvg/16x16', 'cr22' :'crystalsvg/22x22', 'cr32' :'crystalsvg/32x32',
713
+		'cr48' :'crystalsvg/48x48', 'cr64' :'crystalsvg/64x64', 'cr128':'crystalsvg/128x128',
714
+		'crsc' :'crystalsvg/scalable'
715
+		}
716
+
717
+		iconfiles = []
718
+		dir=SCons.Node.FS.default_fs.Dir(path).srcnode()
719
+		mydir=SCons.Node.FS.default_fs.Dir('.')
720
+		import glob
721
+		for ext in ['png', 'xpm', 'mng', 'svg', 'svgz']:
722
+			files = glob.glob(str(dir)+'/'+'*-*-%s.%s' % (icname, ext))
723
+			for file in files:
724
+				iconfiles.append( file.replace(mydir.abspath, '') )
725
+		for iconfile in iconfiles:
726
+			lst = iconfile.split('/')
727
+			filename = lst[ len(lst) - 1 ]
728
+			tmp = filename.split('-')
729
+			if len(tmp)!=3:
730
+				env.pprint('RED','WARNING: icon filename has unknown format: '+iconfile)
731
+				continue
732
+			[icon_dir, icon_type, icon_filename]=tmp
733
+			try:
734
+				basedir=getInstDirForResType(lenv, restype)
735
+				destdir = '%s/%s/%s/%s/' % (basedir, subdir, dir_dic[icon_dir], type_dic[icon_type])
736
+			except KeyError:
737
+				env.pprint('RED','WARNING: unknown icon type: '+iconfile)
738
+				continue
739
+			lenv.bksys_install(destdir, iconfile, icon_filename)
740
+
741
+	## This function uses env imported above - WARNING ugly code, i will have to rewrite (ITA)
742
+	def docfolder(lenv, folder, lang, destination=""):
743
+		# folder is the folder to process
744
+		# lang is the language
745
+		# destination is the subdirectory in KDEDOC (appname)
746
+		import glob
747
+		docfiles=[]
748
+		dir=SCons.Node.FS.default_fs.Dir(folder).srcnode()
749
+		mydir=SCons.Node.FS.default_fs.Dir('.')
750
+		dirpath=mydir.srcnode().abspath
751
+		docg = glob.glob(str(dir)+"/???*.*") # file files that are at least 4 chars wide :)
752
+		for file in docg:
753
+			f = file.replace(dirpath, '')
754
+			docfiles.append(f)
755
+
756
+		if lenv.has_key('DUMPCONFIG'):
757
+			lenv.add_dump( "<docdir name=\"%s\">\n" % destination)
758
+			lenv.add_dump( "    <docdirent lang=\"%s\" dir=\"%s\"/>\n" % (lang, reldir(dir)) )
759
+			lenv.add_dump( "</docdir>\n" )
760
+			return
761
+
762
+		# warn about errors
763
+		#if len(lang) != 2:
764
+		#       print "error, lang must be a two-letter string, like 'en'"
765
+
766
+		# when the destination is not given, use the folder
767
+		if len(destination) == 0: destination=folder
768
+		docbook_list = []
769
+
770
+		bdir='.'
771
+		if lenv.has_key('_BUILDDIR_'): bdir = lenv['_BUILDDIR_']
772
+		for file in docfiles:
773
+			# do not process folders
774
+			#if not os.path.isfile( lenv.join('.', file) ): continue
775
+
776
+			# build a node representing the file in the build directory to force symlinking
777
+			nodefile=relfile( lenv.join(mydir.abspath, file) )
778
+			#print nodefile
779
+			#nodefile=relfile( lenv.join(self.dirprefix, file) )
780
+			nodefile=SCons.Node.FS.default_fs.File( lenv.join('#', bdir, nodefile) )
781
+			#print nodefile.abspath
782
+
783
+			# do not process the cache file
784
+			if file == 'index.cache.bz2': continue
785
+			# ignore invalid files (TODO??)
786
+			if len( SCons.Util.splitext( file ) ) <= 1: continue
787
+			ext = SCons.Util.splitext( file )[1]
788
+
789
+			# install picture files
790
+			if ext in ['.jpeg', '.jpg', '.png']: lenv.KDEinstall('KDEDOC', lenv.join(lang,destination), nodefile.abspath)
791
+                        # docbook files are processed by meinproc
792
+			if ext != '.docbook': continue
793
+			
794
+			docbook_list.append( nodefile )
795
+			lenv.KDEinstall('KDEDOC', lenv.join(lang,destination), nodefile.abspath)
796
+
797
+		# Now process the index.docbook files ..
798
+		if len(docbook_list) == 0: return
799
+
800
+		index=''
801
+		cache=''
802
+		for file in docbook_list:
803
+			if file.name=='index.docbook':
804
+				index=file
805
+				cache=file.dir.File('index.cache.bz2')
806
+
807
+		if not index:
808
+			print "BUG in docfolder: no index.docbook but docbook files found"
809
+			lenv.Exit(1)
810
+
811
+		for file in docbook_list:
812
+			# make the cache.bz2 file depend on all .docbook files in the same dir
813
+			lenv.Depends( cache, file )
814
+
815
+		lenv.Meinproc( cache, index )
816
+		lenv.KDEinstall( 'KDEDOC', lenv.join(lang,destination), cache )
817
+		
818
+		if env['_INSTALL']:
819
+			dir=lenv.join(env['DESTDIR'], lenv.getInstDirForResType('KDEDOC'), lang, destination)
820
+			comp='mkdir -p %s && cd %s && rm -f common && ln -s ../common common' % (dir, dir)
821
+			lenv.Execute(comp)
822
+			
823
+			#self.env.AddPostAction(lenv.join(dir, 'common'), self.env.Chmod(ins, self.perms))
824
+			# TODO add post action of cache (index.cache.bz2)
825
+
826
+	#valid_targets = "program shlib kioslave staticlib".split()
827
+	import generic
828
+	class kobject(generic.genobj):
829
+		def __init__(self, val, senv=None):
830
+			if senv: generic.genobj.__init__(self, val, senv)
831
+			else: generic.genobj.__init__(self, val, env)
832
+			self.iskdelib=0
833
+		def it_is_a_kdelib(self): self.iskdelib=1
834
+		def execute(self):
835
+			if self.executed: return
836
+			if self.orenv.has_key('DUMPCONFIG'):
837
+				self.executed=1
838
+				self.xml()
839
+				return
840
+			if (self.type=='shlib' or self.type=='kioslave'):
841
+				install_dir = 'KDEMODULE'
842
+				if self.iskdelib==1: install_dir = 'KDELIB'
843
+				self.instdir=getInstDirForResType(self.orenv, install_dir)
844
+			elif self.type=='program':
845
+				self.instdir=getInstDirForResType(self.orenv, 'KDEBIN')
846
+				self.perms=0755
847
+
848
+			# ITA
849
+			#print self.source
850
+			#print "hallo"
851
+			self.p_localsource=KDEfiles(env, self.joinpath(self.target), self.joinpath(self.source))
852
+			# ITA
853
+			#print self.p_localsource
854
+			generic.genobj.execute(self)
855
+
856
+		def xml(self):
857
+			dirprefix = reldir('.')
858
+			if not dirprefix: dirprefix=self.dirprefix
859
+			ret='<compile type="%s" dirprefix="%s" target="%s" cxxflags="%s" cflags="%s" includes="%s" linkflags="%s" libpaths="%s" libs="%s" vnum="%s" iskdelib="%s" libprefix="%s">\n' % (self.type, dirprefix, self.target, self.cxxflags, self.cflags, self.includes, self.linkflags, self.libpaths, self.libs, self.vnum, self.iskdelib, self.libprefix)
860
+			if self.source:
861
+				for i in self.orenv.make_list(self.source): ret+='    <source file="%s"/>\n' % i
862
+			ret+="</compile>\n"
863
+			self.orenv.add_dump(ret)
864
+
865
+	# Attach the functions to the environment so that SConscripts can use them
866
+	SConsEnvironment.KDEprogram = KDEprogram
867
+	SConsEnvironment.KDEshlib = KDEshlib
868
+	SConsEnvironment.KDEstaticlib = KDEstaticlib
869
+	SConsEnvironment.KDEinstall = KDEinstall
870
+	SConsEnvironment.KDEinstallas = KDEinstallas
871
+	SConsEnvironment.KDElang = KDElang
872
+	SConsEnvironment.KDEicon = KDEicon
873
+
874
+	SConsEnvironment.KDEaddflags_cxx = KDEaddflags_cxx
875
+	SConsEnvironment.KDEaddflags_c = KDEaddflags_c
876
+	SConsEnvironment.KDEaddflags_link = KDEaddflags_link
877
+	SConsEnvironment.KDEaddlibs = KDEaddlibs
878
+	SConsEnvironment.KDEaddpaths_includes = KDEaddpaths_includes
879
+	SConsEnvironment.KDEaddpaths_libs = KDEaddpaths_libs
880
+
881
+	SConsEnvironment.docfolder = docfolder
882
+	SConsEnvironment.getInstDirForResType = getInstDirForResType
883
+	SConsEnvironment.kobject = kobject
884
+

+ 142
- 0
bksys/parser.py View File

@@ -0,0 +1,142 @@
1
+#!/usr/bin/python
2
+
3
+from xml.sax import make_parser 
4
+from xml.sax.handler import ContentHandler 
5
+
6
+import SCons.Util
7
+
8
+def exists(env):
9
+	return True
10
+
11
+class SconsHandler(ContentHandler): 
12
+
13
+	def __init__ (self, envi, builddir):
14
+		self.envname = ""
15
+		self.env = envi
16
+		self.builddir="" #envi['_BUILDDIR_']
17
+
18
+		#self.dump = True
19
+		self.dump = False
20
+		self.count = 0
21
+		self.dir = ""
22
+		self.autoinstall = False
23
+		self.appname=""
24
+
25
+		self.obj = ""
26
+
27
+		self.subdir =""
28
+		self.type   =""
29
+
30
+		self.isgloballib=""
31
+		self.target=""
32
+		
33
+		self._includes=""
34
+		self.cxxflags=""
35
+		self.globallibs=""
36
+		self.locallibs=""
37
+		self.linkflags=""
38
+    
39
+		self.srclist=[]
40
+
41
+	def adrl(self, file):
42
+		if self.builddir:
43
+			dir=self.env.join(self.builddir,file).lstrip('/')
44
+		else:
45
+			dir=file.lstrip('/')
46
+		return dir
47
+    
48
+	def dump_commands(self, str):
49
+		if self.dump:
50
+			print str
51
+   
52
+	def startElement(self, name, attrs): 
53
+
54
+		if name == 'icondirent':
55
+			dir = attrs.get('dir', '')
56
+			sbdir = attrs.get('subdir', '')
57
+			if dir:
58
+				#if self.env.has_key("DUMPCONFIG"):
59
+				#	print "env.KDEicon('"+dir+")'"
60
+				self.env.KDEicon('*', self.adrl(dir), subdir=sbdir)
61
+		elif name == 'subdirent':
62
+			dir = attrs.get('dir', None)
63
+			if dir:
64
+				#if self.env.has_key("DUMPCONFIG"):
65
+				#	print "env.SConscript('"+dir+"/SConscript')"
66
+				self.env.SConscript(self.env.join(self.adrl(dir),"SConscript"))
67
+		elif name == 'docdir':
68
+			self.appname = self.adrl( attrs.get('name', None) )
69
+		elif name == 'docdirent':
70
+			dir = attrs.get('dir', None)
71
+			lang = attrs.get('lang', None)
72
+			if dir and lang:
73
+				#if self.env.has_key("DUMPCONFIG"):
74
+				#	print "env.docfolder('"+dir+"', '"+lang+"', '"+self.appname+"')"
75
+				self.env.docfolder(self.adrl(dir), lang, self.appname)
76
+		elif name == 'podir':
77
+			dir = attrs.get('dir', None)
78
+			appname = attrs.get('name', None)
79
+			if dir and appname:
80
+				if self.env.has_key('_BUILDDIR_'): dir=self.env.join(self.env['_BUILDDIR_'], dir)
81
+				self.env.KDElang(dir, appname)
82
+		elif name == 'install':
83
+			self.type   = attrs.get('type', None)
84
+			self.subdir = attrs.get('subdir', None)
85
+
86
+		elif name == 'file':
87
+			name = attrs.get('name', None)
88
+			if self.type:
89
+				#if self.env.has_key("DUMPCONFIG"):
90
+				#	print "env.KDEinstall('"+self.type+"', '"+self.subdir+"', '"+name+"')"
91
+				self.env.KDEinstall(self.type, self.subdir, name)
92
+
93
+		elif name == 'compile':
94
+		
95
+			type = attrs.get('type', None)
96
+			if not type: self.env.Exit(1)
97
+			self.obj = self.env.kobject(type)
98
+
99
+			self.obj.target     = str(attrs.get('target', ''))
100
+			self.obj.source     = []
101
+
102
+			self.obj.includes   = str(attrs.get('includes', ''))
103
+			self.obj.cflags     = str(attrs.get('cflags', ''))
104
+			self.obj.cxxflags   = str(attrs.get('cxxflags', ''))
105
+
106
+			self.obj.libs       = str(attrs.get('libs', ''))
107
+			self.obj.linkflags  = str(attrs.get('linkflags', ''))
108
+			self.obj.libpath    = str(attrs.get('libpath', ''))
109
+
110
+			self.obj.vnum       = str(attrs.get('vnum', ''))
111
+			self.obj.iskdelib   = str(attrs.get('iskdelib', 0))
112
+			self.obj.libprefix  = str(attrs.get('libprefix', ''))
113
+
114
+			self.obj.chdir      = self.adrl(str(attrs.get('chdir', '')))
115
+			self.obj.dirprefix  = self.adrl(str(attrs.get('dirprefix', './')))
116
+			if not self.obj.dirprefix: self.obj.dirprefix='./' # avoid silly errors
117
+
118
+		elif name == 'source':
119
+			file = attrs.get('file', None)
120
+			condition = attrs.get('condition', "");
121
+			lst=condition.split(':')
122
+			for c in lst:
123
+				if self.env.has_key(c):
124
+					self.obj.source.append( file )
125
+					break
126
+			if file and not condition: self.obj.source.append( file )
127
+
128
+	def endElement(self, name): 
129
+		if name == 'compile':
130
+			self.obj.execute()
131
+
132
+def generate(env):
133
+	
134
+	def xmlfile(env, file, builddir=''):
135
+		parser = make_parser()
136
+		curHandler = SconsHandler(env, builddir)
137
+		parser.setContentHandler(curHandler)
138
+		parser.parse(open(file))
139
+
140
+	from SCons.Script.SConscript import SConsEnvironment
141
+        SConsEnvironment.xmlfile = xmlfile
142
+

BIN
bksys/scons-mini.tar.bz2 View File


+ 28
- 0
config.bks View File

@@ -0,0 +1,28 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<bksys version="2">
3
+<compile type="program" dirprefix="src" 
4
+         target="wlassistant"
5
+         libs="kdeui qt-mt iw">
6
+<source file="main.cpp"/>
7
+<source file="netlistviewitem.cpp"/>
8
+<source file="ui_NetParamsEdit.ui"/>
9
+<source file="ui_NetParamsWizard.ui"/>
10
+<source file="ui_main.ui"/>
11
+<source file="ui_netparamsedit.cpp"/>
12
+<source file="ui_netparamswizard.cpp"/>
13
+<source file="waconfig.cpp"/>
14
+<source file="watools.cpp"/>
15
+<source file="wlassistant.cpp"/>
16
+</compile>
17
+
18
+<icondir>
19
+    <icondirent dir="icons"/>
20
+</icondir>
21
+
22
+<podir dir="po" name="wlassistant"/>
23
+
24
+<install type="KDEMENU" subdir="Utilities/">
25
+    <file name="src/wlassistant.desktop"/>
26
+</install>
27
+
28
+</bksys>

+ 87
- 0
configure View File

@@ -0,0 +1,87 @@
1
+#!/bin/sh
2
+# Fancy colors used to beautify the output a bit.
3
+#
4
+NORMAL="\033[0m"
5
+BOLD="\033[1m"
6
+RED="\033[91m"
7
+YELLOW="\033[93m"
8
+GREEN="\033[92m"
9
+
10
+# Checks for Python interpreter. Honours $PYTHON if set. Stores path to
11
+# interpreter in $PYTHON.
12
+#
13
+checkPython()
14
+{
15
+	if [ -z $PYTHON ]; then
16
+	  PYTHON=`which python 2> /dev/null`
17
+	fi
18
+	echo -n "Checking for Python               :  "
19
+	if [ ! -x "$PYTHON" ]; then
20
+	  echo -e $GREEN"not found!"$NORMAL
21
+	  echo "Please make sure that the Python interpreter is available in your PATH"
22
+	  echo "or invoke configure using the PYTHON flag, e.g."
23
+	  echo "$ PYTHON=/usr/local/bin/python configure"
24
+	  exit 1
25
+	fi
26
+	echo -e $GREEN"$PYTHON"$NORMAL
27
+}
28
+
29
+# Checks for SCons. Honours $SCONS if set. Stores path to 'scons' in $SCONS.
30
+# Requires that $PYTHON is set.
31
+#
32
+checkSCons()
33
+{
34
+	echo -n "Checking for SCons                :  "
35
+	if [ -z $SCONS ]; then
36
+	  SCONS=`which scons 2> /dev/null`
37
+	fi
38
+	if [ ! -x "$SCONS" ]; then
39
+	  echo -e $BOLD"not found, will use mini distribution."$NORMAL
40
+	  tar xjf bksys/scons-mini.tar.bz2
41
+	  SCONS="./scons"
42
+	else
43
+	  echo -e $GREEN"$SCONS"$NORMAL
44
+	fi
45
+	SCONS="$SCONS"
46
+}
47
+
48
+# Generates a Makefile. Requires that $SCONS is set.
49
+#
50
+generateMakefile()
51
+{
52
+	cat > Makefile << EOF
53
+all:
54
+	@$SCONS
55
+
56
+# it is also possible to use
57
+# @$SCONS -j4
58
+
59
+install:
60
+	@$SCONS install
61
+
62
+clean:
63
+	@$SCONS -c
64
+
65
+uninstall:
66
+	@$SCONS -c install
67
+
68
+dist:
69
+	@$SCONS dist
70
+
71
+distclean:
72
+	rm -rf cache/
73
+
74
+cleanup:
75
+	-find . -name '*~' | \
76
+	  xargs rm
77
+	-find . -name '*.ui' | \
78
+	  xargs perl -pi -e 's#version="3.3"#version="3.2"#; s#^\ *<#<#'
79
+
80
+EOF
81
+}
82
+
83
+checkPython
84
+checkSCons
85
+generateMakefile
86
+
87
+$SCONS configure $@

+ 2
- 0
description-pak View File

@@ -0,0 +1,2 @@
1
+Wireless Assistant (wlassistant) is a small KDE application
2
+allowing you to easily connect to wireless networks.

+ 25
- 0
doc/AUTHORS View File

@@ -0,0 +1,25 @@
1
+Pawel Nawrocki <pnawrocki@interia.pl>
2
+
3
+Special thanks go to people that contributed in various ways, listed chornologically:
4
+
5
+elitecodex and his friend
6
+Michael Long
7
+Marc Onrust
8
+Florian Obradovic
9
+Stephan Binner
10
+Marcel Hilzinger
11
+Christian Bird
12
+Remco Treffkorn
13
+Gerwin Krist
14
+Ed Cates
15
+Andrey Kislyuk
16
+Daniel Nascimento
17
+Olivier Butler
18
+Sheldon Lee-Wen
19
+Adonay Sanz Alsina
20
+Achim Bohnet
21
+Peter Zhang
22
+Wintceas Godois
23
+James Ots
24
+
25
+...and everyone that helped by reporting bugs and giving ideas, as well as packagers.

+ 340
- 0
doc/COPYING View File

@@ -0,0 +1,340 @@
1
+		    GNU GENERAL PUBLIC LICENSE
2
+		       Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+                       51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+			    Preamble
10
+
11
+  The licenses for most software are designed to take away your
12
+freedom to share and change it.  By contrast, the GNU General Public
13
+License is intended to guarantee your freedom to share and change free
14
+software--to make sure the software is free for all its users.  This
15
+General Public License applies to most of the Free Software
16
+Foundation's software and to any other program whose authors commit to
17
+using it.  (Some other Free Software Foundation software is covered by
18
+the GNU Library General Public License instead.)  You can apply it to
19
+your programs, too.
20
+
21
+  When we speak of free software, we are referring to freedom, not
22
+price.  Our General Public Licenses are designed to make sure that you
23
+have the freedom to distribute copies of free software (and charge for
24
+this service if you wish), that you receive source code or can get it
25
+if you want it, that you can change the software or use pieces of it
26
+in new free programs; and that you know you can do these things.
27
+
28
+  To protect your rights, we need to make restrictions that forbid
29
+anyone to deny you these rights or to ask you to surrender the rights.
30
+These restrictions translate to certain responsibilities for you if you
31
+distribute copies of the software, or if you modify it.
32
+
33
+  For example, if you distribute copies of such a program, whether
34
+gratis or for a fee, you must give the recipients all the rights that
35
+you have.  You must make sure that they, too, receive or can get the
36
+source code.  And you must show them these terms so they know their
37
+rights.
38
+
39
+  We protect your rights with two steps: (1) copyright the software, and
40
+(2) offer you this license which gives you legal permission to copy,
41
+distribute and/or modify the software.
42
+
43
+  Also, for each author's protection and ours, we want to make certain
44
+that everyone understands that there is no warranty for this free
45
+software.  If the software is modified by someone else and passed on, we
46
+want its recipients to know that what they have is not the original, so
47
+that any problems introduced by others will not reflect on the original
48
+authors' reputations.
49
+
50
+  Finally, any free program is threatened constantly by software
51
+patents.  We wish to avoid the danger that redistributors of a free
52
+program will individually obtain patent licenses, in effect making the
53
+program proprietary.  To prevent this, we have made it clear that any
54
+patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+  The precise terms and conditions for copying, distribution and
57
+modification follow.
58
+
59
+		    GNU GENERAL PUBLIC LICENSE
60
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+  0. This License applies to any program or other work which contains
63
+a notice placed by the copyright holder saying it may be distributed
64
+under the terms of this General Public License.  The "Program", below,
65
+refers to any such program or work, and a "work based on the Program"
66
+means either the Program or any derivative work under copyright law:
67
+that is to say, a work containing the Program or a portion of it,
68
+either verbatim or with modifications and/or translated into another
69
+language.  (Hereinafter, translation is included without limitation in
70
+the term "modification".)  Each licensee is addressed as "you".
71
+
72
+Activities other than copying, distribution and modification are not
73
+covered by this License; they are outside its scope.  The act of
74
+running the Program is not restricted, and the output from the Program
75
+is covered only if its contents constitute a work based on the
76
+Program (independent of having been made by running the Program).
77
+Whether that is true depends on what the Program does.
78
+
79
+  1. You may copy and distribute verbatim copies of the Program's
80
+source code as you receive it, in any medium, provided that you
81
+conspicuously and appropriately publish on each copy an appropriate
82
+copyright notice and disclaimer of warranty; keep intact all the
83
+notices that refer to this License and to the absence of any warranty;
84
+and give any other recipients of the Program a copy of this License
85
+along with the Program.
86
+
87
+You may charge a fee for the physical act of transferring a copy, and
88
+you may at your option offer warranty protection in exchange for a fee.
89
+
90
+  2. You may modify your copy or copies of the Program or any portion
91
+of it, thus forming a work based on the Program, and copy and
92
+distribute such modifications or work under the terms of Section 1
93
+above, provided that you also meet all of these conditions:
94
+
95
+    a) You must cause the modified files to carry prominent notices
96
+    stating that you changed the files and the date of any change.
97
+
98
+    b) You must cause any work that you distribute or publish, that in
99
+    whole or in part contains or is derived from the Program or any
100
+    part thereof, to be licensed as a whole at no charge to all third
101
+    parties under the terms of this License.
102
+
103
+    c) If the modified program normally reads commands interactively
104