head	1.15;
access;
symbols
	start:1.1.1.1
	salsaman:1.1.1;
locks; strict;
comment	@# @;


1.15
date	2008.11.16.18.09.47;	author gfinch;	state Exp;
branches;
next	1.14;

1.14
date	2008.09.03.19.15.18;	author gfinch;	state Exp;
branches;
next	1.13;

1.13
date	2008.06.11.08.08.37;	author gfinch;	state Exp;
branches;
next	1.12;

1.12
date	2007.06.29.17.18.14;	author gfinch;	state Exp;
branches;
next	1.11;

1.11
date	2007.06.18.21.00.12;	author gfinch;	state Exp;
branches;
next	1.10;

1.10
date	2006.11.23.05.09.38;	author gfinch;	state Exp;
branches;
next	1.9;

1.9
date	2006.01.28.20.58.15;	author gfinch;	state Exp;
branches;
next	1.8;

1.8
date	2005.07.23.17.08.46;	author gfinch;	state Exp;
branches;
next	1.7;

1.7
date	2005.04.03.22.12.48;	author gfinch;	state Exp;
branches;
next	1.6;

1.6
date	2005.04.02.19.10.24;	author gfinch;	state Exp;
branches;
next	1.5;

1.5
date	2005.03.31.01.18.41;	author gfinch;	state Exp;
branches;
next	1.4;

1.4
date	2005.01.02.02.43.52;	author gfinch;	state Exp;
branches;
next	1.3;

1.3
date	2004.12.01.21.53.35;	author gfinch;	state Exp;
branches;
next	1.2;

1.2
date	2004.12.01.18.51.45;	author gfinch;	state Exp;
branches;
next	1.1;

1.1
date	2004.09.19.04.06.47;	author gfinch;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2004.09.19.04.06.47;	author gfinch;	state Exp;
branches;
next	;


desc
@@


1.15
log
@update plugin builder
@
text
@#!/usr/bin/perl


# build-lives-rfx-plugin-multi - Copyright G. Finch (salsaman) 2005
# Released under the GPL 3 or later - see file COPYING or www.gnu.org for details


#########################################################

my ($dir_extra)="/lives/plugins/effects/";
my ($home_dir_extra)="/.lives-dir/plugins/effects/";
my ($builder)="build-lives-rfx-plugin";
my ($type)="builtin"; # default

#########################################################

my ($scripts_dir);
my ($exec_dir);
my ($builder_location);

if (defined $ARGV[0]) {
    $type=$ARGV[0];
}

if (defined $ARGV[1]) {
    $scripts_dir=$ARGV[1];
}

if (defined $ARGV[2]) {
    $exec_dir=$ARGV[2];
}

if (defined $ARGV[3]) {
    $build_bindir=$ARGV[3];
}

if (!defined($scripts_dir)) {
#get <tempdir>
    `smogrify get_tempdir rfx_builder`;
    open IN,"< /tmp/.smogrify.rfx_builder";
    read IN,$tmpdir,512;
    close IN;
    unlink "/tmp/.smogrify.rfx_builder";
    
    if ($tmpdir eq "") {
	$tmpdir="/tmp";
    }
    
    
# check we have the plugin builder
    `smogrify get_location $builder rfx builder`;
    open IN,"< $tmpdir/.smogval.rfx.builder";
    read IN,$builder_location,512;
    close IN;
    unlink "$tmpdir/.smogval.rfx.builder";
    
    if ($builder_location eq "") {
	print "Unable to locate $builder. Exiting.\n";
	exit 3;
    }
    
    
    if ($type eq "builtin") {
# get the prefix_dir from ~/.lives
	`smogrify get_pref prefix_dir rfx builder`;
	open IN,"< $tmpdir/.smogval.rfx.builder";
	read IN,$dir,512;
	close IN;
	unlink "$tmpdir/.smogval.rfx.builder";
	chomp($dir);
	$scripts_dir="$dir/share";
	$exec_dir="$dir/lib";  # guessing
   }
    else {
	$scripts_dir=$ENV{"HOME"};
	chomp($scripts_dir);
	$exec_dir=$scripts_dir;
    }
}



if ($type eq "builtin") {
    $scripts_dir.=$dir_extra;
    $indir=$scripts_dir."RFXscripts/";
    unlink <$indir/*~>;
    $exec_dir.=$dir_extra;
    $outdir=$exec_dir."rendered/";
}
elsif ($type eq "custom") {
    $scripts_dir.=$home_dir_extra;
    $indir=$scripts_dir."RFXscripts/custom/";
    unlink <$indir/*~>;
    $exec_dir.=$home_dir_extra;
    $outdir=$exec_dir."rendered/custom/";
}
elsif ($type eq "test") {
    $scripts_dir.=$home_dir_extra;
    $indir=$scripts_dir."RFXscripts/test/";
    unlink <$indir/*~>;
    $exec_dir.=$home_dir_extra;
    $outdir=$exec_dir."rendered/test/";
}
elsif ($type eq "builtinx") {
    $indir=$scripts_dir;
    $outdir=$exec_dir;
    print "got $scripts_dir $exec_dir\n";
    unlink <$indir/*~>;
}

else {
    print "error: unknown RFX type\n";
    exit 1;
}

print "Deleting scripted plugins from $outdir\n";
&remove_scripted_plugins($outdir);

print "Building all in $indir\n";


`/bin/mkdir -p $outdir`;

opendir DIR,$indir;
while ($plugin=readdir(DIR)) {
    unless ($plugin =~ /^\./) {
	print "building $indir$plugin \n";
	if (defined $build_bindir) {
	    system("$build_bindir/build-lives-rfx-plugin $indir$plugin $outdir");
	}
	else {
	    system("build-lives-rfx-plugin $indir$plugin $outdir");
	}
    }
}
close DIR;

exit 0;

######################################################################

sub remove_scripted_plugins {
    # remove only plugins with properties&0x8000, and "broken" plugins
    my ($outdir)=@@_;
    my ($file);
    opendir DIR,$outdir;
    while ($file=readdir(DIR)) {
	unless ($file =~ /^\./) {
	    if (-x "$outdir$file") {
		my ($fx_caps)=`$outdir$file get_capabilities`;
		if ($fx_caps&0x8000||$fx_caps eq "") {
		    unlink "$outdir$file";
		}
	    }
	}
    }
    closedir DIR;
}


sub location {
    # return the location of an executable
    my ($command)=@@_;
    my ($location)=`which $command 2>/dev/null`;
    chomp($location);
    $location;
}
@


1.14
log
@small fixes
@
text
@d104 7
@


1.13
log
@share to lib changes
@
text
@d77 1
a77 1
	$exec_dir=$script_dir;
@


1.12
log
@update to gpl 3; other fixes
@
text
@d17 2
a18 1
my ($dir);
d26 1
a26 1
    $dir=$ARGV[1];
d30 1
a30 1
    $build_bindir=$ARGV[2];
d33 5
a37 1
if (!defined($dir)) {
d71 2
a72 1
	$dir.="/share";
d75 3
a77 2
	$dir=$ENV{"HOME"};
	chomp($dir);
d84 2
a85 2
    $dir.=$dir_extra;
    $indir=$dir."RFXscripts/";
d87 2
a88 1
    $outdir=$dir."rendered/";
d91 2
a92 2
    $dir.=$home_dir_extra;
    $indir=$dir."RFXscripts/custom/";
d94 2
a95 1
    $outdir=$dir."rendered/custom/";
d98 2
a99 2
    $dir.=$home_dir_extra;
    $indir=$dir."RFXscripts/test/";
d101 2
a102 1
    $outdir=$dir."rendered/test/";
@


1.11
log
@rfx-builder fix mkdir
@
text
@d5 1
a5 1
# Released under the GPL 2.0 or higher - see file COPYING or www.gnu.org for details
@


1.10
log
@updates + license update
@
text
@d105 1
a105 2
$mkdirhier=&location("mkdirhier");
`$mkdirhier $outdir`;
@


1.9
log
@RFX spec updates
@
text
@d5 1
a5 1
# Released under the GPL 2.0 - see file COPYING or www.gnu.org for details
@


1.8
log
@make sure all files have license/copyright
@
text
@d11 1
d67 1
a67 1
    }
a73 3
$dir.=$dir_extra;


d77 1
d83 1
d89 1
@


1.7
log
@update
@
text
@d3 5
@


1.6
log
@RFX string_list part 2
@
text
@d35 1
a35 3
	# TODO - run smogrify report HOME and try again
	print "You must run lives-exe and then check the value of <prefix_dir> in ~/.lives\n before you can use this routine.\n";
	exit 2;
@


1.5
log
@mkdirhier fix
@
text
@a101 1

d146 1
@


1.4
log
@add RFX string support
@
text
@d100 4
a103 1
`mkdirhier $outdir`;
d140 8
@


1.3
log
@fix build-plugins
@
text
@d121 1
a121 1
    # remove only plugins with properties&0x8000
d129 1
a129 1
		if ($fx_caps&0x8000) {
@


1.2
log
@i18n fixes
@
text
@d22 3
d106 6
a111 1
	system("build-lives-rfx-plugin $indir$plugin $outdir");
@


1.1
log
@Initial revision
@
text
@d22 2
d25 13
a37 13
`smogrify get_tempdir rfx_builder`;
open IN,"< /tmp/.smogrify.rfx_builder";
read IN,$tmpdir,512;
close IN;
unlink "/tmp/.smogrify.rfx_builder";

if ($tmpdir eq "") {
    # TODO - run smogrify report HOME and try again
    print "You must run lives-exe and then check the value of <prefix_dir> in ~/.lives\n before you can use this routine.\n";
    exit 2;
}


d39 11
a49 11
`smogrify get_location $builder rfx builder`;
open IN,"< $tmpdir/.smogval.rfx.builder";
read IN,$builder_location,512;
close IN;
unlink "$tmpdir/.smogval.rfx.builder";

if ($builder_location eq "") {
    print "Unable to locate $builder. Exiting.\n";
    exit 3;
}

a50 1
if (!defined($dir)) {
d62 1
a62 5
	`smogrify get_homedir rfx_builder`;
	open IN,"< /tmp/.smogrify.rfx_builder";
	read IN,$dir,512;
	close IN;
	unlink "/tmp/.smogrify.rfx_builder";
a64 1
    $dir.=$dir_extra;
d67 3
@


1.1.1.1
log
@Initial Import
@
text
@@
