Re: CinePaint SCons and cons

"H. S. Teoh" <[email protected]> Tue, 25 Mar 2008 15:57:52 -0700
Newsgroups gmane.comp.video.cinepaint.devel
Message-ID <[email protected]>
On Sun, Mar 23, 2008 at 10:12:37PM -0800, Robin Rowe wrote:
> Teoh,
>
> CC-ing to the list to keep in the loop.
>
>> I haven't gone very far beyond building the cinepaint binary itself
>> (without plugins), but if you like, I can send you the patch for what
>> I have currently.
>
> Steady progress is good progress. Send SCons patch.

OK, attached.

Note that there are still a lot of hackish stuff in it, 'cos I haven't
managed to get it to parse autoconf's output yet.

Speaking of which... is there any reason we set config.cache to
/dev/null? It's probably the easiest way to integrate SCons with the
current configure script.

Once you apply the patch, if you have SCons installed, you can simply
type 'scons' and it should build everything. (Well, just the app binary,
I haven't gotten to the plugins yet.) I tried running the resultant
binary, but didn't get very far -- it crashed after not finding some
required plugins, it seems. :-)

Note: if you have a multicore/multi-cpu machine, you can take advantage
of SCons' native parallel build support. E.g., try running `scons -j8`.
(If I did my job right, SCons should always build things in the right
order regardless of how much it has been parallelized.)


> There's nothing you're doing that could break CVS, right?

Nope, SCons uses completely separate files for the build (just
SConstruct and a bunch of SConscript's in the subdirs).


> Do you want CVS access? I'd need your SourceForge login name.

quickfur


>> Take a look at cons 2.2.0. 
>
> I took a look. 3,300 lines of code. Clearly written, a little tricky
> in  places. Not a monster.

OK, maybe you'll be successful at resurrecting Cons. :-)


> How do I do autotools-like configuration in cons? How do I create
> config.h and test for existence of libs, includes, and functions?
> pkg_config?

AFAIK, there isn't a way to do this in Cons.

SCons does have its own version of autoconf functionality, but I don't
think it's anywhere near the level of doing what cinepaint's configure
script does right now.


> Is there another OSS project of similar complexity somewhere using
> cons that I can look to as a good example?
[...]

You could try asking the cons-discuss list. I heard that several large
commercial projects use it, but I don't know off-hand of any OSS project
that do, though there must be some!


--T

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Cinepaint-developers mailing list
Cinepaint-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cinepaint-developers
scons-patch-2008-03-25b.diff (text/x-diff, 12.8 KB)
diff -Nru ../cinepaint.ORIG/app/depth/SConscript ./app/depth/SConscript
--- ../cinepaint.ORIG/app/depth/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./app/depth/SConscript	2008-02-29 09:42:52.000000000 -0800
@@ -0,0 +1,53 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+Import('*')
+
+lib_env = env.Clone()	# TBD: is this necessary?
+
+lib_env.StaticLibrary('depth', Split("""
+	bezier_select.c
+	boundary.c
+	brightness_contrast.c
+	brush_select.c
+	brushgenerated.c
+	channel.c
+	color_balance.c
+	color_picker.c
+	color_select.c
+	colormaps.c
+	commands.c
+	curves.c
+	desaturate.c
+	displaylut.c
+	dodgeburn.c
+	equalize.c
+	float16.c
+	free_select.c
+	gamma_expose.c
+	histogram.c
+	hue_saturation.c
+	image_render.c
+	info_window.c
+	invert.c
+	layer.c
+	levels.c
+	paint_core_16.c
+	paint_funcs_area.c
+	paint_funcs_row_float.c
+	paint_funcs_row_float16.c
+	paint_funcs_row_u16.c
+	paint_funcs_row_u8.c
+	paint_funcs_row_bfp.c
+	plug_in.c
+	posterize.c
+	tag.c
+	text_tool.c
+	threshold.c
+	trace.c
+	transform_core.c
+	xcf.c
+"""))
+
diff -Nru ../cinepaint.ORIG/app/SConscript ./app/SConscript
--- ../cinepaint.ORIG/app/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./app/SConscript	2008-03-25 15:29:22.000000000 -0700
@@ -0,0 +1,174 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+Import('*')
+
+SConscript('depth/SConscript')
+
+# FIXME: TBD
+precision='123'
+localedir='/usr/lib/locale'
+linux='linux'
+cppflags = '-DPRECISION_CONFIG=' + precision +	\
+	'-DLOCALEDIR="' + localedir + '"' +	\
+	'-DLINUX=' + linux +			\
+	'-DREGEX_MALLOC'
+
+# NOTE: the following is a hack, since we can't seem to make linking multiple
+# libraries into one to work, so we list them all here.
+libs = Split("""
+	depth
+	cinepaint
+	cinepaint_fl_i18n
+	cinepaintHalf
+	wire
+""")
+
+app_env = env.Clone(
+	LINK = env['CXX']		# some libraries require C++, so use
+					# C++ compiler to link
+)
+app_env.Append(
+	CPPFLAGS = cppflags,
+	LIBS = libs,
+	LIBPATH = ['#lib', 'depth']	# FIXME: should import these
+)
+
+
+# TBD: install stuff from buttons/ somewhere
+
+# Main program
+app_env.Program('cinepaint', Split("""
+	about_dialog.c
+	actionarea.c
+	airbrush.c
+	app_procs.c
+	asupsample.c
+	base_frame_manager.c
+	batch.c
+	blend.c
+	brush.c
+	brush_edit.c
+	brushlist.c
+	bucket_fill.c
+	bugs_dialog.c
+	buildmenu.c
+	by_color_select.c
+	canvas.c
+	channel_cmds.c
+	channel_ops.c
+	channels_dialog.c
+	clone.c
+	cms.c
+	color_area.c
+	color_correction.c
+	color_correction_gui.c
+	color_panel.c
+	color_transfer.c
+	convert.c
+	convolve.c
+	crop.c
+	cursorutil.c
+	datafiles.c
+	devices.c
+	disp_callbacks.c
+	dnd.c
+	draw_core.c
+	drawable.c
+	drawable_cmds.c
+	edit_cmds.c
+	edit_selection.c
+	ellipse_select.c
+	eraser.c
+	errors.c
+	expose_image.c
+	filename.c
+	fileops.c
+	flatbuf.c
+	flip_tool.c
+	floating_sel.c
+	floating_sel_cmds.c
+	frac.c
+	fuzzy_select.c
+	gdisplay.c
+	gdisplay_cmds.c
+	gdisplay_ops.c
+	general.c
+	gimage.c
+	gimage_cmds.c
+	gimage_mask.c
+	gimage_mask_cmds.c
+	global_edit.c
+	gradient.c
+	gtk_debug_helpers.c
+	gtkhwrapbox.c
+	gtkvwrapbox.c
+	gtkwrapbox.c
+	gximage.c
+	histogram_tool.c
+	image_map.c
+	indexed_palette.c
+	info_dialog.c
+	install.c
+	interface.c
+	internal_procs.c
+	iscissors.c
+	layer_cmds.c
+	layer_select.c
+	layers_dialog.c
+	layout.c
+	list.c
+	look_profile.c
+	magnify.c
+	main.c
+	measure.c
+	minimize.c
+	move.c
+	noise.c
+	object.c
+	ops_buttons.c
+	paintbrush.c
+	palette.c
+	pattern_select.c
+	patterns.c
+	pencil.c
+	perspective_tool.c
+	pixel_region.c
+	pixelarea.c
+	pixelrow.c
+	plugin_loader.c
+	procedural_db.c
+	rc.c
+	rect_select.c
+	resize.c
+	rotate_tool.c
+	scale.c
+	scale_tool.c
+	scroll.c
+	selection.c
+	shear_tool.c
+	shmbuf.c
+	signal_type.c
+	smudge.c
+	spline.c
+	store_frame_manager.c
+	temp_buf.c
+	tile.c
+	tile_cache.c
+	tile_manager.c
+	tile_swap.c
+	tilebuf.c
+	tips_dialog.c
+	tool_options.c
+	tools.c
+	transform_tool.c
+	undo.c
+	undo_cmds.c
+	vector2d.c
+	zoom.c
+	zoombookmark.c
+	menus.c
+"""))
+
diff -Nru ../cinepaint.ORIG/data/brushes/SConscript ./data/brushes/SConscript
--- ../cinepaint.ORIG/data/brushes/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./data/brushes/SConscript	2008-02-28 16:22:49.000000000 -0800
@@ -0,0 +1,108 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+import os
+
+
+Import('*')
+brushdata = os.path.join(programdatadir, 'brushes')
+
+# FIXME: TBD
+#
+#env.Install(brushdata, Split("""
+#	10x10square.gbr
+#	10x10squareBlur.gbr
+#	11circle.gbr
+#	11fcircle.gbr
+#	13circle.gbr
+#	13fcircle.gbr
+#	15circle.gbr
+#	15fcircle.gbr
+#	17circle.gbr
+#	17fcircle.gbr
+#	19circle.gbr
+#	19fcircle.gbr
+#	1circle.gbr
+#	20x20square.gbr
+#	20x20squareBlur.gbr
+#	3circle.gbr
+#	3fcircle.gbr
+#	5circle.gbr
+#	5fcircle.gbr
+#	5x5square.gbr
+#	5x5squareBlur.gbr
+#	7circle.gbr
+#	7fcircle.gbr
+#	9circle.gbr
+#	9fcircle.gbr
+#	callig1.gbr
+#	callig2.gbr
+#	callig3.gbr
+#	callig4.gbr
+#	confetti.gbr
+#	dunes.gbr
+#	galaxy.gbr
+#	galaxy_big.gbr
+#	galaxy_small.gbr
+#	pixel.gbr
+#	thegimp.gbr
+#	xcf.gbr
+#	10x10square16.gbr
+#	10x10squareBlur16.gbr
+#	11circle16.gbr
+#	13circle16.gbr
+#	15circle16.gbr
+#	17circle16.gbr
+#	19circle16.gbr
+#	1circle16.gbr
+#	20x20square16.gbr
+#	20x20squareBlur16.gbr
+#	3circle16.gbr
+#	5circle16.gbr
+#	5x5square16.gbr
+#	5x5squareBlur16.gbr
+#	7circle16.gbr
+#	9circle16.gbr
+#	callig116.gbr
+#	callig216.gbr
+#	callig316.gbr
+#	callig416.gbr
+#	confetti16.gbr
+#	dunes16.gbr
+#	galaxy16.gbr
+#	galaxy_big16.gbr
+#	galaxy_small16.gbr
+#	pixel16.gbr
+#	thegimp16.gbr
+#	xcf16.gbr
+#	10x10squaref16.gbr
+#	10x10squareBlurf16.gbr
+#	11circlef16.gbr
+#	13circlef16.gbr
+#	15circlef16.gbr
+#	17circlef16.gbr
+#	19circlef16.gbr
+#	1circlef16.gbr
+#	20x20squaref16.gbr
+#	20x20squareBlurf16.gbr
+#	3circlef16.gbr
+#	5circlef16.gbr
+#	5x5squaref16.gbr
+#	5x5squareBlurf16.gbr
+#	7circlef16.gbr
+#	9circlef16.gbr
+#	callig1f16.gbr
+#	callig2f16.gbr
+#	callig3f16.gbr
+#	callig4f16.gbr
+#	confettif16.gbr
+#	dunesf16.gbr
+#	galaxyf16.gbr
+#	galaxy_bigf16.gbr
+#	galaxy_smallf16.gbr
+#	pixelf16.gbr
+#	thegimpf16.gbr
+#	xcff16.gbr
+#"""))
diff -Nru ../cinepaint.ORIG/data/curves/SConscript ./data/curves/SConscript
--- ../cinepaint.ORIG/data/curves/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./data/curves/SConscript	2008-02-28 19:48:46.000000000 -0800
@@ -0,0 +1,12 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+import os
+
+
+Import('*')
+
+# FIXME: TBD: install these files in target directory
+
diff -Nru ../cinepaint.ORIG/data/gradients/SConscript ./data/gradients/SConscript
--- ../cinepaint.ORIG/data/gradients/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./data/gradients/SConscript	2008-02-28 20:18:27.000000000 -0800
@@ -0,0 +1,12 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+import os
+
+
+Import('*')
+
+# FIXME: TBD: install these files in target directory
+
diff -Nru ../cinepaint.ORIG/data/palettes/SConscript ./data/palettes/SConscript
--- ../cinepaint.ORIG/data/palettes/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./data/palettes/SConscript	2008-02-28 20:18:21.000000000 -0800
@@ -0,0 +1,12 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+import os
+
+
+Import('*')
+
+# FIXME: TBD: install these files in target directory
+
diff -Nru ../cinepaint.ORIG/data/patterns/SConscript ./data/patterns/SConscript
--- ../cinepaint.ORIG/data/patterns/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./data/patterns/SConscript	2008-02-28 19:50:01.000000000 -0800
@@ -0,0 +1,12 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+import os
+
+
+Import('*')
+
+# FIXME: TBD: install these files in target directory
+
diff -Nru ../cinepaint.ORIG/data/SConscript ./data/SConscript
--- ../cinepaint.ORIG/data/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./data/SConscript	2008-02-28 19:50:43.000000000 -0800
@@ -0,0 +1,16 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+Import('*')
+
+SConscript(Split("""
+	brushes/SConscript
+	curves/SConscript
+	gradients/SConscript
+	palettes/SConscript
+	patterns/SConscript
+"""))
+
+# SUBDIRS = brushes curves gradients palettes patterns
diff -Nru ../cinepaint.ORIG/lib/fl_i18n/SConscript ./lib/fl_i18n/SConscript
--- ../cinepaint.ORIG/lib/fl_i18n/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./lib/fl_i18n/SConscript	2008-03-25 15:30:24.000000000 -0700
@@ -0,0 +1,20 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+Import('*')
+
+local_env = env.Clone()
+
+# Retrieve fltk config
+local_env.ParseConfig('fltk-config --cxxflags')
+
+# TBD: need to optionally define USE_THREADS macro
+
+libfli18n = env.StaticLibrary('cinepaint_fl_i18n', Split("""
+	fl_i18n_cinepaint.cxx
+	fl_i18n.cxx
+"""))
+
+env.Install(lib_subdir, libfli18n)
diff -Nru ../cinepaint.ORIG/lib/SConscript ./lib/SConscript
--- ../cinepaint.ORIG/lib/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./lib/SConscript	2008-02-29 09:52:21.000000000 -0800
@@ -0,0 +1,63 @@
+#!/usr/bin/scons -u
+#
+# CinePaint SCons subsidiary script
+#
+
+Import('*')
+
+SConscript(Split("""
+	wire/SConscript
+	fl_i18n/SConscript
+"""))
+
+libenv = env.Clone()
+
+# FIXME!!!!!!!!!!!!
+# We cannot directly put libwire and libcinepaint_fl_i18n into the following
+# line, because SCons passes them directly to ar and you get opaque .a files in
+# the library instead of a merged library. But this begs the question... do we
+# need these intermediate .a's? Are they there just to work around Make's
+# bogonity?  If so, we should just collect all the objects and link them all
+# explicitly here.
+#
+#libenv.Append(
+#	LIBS = ['wire', 'cinepaint_fl_i18n']
+#)
+
+# TBD: Need a way to generate version.h
+# Maybe, we'll let autoconf do that for now.
+
+libenv.StaticLibrary('cinepaint', Split("""
+	chain.xpm
+	chainbutton.c	
+	channel.c
+	channelops_pdb.c
+	convert_pdb.c
+	dialog.c
+	display.c
+	drawable.c
+	edit_pdb.c
+	export.c
+	fileops_pdb.c
+	gradient.c
+	guides_pdb.c
+	helpui.c
+	image.c
+	image_convert.c
+	image_pdb.c
+	matrix.c
+	menu.c
+	palette.c
+	pixelrgn.c
+	pixmap.c
+	player.c
+	plugin_main.c
+	plugin_pdb.c
+	selection_pdb.c
+	size_entry.c
+	undo_pdb.c
+	unit.c
+	unit_pdb.c
+	unitmenu.c
+	widgets.c
+"""))
diff -Nru ../cinepaint.ORIG/libgimp/SConscript ./libgimp/SConscript
--- ../cinepaint.ORIG/libgimp/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./libgimp/SConscript	2008-02-28 16:19:18.000000000 -0800
@@ -0,0 +1,8 @@
+#!/usr/bin/scons
+#
+# CinePaint SCons construction script
+#
+
+Import('*')
+
+# TBD: need to install these headers somewhere?
diff -Nru ../cinepaint.ORIG/libhalf/SConscript ./libhalf/SConscript
--- ../cinepaint.ORIG/libhalf/SConscript	1969-12-31 16:00:00.000000000 -0800
+++ ./libhalf/SConscript	2008-02-28 20:49:29.000000000 -0800
@@ -0,0 +1,30 @@
+#!/usr/bin/scons
+#
+# CinePaint SCons subsidiary script
+#
+
+Import('*')
+
+# TBD: FIXME
+versioninfo = '1:2:3'
+
+local_env = env.Clone(
+	CPPPATH = '#config',
+)
+
+# TBD: need to install headers somewhere?
+
+
+# Is this supposed to be static or dynamic??
+local_env.StaticLibrary('cinepaintHalf', Split("""
+	half.cpp
+	cinepaint_half.cpp
+"""))
+
+local_env.Program('eLut', 'eLut.cpp')
+local_env.Command('eLut.h', 'eLut', "./eLut > $TARGET.file", chdir=1)
+
+local_env.Program('toFloat', 'toFloat.cpp')
+local_env.Command('toFloat.h', 'toFloat', "./toFloat > $TARGET.file", chdir=1)
+
+local_env.Install(lib_subdir, 'libcinepaintHalf.a')
diff -Nru ../cinepaint.ORIG/SConstruct ./SConstruct
--- ../cinepaint.ORIG/SConstruct	1969-12-31 16:00:00.000000000 -0800
+++ ./SConstruct	2008-03-25 15:17:50.000000000 -0700
@@ -0,0 +1,64 @@
+#!/usr/bin/scons
+#
+# CinePaint SCons construction script
+#
+
+import string
+import subprocess
+from distutils import sysconfig
+
+
+# Configuration
+#
+# - For now, we parse config.log to get the settings found by the configure
+#   script.
+
+# FIXME
+pythonpfx = ''
+
+# FIXME: the following hacks should be replaced with a proper configuration
+# mechanism.
+cflags = '-DDATADIR=\\"/usr/data\\" -DDOTDIR=\\"/usr/dot\\"' \
+         + ' -DPREFIX=\\"/usr\\" -DVERSION=\\"1.2.3\\"' \
+         + ' -DPACKAGE=\\"cinepaint\\"' \
+	 + ' -DPYTHONDIR=\\"' \
+	 + sysconfig.get_python_lib(0,0,prefix=pythonpfx) + '\\"'
+
+programdatadir = '#tmp/data'	# FIXME: TBD
+
+# Location of lib subdir
+# TBD: should move temporary .a's to saner place
+lib_subdir = Dir('#lib')
+Export('lib_subdir')
+
+env = Environment(
+	CFLAGS = cflags,
+	CPPPATH = ['#', '#app', '#lib']
+)
+
+# Fetch GTK configuration parameters
+env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
+env.ParseConfig('pkg-config lcms --libs')
+
+Export('env programdatadir')
+
+SConscript(Split("""
+	libhalf/SConscript
+	lib/SConscript
+	libgimp/SConscript
+	app/SConscript
+	po/SConscript
+	data/SConscript
+"""))
+
+#SConscript(Split("""
+#	libhalf/SConscript
+#	lib/SConscript
+#	libgimp/SConscript
+#	plug-ins/SConscript
+#	app/SConscript
+#	po/SConscript
+#	po-plug-ins/SConscript
+#	po-script-fu/SConscript
+#	data/SConscript
+#"""))