Magellan Linux

Diff of /trunk/include/meson.sminc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 29787 by niro, Thu Oct 12 08:47:05 2017 UTC revision 31579 by niro, Mon Dec 3 09:18:38 2018 UTC
# Line 19  meson_enable() Line 19  meson_enable()
19  meson_disable()  meson_disable()
20  {  {
21   local feature="$1"   local feature="$1"
22   echo "-Denable_${feature}=false"   echo "-Denable-${feature}=false"
23  }  }
24    
25  # enables features like --with-blah with make  # enables features like --with-blah with make
# Line 36  meson_with() Line 36  meson_with()
36  meson_without()  meson_without()
37  {  {
38   local feature="$1"   local feature="$1"
39   echo "-Dwith-{feature}=false"   echo "-Dwith-${feature}=false"
40    }
41    
42    meson_bool_true()
43    {
44     local feature="$1"
45     meson_opt "${feature}" "true"
46    }
47    
48    meson_bool_false()
49    {
50     local feature="$1"
51     meson_opt "${feature}" "false"
52  }  }
53    
54  # generic meson opts  # generic meson opts
# Line 55  meson_src_prepare() Line 67  meson_src_prepare()
67  meson_configure()  meson_configure()
68  {  {
69   local configure_opts="$@"   local configure_opts="$@"
70     local default_opts
71    
72   meson setup \   default_opts+=" --buildtype=release"
73   --buildtype=release \   default_opts+=" --prefix=/usr"
74   --prefix=/usr \   default_opts+=" --sysconfdir=/etc"
75   --sysconfdir=/etc \   default_opts+=" --localstatedir=/var/lib"
76   --localstatedir=/var/lib \  
77   --libdir=/usr/$(mlibdir) \   if [[ ${MULTILIB_BUILD} = true ]]
78   --libexecdir=/usr/$(mlibdir)/${PNAME} \   then
79   ${configure_opts} \   # must be escaped so the mlibdir variable gets evaluated later
80   ${SRCDIR}/${SRCSUBDIR} \   default_opts+=' --libdir=/usr/$(mlibdir)'
81   || die   default_opts+=' --libexecdir=/usr/$(mlibdir)/${PNAME}'
82     all-abis meson setup ${default_opts} ${configure_opts} ${SRCDIR}-$(mabi)/${SRCSUBDIR} ${BUILDDIR}/build-$(mabi) || die
83     else
84     # the mlibdir variable gets right now evaluated
85     default_opts+=" --libdir=/usr/$(mlibdir)"
86     default_opts+=" --libexecdir=/usr/$(mlibdir)/${PNAME}"
87     meson setup ${default_opts} ${configure_opts} ${SRCDIR}/${SRCSUBDIR} ${BUILDDIR}/build || die
88     fi
89  }  }
90    
91  mninja()  mninja()
92  {  {
93   ninja -v ${MAKEOPTS} "$@"   local abi
94     local abis_to_run="${MULTILIB_ABIS}"
95    
96     # respect MULTILIB_ONLY_ABI variable
97     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
98    
99     if [[ ${MULTILIB_BUILD} = true ]]
100     then
101     for abi in ${abis_to_run}
102     do
103     echo -e "${COLBLUE}*** ${COLGREEN}running ninja for ABI -${abi}${COLDEFAULT}"
104     abi-${abi} ninja -C ${SRCDIR}-$(mabi)/${SRCSUBDIR} -C ${BUILDDIR}/build-$(mabi) -v ${MAKEOPTS} "$@"
105     done
106     else
107     ninja -C ${SRCDIR}/${SRCSUBDIR} -C ${BUILDDIR}/build -v ${MAKEOPTS} "$@"
108     fi
109    }
110    
111    meson_setup_builddir()
112    {
113     local abi
114     local abis_to_run="${MULTILIB_ABIS}"
115    
116     # respect MULTILIB_ONLY_ABI variable
117     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
118    
119     if [[ ${MULTILIB_BUILD} = true ]]
120     then
121     for abi in ${abis_to_run}
122     do
123     echo -e "${COLBLUE}*** ${COLGREEN}running ninja for ABI -${abi}${COLDEFAULT}"
124     abi-${abi} install -d ${BUILDDIR}/build-$(mabi) || die
125     done
126     else
127     install -d ${BUILDDIR}/build || die
128     fi
129  }  }
130    
131  meson_src_compile()  meson_src_compile()
132  {  {
133   cd ${SRCDIR}   if [[ ${MULTILIB_BUILD} != true ]]
134     then
135   # remove build dir if exist   cd ${SRCDIR}
136   [[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build   fi
   
  # build outside of the source dir  
  install -d ${BUILDDIR}/build || die  
  cd ${BUILDDIR}/build  
137    
138   meson_configure || die   meson_setup_builddir || die
139     meson_configure "$@" || die
140   mninja || die   mninja || die
141  }  }
142    
# Line 94  meson_src_check() Line 146  meson_src_check()
146   meson test || die   meson test || die
147  }  }
148    
149    meson_multilib_src_check()
150    {
151     local abi
152     local abis_to_run="${MULTILIB_ABIS}"
153    
154     # respect MULTILIB_ONLY_ABI variable
155     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
156     for abi in ${abis_to_run}
157     do
158     cd ${BUILDDIR}/build-${abi}
159     meson test || die
160     done
161    }
162    
163  meson_src_install()  meson_src_install()
164  {  {
165   cd ${BUILDDIR}/build   cd ${BUILDDIR}/build
# Line 111  meson_src_install() Line 177  meson_src_install()
177   done   done
178  }  }
179    
180  export_inherits meson src_prepare src_compile src_check src_install  meson_multilib_src_install()
181    {
182     local abi
183     local abis_to_run="${MULTILIB_ABIS}"
184    
185     # respect MULTILIB_ONLY_ABI variable
186     [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"
187     for abi in ${abis_to_run}
188     do
189     cd ${BUILDDIR}/build-${abi}
190     DESTDIR=${BINDIR} ninja install || die
191    
192     cd ${SRCDIR}-${abi}
193     local i
194     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
195     FAQ LICENSE NEWS README TODO
196     do
197     if [ -f ${SRCDIR}-${abi}/${i} ]
198     then
199     minstalldocs ${i} || die
200     fi
201     done
202     done
203    }
204    
205    export_inherits meson src_prepare src_compile
206    if [[ ${MULTILIB_BUILD} = true ]]
207    then
208     export_inherits meson_multilib src_check src_install
209    else
210     export_inherits meson src_check src_install
211    fi

Legend:
Removed from v.29787  
changed lines
  Added in v.31579