first commit
[scm/bb/meta-tizen.git] / recipes-tizen / bash / bash.inc
1 DESCRIPTION = "The GNU Bourne Again shell"
2 HOMEPAGE = "http://www.gnu.org/software/bash"
3 SECTION = "Base/Tools"
4 LICENSE = "GPL-3.0+"
5
6 SRC_URI = ""
7
8 S = "${WORKDIR}/git"
9
10 PROVIDES = ""
11
12 #PROVIDES by bash-docs  
13 PROVIDES += "bash-docs "
14 RPROVIDES_bash-docs  += "bash-docs "
15
16 #PROVIDES by bash 
17 PROVIDES += "bash"
18 RPROVIDES_bash += "bash"
19 # the PROVIDES rules is ignore "/bin/bash  "
20 PROVIDES += "/bin/bash"
21 RPROVIDES_bash += "/bin/bash"
22 # the PROVIDES rules is ignore "/bin/sh  "
23 PROVIDES += "/bin/sh"
24 RPROVIDES_bash += "/bin/sh"
25
26 RDEPENDS = ""
27
28 DEPENDS = ""
29 #DEPENDS of bash 
30 DEPENDS += "autoconf-native"
31 DEPENDS += "bison-native"
32
33 do_patch() {
34  chmod -Rf a+rX,u+w,g-w,o-w ${S}
35  #setup -q
36  cp ${S}/packaging/bash.manifest .
37  
38  
39 }
40
41 do_configure() {
42 }
43
44 do_compile() {
45  LANG=C
46  export LANG
47  unset DISPLAY
48  CFLAGS="-O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables" ; export CFLAGS ; 
49  CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ; 
50  FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir}" ; export FFLAGS ; 
51  LD_AS_NEEDED=1; export LD_AS_NEEDED ; 
52  
53  
54    CFLAGS="${CFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CFLAGS ; 
55    CXXFLAGS="${CXXFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables}" ; export CXXFLAGS ; 
56    FFLAGS="${FFLAGS:--O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -I%_fmoddir}" ; export FFLAGS ; 
57    autotools_do_configure --build=${TARGET_SYS} --host=${HOST_SYS} \
58          --target=x86_64-tizen-linux \
59          --program-prefix= \
60          --prefix=/usr \
61          --exec-prefix=/usr \
62          --bindir=/usr/bin \
63          --sbindir=/usr/sbin \
64          --sysconfdir=/etc \
65          --datadir=/usr/share \
66          --includedir=/usr/include \
67          --libdir=/usr/lib \
68          --libexecdir=/usr/libexec \
69          --localstatedir=/var \
70          --sharedstatedir=/usr/com \
71          --mandir=/usr/share/man \
72          --infodir=/usr/share/info --enable-largefile \
73              --without-bash-malloc \
74              --disable-nls \
75              --enable-alias \
76              --enable-readline  \
77              --enable-history
78  
79  # Recycles pids is neccessary. When bash's last fork's pid was X
80  # and new fork's pid is also X, bash has to wait for this same pid.
81  # Without Recycles pids bash will not wait.
82  make "CPPFLAGS=-D_GNU_SOURCE -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' -DRECYCLES_PIDS `getconf LFS_CFLAGS`"
83  exit 0
84  make check
85  
86  
87  
88 }
89
90 do_install() {
91  echo export RPM_BUILD_ROOT=${D}
92  LANG=C
93  export LANG
94  unset DISPLAY
95  rm -rf ${D} 
96  mkdir -p ${D} 
97  
98  
99    oe_runmake \
100          DESTDIR=${D} \
101          INSTALL_ROOT=${D} \
102          BINDIR=/usr/bin \
103    install  
104    rm -f ${D}/usr/share/info/dir 
105    find ${D} -regex ".*\.la$" | xargs rm -f -- 
106    find ${D} -regex ".*\.a$" | xargs rm -f --
107  
108  mkdir -p ${D}/etc/bash_completion.d
109  
110  # make manpages for bash builtins as per suggestion in DOC/README
111  pushd doc
112  sed -e '
113  /^\.SH NAME/, /\\- bash built-in commands, see \\fBbash\\fR(1)$/{
114  /^\.SH NAME/d
115  s/^bash, //
116  s/\\- bash built-in commands, see \\fBbash\\fR(1)$//
117  s/,//g
118  b
119  }
120  d
121  ' builtins.1 > man.pages
122  # '
123  for i in echo pwd test kill; do
124    perl -pi -e "s,$i,,g" man.pages
125    perl -pi -e "s,  , ,g" man.pages
126  done
127  
128  install -c -m 644 builtins.1 ${D}/usr/share/man/man1/builtins.1
129  install -c -m 644 bash.1 ${D}/usr/share/man/man1/bash.1
130  
131  for i in `cat man.pages` ; do
132    echo .so man1/builtins.1 > ${D}/usr/share/man/man1/$i.1
133    chmod 0644 ${D}/usr/share/man/man1/$i.1
134  done
135  popd
136  
137  # Link bash man page to sh so that man sh works.
138  ln -s bash.1 ${D}/usr/share/man/man1/sh.1
139  
140  # Not for printf, true and false (conflict with coreutils)
141  rm -f ${D}//usr/share/man/man1/printf.1
142  rm -f ${D}//usr/share/man/man1/true.1
143  rm -f ${D}//usr/share/man/man1/false.1
144  
145  pushd ${D}
146  ln -sf bash ./usr/bin/sh
147  rm -f ./usr/share/info/dir
148  popd
149  mkdir -p ${D}/etc/skel
150  install -c -m644 ${S}/packaging/dot.bashrc ${D}/etc/skel/.bashrc
151  install -c -m644 ${S}/packaging/dot.profile ${D}/etc/skel/.bash_profile
152  LONG_BIT=$(getconf LONG_BIT)
153  mv ${D}/usr/bin/bashbug \
154     ${D}/usr/bin/bashbug-"${LONG_BIT}"
155  
156  # Fix missing sh-bangs in example scripts (bug #225609).
157  for script in \
158    examples/scripts/krand.bash \
159    examples/scripts/bcsh.sh \
160    examples/scripts/precedence \
161    examples/scripts/shprompt
162  do
163    cp "$script" "$script"-orig
164    echo '#!/bin/bash' > "$script"
165    cat "$script"-orig >> "$script"
166    rm -f "$script"-orig
167  done
168  
169  rm -rf ${D}/usr/bin/bashbug-*
170  chmod a-x doc/*.sh
171  
172  
173  
174 }
175
176 PACKAGES = ""
177 PACKAGES += "bash-docs"
178 PACKAGES += "bash"
179
180 bash-docs_files = ""
181 bash-docs_files += "/usr/share/info"
182 bash-docs_files += "/usr/share/man"
183
184 bash_files = ""
185 bash_files += "bash.manifest"
186 bash_files += "/usr/bin/sh"
187 bash_files += "/usr/bin/bash"
188 bash_files += "/etc/skel"
189 bash_files += "/etc/bash_completion.d"
190
191 FILES_${PN}-docs = "${bash-docs_files}"
192 FILES_${PN} = "${bash_files}"
193
194 PKG_bash-docs= "bash-docs"
195 PKG_bash= "bash"
196
197 require bash-extraconf.inc