ここしばらく
Plamo Linuxのビルドスクリプトやパッケージ管理ツールについては、
PlamoBuildスクリプトを使ってパッケージを作成し、
ビルドスクリプトの改修
最初期のPlamoBuildスクリプトは、
そのうち、
さらには、
もともとPlamoBuildスクリプトを使い始めた当時は、
しかし過去の記事でも指摘したように、
テンプレート化したビルドスクリプトを使い回す方法は簡単なものの、
もともとPlamo Linuxは
そこでPlamo Linuxの原点に回帰するためにも、
ビルドスクリプトの再構成
PlamoBuildスクリプトはシェルスクリプトなので、
今回は、
1 prune_symlink() {
2 echo "pruning symlink in $1"
3 if [ -d $1 ] ; then (
4 cd $P
5 rm -f /tmp/iNsT-a.$$ ; touch /tmp/iNsT-a.$$
6 for i in `find ${1#$P/} -type l` ; do
7 target=`readlink $i`
...
45 strip_all() {
46 for chk in `find . ` ; do
47 chk_elf=`file $chk | grep ELF`
48 if [ "$chk_elf.x" != ".x" ]; then
49 chk_lib=`echo $chk | grep lib`
50 if [ "$chk_lib.x" != ".x" ]; then
51 echo "stripping $chk with -g "
...
コードの断片だけで恐縮ですが、
このような形で、
plamobuild_
メタ・ビルドスクリプトの仕様変更
前節で紹介したplamobuild_
そのためにはメタ・
make_
$ make_PlamoBuild.py -h usage: make_PlamoBuild.py [-h] [-p PREFIX] [-u URL] [-v] [-m METHOD] [-s] srcdir PlamoBuild script maker positional arguments: srcdir source code directory optional arguments: -h, --help show this help message and exit -p PREFIX, --prefix PREFIX install directory prefix(default=/usr) -u URL, --url URL source code download url -v, --verbose Verbose mode -m METHOD, --method METHOD force config method(config, cmake, perl, python) -s, --source copy source codes into build directory(use with configure)
make_
メタ・ビルドスクリプトの使用例
ビルドスクリプトに記載するソースコードのURLは-uオプションで指定できるので、
まず、
$ wget --no-check-certificate https://gstreamer.freedesktop.org/src/orc/orc-0.4.26.tar.xz ... 長さ: 465768 (455K) [application/x-xz] `orc-0.4.26.tar.xz' に保存中 orc-0.4.26.tar.xz 100%[===================>] 454.85K 686KB/s in 0.7s $ tar xvf orc-0.4.26.tar.xz orc-0.4.26/ orc-0.4.26/orc.pc.in orc-0.4.26/tools/ orc-0.4.26/tools/Makefile.in ...
コピーしたURLを-uオプションに指定してmake_
$ make_PlamoBuild.py -u https://gstreamer.freedesktop.org/src/orc/orc-0.4.26.tar.xz orc-0.4.26
このコマンドで作成されたorc-0.
1 #!/bin/sh
2 ##############################################################
3 pkgbase='orc'
4 vers='0.4.26'
5 url="https://gstreamer.freedesktop.org/src/${pkgbase}/${pkgbase}-${vers}.tar.xz"
6 arch=`uname -m`
7 build=P1
8 src="${pkgbase}-${vers}"
9 OPT_CONFIG='--disable-static --enable-shared'
10 DOCS='COPYING README RELEASE TODO'
11 patchfiles=''
12 compress=txz
13 ##############################################################
14
15 source /usr/share/plamobuild_functions.sh
16
17 # このスクリプトで使う1文字変数の意味
18 #
19 # $W : このスクリプトを動かすカレントディレクトリ
20 # $S : ソースコードのあるディレクトリ(デフォルト: $W/${src})
21 # $B : ビルド用ディレクトリ(デフォルト: /tmp/build{,32})
22 # $P : ビルドしたファイルをインストールするディレクトリ(デフォルト: $W/work)
23
24
25 if [ $# -eq 0 ] ; then
26 opt_download=0 ; opt_config=1 ; opt_build=1 ; opt_package=1
27 else
28 opt_download=0 ; opt_config=0 ; opt_build=0 ; opt_package=0
29 for i in $@ ; do
30 case $i in
31 download) opt_download=1 ;;
32 config) opt_config=1 ;;
33 build) opt_build=1 ;;
34 package) opt_package=1 ;;
35 esac
36 done
37 fi
38 if [ $opt_download -eq 1 ] ; then
39 download_sources
40 fi
41
42 if [ $opt_config -eq 1 ] ; then
43 if [ -d $B ] ; then rm -rf $B ; fi ; mkdir -p $B
44 ######################################################################
45 # don't copy sources, so need patch in the src dir
46 ######################################################################
47 cd $S
48 for patch in $patchfiles ; do
49 if [ ! -f .${patch} ]; then
50 patch -p1 < $W/$patch
51 touch .${patch}
52 fi
53 done
54 # if [ -f autogen.sh ] ; then
55 # sh ./autogen.sh
56 # fi
57
58 cd $B
59 export PKG_CONFIG_PATH=/usr/${libdir}/pkgconfig:/usr/share/pkgconfig:/opt/kde/${libdir}/pkgconfig
60 export LDFLAGS='-Wl,--as-needed'
61 $S/configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir='${prefix}'/share/man ${OPT_CONFIG[$i]}
62
63 if [ $? != 0 ]; then
64 echo "configure error. $0 script stop"
65 exit 255
66 fi
67 fi
68
69 if [ $opt_build -eq 1 ] ; then
70 cd $B
71 export LDFLAGS='-Wl,--as-needed'
72 make -j3
73 if [ $? != 0 ]; then
74 echo "build error. $0 script stop"
75 exit 255
76 fi
77 fi
78
79 if [ $opt_package -eq 1 ] ; then
80 check_root
81 if [ -d $P ] ; then rm -rf $P ; fi ; mkdir -p $P
82 cd $B
83 export LDFLAGS='-Wl,--as-needed'
84 make install DESTDIR=$P
85
86 ################################
87 # install tweaks
88 # strip binaries, delete locale except ja, compress man,
89 # install docs and patches, compress them and chown root.root
90 ################################
91 install_tweak
92
93 #############################
94 # convert symlink to null file and
95 # add "ln -sf" command into install/doinst.sh
96 ################################
97 convert_links
98
99 cd $P
100 /sbin/makepkg ../$pkg.$compress <<EOF
101 y
102 1
103 EOF
104
105 fi
例に用いたorc-0.
上記ビルドスクリプトをご覧いただければ分かるように、
旧バージョンのorcをパッケージ化する際に利用したビルドスクリプトは292行だったので、
「別ファイルに処理を分けるとスクリプトの独立性が低くなってわかりにくくなる」
Plamo Linuxの場合、