Browse Source

Added kstreamripper


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kstreamripper@1239912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
tags/v3.5.13
tpearson 8 years ago
commit
2e77c0b4ce

+ 2
- 0
AUTHORS View File

@@ -0,0 +1,2 @@
Michael Goettsche <mail@tuxipuxi.org>
William Entriken <william.entriken@villanova.edu>

+ 340
- 0
COPYING View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.

When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.

We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.

b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.

c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,

b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,

c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.

<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

+ 1
- 0
ChangeLog View File

@@ -0,0 +1 @@

+ 234
- 0
Doxyfile View File

@@ -0,0 +1,234 @@
# Doxyfile 1.3.3-Gideon

#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = kstreamripper.kdevelop
PROJECT_NUMBER = 0.1
OUTPUT_DIRECTORY =
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = /home/tuxipuxi/Documents/cpp/kde/kstreamripper
FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.idl \
*.odl \
*.cs \
*.php \
*.php3 \
*.inc \
*.C \
*.H \
*.tlh \
*.diff \
*.patch \
*.moc \
*.xpm \
*.dox
RECURSIVE = yes
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = yes
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO

+ 84
- 0
INSTALL View File

@@ -0,0 +1,84 @@
sctest REQUIREMENTS
------------------------

kde >= 3.2 is needed to run sctest

To compile sctest, the kde development packages
are needed: kdelibs-devel, kdebase-devel and python

scons is also needed http://www.scons.org
(this tool also used by Blender, ..)
Make sure scons is at least v0.96.1, otherwise
the compilation will fail. In case if you do not have
it, a minimum distribution is provided (see SCONS below)

-> One should only have to run :
$ scons
# scons install
(do "scons install" as root - the menus may not
show up if you skip this step)


SCONS
-----

-> If scons is missing, use the one bundled with PROGRAMNAME :
./unpack_local_scons.sh
python scons.py
python scons.py install
(run the last command as root)


-> For your convenience, a quick makefile is created :
./unpack_local_scons.sh
make
make install


USEFUL SCONS COMMANDS
---------------------

build the targets : scons
install them : scons install
clean the project : scons -c
uninstall : scons -c install
build in parallel : scons -j2

CONFIGURATION NOTES
-------------------

The installation scripts are relying on the kde-config program.
The programs kde-config, qmake, uic and moc must be accesssible
through your PATH.

Qt and kde may not be installed as expected (in QTDIR and KDEDIR)
So until kde-config is able to give that information, you may
have to give those paths.

Here are some examples :
On Fedora/Redhat
scons configure kdeincludes=/usr/include/kde/
On Debian
scons configure qtincludes=/usr/include/qt/ kdeinclude=/usr/include/kde/
To install in some particular location with additional include paths
scons configure prefix=~/tmp extraincludes=/tmp/include:/usr/local/include

For more options to tune the build look at the .py files available on
the top-level directory :
generic.py, kde.py, ...

The build system is based on bksys, a build system that replaces
autoconf, automake and make in a row. Feel free to report your opinion
about it to the authors.

BUILDING RPMS OR DEBS WITH CHECKINSTALL
---------------------------------------

With checkinstall 1.6, use
$ scons
# checkinstall --fstrans=no --nodoc scons install
# scons uninstall

---------------------------------------
enjoy KStreamRipper
Michael Goettsche

+ 20
- 0
Makefile View File

@@ -0,0 +1,20 @@
all:
@/usr/bin/scons -Q

# it is also possible to use
# @/usr/bin/scons -Q -j4

install:
@/usr/bin/scons -Q install

clean:
@/usr/bin/scons -Q -c

uninstall:
@/usr/bin/scons -Q -c install

dist:
@/usr/bin/scons -Q dist

distclean:
@/usr/bin/scons -Q distclean

+ 1
- 0
NEWS View File

@@ -0,0 +1 @@

+ 1
- 0
README View File

@@ -0,0 +1 @@
see INSTALL

+ 234
- 0
SConstruct View File

@@ -0,0 +1,234 @@
#! /usr/bin/env python
## The kde detection is located in kde.py (have a look!)
## Delete the comments following as you see it fit

"""
scons files are python scripts, comments begin by a "#" symbol
or are enclosed between sequences of triple quotes, so
this is a comment :)

There is a lot of documentation and comments, but you can
remove them when you convert your program
"""

"""
----------------------------------
How to enjoy bksys full and plenty
(and forget about the autohell ? :)
-----------------------------------

The program scons is usually launched as "scons"
When it is not intalled globally, one can run
"python scons.py" instead (ie : to use the local scons
that comes with bksys - try ./unpack_local_scons.sh)

To compile the project, you will then only need to launch
scons on the top-level directory, the scripts find and
cache the proper environment automatically :
-> scons
(or python scons.py)

To clean the project
-> scons -c
(or python scons.py -c)

To install the project
-> scons install
(or python scons.py scons install)

To uninstall the project
-> scons -c install

To compile while being in a subdirectory
-> cd src; scons -u

To (re)configure the project and give particular arguments, use ie :
-> scons configure debug=1
-> scons configure prefix=/tmp/ita debug=full extraincludes=/usr/local/include:/tmp/include prefix=/usr/local
or -> python scons.py configure debug=1
etc ..
The variables are saved automatically after the first run
(look at kde.cache.py, ..)

Here is a quick list of options used (look at generic.py and kde.py) :
prefix
exec_prefix
datadir
libdir
kdeincludes
qtincludes
kdelibs
qtlibs
extraincludes (a list of paths separated by ':')

"""

###########################################
## Common section, for loading the tools

## Load the builders in config
env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde'], toolpath=['./', './admin'])
#env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'cg'], toolpath=['./'])
#env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'sound'], toolpath=['./'])
#env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'libxml'], toolpath=['./'])

## the configuration should be done by now, quit
if 'configure' in COMMAND_LINE_TARGETS:
env.Exit(0)

"""
Overview of the module system :

Each module (kde.py, generic.py, sound.py..) tries to load a stored
configuration when run. If the stored configuration does not exist
or if 'configure' is given on the command line (scons configure),
the module launches the verifications and detectioins and stores
the results. Modules also call exit when the detection fail.

For example, kde.py stores its config into kde.cache.py

This has several advantages for both developers and users :
- Users do not have to run ./configure to compile
- The build is insensitive to environment changes
- The cache maintains the objects so the config can be changed often
- Each module adds its own help via env.Help("message")
"""

## Use the variables available in the environment - unsafe, but moc, meinproc need it :-/
import os
env.AppendUnique( ENV = os.environ )

## The target make dist requires the python module shutil which is in 2.3
env.EnsurePythonVersion(2, 3)

## Bksys requires scons 0.96
env.EnsureSConsVersion(0, 96)

"""
Explanation of the 'env = Environment...' line :
* the command line arguments and targets are stored in env['TARGS'] and env['ARGS'] for use by the tools
* the part 'tools=['default', 'generic ..' detect and load the necessary functions for doing the things
* the part "toolpath=['./']" tells that the tools can be found in the current directory (generic.py, kde.py ..)
"""

"""
To load more configuration modules one should only have to add the appropriate tool
ie: to detect alsa and add the proper cflags, ldflags ..
a file alsa.py file will be needed, and one should then use :
env = Environment(TARGS=COMMAND_LINE_TARGETS, ARGS=ARGUMENTS, tools=['default', 'generic', 'kde', 'alsa'], toolpath=['./'])

You can also load environments that are targetted to different platforms
ie: if os.sys.platform = "darwin":
env = Environment(...
elsif os.sys.platform = "linux":
env = Environment(...

"""

## Setup the cache directory - this avoids recompiling the same files over and over again
## this is very handy when working with cvs
env.CacheDir('cache')

## Avoid spreading .sconsign files everywhere - keep this line
env.SConsignFile('scons_signatures')

## If you need more libs and they rely on pkg-config
## ie: add support for GTK (source: the scons wiki on www.scons.org)
# env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')

"""
This tell scons that there are no rcs or sccs files - this trick
can speed up things a bit when having lots of #include
in the source code and for network file systems
"""
env.SourceCode(".", None)

dirs = [ '.', 'src', 'po', 'doc']

for dir in dirs:
env.SourceCode(dir, None)

## If we had only one program (named kvigor) to build,
## we could add before exporting the env (some kde
## helpers in kde.py need it) :
# env['APPNAME'] = 'kvigor'

## Use this define if you are using the kde translation scheme (.po files)
env.Append( CPPFLAGS = ['-DQT_NO_TRANSLATION'] )

## Add this define if you want to use qthreads
#env.Append( CPPFLAGS = ['-DQT_THREAD_SUPPORT', '-D_REENTRANT'] )

## To use kdDebug(intvalue)<<"some trace"<<endl; you need to define -DDEBUG - it is done
## in generic.py automatically when you do scons configure debug=1

## There are also many other defines :
### -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION
# where are they documented ? if you know, mail tnagyemail-mail@yahoo@fr please

## Important : export the environment so that SConscript files can the
## configuration and builders in it
Export("env")


####################################################
## Process the SConscript files to build the targets
## the sconscript files are comparable to Makefile.am_s
## except that no makefile is generated here :)

env.SConscript("src/SConscript")
env.SConscript("doc/SConscript")
env.SConscript("po/SConscript")

####################################################
## Quick helper to distribute the program

"""
'scons dist' creates a tarball named bksys-version.tar.bz2
containing the source code - this is handy
do not forget to remove the object files by scons -c
"""

### To make a tarball of your sctest
if 'dist' in COMMAND_LINE_TARGETS:

APPNAME = 'sctest'
VERSION = os.popen("cat VERSION").read().rstrip()
FOLDER = APPNAME+'-'+VERSION
ARCHIVE = FOLDER+'.tar.bz2'

GREEN ="\033[92m"
NORMAL ="\033[0m"

import shutil
import glob

## check if the temporary directory already exists
if os.path.isdir(FOLDER):
shutil.rmtree(FOLDER)

## create a temporary directory
startdir = os.getcwd()
shutil.copytree(startdir, FOLDER)

## remove the unnecessary files
os.popen("find "+FOLDER+" -name \"{arch}\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \".arch-ids\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \".arch-inventory\" | xargs rm -f")
os.popen("find "+FOLDER+" -name \"sconsign*\" | xargs rm -f")
os.popen("find "+FOLDER+" -name \"*cache*\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \"kdiss*-data\" | xargs rm -rf")
os.popen("find "+FOLDER+" -name \"*.pyc\" | xargs rm -f")
os.popen("rm -f "+FOLDER+"/config.py*")

## make the tarball
print GREEN+"Writing archive "+ARCHIVE+NORMAL
os.popen("tar cjf "+ARCHIVE+" "+FOLDER)

## remove the temporary directory
if os.path.isdir(FOLDER):
shutil.rmtree(FOLDER)

env.Default(None)
env.Exit(0)


+ 7
- 0
TODO View File

@@ -0,0 +1,7 @@
--TODO--

-implement stats widget
-implement filtering( just ripping a special artist/song )
-(receiving shoutcast list via web)


+ 161
- 0
admin/generic.py View File

@@ -0,0 +1,161 @@
## Thomas Nagy, 2005

"""
Detect and store the most common options
* kdecxxflags : debug=1 (-g) or debug=full (-g3, slower)
else use the user CXXFLAGS if any, - or -O2 by default
* prefix : the installation path
* extraincludes : a list of paths separated by ':'
ie: scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
"""

BOLD ="\033[1m"
RED ="\033[91m"
GREEN ="\033[92m"
YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
CYAN ="\033[96m"
NORMAL ="\033[0m"

import os

def exists(env):
return true

def generate(env):
env.Help("""
"""+BOLD+
"""*** Generic options ***
-----------------------"""+NORMAL+"""
"""+BOLD+"""* debug """+NORMAL+""": debug=1 (-g) or debug=full (-g3, slower) else use environment CXXFLAGS, or -O2 by default
"""+BOLD+"""* prefix """+NORMAL+""": the installation path
"""+BOLD+"""* extraincludes """+NORMAL+""": a list of paths separated by ':'
ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
"""+NORMAL)

## Bksys requires scons 0.96
env.EnsureSConsVersion(0, 96)
## 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'] = 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
env.CacheDir(os.getcwd()+'/cache/objects')

## Avoid spreading .sconsign files everywhere - keep this line
env.SConsignFile(env['CACHEDIR']+'/scons_signatures')
# Special trick for installing rpms ...
env['DESTDIR']=''
if 'install' in env['TARGS'] and os.environ.has_key('DESTDIR'):
env['DESTDIR']=os.environ['DESTDIR']+'/'
print CYAN+'** Enabling DESTDIR for the project ** ' + NORMAL + env['DESTDIR']

# load the options
from SCons.Options import Options, PathOption
cachefile=env['CACHEDIR']+'generic.cache.py'
opts = Options(cachefile)
opts.AddOptions(
( 'KDECCFLAGS', 'C flags' ),
( 'KDECXXFLAGS', 'debug level for the project : full or just anything' ),
( 'KDELINKFLAGS', '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)

import SCons.Util

# configure the environment if needed
if 'configure' in env['TARGS'] or not env.has_key('ISCONFIGURED'):
# be paranoid, unset existing variables
if env.has_key('KDECXXFLAGS'):
env.__delitem__('KDECXXFLAGS')
if env.has_key('KDECCFLAGS'):
env.__delitem__('KDECCFLAGS')
if env.has_key('KDELINKFLAGS'):
env.__delitem__('KDELINKFLAGS')
if env.has_key('PREFIX'):
env.__delitem__('PREFIX')
if env.has_key('EXTRAINCLUDES'):
env.__delitem__('EXTRAINCLUDES')
if env.has_key('ISCONFIGURED'):
env.__delitem__('ISCONFIGURED')

if env['ARGS'].get('debug', None):
debuglevel = env['ARGS'].get('debug', None)
print CYAN+'** Enabling debug for the project **' + NORMAL
if (debuglevel == "full"):
env['KDECXXFLAGS'] = ['-DDEBUG', '-g3']
else:
env['KDECXXFLAGS'] = ['-DDEBUG', '-g']
else:
if os.environ.has_key('CXXFLAGS'):
# user-defined flags (gentooers will be elighted)
env['KDECXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] )
env.Append( KDECXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] )
else:
env.Append(KDECXXFLAGS = ['-O2', '-DNDEBUG', '-DNO_DEBUG'])

if os.environ.has_key('CFLAGS'):
env['KDECCFLAGS'] = 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( KDELINKFLAGS = 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( KDELINKFLAGS = ['-pthread'])
env.AppendUnique( KDECXXFLAGS = ['-D_THREAD_SAFE'])
elif osreldate < 502102:
env.AppendUnique( KDELINKFLAGS = ['-lc_r'])
env.AppendUnique( KDECXXFLAGS = ['-D_THREAD_SAFE'])
else:
env.AppendUnique( KDELINKFLAGS = ['-pthread'])

# User-specified prefix
if env['ARGS'].get('prefix', None):
env['PREFIX'] = env['ARGS'].get('prefix', None)
print CYAN+'** set the installation prefix for the project : ' + env['PREFIX'] +' **'+ NORMAL
elif env.has_key('PREFIX'):
env.__delitem__('PREFIX')

# User-specified include paths
env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None)
if env['ARGS'].get('extraincludes', None):
print CYAN+'** set extra include paths for the project : ' + env['EXTRAINCLUDES'] +' **'+ NORMAL
elif env.has_key('EXTRAINCLUDES'):
env.__delitem__('EXTRAINCLUDES')

env['ISCONFIGURED']=1

# And finally save the options in the cache
opts.Save(cachefile, env)

if env.has_key('KDECXXFLAGS'):
env.AppendUnique( CPPFLAGS = env['KDECXXFLAGS'] )

if env.has_key('KDECCFLAGS'):
env.AppendUnique( CCFLAGS = env['KDECCFLAGS'] )

if env.has_key('KDELINKFLAGS'):
env.AppendUnique( LINKFLAGS = env['KDELINKFLAGS'] )

if env.has_key('EXTRAINCLUDES'):
incpaths = []
for dir in str(env['EXTRAINCLUDES']).split(':'):
incpaths.append( dir )
env.Append(CPPPATH = incpaths)


+ 683
- 0
admin/kde.py View File

@@ -0,0 +1,683 @@
#! /usr/bin/env python
# more or less derived from scons qt.py
# this version makes less scans over the data and is thus faster
# it is less accurate however (when mocable classes become unmocable)
# Thomas Nagy, 2004, 2005 <tnagy2^8@yahoo.fr>

from time import *
import SCons.Util
import string

import os, re

BOLD ="\033[1m"
RED ="\033[91m"
GREEN ="\033[92m"
YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
CYAN ="\033[96m"
NORMAL ="\033[0m"

# Returns the name of the shared object (i.e. 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

def exists(env):
return True

def detect_kde(env):
""" Detect the qt and kde environment using kde-config mostly """

prefix = env['ARGS'].get('prefix', None)
execprefix = env['ARGS'].get('execprefix', None)
datadir = env['ARGS'].get('datadir', None)
libdir = env['ARGS'].get('libdir', None)
kdeincludes= env['ARGS'].get('kdeincludes', None)
kdelibs = env['ARGS'].get('kdelibs', None)
qtincludes = env['ARGS'].get('qtincludes', None)
qtlibs = env['ARGS'].get('qtlibs', None)

## Detect the kde libraries
print "Checking for kde-config : ",
kde_config = os.popen("which kde-config 2>/dev/null").read().strip()
if len(kde_config):
print GREEN + "kde-config was found" + NORMAL
else:
print RED + "kde-config was NOT found in your PATH"+ NORMAL
print "Make sure kde is installed properly"
print "(missing package kdebase-devel?)"
env.Exit(1)
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:
print RED + kde_version
print RED + "Your kde version can be too old" + NORMAL
print RED + "Please make sure kde is at least 3.2" + NORMAL
else:
print GREEN + kde_version + NORMAL

## Detect the qt library
print "Checking for the qt library : ",
qtdir = os.getenv("QTDIR")
if qtdir:
print GREEN + "qt is in " + qtdir + NORMAL
else:
libdir = os.popen('kde-config --expandvars --install lib').read().strip()
libkdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libkdeui.la')
m = re.search('(.*)/lib/libqt.*', os.popen('ldd '+libkdeuiSO+' | grep libqt').read().strip().split()[2])
if m:
qtdir = m.group(1)
print YELLOW+"qt was found as " + m.group(1) + NORMAL
else:
print RED+"qt was not found"+NORMAL
print RED+"Please set QTDIR first (/usr/lib/qt3?)"+NORMAL
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):
print GREEN+"uic was found as "+uic+NORMAL
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
print YELLOW+"uic was found as "+uic+NORMAL
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
print YELLOW+"uic was found as "+uic+NORMAL
else:
print RED+"uic was not found - set QTDIR put it in your PATH ?"+NORMAL
env.Exit(1)
env['QT_UIC'] = uic

print "Checking for moc : ",
moc = qtdir + "/bin/moc"
if os.path.isfile(moc):
print GREEN+"moc was found as "+moc+NORMAL
else:
moc = os.popen("which moc 2>/dev/null").read().strip()
if len(moc):
print YELLOW+"moc was found as "+moc+NORMAL
elif os.path.isfile("/usr/share/qt3/bin/moc"):
moc = "/usr/share/qt3/bin/moc"
print YELLOW+"moc was found as "+moc+NORMAL
else:
print RED+"moc was not found - set QTDIR or put it in your PATH ?"+NORMAL
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
print GREEN+"ok "+qtincludes+NORMAL
else:
if os.path.isfile(qtdir + "/include/qlayout.h"):
# Automatic detection
print GREEN+"ok "+qtdir + "/include/ "+NORMAL
qtincludes = qtdir + "/include/"
elif os.path.isfile("/usr/include/qt3/qlayout.h"):
# Debian probably
print YELLOW+"the qt headers were found in /usr/include/qt3/ "+NORMAL
qtincludes = "/usr/include/qt3"
else:
print RED+"the qt headers were not found"+NORMAL
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"):
print GREEN+"ok "+kdeincludes+NORMAL
else:
if os.path.isfile(kdeprefix+"/include/kde/klineedit.h"):
# Debian, Fedora probably
print YELLOW+"the kde headers were found in "+kdeprefix+"/include/kde/"+NORMAL
kdeincludes = kdeprefix + "/include/kde/"
else:
print RED+"The kde includes were NOT found"+NORMAL
env.Exit(1)

if prefix:
## use the user-specified prefix
if not execprefix:
execprefix = prefix
if not datadir:
datadir = prefix+"/share"
if not libdir:
libdir = execprefix+"/lib"

subst_vars = lambda x: x.replace('${exec_prefix}',execprefix).replace('${datadir}',datadir).replace('${libdir}',libdir)
env['KDEBIN'] = subst_vars(os.popen('kde-config --install exe').read().strip())
env['KDEAPPS'] = subst_vars(os.popen('kde-config --install apps').read().strip())
env['KDEDATA'] = subst_vars(os.popen('kde-config --install data').read().strip())
env['KDEMODULE']= subst_vars(os.popen('kde-config --install module').read().strip())
env['KDELOCALE']= subst_vars(os.popen('kde-config --install locale').read().strip())
env['KDEDOC'] = subst_vars(os.popen('kde-config --install html').read().strip())
env['KDEKCFG'] = subst_vars(os.popen('kde-config --install kcfg').read().strip())
env['KDEXDG'] = subst_vars(os.popen('kde-config --install xdgdata-apps').read().strip())
env['KDEMENU'] = subst_vars(os.popen('kde-config --install apps').read().strip())
env['KDEMIME'] = subst_vars(os.popen('kde-config --install mime').read().strip())
env['KDEICONS'] = subst_vars(os.popen('kde-config --install icon').read().strip())
env['KDESERV'] = subst_vars(os.popen('kde-config --install services').read().strip())
else:
# the user has given no prefix, install as a normal kde app
env['PREFIX'] = os.popen('kde-config --prefix').read().strip()
env['KDEBIN'] = os.popen('kde-config --expandvars --install exe').read().strip()
env['KDEAPPS'] = os.popen('kde-config --expandvars --install apps').read().strip()
env['KDEDATA'] = os.popen('kde-config --expandvars --install data').read().strip()
env['KDEMODULE']= os.popen('kde-config --expandvars --install module').read().strip()
env['KDELOCALE']= os.popen('kde-config --expandvars --install locale').read().strip()
env['KDEDOC'] = os.popen('kde-config --expandvars --install html').read().strip()
env['KDEKCFG'] = os.popen('kde-config --expandvars --install kcfg').read().strip()
env['KDEXDG'] = os.popen('kde-config --expandvars --install xdgdata-apps').read().strip()
env['KDEMENU'] = os.popen('kde-config --expandvars --install apps').read().strip()
env['KDEMIME'] = os.popen('kde-config --expandvars --install mime').read().strip()
env['KDEICONS'] = os.popen('kde-config --expandvars --install icon').read().strip()
env['KDESERV'] = os.popen('kde-config --expandvars --install services').read().strip()

env['QTPLUGINS']=os.popen('kde-config --expandvars --install qtplugins').read().strip()

## kde libs and includes
env['KDEINCLUDEPATH']= kdeincludes
if not kdelibs:
kdelibs = os.popen('kde-config --expandvars --install lib').read().strip()
env['KDELIBPATH']= kdelibs

## qt libs and includes
env['QTINCLUDEPATH']= qtincludes
if not qtlibs:
qtlibs = qtdir+"/lib"
env['QTLIBPATH']= qtlibs

def mocscan(target, source, env):
splitext = SCons.Util.splitext

q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')

for obj in source:

if not obj.has_builder():
# binary obj file provided
continue

cpp = obj.sources[0]
if not splitext(str(cpp))[1] == '.cpp':
# not a cplusplus source
continue

# if we have a .ui file, it is automatically handled by Uic
uiname = string.split(cpp.abspath, '.cpp')[0] + ".ui"
if os.path.isfile(uiname):
continue

hname = splitext(cpp.name)[0] + ".h"
h = SCons.Node.FS.find_file(hname, (cpp.get_dir(),) )

if h:
# h file with the Q_OBJECT macro found -> add .moc file
mocfile = string.split(cpp.abspath, '.cpp')[0] + ".moc"
# trick : check if the moc file already exists (avoid a scan)
if os.path.isfile(mocfile):
env.Moc(h)
elif q_object_search.search(h.get_contents()):
# FIXME : strong assumption
env.Moc(h)

return (target, source)

def generate(env):

import SCons.Defaults
import SCons.Tool
env.Help("""
"""+BOLD+
"""*** KDE options ***
-------------------"""+NORMAL+"""
"""+BOLD+"""* prefix """+NORMAL+""": base install path, ie: /usr/local
"""+BOLD+"""* execprefix """+NORMAL+""": install path for binaries, ie: /usr/bin
"""+BOLD+"""* datadir """+NORMAL+""": install path for the data, ie: /usr/local/share
"""+BOLD+"""* libdir """+NORMAL+""": install path for the libs, ie: /usr/lib
"""+BOLD+"""* kdeincludes"""+NORMAL+""": path to the kde includes (/usr/include/kde on debian, ...)
"""+BOLD+"""* qtincludes """+NORMAL+""": same punishment, for qt includes (/usr/include/qt on debian, ...)
"""+BOLD+"""* kdelibs """+NORMAL+""": path to the kde libs, for linking the programs
"""+BOLD+"""* qtlibs """+NORMAL+""": same punishment, for qt libraries
ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
"""+NORMAL)
CLVar = SCons.Util.CLVar
splitext = SCons.Util.splitext
Builder = SCons.Builder.Builder
# Detect the environment - replaces ./configure implicitely
# and store the options into a cache
from SCons.Options import Options
cachefile=env['CACHEDIR']+'/kde.cache.py'
opts = Options(cachefile)
opts.AddOptions(
( 'QTDIR', 'root of qt directory' ),
( 'QTLIBPATH', 'path to the qt libraries' ),
( 'QTINCLUDEPATH', 'path to the qt includes' ),
( 'QT_UIC', 'moc directory'),
( 'QT_MOC', 'moc executable command'),
( 'QTPLUGINS', 'uic executable command'),
( 'KDEDIR', 'root of kde directory' ),
( 'KDELIBPATH', 'path to the kde libs' ),
( 'KDEINCLUDEPATH', 'path to the kde includes' ),

( 'PREFIX', 'root of the program installation'),

( 'KDEBIN', 'installation path of the kde binaries'),
( 'KDEMODULE', 'installation path of the parts and libs'),
( 'KDEAPPS', ''),
( 'KDEDATA', 'installation path of the application data'),
( 'KDELOCALE', ''),
( 'KDEDOC', 'installation path of the application documentation'),
( 'KDEKCFG', 'installation path of the .kcfg files'),
( 'KDEXDG', 'installation path of the service types'),
( 'KDEMENU', ''),
( 'KDEMIME', 'installation path of to the mimetypes'),
( 'KDEICONS', ''),
( 'KDESERV', ''),
)
opts.Update(env)

# reconfigure when things are missing
if 'configure' in env['TARGS'] or not env.has_key('QTDIR') or not env.has_key('KDEDIR'):
detect_kde(env)

# finally save the configuration
opts.Save(cachefile, env)

## set default variables, one can override them in sconscript files
env.Append(CXXFLAGS = ['-I'+env['KDEINCLUDEPATH'], '-I'+env['QTINCLUDEPATH'] ])
env.Append(LIBPATH = [env['KDELIBPATH'], env['QTLIBPATH'] ])
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
env['QT_AUTOSCAN'] = 1
env['QT_DEBUG'] = 0
env['QT_UIC_HFLAGS'] = '-L $QTPLUGINS -nounload'
env['QT_UIC_CFLAGS'] = '$QT_UIC_HFLAGS -tr tr2i18n'
env['QT_LIBS'] = 'qt-mt'
env['LIBTOOL_FLAGS'] = '--silent --mode=compile --tag=CXX'
env['QT_UICIMPLPREFIX'] = ''
env['QT_UICIMPLSUFFIX'] = '.cpp'
env['QT_MOCHPREFIX'] = ''
env['QT_MOCHSUFFIX'] = '.moc'
env['KDE_KCFG_IMPLPREFIX'] = ''
env['KDE_KCFG_IMPL_HSUFFIX'] = '.h'
env['KDE_KCFG_IMPL_CSUFFIX'] = '.cpp'
env['KDE_SKEL_IMPL_SUFFIX'] = '.skel'
env['MEINPROC'] = 'meinproc'
env['MSGFMT'] = 'msgfmt'


###### ui file processing
def uicGenerator(target, source, env, for_signature):
act=[]
act.append('$QT_UIC $QT_UIC_HFLAGS -o '+target[0].path+' '+source[0].path)
act.append('rm -f ' +target[1].path)
act.append('echo \'#include <klocale.h>\' >> '+target[1].path)
act.append('echo \'#include <kdialog.h>\' >> '+target[1].path)
act.append('$QT_UIC $QT_UIC_CFLAGS -impl '+target[0].path+' -o '+target[1].path+'.tmp '+source[0].path)
act.append('cat '+target[1].path+'.tmp >> '+target[1].path)
act.append('rm -f '+target[1].path+'.tmp')
act.append('echo \'#include "' + target[2].name + '"\' >> '+target[1].path)
act.append('$QT_MOC -o '+target[2].path+' '+target[0].path)
return act
def uicEmitter(target, source, env):
adjustixes = SCons.Util.adjustixes
bs = SCons.Util.splitext(str(source[0].name))[0]
bs = os.path.join(str(target[0].get_dir()),bs)
# first target is automatically added by builder (.h file)
if len(target) < 2:
# second target is .cpp file
target.append(adjustixes(bs,
env.subst('$QT_UICIMPLPREFIX'),
env.subst('$QT_UICIMPLSUFFIX')))
if len(target) < 3:
# third target is .moc file
target.append(adjustixes(bs,
env.subst('$QT_MOCHPREFIX'),
env.subst('$QT_MOCHSUFFIX')))
return target, source
UIC_BUILDER = Builder(
generator = uicGenerator,
emitter = uicEmitter,
suffix = '.h',
src_suffix = '.ui' )
###### moc file processing
env['QT_MOCCOM'] = ('$QT_MOC -o ${TARGETS[0]} $SOURCE')
MOC_BUILDER = Builder(
action = '$QT_MOCCOM',
suffix = '.moc',
src_suffix = '.h' )
MOCCPP_BUILDER = Builder(
action = '$QT_MOCCOM',
suffix = '_moc.cpp',
src_suffix = '.h' )
###### kcfg file processing
def kcfgGenerator(target, source, env, for_signature):
act=[]
act.append('kconfig_compiler -d'+str(source[0].get_dir())+' '+source[1].path+' '+source[0].path)
return act
def kcfgEmitter(target, source, env):
adjustixes = SCons.Util.adjustixes
bs = SCons.Util.splitext(str(source[0].name))[0]
bs = os.path.join(str(target[0].get_dir()),bs)
# first target is automatically added by builder (.h file)
if len(target) < 2:
# second target is .cpp file
target.append(adjustixes(bs, env.subst('$KDE_KCFG_IMPLPREFIX'), env.subst('$KDE_KCFG_IMPL_CSUFFIX')))
if len(source) <2:
kcfgfilename = os.popen("cat "+str(source[0])+"|grep File|sed 's/File.*=//i'").read().rstrip()
source.append( str(source[0].get_dir())+'/'+kcfgfilename )
return target, source

KCFG_BUILDER = Builder(
generator = kcfgGenerator,
emitter = kcfgEmitter,
suffix = '.h',
src_suffix = '.kcfgc' )
###### dcop processing
def dcopGenerator(target, source, env, for_signature):
act=[]
act.append('dcopidl '+source[0].path+' > '+target[1].path+'|| ( rm -f '+target[1].path+' ; false )')
act.append('dcopidl2cpp --c++-suffix cpp --no-signals --no-stub '+target[1].path)
return act

def dcopEmitter(target, source, env):
bs = SCons.Util.splitext(str(source[0].name))[0]
bs = os.path.join(str(target[0].get_dir()),bs)
target.append(bs+'.kidl')
#target.append(bs+'_skel.cpp')
return target, source

DCOP_BUILDER = Builder(
generator = dcopGenerator,
emitter = dcopEmitter,
suffix = '_skel.cpp',
src_suffix = '.h' )

###### documentation (meinproc) processing
MEINPROC_BUILDER = Builder(
action = '$MEINPROC --check --cache $TARGET $SOURCE',
suffix = '.cache.bz2',
src_suffix = '.docbook' )

###### translation files builder
TRANSFILES_BUILDER = Builder(
action = '$MSGFMT $SOURCE -o $TARGET',
suffix = '.gmo',
src_suffix = '.po' )

###### libtool file builder
def laGenerator(target, source, env, for_signature):
act=[]
act.append('echo "dlname=\''+source[0].name+'\'" > '+target[0].path)
act.append('echo "library_names=\''+source[0].name+' '+source[0].name+' '+source[0].name+'\'" >> '+target[0].path)
act.append('echo "old_library=\'\'">> '+target[0].path)
act.append('echo "dependency_libs=\'\'">> '+target[0].path)
act.append('echo "current=0">> '+target[0].path)
act.append('echo "age=0">> '+target[0].path)
act.append('echo "revision=0">> '+target[0].path)
act.append('echo "installed=yes">> '+target[0].path)
act.append('echo "shouldnotlink=no">> '+target[0].path)
act.append('echo "dlopen=\'\'">> '+target[0].path)
act.append('echo "dlpreopen=\'\'">> '+target[0].path)
act.append('echo "libdir=\''+env['KDEMODULE']+'\'" >> '+target[0].path)
return act
LA_BUILDER = Builder(
generator = laGenerator,
suffix = '.la',
src_suffix = '.so' )
##### register the builders
env['BUILDERS']['Uic'] = UIC_BUILDER
env['BUILDERS']['Moc'] = MOC_BUILDER
env['BUILDERS']['Moccpp'] = MOCCPP_BUILDER
env['BUILDERS']['Dcop'] = DCOP_BUILDER
env['BUILDERS']['Kcfg'] = KCFG_BUILDER
env['BUILDERS']['LaFile'] = LA_BUILDER
env['BUILDERS']['Meinproc'] = MEINPROC_BUILDER
env['BUILDERS']['Transfiles'] = TRANSFILES_BUILDER

static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
static_obj.src_builder.append('Uic')
shared_obj.src_builder.append('Uic')
static_obj.src_builder.append('Kcfg')
shared_obj.src_builder.append('Kcfg')
static_obj.src_builder.append('LaFile')
shared_obj.src_builder.append('LaFile')
static_obj.src_builder.append('Meinproc')
shared_obj.src_builder.append('Meinproc')
static_obj.src_builder.append('Transfiles')
shared_obj.src_builder.append('Transfiles')

## find the files to moc, dcop, and link against kde and qt
env.AppendUnique(PROGEMITTER=[mocscan], SHLIBEMITTER=[mocscan], LIBEMITTER =[mocscan])

###########################################
## Handy helpers for building kde programs
## You should not have to modify them ..

#import SCons.Util
skel_ext = [".skel", ".SKEL"]
def KDEfiles(lenv, target, source):
""" Returns a list of files for scons (handles kde tricks like .skel)
It also makes custom checks against double includes like : ['file.ui', 'file.cpp']
(file.cpp is already included because of file.ui) """

src=[]
ui_files=[]
kcfg_files=[]
skel_files=[]
other_files=[]

# For each file, check wether it is a dcop file or not, and create the complete list of sources
for file in source:
bs = SCons.Util.splitext(file)[0]
ext = SCons.Util.splitext(file)[1]
if ext in skel_ext:
lenv.Dcop(bs+'.h')
src.append(bs+'_skel.cpp')
elif ext == ".moch":
lenv.Moccpp(bs+'.h')
src.append(bs+'_moc.cpp')
else:
src.append(file)

if ext == '.ui':
ui_files.append(bs)
elif ext == '.kcfgc':
kcfg_files.append(bs)
elif ext == '.skel':
skel_files.append(bs)
else:
other_files.append(bs)
return src

"""
In the future, these functions will contain the code that will dump the
configuration for re-use from an IDE
"""
import glob
def KDEinstall(lenv, restype, subdir, files):
if not 'install' in env['TARGS']:
return
basedir=env['DESTDIR']
if len(restype)>0:
if not lenv.has_key(restype):
print RED+"unknown resource type "+restype+NORMAL
else:
basedir += lenv[restype]+'/'
#print file # <- useful to trace stuff :)
install_list = env.Install(basedir+subdir, files)
env.Alias('install', install_list)
return install_list

def KDEinstallas(lenv, restype, destfile, file):
if not 'install' in env['TARGS']:
return
basedir=env['DESTDIR']
if len(restype)>0:
if not lenv.has_key(restype):
print RED+"unknown resource type "+restype+NORMAL
else:
basedir += lenv[restype]+'/'
install_list = env.InstallAs(basedir+destfile, file)
env.Alias('install', install_list)
return install_list

def KDEprogram(lenv, target, source):
""" Makes a kde program
The program is installed except if one sets env['NOAUTOINSTALL'] """
src = KDEfiles(lenv, target, source)
program_list = lenv.Program(target, src)
if not lenv.has_key('NOAUTOINSTALL'):
KDEinstall(lenv, 'KDEBIN', '', target)
return program_list

def KDEshlib(lenv, target, source, kdelib=0):
""" Makes a shared library for kde (.la file for klibloader)
The library is installed except if one sets env['NOAUTOINSTALL'] """
src = KDEfiles(lenv, target, source)
library_list = lenv.SharedLibrary(target, src)
lafile_list = lenv.LaFile(target, library_list)
if not lenv.has_key('NOAUTOINSTALL'):
install_dir = 'KDEMODULE'
if kdelib==1:
install_dir = 'KDELIBPATH'
KDEinstall(lenv, install_dir, '', library_list)
KDEinstall(lenv, install_dir, '', lafile_list)
return library_list

def KDEstaticlib(lenv, target, source):
""" Makes a static library for kde - in practice you should not use static libraries
1. they take more memory than shared ones
2. makefile.am needed it because of limitations
(cannot handle sources in separate folders - takes extra processing) """
src = KDEfiles(lenv, target, source)
return lenv.StaticLibrary(target, src)
# do not install static libraries by default

def KDEaddflags_cxx(lenv, fl):
""" Compilation flags for C++ programs """
lenv.AppendUnique(CXXFLAGS = fl)

def KDEaddflags_c(lenv, fl):
""" Compilation flags for C programs """
lenv.AppendUnique(CFLAGS = fl)

def KDEaddflags_link(lenv, fl):
""" Add link flags - Use this if KDEaddlibs below is not enough """
lenv.AppendUnique(LINKFLAGS = fl)

def KDEaddlibs(lenv, libs):
""" Helper function """
lenv.AppendUnique(LIBS = libs)

def KDEaddpaths_includes(lenv, paths):
""" Add new include paths """
lenv.AppendUnique(CPPPATH = paths)

def KDEaddpaths_libs(lenv, paths):
""" Add paths to libraries """
lenv.AppendUnique(LIBPATH = paths)

def KDElang(lenv, folder, appname):
""" Process translations (.po files) in a po/ dir """
transfiles = glob.glob(folder+'/*.po')
for lang in transfiles:
result = lenv.Transfiles(lang)
country = SCons.Util.splitext(result[0].name)[0]
KDEinstallas(lenv, 'KDELOCALE', country+'/LC_MESSAGES/'+appname+'.mo', result)

def KDEicon(lenv, icname):
""" Emulates the behaviour of Makefile.am to install icons
Contributed by: "Andrey Golovizin" <grooz@gorodok@net> """
type_dic = { 'action' : 'actions', 'app' : 'apps', 'device' :
'devices', 'filesys' : 'filesystems', 'mime' : 'mimetypes' }
dir_dic = {
'los' :'locolor/16x16',
'lom' :'locolor/32x32',
'him' :'hicolor/32x32',
'hil' :'hicolor/48x48',
'lo16' :'locolor/16x16',
'lo22' :'locolor/22x22',
'lo32' :'locolor/32x32',
'hi16' :'hicolor/16x16',
'hi22' :'hicolor/22x22',
'hi32' :'hicolor/32x32',
'hi48' :'hicolor/48x48',
'hi64' :'hicolor/64x64',
'hi128':'hicolor/128x128',
'hisc' :'hicolor/scalable',
'cr16' :'crystalsvg/16x16',
'cr22' :'crystalsvg/22x22',
'cr32' :'crystalsvg/32x32',
'cr48' :'crystalsvg/48x48',
'cr64' :'crystalsvg/64x64',
'cr128':'crystalsvg/128x128',
'crsc' :'crystalsvg/scalable'
}

import glob
iconfiles = []
for ext in ['png', 'xpm', 'mng', 'svg', 'svgz']:
files = glob.glob('*-*-%s.%s' % (icname, ext))
iconfiles += files
for iconfile in iconfiles:
tmp = iconfile.split('-')
if len(tmp) != 3:
print RED + 'WARNING: icon filename has unknown format: ' + iconfile + NORMAL
continue
[icon_dir, icon_type, icon_filename] = tmp
try:
destfile = '%s/%s/%s/%s' % (lenv['KDEICONS'], dir_dic[icon_dir], type_dic[icon_type], icon_filename)
except KeyError:
print RED + 'WARNING: unknown icon type: ' + iconfile + NORMAL
continue
## do not use KDEinstallas here, as parsing from an ide will be necessary
if 'install' in env['TARGS']:
env.Alias('install', env.InstallAs( env['DESTDIR']+'/'+destfile, iconfile ) )

# Attach the functions to the environment so that sconscripts can use them
from SCons.Script.SConscript import SConsEnvironment
SConsEnvironment.KDEprogram = KDEprogram
SConsEnvironment.KDEshlib = KDEshlib
SConsEnvironment.KDEstaticlib = KDEstaticlib
SConsEnvironment.KDEinstall = KDEinstall
SConsEnvironment.KDEinstallas = KDEinstallas
SConsEnvironment.KDElang = KDElang
SConsEnvironment.KDEicon = KDEicon

SConsEnvironment.KDEaddflags_cxx = KDEaddflags_cxx
SConsEnvironment.KDEaddflags_c = KDEaddflags_c
SConsEnvironment.KDEaddflags_link = KDEaddflags_link
SConsEnvironment.KDEaddlibs = KDEaddlibs
SConsEnvironment.KDEaddpaths_includes = KDEaddpaths_includes
SConsEnvironment.KDEaddpaths_libs = KDEaddpaths_libs

+ 83
- 0
doc/SConscript View File

@@ -0,0 +1,83 @@
#! /usr/bin/env python
## This script demonstrates to build and install
## the documentation of a kde program with scons
##
## Thomas Nagy, 2005

## This file can be reused freely for any project (see COPYING)

## First load the environment set in the top-level SConstruct file
Import( 'env' )
myenv=env.Copy()

## The following looks complicated but it is not
## We first define a function to install all files as documentation
## The documentation is of course lying in subfolders from here
## * normal files are installed under KDEDOC/destination
## * meinproc files are not installed, but processed into a single
## index.cache.bz2 which is installed afterwards

## This is far more maintainable to have *one* file than
## having lots of almost empty SConscript in several folders

import os
import sys
import glob
import SCons.Util

## Define this to 1 if you are writing documentation else to 0 :)
i_am_a_documentation_writer = 0

## This function uses env imported above
def processfolder(folder, lang, destination=""):
# folder is the folder to process
# lang is the language
# destination is the subdirectory in KDEDOC
docfiles = glob.glob(folder+"/???*.*") # file files that are at least 4 chars wide :)

# warn about errors
#if len(lang) != 2:
# print "error, lang must be a two-letter string, like 'en'"

# when the destination is not given, use the folder
if len(destination) == 0:
destination=folder
docbook_list = []
for file in docfiles:

# do not process folders
if not os.path.isfile(file):
continue
# do not process the cache file
if file == 'index.cache.bz2':
continue
# ignore invalid files (TODO??)
if len( SCons.Util.splitext( file ) ) <= 1 :
continue

ext = SCons.Util.splitext( file )[1]
# docbook files are processed by meinproc
if ext == '.docbook':
docbook_list.append( file )
continue

myenv.KDEinstall('KDEDOC', lang+'/'+destination, file)

# Now process the index.docbook files ..
if len(docbook_list) == 0:
return
if not os.path.isfile( folder+'index.docbook' ):
print "Error, index.docbook was not found in "+folder+'/index.docbook'
return
if i_am_a_documentation_writer:
for file in docbook_list:
myenv.Depends( folder+'index.cache.bz2', file )
myenv.Meinproc( folder+'/index.cache.bz2', folder+'/index.docbook' )
myenv.KDEinstall( 'KDEDOC', lang+'/'+destination, folder+'/index.cache.bz2' )

## Use processfolder for each documentation directory
processfolder('en/', 'en')


+ 101
- 0
doc/en/index.docbook View File

@@ -0,0 +1,101 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.0//EN" "dtd/kdex.dtd" [
<!ENTITY kappname "&KStreamRipper;">
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE" > <!-- change language only here -->
]>
<!-- Important note: please use template.docbook instead of this file.
This is only the conversion of app.sgml into DocBook SGML.
template.docbook gives you more information on what you can and
should do. Thanks. -->

<book lang="&language;">

<bookinfo>
<title>The KStreamRipper Handbook</title>
<authorgroup>
<author>
<firstname></firstname>
<surname>Michael Goettsche</surname>
<affiliation><address><email>mail&#64;tuxipuxi&#46;de</email></address></affiliation>
</author>
</authorgroup>
<date>date</date>
<releaseinfo>0&#46;1</releaseinfo>
<abstract>
<para>SHORT DESCRIPTION GOES HERE</para>
</abstract>
<keywordset>
<keyword>KDE</keyword>
<keyword>KStreamRipper</keyword>
</keywordset>
</bookinfo>

<chapter id="introduction">
<title>Introduction</title>

<sect1 id="features">
<title>Features</title>
<para></para>
</sect1>
</chapter>

<chapter id="installation">
<title>Installation</title>

<sect1 id="how-to-obtain-KStreamRipper">
<title>How to obtain KStreamRipper</title>
<para></para>
</sect1>

<sect1 id="requirements">
<title>Requirements</title>
<para></para>
</sect1>

<sect1 id="compilation-and-installation">
<title>Compilation and Installation</title>

<para>Compiling KStreamRipper is very easy. The following should do
it: <screen>
<prompt>%</prompt> <userinput><command>./configure</command></userinput>
<prompt>%</prompt> <userinput><command>make</command></userinput>
<prompt>%</prompt> <userinput><command>make</command> install</userinput></screen>
</para>

<para>That should do it! Should you run into any problems,
please report them to the <ulink
url="mailto:mail&#64;tuxipuxi&#46;de">author</ulink></para>
</sect1>
</chapter>

<chapter id="using-KStreamRipper">
<title>Using KStreamRipper</title>
<para></para>
</chapter>

<chapter id="questionsanswersandtips">
<title>Questions, Answers, and Tips</title>

<qandaset id="faq">
<title>Frequently asked questions</title>
<qandaentry>
<question>
<para>Question 1</para>
</question>
<answer>
<para>The answer</para>
</answer>
</qandaentry>
</qandaset>

</chapter>
</book>
<!--
Local Variables:
mode: sgml
sgml-omittag: nil
sgml-shorttag: t
sgml-general-insert-case: lower
End:
-->

+ 816
- 0
kde.py View File

@@ -0,0 +1,816 @@
# Made from scons qt.py and (heavily) modified into kde.py
# Thomas Nagy, 2004, 2005 <tnagy2^8@yahoo.fr>

"""
Run scons -h to display the associated help, or look below ..
"""

BOLD ="\033[1m"
RED ="\033[91m"
GREEN ="\033[92m"
YELLOW ="\033[1m" #"\033[93m" # unreadable on white backgrounds
CYAN ="\033[96m"
NORMAL ="\033[0m"

import os, re

# Returns the name of the shared object (i.e. 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

def exists(env):
return True

def detect_kde(env):
""" Detect the qt and kde environment using kde-config mostly """

prefix = env['ARGS'].get('prefix', None)
execprefix = env['ARGS'].get('execprefix', None)
datadir = env['ARGS'].get('datadir', None)
libdir = env['ARGS'].get('libdir', None)
libsuffix = env['ARGS'].get('libsuffix', '')
kdeincludes = env['ARGS'].get('kdeincludes', None)
kdelibs = env['ARGS'].get('kdelibs', None)
qtincludes = env['ARGS'].get('qtincludes', None)
qtlibs = env['ARGS'].get('qtlibs', None)

if libdir:
libdir = libdir+libsuffix

## Detect the kde libraries
print "Checking for kde-config : ",
kde_config = os.popen("which kde-config 2>/dev/null").read().strip()
if len(kde_config):
print GREEN+"kde-config was found"+NORMAL
else:
print RED+"kde-config was NOT found in your PATH"+NORMAL
print "Make sure kde is installed properly"
print "(missing package kdebase-devel?)"
env.Exit(1)
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]
try:
env['KDEm1']=int(kde_version[0])
except:
pass
try:
env['KDEm2']=int(kde_version[2])
except:
pass
try:
env['KDEm3']=int(kde_version[4])
except:
pass
if int(kde_version[0]) != 3 or int(kde_version[2]) < 2:
print RED+kde_version
print RED+"Your kde version can be too old"+NORMAL
print RED+"Please make sure kde is at least 3.2"+NORMAL
else:
print GREEN+kde_version+NORMAL

## Detect the qt library
print "Checking for the qt library : ",
qtdir = os.getenv("QTDIR")
if qtdir:
print GREEN+"qt is in "+qtdir+NORMAL
else:
libdir = os.popen('kde-config --expandvars --install lib').read().strip()
libkdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libkdeui.la')
m = re.search('(.*)/lib/libqt.*', os.popen('ldd ' + libkdeuiSO + ' | grep libqt').read().strip().split()[2])
if m:
qtdir = m.group(1)
print YELLOW+"qt was found as "+m.group(1)+NORMAL
else:
print RED+"qt was not found"+NORMAL
print RED+"Please set QTDIR first (/usr/lib/qt3?)"+NORMAL
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):
print GREEN+"uic was found as "+uic+NORMAL
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
print YELLOW+"uic was found as "+uic+NORMAL
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
print YELLOW+"uic was found as "+uic+NORMAL
else:
print RED+"uic was not found - set QTDIR put it in your PATH ?"+NORMAL
env.Exit(1)
env['QT_UIC'] = uic

print "Checking for moc : ",
moc = qtdir + "/bin/moc"
if os.path.isfile(moc):
print GREEN + "moc was found as " + moc + NORMAL
else:
moc = os.popen("which moc 2>/dev/null").read().strip()
if len(moc):
print YELLOW + "moc was found as " + moc + NORMAL
elif os.path.isfile("/usr/share/qt3/bin/moc"):
moc = "/usr/share/qt3/bin/moc"
print YELLOW + "moc was found as " + moc + NORMAL