File: init.pl

package info (click to toggle)
libgoo-canvas-perl 0.06-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 572 kB
  • ctags: 777
  • sloc: perl: 6,868; ansic: 38; makefile: 17
file content (49 lines) | stat: -rwxr-xr-x 1,122 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl -w
# init.pl --- 
# Last modify Time-stamp: <Ye Wenbin 2007-09-26 17:00:07>
# Version: v 0.0 2007/09/22 05:30:05
# Author: Ye Wenbin <wenbinye@gmail.com>

use strict;
use warnings;

my $gc = "goocanvas";
my ($dir) = grep {/$gc/} split /\s*-I\s*/, `pkg-config $gc --cflags`;

opendir(DIR, $dir) or die "Can't open directory $dir: $!";
foreach ( readdir(DIR) ) {
    next unless $_ =~ s/\.h$//;
    if ( /png/ ) {
        s/png/PNG/;
    }
    my $out = "../xs/$_.xs";
    (my $mod = $_) =~ s/goocanvas(.*)/'Goo::Canvas::'.ucfirst($1)/e;
    $mod =~ s/::$//;
    (my $pre = $_) =~ s/goocanvas(.*)/goo_canvas_${1}_/;
    $pre =~ s/__$/_/;
    next if -e $out;
    open(FH, ">$out") or die "Can't create file $out: $!";
    print FH <<TPL;
#include "goocanvas-perl.h"

MODULE = $mod		PACKAGE = $mod   PREFIX = $pre

TPL
}

# create_gc();

sub create_gc {
    my $cc = '../xs/Goo.xs';
    return if -e $cc;
    open(FH, ">$cc") or die "Can't create file $cc: $!";
    print FH <<TPL;
#include "goocanvas-perl.h"

MODULE = Goo::Canvas		PACKAGE = Goo::Can

BOOT:
#include "register.xsh"
#include "boot.xsh"
TPL
}