Added KDE3 version of wlassistant

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/wlassistant@1097621 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
commit e0311ffdf8

@ -0,0 +1,588 @@
2007-04-03 Paweł Nawrocki <pnawrocki@gmail.com>
* WPA-PSK support, UI cleanup and much more.
2007-02-27 Paweł Nawrocki <pnawrocki@gmail.com>
* dhclient connection: get gateway from stdout, so there's no need to check later.
2007-02-27 Paweł Nawrocki <pnawrocki@gmail.com>
* get rid of many external proc calls in favor of ioctls, WATools cleanup
2007-02-27 Paweł Nawrocki <pnawrocki@gmail.com>
* Don't check for active connection while wizard is running
2007-02-27 Paweł Nawrocki <pnawrocki@gmail.com>
* Fixed connection success detection
2007-02-27 Paweł Nawrocki <pnawrocki@gmail.com>
* Beginnings of WPA-PSK support
2007-02-09 Paweł Nawrocki <pnawrocki@gmail.com>
* Got rid of "iwconfig_status" action. Get essid with iwlib calls.
2007-02-03 Paweł Nawrocki <pnawrocki@gmail.com>
* Added option to group APs with the same ESSID
2007-02-03 Paweł Nawrocki <pnawrocki@gmail.com>
* Hide security keys in dialogs and console output
2006-11-22 RELEASE 0.5.6
2006-11-22 Pawel Nawrocki <pnawrocki@gmail.com>
* Added an option to wait before getting scan results - fixes a problem when some networks were not visible after initial scan.
2006-11-22 Pawel Nawrocki <pnawrocki@gmail.com>
* Added option to automatically connect to best network at startup.
2006-11-22 Pawel Nawrocki <pnawrocki@gmail.com>
* Added customizable per-network commands before/after connection/disconnection.
2006-11-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed the '-q' option from dhclient execution (problem reported by marshallbanana)
2006-11-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Added Arabic translation (by Mohammed Gamal)
2006-11-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Added Norwegian Bokm<6B> translation (by Alexander Nicolaysen S?rnes)
2006-11-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Added Swedish translation (by Daniel Nylander)
2006-11-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Updated Spanish translation (by Enrique Mat<61>s S<>chez)
2006-11-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Made automatic reconnection option more visible (modified patch by Henry Kay)
2006-03-11 Pawel Nawrocki <pnawrocki@gmail.com>
* Fix bug 1447119 - ignore hostap's wifi0 interface (reported and patched by Andreas Nolda)
2006-03-09 Pawel Nawrocki <pnawrocki@gmail.com>
* Wait a little bit before checking if connection was successful (a working connection was sometimes not detected)
2006-03-09 Pawel Nawrocki <pnawrocki@gmail.com>
* Fixed detection of a running DHCP client (patch by James Ots)
* Fixed gateway detection for SUSE10 (patch by James Ots)
2006-03-04 Pawel Nawrocki <pnawrocki@gmail.com>
* Added .info files path for SUSE10
2006-03-01 Pawel Nawrocki <pnawrocki@gmail.com>
* Skip channel setting if not supported (fixes bug 1349228)
2006-02-16 Pawel Nawrocki <pnawrocki@gmail.com>
* Revised and completed Portugese (Brazil) translation (by BRUNO GON<4F>LVES)
2006-02-13 RELEASE 0.5.5
2006-02-13 Pawel Nawrocki <pnawrocki@gmail.com>
* Get device list from iwconfig
2006-02-13 Pawel Nawrocki <pnawrocki@gmail.com>
* Added AUTHORS file
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* Updated to latest bksys (based on kdissert)
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* Show system tray icon by default. Added categories. (wlassistant.desktop)
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* Always try to kill stale dhcp client before connecting (fixes bug #1305952)
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* New quality level indication. Fixes bug #1323274 "Link quality seems strangefully low..."
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* Updated Portugese (Brazilian) translation (changes by Wintceas Godois)
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* Added Chinese (Simplified and Traditional) translations (by Peter Zhang)
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* Fixed "unknown escape sequence" warning (thanks to Achim Bohnet)
2006-02-12 Pawel Nawrocki <pnawrocki@gmail.com>
* Return to iwlist scan results parsing
* Pass essid as the last argument - fixes bug #1366531
2006-01-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Added license to src/waconfig.h
2005-10-24 Pawel Nawrocki <pnawrocki@gmail.com>
* Automatically detect paths to .pid and .info/.leases files. Fixes bug #1323263
2005-10-07 Pawel Nawrocki <pnawrocki@gmail.com>
* No concole output if radio ok
* Added missing i18n(...) (wlassistant.cpp line 382)
2005-10-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Added Catalan translation (by Adonay Sanz Alsina)
2005-09-30 Pawel Nawrocki <pnawrocki@gmail.com>
* Normalize quality returned by scan results (range 0-100)
2005-09-30 Pawel Nawrocki <pnawrocki@gmail.com>
* Open kernel socket once, reuse it till program exits.
2005-09-29 Pawel Nawrocki <pnawrocki@gmail.com>
* Fixed possible division by zero problem.
2005-09-27 Pawel Nawrocki <pnawrocki@gmail.com>
* FIxed initialization of some variables in WATools.
2005-09-27 Pawel Nawrocki <pnawrocki@gmail.com>
* WATools::scanResults does not freeze UI anymore (using callback function to update UI)
2005-09-23 Pawel Nawrocki <pnawrocki@gmail.com>
* Small fixes to the WATools::scanResults parsing. (wlassistant.cpp)
* Migrated to bksys/scons
2005-09-20 Pawel Nawrocki <pnawrocki@gmail.com>
* Get Wireless Extensions version from iw_get_kernel_we_version() (watools.cpp)
2005-09-14 Pawel Nawrocki <pnawrocki@gmail.com>
* Added configure check for iwlib.h (patch by Sheldon Lee-Wen)
2005-09-13 Pawel Nawrocki <pnawrocki@gmail.com>
* Migrated from iwlist scan results parsing to direct iwlib calls.
2005-09-11 Pawel Nawrocki <pnawrocki@gmail.com>
* Added version number in window title (main.cpp)
2005-09-11 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed redundant <string> include (watools.h)
* Default (fallback) interface in WATools
* Auto set fallback interface in WATools::interfaceList() if none set.
* Made returned variables static in WATools functions
* Renamed devices() to interfaceList() in WATools, adjusted references.
2005-09-06 Pawel Nawrocki <pnawrocki@gmail.com>
* Added French translation (by Olivier Butler)
2005-09-06 Pawel Nawrocki <pnawrocki@gmail.com>
* Added 'ASCII' checkbox next to WEP key fields.
2005-09-02 RELEASE 0.5.4a
2005-09-01 Pawel Nawrocki <pnawrocki@gmail.com>
* Made WATools::txpower return -1 if radio is disabled.
* Use WATools::txpower instead of output parsing to check if radio is enabled.
2005-09-01 Pawel Nawrocki <pnawrocki@gmail.com>
* List only managed (& master) networks
2005-09-01 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed setIfname and ifname from WATools, made 'iface' argument in functions mandatory..
* Don't check for active connection when no scan results.
* Changed linux/socket.h to sys/socket.h (watools.cpp)
* Only bring interface up (before scanning) if it is down. ('no scan results' fix, part 1)
* Don't bring interface down if there were no scan results. ('no scan results' fix, part 2)
* added "ifconfig_status" action (output to check if interface is up) (netparams.cpp)
2005-08-30 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed double #include for qcursor
2005-08-27 Pawel Nawrocki <pnawrocki@gmail.com>
* Changed linux/socket.h include to sys/socket.h (watools.cpp)
* Don't check for active connection if there are no scan results (wlassistant.cpp)
2005-08-20 RELEASE 0.5.4
2005-08-20 Pawel Nawrocki <pnawrocki@gmail.com>
* Reviewed 'timerConnectionCheck' occurences. Make it work regardless of connectedItem presence (to detect if connected from an outside app)
* Fixed 'wlassistant crashes when pressing 'scan' a lot' bug.
* Set config groups
* Created README with usage hints
* Changed 'restricted' to 'shared key'
* Changed 'open' to 'open system' (WEP mode)
* Fixed 'connect from selected network' to 'connect to connected network'
* Added Portugese Brazilian translation (by Daniel Nascimento)
* Added Polish translation
* Added Polish description to .desktop file (Comment[pl])
2005-08-16 Pawel Nawrocki <pnawrocki@gmail.com>
* Added WATools:: txpower, ap, iface, setIface. (watools.h/.cpp)
* Added getGateway() function. (wlassistant.h/.cpp)
2005-08-15 Pawel Nawrocki <pnawrocki@gmail.com>
* Pressing 'Quit' kills all background processes. (wlassistant.cpp)
2005-08-15 Pawel Nawrocki <pnawrocki@gmail.com>
* Changed 'Scan' to 'Refresh' (ui_main.ui)
2005-08-13 Pawel Nawrocki <pnawrocki@gmail.com>
* Fix: if no gateway (manual config or DHCP) - report that connection failed.
* Properly detect connection on startup, if only gateway accessible.
* Wait 2sec before checking for internet after establishing connection.
* Wait 150ms after DHCP client finishes before getting gateway from route.
* Added more detailed output to stdout.
2005-08-13 Pawel Nawrocki <pnawrocki@gmail.com>
* Changed host to ping to www.ibiblio.org
2005-08-13 Pawel Nawrocki <pnawrocki@gmail.com>
* Fix: set mInternet to false when mConnected is false.
2005-08-11 Pawel Nawrocki <pnawrocki@gmail.com>
* Reworked connection status monitoring & indication.
2005-08-09 Pawel Nawrocki <pnawrocki@gmail.com>
* Added WATools::devices that returns comma separated list of wireless devices.
* Migrated to WATools::devices (wlassistant.cpp)
2005-08-08 Pawel Nawrocki <pnawrocki@gmail.com>
* Added WATools::isWireless to determine if interface supports wireless extensions.
2005-08-08 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed KConfigXT, .kcfg & .kcfgc files. Variables to store are added in wlassistant.cpp files.
* Changed 'WaSettings' to WAConfig.
2005-08-08 Pawel Nawrocki <pnawrocki@gmail.com>
* Introduced helper class WATools (uses iwlib directly).
* Get currentItem quality with WATools::quality instead of parsing iwconfig output.
2005-08-07 RELEASE 0.5.3
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed redundant includes.
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed "ui_confgeneral.h" dependancy (wlassistant.cpp).
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed KDE version dependancy (ui_main.ui).
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Added ToolTips and 'What's This' help to all elements.
* Changed 'Close' to 'Quit'.
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Change 'Settings' to 'Options' where appropriate.
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Added formatting to message boxes.
* Change 'Close' to 'Stop' only if process runs longer than 1.5sec
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Last used interface is saved in config file and reused next time the app is run.
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* While running external executables, 'Close' button changes to 'Stop' that terminates current process.
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* Added DHCP client timeout and GUI to configure it.
2005-08-07 Pawel Nawrocki <pnawrocki@gmail.com>
* New settings GUI (wlassistant.h/.cpp, ui_main.ui).
* Droppen kconfigdialog.h dependancy.
* Fixed item height with the new settings GUI (netlistviewitem.h/.cpp).
2005-08-06 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed 'netReconnect()' function.
* Reduced CPU usage while running external executables. Thanks to Remco Treffkorn.
2005-08-05 Pawel Nawrocki <pnawrocki@gmail.com>
* Removed 'Honor KDE single click' UI.
* Removed 'Honor KDE single click' from kcfg.
* Connect signal/slots in wlassistant.cpp, not in the .ui files.
* Removed 'Reconnect' context menu action. (sometimes froze the app for unknown reasons).
2005-08-05 Pawel Nawrocki <pnawrocki@gmail.com>
* Changes to global KDE settings take immediate effect in wlassistant.
2005-08-05 Pawel Nawrocki <pnawrocki@gmail.com>
* If encryption is "off" - disable it, enable if anything else. This fixes encryption detection for drivers that return '****-****-****-**' instead of just 'on'
2005-08-05 Pawel Nawrocki <pnawrocki@gmail.com>
* Changed connected item's context menu (part II) so that default action is listed first.
* Make mouse behaviour (Single- or Double-Click) consistent with KDE global settings.
* 'Connect' button caption changes to 'Disconnect' when connected item is selected.
* Double clicking on an item connects/disconnects (when mouse settings require this behaviour).
2005-08-04 RELEASE 0.5.2f
2005-08-04 Pawel Nawrocki <pnawrocki@gmail.com>
* Fixed sorting by channel number (e.g. 11 is now after 10, not after 1)
* #ifdef to check for KDE 3.4 - this should make wlassistant compile on KDE 3.3
2005-08-04 Pawel Nawrocki <pnawrocki@gmail.com>
* Fixed recognition of '<hidden>' ESSID.
2005-08-04 RELEASE 0.5.2e
2005-08-04 Pawel Nawrocki <pnawrocki@gmail.com>
* Try to kill stale DHCP client instance (if any) when connection fails.
2005-08-04 Pawel Nawrocki <pnawrocki@gmail.com>
* Try to kill any stale DHCP client if connection fails. This seems to be dhclient only.
2005-08-03 Pawel Nawrocki <pnawrocki@gmail.com>
* Bring interface up before setting network parameters (esp. wep key) - this fixes problems with connecting to encrypted networks using a DHCP client.
2005-08-03 Pawel Nawrocki <pnawrocki@gmail.com>
* Fixed network encryption and frequency (if no channel info available) detection.
2005-08-03 Pawel Nawrocki <pnawrocki@gmail.com>
* Changed connected item's context menu so that default action is listed first.
2005-08-03 Pawel Nawrocki <pnawrocki@gmail.com>
* automatically disconnect from current network when connecting to a different one.
2005-08-02 Pawel Nawrocki <pnawrocki@gmail.com>
* Try to kill running instance of DHCP client (if any) before connecting.
2005-08-02 Pawel Nawrocki <pnawrocki@gmail.com>
* Added semicolons to DNS labels in the 'Edit Settings' dialog.
*** version 0.5.2d:
* FIX: Wait 1.5sec for dhcp client to quit. This fixes reconnecting problems.
* FIX: Default action when clicking on a connected item is "Disconnect..." again.
*** version 0.5.2c:
* FIX: On some systems user got disconnected on app startup.
*** version 0.5.2b:
* FIX: Network status monitoring.
* FIX: Wrong WEP indication
* FIX: Few more fixes of ridiculous bugs.
*** version 0.5.2a:
* FIX: uncommented lines that were commented out for testing only.
*** version 0.5.2:
* NEW: Connection status monitoring, ask to reconnect when connection lost.
* NEW: If no scan results returned - check if external radio switch (laptops) is turned on.
* The above feature is tested with madwifi driver only. Please let me know if it works with different ones.
* NEW: Connected network marked with an icon.
* NEW: 'Don't ask again' checkboxes for some dialogs (No GUI to switch them back on yet, you will need to edit 'wlassistantrc' manually)
* FIX: Fixed crash on startup/scan (thanks go to Remco Treffkorn for reporting this).
* FIX: No not report half a star when quality is 0.
* FIX: Reduced flicker when populating network list.
* FIX: Workaround for some drivers wrongly reporting that connection is available when it is not.
* FIX: Workaround for drivers overusing cache when returning scan results/errors (works with madwifi at least).
* Lots of other fixes and internal improvements, code cleanup.
*** version 0.5.1a (BUGFIX RELEASE):
* NEW: Actions for a network that is connected but not configured.
* FIX: Network is no longer shown as 'connected' if link quality is 0.
* FIX: Tab order in "Edit Settings..." dialog.
* FIX/ADD: The AP column is back :)
* FIX: Changed default action of connected item to 'Reconnect'.
*** version 0.5.1:
* NEW: Dialog to edit existing network settings.
* 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).
* NEW: connected network item always first and highlighted and bold and whatnot.
* NEW: Dynamic quality indication for the connected network.
* NEW: Disconnect functionality.
* NEW: Moved to i18n strings.
* NEW: If radio is off, user is asked if it should be switched on.
* 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).
* NEW: If connection fails, user is asked whether to review settings. Comment if it annoys you...
* FIX: Rewritten item drawing code. Reduced flicker.
* FIX: Changed dhclient command arguments. Does this one work for everybody?
* FIX: UI refinements (thanks to Stephan Binner for pointing these out)
* FIX: Couldn't connect after channel/frequency of a network changed.
* FIX: Hack to prevent wrong column width setting.
* FIX/REM: AP column removed.
* Changed scan results parsing to use qregexp and optimised.
* Quite a few other bug fixes, some code cleanup.
* 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
* THANKS go to Stephan Binner for giving me some valuable hints.
*** version 0.5.0:
*** 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.
* NEW: Network profiles (finally!). Comments please!
* NEW: Automatic path detection. No manual config.
* NEW: Support for networks with hidden ESSIDs.
* NEW: Context menu for each found network.
* NEW: Sysfs based device detection (kernel 2.6.x required!).
* NEW: Device selection combo is hidden if only one interface is found.
* NEW: wlassistant runs using sudo to avoid permissions mess in different distros.
* FIX: Much shorter startup time.
* FIX: Proper connection checking.
* REM: Real interface name lookup removed.
* 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.).
* REM: Removed "Scan upon startup" option - it is the default behaviour now.
* REM: Removed "Skip encrypted networks" scanning option.
* REM: Removed "Connection timeout" option for dhcpcd. Hardcoded to 25s.
* 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.
* NOTE: You might encounter some annoying "This function is not yet implemented" messages. Reason? See above.
* 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!
* NOTE: See TODO before giving ideas or feature requests to get an overview of what is already planned for the next releases.
*** 0.3.9:
* NEW: the long-awaited dhclient support
* NEW: button to terminate current process
* some bugfixes and ui changes
*** 0.3.8a BUGFIX RELEASE:
* FIX: Quality detection (again, last time, hopefully)
* FIX: some cards reported 'Managed' as 'Master'
* FIX: ESSIDs including space now are correctly set
* FIX: no more unnecessary errors from iwlist & others
* FIX: kcfg file now installed in the proper location
* FIX: path detection (now only accepts files in /usr/.. or /sbin or /bin)
* FIX: existing dhcpcd instance now properly quits if necessary
* some code cleanup
*** version 0.3.8:
* NEW: manual interface configuration (not DHCP)
* NEW: Option to run custom command upon connection
* NEW: use frequency if channel number not available
* NEW: honor KDE single-click behaviour (option)
* NEW: Quit upon successful connection (option)
* NEW: Use ping to verify that connection is successfully established.
* NEW: Case-sensitive essid matching option
* FIX: Support for dhcpcd .pid files
* FIX: Column width set correctly
* FIX: Removed "Auto mode" option (shouldn't be needed)
* FIX: All columns now movable & resizable
* FIX: Proper quality detection / estimation (if no noise level reported)
* FIX: Icon
*** version 0.3.7:
* NEW: app now aware of channel number (thanks to Michael Long)
* FIX: network list is sorted properly now
* FIX: interfaces should be now detected properly if more than 1 is present (feedback pls!)
* FIX: 'Detect' and 'Configure...' buttons disabled while connecting
* FIX: quality should be now reported properly on all cards (with help of Michael Long, feedback pls!)
* FIX: mode changed to 'Managed' before scanning to ensure proper results
* other minor fixes
*** version 0.3.6:
* NEW: Encryption status shown using an icon
* NEW: Graphical link quality indicator
* NEW: automatic key selection if name matches ESSID.
* FIX: revert cursor after setting ad-hoc parameters
* some UI refinements
* status info if ad-hoc and/or encrypted networks skipped during scanning
* other small fixes I don't remember.
*** version 0.3.5:
* NEW: WEP support (please test it, I have no wlan with WEP atm)
* FIX: compile problem fixed, thanks to elitecodex (& his friend)
* FIX: do not try to get info from dhcp when in ad-hoc mode.
* changed binary name to wlassistant (shorter), so make sure to uninstall any previous version!
* changed defaults.
*** version 0.3.1:
* NEW: human-readable interface names (PCI devices only, udev required).
* NEW: option to automatically scan at startup (using first detected device)
* FIX: signal quality now shown correctly.
* FIX: other small fixes.
****** DESCRIPTION ******
Wireless Assistant (wlassistant) is a small application that allows you to connect to wireless networks.
* MAIN FEATURES:
- Managed Networks Support
- WEP Encryption Support
- Not Broadcasted ("hidden") ESSIDs Support
- Per Network (AP) Configuration Profiles
- Automatic (DHCP, both dhcpcd and dhclient) and manual configuration options.
The program uses wireless-tools, route, ifconfig, dhcpcd/dhclient as its backends so they need to be installed.
*** 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.
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:
%wifi ALL=NOPASSWD: <your_kde_dir>/bin/wlassistant

@ -0,0 +1,35 @@
#! /usr/bin/env python
"""
help -> scons -h
compile -> scons
clean -> scons -c
install -> scons install
uninstall -> scons -c install
configure -> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local
Run from a subdirectory -> scons -u
The variables are saved automatically after the first run (look at cache/kde.cache.py, ..)
"""
###################################################################
# LOAD THE ENVIRONMENT AND SET UP THE TOOLS
###################################################################
## Load the builders in config
env = Environment(tools=['default', 'generic', 'kde', 'parser'], toolpath=['./', './bksys'])
env.KDEuse("environ")
#env['DUMPCONFIG']=1
###################################################################
# SCRIPTS FOR BUILDING THE TARGETS
###################################################################
env.set_build_dir('src po', 'build')
env.xmlfile('config.bks')
###################################################################
# CONVENIENCE FUNCTIONS TO EMULATE 'make dist' and 'make distclean'
###################################################################
env.dist('wlassistant', '0.5.7')

@ -0,0 +1 @@
0.5.7

@ -0,0 +1,644 @@
## Thomas Nagy, 2005
""" Run scons -h to display the associated help, or look below """
import os, re, types, sys, string, shutil, stat, glob
import SCons.Defaults
import SCons.Tool
import SCons.Util
from SCons.Script.SConscript import SConsEnvironment
from SCons.Options import Options, PathOption
def getreldir(lenv):
cwd=os.getcwd()
root=SCons.Node.FS.default_fs.Dir('#').abspath
return cwd.replace(root,'').lstrip('/')
def dist(env, appname, version=None):
### To make a tarball of your masterpiece, use 'scons dist'
import os
if 'dist' in sys.argv:
if not version: VERSION=os.popen("cat VERSION").read().rstrip()
else: VERSION=version
FOLDER = appname+'-'+VERSION
TMPFOLD = ".tmp"+FOLDER
ARCHIVE = FOLDER+'.tar.bz2'
## check if the temporary directory already exists
os.popen('rm -rf %s %s %s' % (FOLDER, TMPFOLD, ARCHIVE) )
## create a temporary directory
startdir = os.getcwd()
os.popen("mkdir -p "+TMPFOLD)
os.popen("cp -R * "+TMPFOLD)
os.popen("mv "+TMPFOLD+" "+FOLDER)
## remove scons-local if it is unpacked
os.popen("rm -rf "+FOLDER+"/scons "+FOLDER+"/sconsign "+FOLDER+"/scons-local-0.96.1")
## remove our object files first
os.popen("find "+FOLDER+" -name \"cache\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \"build\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f")
## CVS cleanup
os.popen("find "+FOLDER+" -name \"CVS\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \".cvsignore\" | xargs rm -rf")
## Subversion cleanup
os.popen("find %s -name .svn -type d | xargs rm -rf" % FOLDER)
## GNU Arch cleanup
os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \".arch-i*\" | xargs rm -rf")
## Create the tarball (coloured output)
print "\033[92m"+"Writing archive "+ARCHIVE+"\033[0m"
os.popen("tar cjf "+ARCHIVE+" "+FOLDER)
## Remove the temporary directory
os.popen('rm -rf '+FOLDER)
env.Exit(0)
if 'distclean' in sys.argv:
## Remove the cache directory
import os, shutil
if os.path.isdir(env['CACHEDIR']): shutil.rmtree(env['CACHEDIR'])
os.popen("find . -name \"*.pyc\" | xargs rm -rf")
env.Exit(0)
colors= {
'BOLD' :"\033[1m",
'RED' :"\033[91m",
'GREEN' :"\033[92m",
'YELLOW':"\033[1m", #"\033[93m" # unreadable on white backgrounds
'CYAN' :"\033[96m",
'NORMAL':"\033[0m",
}
def pprint(env, col, str, label=''):
if env.has_key('NOCOLORS'):
print "%s %s" % (str, label)
return
try: mycol=colors[col]
except: mycol=''
print "%s%s%s %s" % (mycol, str, colors['NORMAL'], label)
class genobj:
def __init__(self, val, env):
if not val in "program shlib kioslave staticlib".split():
print "unknown genobj given: "+val
env.Exit(1)
self.type = val
self.orenv = env
self.env = None
self.executed = 0
self.target=''
self.src=None
self.cxxflags=''
self.cflags=''
self.includes=''
self.linkflags=''
self.libpaths=''
self.libs=''
# vars used by shlibs
self.vnum=''
self.libprefix=''
# a directory where to install the targets (optional)
self.instdir=''
# change the working directory before reading the targets
self.chdir=''
# unix permissions
self.perms=''
# these members are private
self.chdir_lock=None
self.dirprefix='./'
self.old_os_dir=''
self.old_fs_dir=''
self.p_local_shlibs=[]
self.p_local_staticlibs=[]
self.p_global_shlibs=[]
self.p_localsource=None
self.p_localtarget=None
# work directory
self.workdir_lock=None
self.orig_fs_dir=SCons.Node.FS.default_fs.getcwd()
self.not_orig_fs_dir=''
self.not_orig_os_dir=''
if not env.has_key('USE_THE_FORCE_LUKE'): env['USE_THE_FORCE_LUKE']=[self]
else: env['USE_THE_FORCE_LUKE'].append(self)
def joinpath(self, val):
if len(self.dirprefix)<3: return val
dir=self.dirprefix
thing=self.orenv.make_list(val)
files=[]
bdir="./"
if self.orenv.has_key('_BUILDDIR_'): bdir=self.orenv['_BUILDDIR_']
for v in thing: files.append( self.orenv.join(bdir, dir, v) )
return files
# a list of paths, with absolute and relative ones
def fixpath(self, val):
def reldir(dir):
ndir = SCons.Node.FS.default_fs.Dir(dir).srcnode().abspath
rootdir = SCons.Node.FS.default_fs.Dir('#').abspath
return ndir.replace(rootdir, '').lstrip('/')
dir=self.dirprefix
if not len(dir)>2: dir=reldir('.')
thing=self.orenv.make_list(val)
ret=[]
bdir="./"
if self.orenv.has_key('_BUILDDIR_'): bdir=self.orenv['_BUILDDIR_']
for v in thing:
#if v[:2] == "./" or v[:3] == "../":
# ret.append( self.orenv.join('#', bdir, dir, v) )
#elif v[:1] == "#" or v[:1] == "/":
# ret.append( v )
#else:
# ret.append( self.orenv.join('#', bdir, dir, v) )
if v[:1] == "#" or v[:1] == "/":
ret.append(v)
else:
ret.append( self.orenv.join('#', bdir, dir, v) )
return ret
def lockworkdir(self):
if self.workdir_lock: return
self.workdir_lock=1
self.not_orig_fs_dir=SCons.Node.FS.default_fs.getcwd()
self.not_orig_os_dir=os.getcwd()
SCons.Node.FS.default_fs.chdir( self.orig_fs_dir, change_os_dir=1)
def unlockworkdir(self):
if not self.workdir_lock: return
SCons.Node.FS.default_fs.chdir( self.not_orig_fs_dir, change_os_dir=0)
os.chdir(self.not_orig_os_dir)
self.workdir_lock=None
def execute(self):
if self.executed: return
if self.orenv.has_key('DUMPCONFIG'):
self.xml()
self.executed=1
return
self.env = self.orenv.Copy()
if not self.p_localtarget: self.p_localtarget = self.joinpath(self.target)
if not self.p_localsource: self.p_localsource = self.joinpath(self.src)
if (not self.src or len(self.src) == 0) and not self.p_localsource:
self.env.pprint('RED',"no source file given to object - self.src")
self.env.Exit(1)
if not self.target:
self.env.pprint('RED',"no target given to object - self.target")
self.env.Exit(1)
if not self.env.has_key('nosmart_includes'): self.env.AppendUnique(CPPPATH=['./'])
if self.type == "kioslave": self.libprefix=''
if len(self.includes)>0: self.env.AppendUnique(CPPPATH=self.fixpath(self.includes))
if len(self.cxxflags)>0: self.env.AppendUnique(CXXFLAGS=self.env.make_list(self.cxxflags))
if len(self.cflags)>0: self.env.AppendUnique(CCFLAGS=self.env.make_list(self.cflags))
llist=self.env.make_list(self.libs)
lext=['.so', '.la']
sext='.a'.split()
for l in llist:
sal=SCons.Util.splitext(l)
if len(sal)>1:
if sal[1] in lext: self.p_local_shlibs.append(self.fixpath(sal[0]+'.so')[0])
elif sal[1] in sext: self.p_local_staticlibs.append(self.fixpath(sal[0]+'.a')[0])
else: self.p_global_shlibs.append(l)
if len(self.p_global_shlibs)>0: self.env.AppendUnique(LIBS=self.p_global_shlibs)
if len(self.libpaths)>0: self.env.PrependUnique(LIBPATH=self.fixpath(self.libpaths))
if len(self.linkflags)>0: self.env.PrependUnique(LINKFLAGS=self.env.make_list(self.linkflags))
if len(self.p_local_shlibs)>0:
self.env.link_local_shlib(self.p_local_shlibs)
if len(self.p_local_staticlibs)>0:
self.env.link_local_staticlib(self.p_local_staticlibs)
# the target to return - no more self.env modification is allowed after this part
ret=None
if self.type=='shlib' or self.type=='kioslave':
ret=self.env.bksys_shlib(self.p_localtarget, self.p_localsource, self.instdir,
self.libprefix, self.vnum)
elif self.type=='program':
ret=self.env.Program(self.p_localtarget, self.p_localsource)
if not self.env.has_key('NOAUTOINSTALL'):
ins=self.env.bksys_install(self.instdir, ret)
if ins and self.perms:
for i in ins: self.env.AddPostAction(ins, self.env.Chmod(str(i), self.perms))
elif self.type=='staticlib':
ret=self.env.StaticLibrary(self.p_localtarget, self.p_localsource)
# we link the program against a shared library made locally, add the dependency
if len(self.p_local_shlibs)>0:
if ret: self.env.Depends( ret, self.p_local_shlibs )
if len(self.p_local_staticlibs)>0:
if ret: self.env.Depends( ret, self.p_local_staticlibs )
self.executed=1
## Copy function that honors symlinks
def copy_bksys(dest, source, env):
if os.path.islink(source):
#print "symlinking "+source+" "+dest
if os.path.islink(dest):
os.unlink(dest)
os.symlink(os.readlink(source), dest)
else:
shutil.copy2(source, dest)
st=os.stat(source)
os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
return 0
## Return a list of things
def make_list(env, s):
if type(s) is types.ListType: return s
else:
try: return s.split()
except AttributeError: return s
def join(lenv, s1, s2, s3=None, s4=None):
if s4 and s3: return lenv.join(s1, s2, lenv.join(s3, s4))
if s3 and s2: return lenv.join(s1, lenv.join(s2, s3))
elif not s2: return s1
# having s1, s2
#print "path1 is "+s1+" path2 is "+s2+" "+os.path.join(s1,string.lstrip(s2,'/'))
if not s1: s1="/"
return os.path.join(s1,string.lstrip(s2,'/'))
def exists(env):
return true
# record a dump of the environment
bks_dump='<?xml version="1.0" encoding="UTF-8"?>\n<bksys version="1">\n'
def add_dump(nenv, str):
global bks_dump
if str: bks_dump+=str
def get_dump(nenv):
if not nenv.has_key('DUMPCONFIG'):
nenv.pprint('RED','WARNING: trying to get a dump while DUMPCONFIG is not set - this will not work')
global bks_dump
return bks_dump+"</bksys>\n"
def generate(env):
## Bksys requires scons 0.96
env.EnsureSConsVersion(0, 96)
SConsEnvironment.pprint = pprint
SConsEnvironment.make_list = make_list
SConsEnvironment.join = join
SConsEnvironment.dist = dist
SConsEnvironment.getreldir = getreldir
SConsEnvironment.add_dump = add_dump
SConsEnvironment.get_dump = get_dump
env['HELP']=0
if '--help' in sys.argv or '-h' in sys.argv or 'help' in sys.argv: env['HELP']=1
if env['HELP']:
p=env.pprint
p('BOLD','*** Instructions ***')
p('BOLD','--------------------')
p('BOLD','* scons ','to compile')
p('BOLD','* scons -j4 ','to compile with several instances')
p('BOLD','* scons install ','to compile and install')
p('BOLD','* scons -c install','to uninstall')
p('BOLD','\n*** Generic options ***')
p('BOLD','--------------------')
p('BOLD','* debug ','debug=1 (-g) or debug=full (-g3, slower) else use environment CXXFLAGS, or -O2 by default')
p('BOLD','* prefix ','the installation path')
p('BOLD','* extraincludes','a list of paths separated by ":"')
p('BOLD','* scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local')
p('BOLD','* scons install prefix=/opt/local DESTDIR=/tmp/blah\n')
return
## Global cache directory
# Put all project files in it so a rm -rf cache will clean up the config
if not env.has_key('CACHEDIR'): env['CACHEDIR'] = env.join(os.getcwd(),'/cache/')
if not os.path.isdir(env['CACHEDIR']): os.mkdir(env['CACHEDIR'])
## SCons cache directory
# This avoids recompiling the same files over and over again:
# very handy when working with cvs
if os.getuid() != 0: env.CacheDir(os.getcwd()+'/cache/objects')
# Avoid spreading .sconsign files everywhere - keep this line
env.SConsignFile(env['CACHEDIR']+'/scons_signatures')
def makeHashTable(args):
table = { }
for arg in args:
if len(arg) > 1:
lst=arg.split('=')
if len(lst) < 2: continue
key=lst[0]
value=lst[1]
if len(key) > 0 and len(value) >0: table[key] = value
return table
env['ARGS']=makeHashTable(sys.argv)
SConsEnvironment.Chmod = SCons.Action.ActionFactory(os.chmod, lambda dest, mode: 'Chmod("%s", 0%o)' % (dest, mode))
## Special trick for installing rpms ...
env['DESTDIR']=''
if 'install' in sys.argv:
dd=''
if os.environ.has_key('DESTDIR'): dd=os.environ['DESTDIR']
if not dd:
if env['ARGS'] and env['ARGS'].has_key('DESTDIR'): dd=env['ARGS']['DESTDIR']
if dd:
env['DESTDIR']=dd
env.pprint('CYAN','** Enabling DESTDIR for the project ** ',env['DESTDIR'])
## install symlinks for shared libraries properly
env['INSTALL'] = copy_bksys
## Use the same extension .o for all object files
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
## no colors
if os.environ.has_key('NOCOLORS'): env['NOCOLORS']=1
## load the options
cachefile=env['CACHEDIR']+'generic.cache.py'
opts = Options(cachefile)
opts.AddOptions(
( 'GENCCFLAGS', 'C flags' ),
( 'BKS_DEBUG', 'debug level: full, trace, or just something' ),
( 'GENCXXFLAGS', 'additional cxx flags for the project' ),
( 'GENLINKFLAGS', 'additional link flags' ),
( 'PREFIX', 'prefix for installation' ),
( 'EXTRAINCLUDES', 'extra include paths for the project' ),
( 'ISCONFIGURED', 'is the project configured' ),
)
opts.Update(env)
# Use this to avoid an error message 'how to make target configure ?'
env.Alias('configure', None)
# Check if the following command line arguments have been given
# and set a flag in the environment to show whether or not it was
# given.
if 'install' in sys.argv: env['_INSTALL']=1
else: env['_INSTALL']=0
if 'configure' in sys.argv: env['_CONFIGURE']=1
else: env['_CONFIGURE']=0
# Configure the environment if needed
if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('ISCONFIGURED')):
# be paranoid, unset existing variables
for var in ['BKS_DEBUG', 'GENCXXFLAGS', 'GENCCFLAGS', 'GENLINKFLAGS', 'PREFIX', 'EXTRAINCLUDES', 'ISCONFIGURED', 'EXTRAINCLUDES']:
if env.has_key(var): env.__delitem__(var)
if env['ARGS'].get('debug', None):
env['BKS_DEBUG'] = env['ARGS'].get('debug', None)
env.pprint('CYAN','** Enabling debug for the project **')
else:
if os.environ.has_key('CXXFLAGS'):
# user-defined flags (gentooers will be elighted)
env['GENCXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] )
env.Append( GENCXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] )
else:
env.Append(GENCXXFLAGS = ['-O2', '-DNDEBUG', '-DNO_DEBUG'])
if os.environ.has_key('CFLAGS'): env['GENCCFLAGS'] = SCons.Util.CLVar( os.environ['CFLAGS'] )
## FreeBSD settings (contributed by will at freebsd dot org)
if os.uname()[0] == "FreeBSD":
if os.environ.has_key('PTHREAD_LIBS'):
env.AppendUnique( GENLINKFLAGS = SCons.Util.CLVar( os.environ['PTHREAD_LIBS'] ) )
else:
syspf = os.popen('/sbin/sysctl kern.osreldate')
osreldate = int(syspf.read().split()[1])
syspf.close()
if osreldate < 500016:
env.AppendUnique( GENLINKFLAGS = ['-pthread'])
env.AppendUnique( GENCXXFLAGS = ['-D_THREAD_SAFE'])
elif osreldate < 502102:
env.AppendUnique( GENLINKFLAGS = ['-lc_r'])
env.AppendUnique( GENCXXFLAGS = ['-D_THREAD_SAFE'])
else:
env.AppendUnique( GENLINKFLAGS = ['-pthread'])
# User-specified prefix
if env['ARGS'].has_key('prefix'):
env['PREFIX'] = os.path.abspath( env['ARGS'].get('prefix', '') )
env.pprint('CYAN','** installation prefix for the project set to:',env['PREFIX'])
# User-specified include paths
env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None)
if env['EXTRAINCLUDES']:
env.pprint('CYAN','** extra include paths for the project set to:',env['EXTRAINCLUDES'])
env['ISCONFIGURED']=1
# And finally save the options in the cache
opts.Save(cachefile, env)
def bksys_install(lenv, subdir, files, destfile=None, perms=None):
""" Install files on 'scons install' """
if not env['_INSTALL']: return
basedir = env['DESTDIR']
install_list=None
if not destfile: install_list = env.Install(lenv.join(basedir,subdir), lenv.make_list(files))
elif subdir: install_list = env.InstallAs(lenv.join(basedir,subdir,destfile), lenv.make_list(files))
else: install_list = env.InstallAs(lenv.join(basedir,destfile), lenv.make_list(files))
if perms and install_list: lenv.AddPostAction(install_list, lenv.Chmod(install_list, perms))
env.Alias('install', install_list)
return install_list
def build_la_file(target, source, env):
""" Writes a .la file, used by libtool """
dest=open(target[0].path, 'w')
sname=source[0].name
dest.write("# Generated by ltmain.sh - GNU libtool 1.5.18 - (pwn3d by bksys)\n#\n#\n")
if len(env['BKSYS_VNUM'])>0:
vnum=env['BKSYS_VNUM']
nums=vnum.split('.')
src=source[0].name
name = src.split('so.')[0] + 'so'
strn = src+" "+name+"."+str(nums[0])+" "+name
dest.write("dlname='%s'\n" % (name+'.'+str(nums[0])) )
dest.write("library_names='%s'\n" % (strn) )
else:
dest.write("dlname='%s'\n" % sname)
dest.write("library_names='%s %s %s'\n" % (sname, sname, sname) )
dest.write("old_library=''\ndependency_libs=''\ncurrent=0\n")
dest.write("age=0\nrevision=0\ninstalled=yes\nshouldnotlink=no\n")
dest.write("dlopen=''\ndlpreopen=''\n")
dest.write("libdir='%s'" % env['BKSYS_DESTDIR'])
dest.close()
return 0
def string_la_file(target, source, env):
print "building '%s' from '%s'" % (target[0].name, source[0].name)
la_file = env.Action(build_la_file, string_la_file, ['BKSYS_VNUM', 'BKSYS_DESTDIR'])
env['BUILDERS']['LaFile'] = env.Builder(action=la_file,suffix='.la',src_suffix=env['SHLIBSUFFIX'])
## Function for building shared libraries
def bksys_shlib(lenv, ntarget, source, libdir, libprefix='lib', vnum='', noinst=None):
""" Install a shared library.
Installs a shared library, with or without a version number, and create a
.la file for use by libtool.
If library version numbering is to be used, the version number
should be passed as a period-delimited version number (e.g.
vnum = '1.2.3'). This causes the library to be installed
with its full version number, and with symlinks pointing to it.
For example, for libfoo version 1.2.3, install the file
libfoo.so.1.2.3, and create symlinks libfoo.so and
libfoo.so.1 that point to it.
"""
# parameter can be a list
if type(ntarget) is types.ListType: target=ntarget[0]
else: target=ntarget
thisenv = lenv.Copy() # copying an existing environment is cheap
thisenv['BKSYS_DESTDIR']=libdir
thisenv['BKSYS_VNUM']=vnum
thisenv['SHLIBPREFIX']=libprefix
if len(vnum)>0:
thisenv['SHLIBSUFFIX']='.so.'+vnum
thisenv.Depends(target, thisenv.Value(vnum))
num=vnum.split('.')[0]
lst=target.split('/')
tname=lst[len(lst)-1]
libname=tname.split('.')[0]
thisenv.AppendUnique(LINKFLAGS = ["-Wl,--soname=%s.so.%s" % (libname, num)] )
# Fix against a scons bug - shared libs and ordinal out of range(128)
if type(source) is types.ListType:
src2=[]
for i in source: src2.append( str(i) )
source=src2
library_list = thisenv.SharedLibrary(target, source)
lafile_list = thisenv.LaFile(target, library_list)
## Install the libraries automatically
if not thisenv.has_key('NOAUTOINSTALL') and not noinst:
thisenv.bksys_install(libdir, library_list)
thisenv.bksys_install(libdir, lafile_list)
## Handle the versioning
if len(vnum)>0:
nums=vnum.split('.')
symlinkcom = ('cd $TARGET.dir && rm -f $TARGET.name && ln -s $SOURCE.name $TARGET.name')
tg = target+'.so.'+vnum
nm1 = target+'.so'
nm2 = target+'.so.'+nums[0]
thisenv.Command(nm1, tg, symlinkcom)
thisenv.Command(nm2, tg, symlinkcom)
thisenv.bksys_install(libdir, nm1)
thisenv.bksys_install(libdir, nm2)
return library_list
# Declare scons scripts to process
def subdirs(lenv, folderlist):
flist=lenv.make_list(folderlist)
for i in flist:
lenv.SConscript(lenv.join(i, 'SConscript'))
# take all objects - warn those who are not already executed
if lenv.has_key('USE_THE_FORCE_LUKE'):
for ke in lenv['USE_THE_FORCE_LUKE']:
if ke.executed: continue
#lenv.pprint('GREEN',"you forgot to execute object "+ke.target)
ke.lockworkdir()
ke.execute()
ke.unlockworkdir()
def link_local_shlib(lenv, str):
""" Links against a shared library made in the project """
lst = lenv.make_list(str)
for file in lst:
import re
reg=re.compile("(.*)/lib(.*).(la|so)$")
result=reg.match(file)
if not result:
reg = re.compile("(.*)/lib(.*).(la|so)\.(.)")
result=reg.match(file)
if not result:
print "Unknown la file given "+file
continue
dir = result.group(1)
link = result.group(2)
else:
dir = result.group(1)
link = result.group(2)
lenv.AppendUnique(LIBS = [link])
lenv.PrependUnique(LIBPATH = [dir])
def link_local_staticlib(lenv, str):
""" Links against a shared library made in the project """
lst = lenv.make_list(str)
for file in lst:
import re
reg = re.compile("(.*)/(lib.*.a)")
result = reg.match(file)
if not result:
print "Unknown archive file given "+file
continue
f=SCons.Node.FS.default_fs.File(file)
lenv.Append(LINKFLAGS=[f.path])
def set_build_dir(lenv, dirs, buildto):
lenv.SetOption('duplicate', 'soft-copy')
lenv['_BUILDDIR_']=buildto
ldirs=lenv.make_list(dirs)
for dir in ldirs:
lenv.BuildDir(buildto+os.path.sep+dir, dir)
#valid_targets = "program shlib kioslave staticlib".split()
SConsEnvironment.bksys_install = bksys_install
SConsEnvironment.bksys_shlib = bksys_shlib
SConsEnvironment.subdirs = subdirs
SConsEnvironment.link_local_shlib = link_local_shlib
SConsEnvironment.link_local_staticlib = link_local_staticlib
SConsEnvironment.genobj=genobj
SConsEnvironment.set_build_dir=set_build_dir
if env.has_key('GENCXXFLAGS'): env.AppendUnique( CPPFLAGS = env['GENCXXFLAGS'] )
if env.has_key('GENCCFLAGS'): env.AppendUnique( CCFLAGS = env['GENCCFLAGS'] )
if env.has_key('GENLINKFLAGS'): env.AppendUnique( LINKFLAGS = env['GENLINKFLAGS'] )
if env.has_key('BKS_DEBUG'):
if (env['BKS_DEBUG'] == "full"):
env.AppendUnique(CXXFLAGS = ['-DDEBUG', '-g3', '-Wall'])
elif (env['BKS_DEBUG'] == "trace"):
env.AppendUnique(
LINKFLAGS=env.Split("-lmrwlog4cxxconfiguration -lmrwautofunctiontracelog4cxx -finstrument-functions"),
CXXFLAGS=env.Split("-DDEBUG -Wall -finstrument-functions -g3 -O0"))
else:
env.AppendUnique(CXXFLAGS = ['-DDEBUG', '-g', '-Wall'])
if env.has_key('EXTRAINCLUDES'):
if env['EXTRAINCLUDES']:
incpaths = []
for dir in str(env['EXTRAINCLUDES']).split(':'): incpaths.append( dir )
env.Append(CPPPATH = incpaths)
env.Export('env')

@ -0,0 +1,884 @@
# Thomas Nagy, 2005 <tnagy2^8@yahoo.fr>
""" Run scons -h to display the associated help, or look below """
import os, re, types
from SCons.Script.SConscript import SConsEnvironment
# Returns the name of the shared object (eg: libkdeui.so.4)
# referenced by a libtool archive (like libkdeui.la)
def getSOfromLA(lafile):
contents = open(lafile, 'r').read()
match = re.search("^dlname='([^']*)'$", contents, re.M)
if match: return match.group(1)
return None
# A helper, needed .. everywhere
def KDEuse(lenv, flags):
if lenv['HELP']: lenv.Exit(0)
_flags=lenv.make_list(flags)
if 'environ' in _flags:
## The scons developers advise against using this but it is mostly innocuous :)
lenv.AppendUnique( ENV = os.environ )
if not 'lang_qt' in _flags:
## Use this define if you are using the kde translation scheme (.po files)
lenv.Append( CPPFLAGS = '-DQT_NO_TRANSLATION' )
if 'rpath' in _flags:
## Use this to set rpath - this may cause trouble if folders are moved (chrpath)
kdelibpaths=[]
if lenv['KDELIBPATH'] == lenv['KDELIB']: kdelibpaths = [lenv['KDELIB']]
else: kdelibpaths = [lenv['KDELIBPATH'], lenv['KDELIB']]
lenv.Append( RPATH = [lenv['QTLIBPATH'], lenv['KDEMODULE']]+kdelibpaths )
if 'thread' in _flags:
## Uncomment the following if you need threading support
lenv.KDEaddflags_cxx( ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] )
if 'fastmoc' in _flags:
lenv['BKSYS_FASTMOC']=1
if 'dump' in _flags:
lenv['DUMPCONFIG']=1
if not 'nohelp' in _flags:
if lenv['_CONFIGURE'] or lenv['HELP']: lenv.Exit(0)
if not 'nosmart' or not lenv.has_key('nosmart_includes'):
lenv.AppendUnique(CPPPATH=['#/'])
lst=[]
if lenv.has_key('USE_THE_FORCE_LUKE'):
lst=lenv['USE_THE_FORCE_LUKE']
lenv.__delitem__('USE_THE_FORCE_LUKE')
for v in lst: v.execute()
else: lenv['nosmart_includes']=1
## To use kdDebug(intvalue)<<"some trace"<<endl; you need to define -DDEBUG
## it is done in admin/generic.py automatically when you do scons configure debug=1
def exists(env):
return True
def detect_kde(env):
""" Detect the qt and kde environment using kde-config mostly """
def getpath(varname):
if not env.has_key('ARGS'): return None
v=env['ARGS'].get(varname, None)
if v: v=os.path.abspath(v)
return v
def getstr(varname):
if env.has_key('ARGS'): return env['ARGS'].get(varname, '')
return ''
prefix = getpath('prefix')
execprefix = getpath('execprefix')
datadir = getpath('datadir')
libdir = getpath('libdir')
kdedir = getstr('kdedir')
kdeincludes = getpath('kdeincludes')
kdelibs = getpath('kdelibs')
qtdir = getstr('qtdir')
qtincludes = getpath('qtincludes')
qtlibs = getpath('qtlibs')
libsuffix = getstr('libsuffix')
p=env.pprint
if libdir: libdir = libdir+libsuffix
## Detect the kde libraries
print "Checking for kde-config : ",
str="which kde-config 2>/dev/null"
if kdedir: str="which %s 2>/dev/null" % (kdedir+'/bin/kde-config')
kde_config = os.popen(str).read().strip()
if len(kde_config):
p('GREEN', 'kde-config was found as '+kde_config)
else:
if kdedir: p('RED','kde-config was NOT found in the folder given '+kdedir)
else: p('RED','kde-config was NOT found in your PATH')
print "Make sure kde is installed properly"
print "(missing package kdebase-devel?)"
env.Exit(1)
if kdedir: env['KDEDIR']=kdedir
else: env['KDEDIR'] = os.popen(kde_config+' -prefix').read().strip()
print "Checking for kde version : ",
kde_version = os.popen(kde_config+" --version|grep KDE").read().strip().split()[1]
if int(kde_version[0]) != 3 or int(kde_version[2]) < 2:
p('RED', kde_version)
p('RED',"Your kde version can be too old")
p('RED',"Please make sure kde is at least 3.2")
else:
p('GREEN',kde_version)
## Detect the qt library
print "Checking for the qt library : ",
if not qtdir: qtdir = os.getenv("QTDIR")
if qtdir:
p('GREEN',"qt is in "+qtdir)
else:
try:
tmplibdir = os.popen(kde_config+' --expandvars --install lib').read().strip()
libkdeuiSO = env.join(tmplibdir, getSOfromLA(env.join(tmplibdir,'/libkdeui.la')) )
m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2])
except: m=None
if m:
qtdir = m.group(1)
p('YELLOW',"qt was found as "+m.group(1))
else:
p('RED','qt was not found')
p('RED','Please set QTDIR first (/usr/lib/qt3?) or try scons -h for more options')
env.Exit(1)
env['QTDIR'] = qtdir.strip()
## Find the necessary programs uic and moc
print "Checking for uic : ",
uic = qtdir + "/bin/uic"
if os.path.isfile(uic):
p('GREEN',"uic was found as "+uic)
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
p('YELLOW',"uic was found as "+uic)
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
p('YELLOW',"uic was found as "+uic)
else:
p('RED',"uic was not found - set QTDIR put it in your PATH ?")
env.Exit(1)
env['QT_UIC'] = uic
print "Checking for moc : ",
moc = qtdir + "/bin/moc"
if os.path.isfile(moc):
p('GREEN',"moc was found as "+moc)
else:
moc = os.popen("which moc 2>/dev/null").read().strip()
if len(moc):
p('YELLOW',"moc was found as "+moc)
elif os.path.isfile("/usr/share/qt3/bin/moc"):
moc = "/usr/share/qt3/bin/moc"
p('YELLOW',"moc was found as "+moc)
else:
p('RED',"moc was not found - set QTDIR or put it in your PATH ?")
env.Exit(1)
env['QT_MOC'] = moc
## check for the qt and kde includes
print "Checking for the qt includes : ",
if qtincludes and os.path.isfile(qtincludes + "/qlayout.h"):
# The user told where to look for and it looks valid
p('GREEN',"ok "+qtincludes)
else:
if os.path.isfile(qtdir + "/include/qlayout.h"):
# Automatic detection
p('GREEN',"ok "+qtdir+"/include/")
qtincludes = qtdir + "/include/"
elif os.path.isfile("/usr/include/qt3/qlayout.h"):
# Debian probably
p('YELLOW','the qt headers were found in /usr/include/qt3/')
qtincludes = "/usr/include/qt3"
else:
p('RED',"the qt headers were not found")
env.Exit(1)
print "Checking for the kde includes : ",
kdeprefix = os.popen(kde_config+" --prefix").read().strip()
if not kdeincludes:
kdeincludes = kdeprefix+"/include/"
if os.path.isfile(kdeincludes + "/klineedit.h"):
p('GREEN',"ok "+kdeincludes)
else:
if os.path.isfile(kdeprefix+"/include/kde/klineedit.h"):
# Debian, Fedora probably
p('YELLOW',"the kde headers were found in %s/include/kde/"%kdeprefix)
kdeincludes = kdeprefix + "/include/kde/"
else:
p('RED',"The kde includes were NOT found")
env.Exit(1)
# kde-config options
kdec_opts = {'KDEBIN' : 'exe', 'KDEAPPS' : 'apps',
'KDEDATA' : 'data', 'KDEICONS' : 'icon',
'KDEMODULE' : 'module', 'KDELOCALE' : 'locale',
'KDEKCFG' : 'kcfg', 'KDEDOC' : 'html',
'KDEMENU' : 'apps', 'KDEXDG' : 'xdgdata-apps',
'KDEMIME' : 'mime', 'KDEXDGDIR' : 'xdgdata-dirs',
'KDESERV' : 'services','KDESERVTYPES' : 'servicetypes',
'KDEINCLUDE': 'include' }
if prefix:
## use the user-specified prefix
if not execprefix: execprefix=prefix