Logoj0ke.net Open Build Service > Projects > internetx:php7 > php-7.0.10 > macros.php
Sign Up | Log In

File macros.php of Package php-7.0.10

 
1
# macros.php file
2
# macros for module building. handle with care.
3
4
#
5
# Interface versions exposed by PHP:
6
#
7
%php_core_api @PHP_APIVER@
8
%php_zend_api @PHP_ZENDVER@
9
10
# Useful php macros (from Christian Wittmer <chris@computersalat.de>)
11
#
12
%__php          /usr/bin/php
13
%__phpize       /usr/bin/phpize
14
%__php_config   /usr/bin/php-config
15
%php_version    %(%{__php_config} --version)
16
#
17
%__pear         /usr/bin/pear
18
%php_peardir    %(%{__pear} config-get php_dir)
19
%php_pearxmldir /var/lib/pear
20
21
# macro: php_pear_gen_filelist
22
# do the rpmlint happy filelist generation
23
# with %dir in front of directories
24
%php_pear_gen_filelist(n)\
25
FILES=%{name}.files\
26
# fgen_dir func\
27
# IN: dir\
28
fgen_dir(){\
29
%{__cat} >> $FILES << EOF\
30
%dir ${1}\
31
EOF\
32
}\
33
# fgen_file func\
34
# IN: file\
35
fgen_file(){\
36
%{__cat} >> $FILES << EOF\
37
${1}\
38
EOF\
39
}\
40
# check for files in %{php_peardir}\
41
RES=`find ${RPM_BUILD_ROOT}%{php_peardir} -maxdepth 1 -type f`\
42
if [ -n "$RES" ]; then\
43
  for file in $RES; do\
44
    fgen_file "%{php_peardir}/$(basename ${file})"\
45
  done\
46
fi\
47
\
48
# get all dirs into array\
49
base_dir="${RPM_BUILD_ROOT}%{php_peardir}/"\
50
for dir in `find ${base_dir} -type d | sort`; do\
51
  if [ "$dir" = "${base_dir}" ]; then\
52
    continue\
53
  else\
54
    el=`echo $dir | %{__awk} -F"${base_dir}" '{print $2}'`\
55
    all_dir=(${all_dir[@]} $el)\
56
  fi\
57
done\
58
\
59
# build filelist\
60
for i in ${all_dir[@]}; do\
61
  if [ -d ${base_dir}/${i} ]; then\
62
    RES=`find "${base_dir}/${i}" -maxdepth 1 -type f`\
63
    if [ -n "$RES" ]; then\
64
      fgen_dir "%{php_peardir}/${i}"\
65
      for file in $RES; do\
66
        fgen_file "%{php_peardir}/${i}/$(basename ${file})"\
67
      done\
68
    else\
69
      fgen_dir "%{php_peardir}/${i}"\
70
    fi\
71
  fi\
72
done\
73
# add xml file\
74
fgen_file "%php_pearxmldir/%{pear_name}.xml"\
75
#
76