QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3115|回复: 13

E17 自动安装脚本

[复制链接]
发表于 2006-1-21 17:48:41 | 显示全部楼层 |阅读模式
前几天连接linuxfans时发现出现正在开发的字样 还以为这里要关了呢
想不到今天又可以上来了 那就把这自动安装脚本放上来

后面可能会写一个介绍文件管理器evidence的文章
介绍怎样使用它来订制自己的文件管理器

E17介绍:
一个快速的窗口管理器, 现在功能正在不断完善中,速度快, 轻量, 使用大量图形效果并且完全可以订制是它的特点
官方网站
www.enlightenment.org
资源站
www.get-e.org
中文翻译:
http://www.get-e.org/E17_User_Guide/Chinese/

旧的脚本在
http://www.linuxsir.org/bbs/showthre...=229286&page=3

新脚本功能:
(针对上版功能)
自动检查编译环境(autoconf,等有没有安装)
如果编译某个目录失败 ,如因为某个包依赖没有安装时, 会自动提示你
让你把依赖的包安装后敲 回车可以继续重编译这个目录
可以选择是不是从CVS下载源码
保存编译过程到build.log, 保存屏幕输出到screen.log 方便自己查找出错问题
默认自动编译deb包, 并且自动安装deb包
如果你不是使用debian系统, 那可以自动使用make;make install编译安装

另外如果使用xorg的, 如果报 依赖xlibs-dev的话 可以安装libx11-dev, 并且把 那个目录下的/debian/control文件中 xlibs-dev全部修改成libx11-dev
这样就可以编译通过了

这里只安装最基本的E17窗口管理器
如果想安装更多E17包,那可以修改my @e17objs =(内容, 把更多的目录添加到这里面

[code:1]
#!/usr/bin/perl
#
use strict;
use FileHandle;

my  $autobuilddir   = 1;#   if true,then auto build all directory
my  $autobuild            = 1;#   if true,auto build all packages in a directory
my  $autocvs        = 0;#   if true, auto download source code from CVS
my  $usedeb            = 1;#   if true, will create deb and install deb package,else use "make install" to install
my @e17objs =(
    ['e17/libs','../..',
    'eet',
    'evas',
    'ecore',
    'embryo'
    ],
    ['e17/apps','../..',
    'e'
    ],
);

my  $fd_build          = new FileHandle ">build.log";
my  $fd_screen  = new FileHandle ">screen.log";

check_debbuildenv();    # if you don't want to build deb package, comment this line
get_cvs()       if($autocvs);
do_install(@e17objs);

close($fd_build);
close($fd_screen);


sub do_install(){
    my @compileobjs = @_;
    log_screen("\n\nstart build debian packages\n\n");
    my $objs;
    foreach $objs (@compileobjs){
        my        @objarray   = @$objs;
        my        $dir            = shift(@objarray);
        my        $back_dir   = shift(@objarray);
        if( ! -d $dir ){
            log_screen("dir:$dir not exist,will skip compile it\n");
            next;
        }
        next if( (!$autobuilddir)
            && (!choseact("are you want to build dir:$dir\n")) );

        log_screen("start parse:<<<<<        $dir  >>>>>: back:$back_dir\n");
        chdir $dir;
        system('rm -f *.deb *.dsc *.tar.gz *.changes');

        my        $subdir;
        foreach $subdir (@objarray){
            if( !(-d $subdir) ){
                log_screen("dir:$subdir not exist,skip compile it\n");
                next;
            }
            chdir($subdir);
            while( parsedir($subdir) ){}
            $fd_build->autoflush(1);
            log_screen("\n");
            chdir("../");
            system('rm -f *.dsc *.tar.gz *.changes');
        }
        chdir $back_dir;
    }
}




sub parsedir()
{
    my $pkg        = $_[0];
    log_screen("\n\nenter directory:".$pkg."\n");
    return 0 if((!$autobuild) && (!choseact("are you want to build:$pkg\n")) );
    my $curpwd        = qx(pwd);
    chomp($curpwd);

    $fd_build->autoflush(0);
    log_screen("\tcur dir is:\n\t$curpwd\n");
    log_screen("\trun:   dpkg-buildpackage -us -uc -rfakeroot 2>&1\n");

    chmod 755,'debian/rules' if(! -x 'debian/rules');
    chmod 755,'autogen.sh' if(! -x 'autogen.sh');
    system("make distclean >/dev/null 2>&1");

    if(!$usedeb){
#if you don't use deb,then you can call these line
            run_cmd('./autogen.sh --prefix=/usr');
            run_cmd('make');
            run_cmd('make uninstall');
            run_cmd('make install');
            return ;
    }

    system('cp debian/changelog.in debian/changelog >/dev/null 2>&1') if(! -f 'debian/changelog');

    open(MAKEFI,"dpkg-buildpackage -us -uc -rfakeroot 2>&1|") || die "exec fail\n";
    log_screen( 'dpkg-buildpackage -us -uc -rfakeroot 2>&1'."\n");

    my @pkgs;
    my $line;
    while($line=<MAKEFI>){
        my $notlog        = 1;
        if($line=~m/\berror\b/i){
            if($line!~m/dpkg-genchanges:\s+error:\s+cannot\s+open\s+\.dsc/){
                $notlog = 0;
                log_screen($line);
            }
        }
        log_build( $line) if($notlog);

        if($line=~m/\bUnmet\s+build\s+dependencies\b/i){
            log_screen($line);
            log_screen("are you want to install missing dependence then rebuild this package or skip build this package(default:skip)\n");
            log_screen("press n to skip,else you press 'Y' after finish install missing packages\n");
            return choseact("") ;
        }
        next if($line!~m/dpkg-deb:\s+building\s+package\s+\`([^']+)\'\s+in\s+\`([^']+)\'/);

        log_screen("\tpkg:[$1:\t$2]\n");
        push(@pkgs,$2);
    }
    close(MAKEFI);

    if($#pkgs < 0){
        log_screen("error no package found,build message is write to build.log file\n");
    }
    else{
        my $pkgfile = join(" ",@pkgs);
        log_screen( "\n>>>>>>>>>\n\tdpkg -i $pkgfile\n\n");
        run_cmd("dpkg -i $pkgfile");
    }
    log_screen("\n");
    return 0;
}





#
#   choose user select
#
sub choseact()
{
    log_screen( $_[0]."\nplease input yes or no [Y]\n");
    my $in=<STDIN>;
    if($in=~m/n/i){
        log_screen( "cancel\n");
        return 0;
    }
    log_screen( "\n");
    return 1;
}


#
#        downlaod E17 source code from CVS
#
sub get_cvs()
{
    print   "get CVS source code\n";
    print   "login CVS:,when need you input password,press return directly\n";
    print   'cvs -d:pserver:[email protected]:/cvsroot/enlightenment login'."\n";
    system('cvs -d:pserver:[email protected]:/cvsroot/enlightenment login');
    print   'chech out E17:'."\n";
    print   'cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co e17'."\n";
    system('cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co e17');
    print   'chech out Misc:'."\n";
    print   'cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co misc'."\n";
    system('cvs -z3 -d:pserver:[email protected]:/cvsroot/enlightenment co misc');
}

#
#   check debian build env
#
sub check_debbuildenv()
{
        my @pkglist = qx(dpkg --get-selections);
        my $lines   = join(':',@pkglist);

        check_pkg($lines,"autoconf",1);
        check_pkg($lines,"automake",1,"(version >=1.7)");
        check_pkg($lines,"libtool",1);
        check_pkg($lines,"pkg-config",1);

        if($usedeb){
                check_pkg($lines,"fakeroot",1);
                check_pkg($lines,"dpkg-dev",1);
        }

        check_pkg($lines,"libxcursor-dev",0,"(it may need by ecore,if link ecore fail, please install it)");

        log_screen("if you use xorg,then build script report xlibs-dev not install, you need to modify the {directory}/debian/control file, change xlibs-dev to libx11-dev\n");
}
sub check_pkg()
{
    my  ($pkglists,$pkgname,$exitmode,$version)=@_;
    my  $exit   = 0;
    $exit       = 1 if( $pkglists!~m/\b$pkgname[^:]*\s+install/);
    if( $exit ){
        log_screen("WARNNING: ") if(! $exitmode );
        log_screen("you don't install $pkgname, please use \n\tapt-get install $pkgname\n to install it.$version \n");
        die if( $exitmode );
    }
}



#
#        run a command,and log command output to screen.log
#
sub run_cmd()
{
    my $cmd        = $_[0];
    my $fd;
    open($fd,"$cmd 2>&1 |");
    if( ! $fd ){
        log_screen("exec $cmd fail,check if this command exist\n");
        die;
    }
    my $line;
    while($line=<$fd>){
        log_screen($line);
    }
}

#
#        log screen output
#
sub log_screen()
{
    print        @_;
    print        $fd_screen @_;
    log_build(@_);
}

#
#        log build result to build.log
#
sub log_build()
{
    print        $fd_build @_;
}
[/code:1]
发表于 2006-1-21 18:46:49 | 显示全部楼层
ths 无双,我再编译一次。。     
回复

使用道具 举报

 楼主| 发表于 2006-1-21 20:49:42 | 显示全部楼层
回复

使用道具 举报

发表于 2006-1-22 12:04:03 | 显示全部楼层
configure模块又多了些设置,engage也改用evas了
回复

使用道具 举报

发表于 2006-1-22 23:32:21 | 显示全部楼层
[quote:d041cfe4d8="cobranail"]configure模块又多了些设置,engage也改用evas了[/quote]

老大一天CVS一次?天天make?
回复

使用道具 举报

发表于 2006-1-23 02:17:13 | 显示全部楼层
[quote:2bf74567d2="limit"][quote:2bf74567d2="cobranail"]configure模块又多了些设置,engage也改用evas了[/quote]

老大一天CVS一次?天天make? [/quote]

平均一星期一次,天天make伤身体
回复

使用道具 举报

发表于 2006-1-23 08:30:31 | 显示全部楼层
平均一星期一次,天天make伤身体  
  
回复

使用道具 举报

发表于 2006-1-26 13:57:40 | 显示全部楼层
我以前编译时,是给 jhbuild 加了个 e17 的模块,一个命令搞定,也很容易了。

http://www.jamesh.id.au/software/jhbuild/
回复

使用道具 举报

发表于 2006-1-27 09:30:54 | 显示全部楼层
无双TM, 如果你能找一个空间每天或者每周把cvs上所需要下载的内容打包放出来就好了

我这里上cvs太慢
回复

使用道具 举报

发表于 2006-1-27 14:20:12 | 显示全部楼层
在enlightenment.freedesktop.org上有cvs的snapshot,不过只有主要的部分
回复

使用道具 举报

发表于 2006-2-4 19:58:46 | 显示全部楼层
运行这个脚本以后直接就开始编译了

都不下载src

太奇怪了

还没有来得及看关于xorg的事情
回复

使用道具 举报

发表于 2006-2-5 10:15:13 | 显示全部楼层
I have downloaded all things about e17

now I am compiling theme.

I want to know how to compile them all by one command,

instade of manully compile theme one by one?
回复

使用道具 举报

 楼主| 发表于 2006-2-6 18:52:32 | 显示全部楼层
my  $autocvs        = 0;#   if true, auto download source code from CVS

把它设置成1

运行这个脚本就可以自动编译了 不过需要注意脚本的位置在
inse17.pl
e17/libs/...
e17/apps/...
misc/...

也就是这个脚本的位置与e17目录在同一目录下


PS: 没有大的ftp空间 E的源码打包需要60M 左右

我一般也是过一段时间编译一次
回复

使用道具 举报

 楼主| 发表于 2006-2-6 18:55:54 | 显示全部楼层
现在好像加了个itray 实现了图标栏 后面应该是实现桌面图标功能了
另外现在在源码的proto目录下也有几个东东 如文件管理器 (但是觉得不如evidence好用 看来还是需要再提高)
期待能快点看到e17快点进入alpha
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-6-7 00:56 , Processed in 0.070022 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表