Magellan Linux

Diff of /branches/R11-unstable/include/multilib.sminc

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

revision 29788 by niro, Thu Oct 12 08:49:24 2017 UTC revision 31852 by niro, Thu Dec 20 13:40:54 2018 UTC
# Line 7  export MULTILIB_BUILD="true" Line 7  export MULTILIB_BUILD="true"
7  # be verbose or nor (true|false}  # be verbose or nor (true|false}
8  : ${MULTILIB_VERBOSE="true"}  : ${MULTILIB_VERBOSE="true"}
9    
10    # enter the abi srcdir as default setting
11    : ${MULTILIB_ENTER_SRCDIR="true"}
12    
13  # multilib should call all dependant includes, which gets overridden  # multilib should call all dependant includes, which gets overridden
14  sminclude mtools  sminclude mtools
15    
# Line 79  abi-m32() Line 82  abi-m32()
82   local orig_pkg_config_path="${PKG_CONFIG_PATH}"   local orig_pkg_config_path="${PKG_CONFIG_PATH}"
83   export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}"   export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}"
84    
85     # honor rust
86     case ${ARCH} in
87     # use native abi as RUST_TARGET
88     i686) export RUST_TARGET="${ARCH}-unknown-linux-gnu" ;;
89     # use i686 as RUST_TARGET for i{3,4,5}86 targets and on multilib-x86_64 target too
90     i*86|x86_64) export RUST_TARGET="i686-unknown-linux-gnu" ;;
91     *)  die "unknown RUST_TARGET '${ARCH}'" ;;
92     esac
93    
94   if [[ ${MULTILIB_VERBOSE} = true ]]   if [[ ${MULTILIB_VERBOSE} = true ]]
95   then   then
96   echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}"
# Line 113  abi-m32() Line 125  abi-m32()
125   fi   fi
126    
127   # run any given command   # run any given command
128     if [[ ${MULTILIB_VERBOSE} = true ]]
129     then
130     echo -e "${COLGREEN}Executing:${COLDEFAULT} '$@'"
131     fi
132   eval $@ || die   eval $@ || die
133    
134   unset ABI CC CXX ABI_LIBDIR   unset ABI CC CXX ABI_LIBDIR RUST_TARGET
135   # keep pkgconfig clean   # keep pkgconfig clean
136   export PKG_CONFIG_PATH="${orig_pkg_config_path}"   export PKG_CONFIG_PATH="${orig_pkg_config_path}"
137   export LDFLAGS="${saved_ldflags}"   export LDFLAGS="${saved_ldflags}"
# Line 143  abi-m64() Line 159  abi-m64()
159   local orig_pkg_config_path="${PKG_CONFIG_PATH}"   local orig_pkg_config_path="${PKG_CONFIG_PATH}"
160   export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}"   export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}"
161    
162     # honor rust
163     case ${ARCH} in
164     # use native abi as RUST_TARGET
165     x86_64) export RUST_TARGET="${ARCH}-unknown-linux-gnu" ;;
166     *)  die "unknown RUST_TARGET '${ARCH}'" ;;
167     esac
168    
169   if [[ ${MULTILIB_VERBOSE} = true ]]   if [[ ${MULTILIB_VERBOSE} = true ]]
170   then   then
171   echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}"
# Line 162  abi-m64() Line 185  abi-m64()
185   fi   fi
186    
187   # run any given command   # run any given command
188     if [[ ${MULTILIB_VERBOSE} = true ]]
189     then
190     echo -e "${COLGREEN}Executing:${COLDEFAULT} '$@'"
191     fi
192   eval $@ || die   eval $@ || die
193    
194   unset ABI CC CXX ABI_LIBDIR   unset ABI CC CXX ABI_LIBDIR RUST_TARGET
195   # keep pkgconfig clean   # keep pkgconfig clean
196   export PKG_CONFIG_PATH="${orig_pkg_config_path}"   export PKG_CONFIG_PATH="${orig_pkg_config_path}"
197   export LDFLAGS="${saved_ldflags}"   export LDFLAGS="${saved_ldflags}"
# Line 182  only-m32() Line 209  only-m32()
209   # export this for mpatch etc (to repect only-${abi})   # export this for mpatch etc (to repect only-${abi})
210   export MULTILIB_ONLY_ABI=${abi}   export MULTILIB_ONLY_ABI=${abi}
211    
212   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
213     then
214     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
215     fi
216   abi-${abi} $@ || die   abi-${abi} $@ || die
217    
218   # unset this is very important   # unset this is very important
# Line 203  only-m64() Line 233  only-m64()
233   # export this for mpatch etc (to repect only-${abi})   # export this for mpatch etc (to repect only-${abi})
234   export MULTILIB_ONLY_ABI=${abi}   export MULTILIB_ONLY_ABI=${abi}
235    
236   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
237     then
238     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
239     fi
240   abi-${abi} $@ || die   abi-${abi} $@ || die
241    
242   # unset this is very important   # unset this is very important
# Line 217  all-abis() Line 250  all-abis()
250   local abi   local abi
251   for abi in ${MULTILIB_ABIS}   for abi in ${MULTILIB_ABIS}
252   do   do
253   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
254     then
255     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
256     fi
257   abi-${abi} $@ || die   abi-${abi} $@ || die
258   done   done
259  }  }
# Line 272  mconfigure() Line 308  mconfigure()
308    
309   for abi in ${abis_to_run}   for abi in ${abis_to_run}
310   do   do
311   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
  abi-${abi} oldmconfigure $@ || die  
  done  
 }  
 fi  
   
 if [[ ! -z $(typeset -f cmake_configure) ]]  
 then  
  # rename the old one  
  old_cmake_configure=old$(typeset -f cmake_configure)  
  eval "${old_cmake_configure}"  
   
 cmake_configure()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  local saved_SRCDIR="${SRCDIR}"  
  for abi in ${abis_to_run}  
  do  
  SRCDIR="${saved_SRCDIR}-${abi}"  
  # honor inside and outside build-dir builds  
  if [ -d ${BUILDDIR}/build-${abi} ]  
  then  
  cd ${BUILDDIR}/build-${abi}  
  else  
  cd ${SRCDIR}  
  fi  
  abi-${abi} oldcmake_configure $@ || die  
  done  
  # restore SRCDIR  
  SRCDIR="${saved_SRCDIR}"  
 }  
 fi  
   
 if [[ ! -z $(typeset -f cmake_src_compile) ]]  
 then  
  # rename the old one  
  old_cmake_src_compile=old$(typeset -f cmake_src_compile)  
  eval "${old_cmake_src_compile}"  
   
 cmake_src_compile()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  for abi in ${abis_to_run}  
  do  
  # remove build dir if exist  
  [[ -d ${BUILDDIR}/build-${abi} ]] && rm -rf ${BUILDDIR}/build-${abi}  
   
  # build outside of the source dir  
  install -d ${BUILDDIR}/build-${abi} || die  
  cd ${BUILDDIR}/build-${abi}  
  done  
   
  cmake_configure || die  
   
  for abi in ${abis_to_run}  
  do  
  cd ${BUILDDIR}/build-${abi}  
  abi-${abi} oldmmake $@ || die  
  done  
 }  
 fi  
   
 if [[ ! -z $(typeset -f cmake_src_check) ]]  
 then  
  # rename the old one  
  old_cmake_src_check=old$(typeset -f cmake_src_check)  
  eval "${old_cmake_check}"  
   
 cmake_src_check()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  for abi in ${abis_to_run}  
  do  
  # honor inside and outside build-dir builds  
  if [ -d ${BUILDDIR}/build-${abi} ]  
  then  
  cd ${BUILDDIR}/build-${abi}  
  else  
  cd ${SRCDIR}-${abi}  
  fi  
  mmake -j1 -k check || die  
  done  
 }  
 fi  
   
 if [[ ! -z $(typeset -f cmake_src_install) ]]  
 then  
  # rename the old one  
  old_cmake_src_install=old$(typeset -f cmake_src_install)  
  eval "${old_cmake_install}"  
   
 cmake_src_install()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  for abi in ${abis_to_run}  
  do  
  # honor inside and outside build-dir builds  
  if [ -d ${BUILDDIR}/build-${abi} ]  
312   then   then
313   cd ${BUILDDIR}/build-${abi}   cd ${SRCDIR}-${abi}/${SRCSUBDIR}
  else  
  cd ${SRCDIR}-${abi}  
  fi  
  abi-${abi} oldmmake DESTDIR=${BINDIR} $@ install || die  
  done  
 }  
 fi  
   
 if [[ ! -z $(typeset -f mninja) ]]  
 then  
  # rename the old one  
  old_mninja=old$(typeset -f mninja)  
  eval "${old_mninja}"  
   
 mninja()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  for abi in ${abis_to_run}  
  do  
  echo -e "${COLBLUE}*** ${COLGREEN}compiling for ABI -${abi}${COLDEFAULT}"  
  cd ${SRCDIR}-${abi}/${SRCSUBDIR}  
  abi-${abi} oldmninja $@ || die  
  done  
 }  
 fi  
   
 if [[ ! -z $(typeset -f meson_configure) ]]  
 then  
  # rename the old one  
  old_meson_configure=old$(typeset -f meson_configure)  
  eval "${old_meson_configure}"  
   
 meson_configure()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  local saved_SRCDIR="${SRCDIR}"  
  for abi in ${abis_to_run}  
  do  
  SRCDIR="${saved_SRCDIR}-${abi}"  
  # honor inside and outside build-dir builds  
  if [ -d ${BUILDDIR}/build-${abi} ]  
  then  
  cd ${BUILDDIR}/build-${abi}  
  else  
  cd ${SRCDIR}  
  fi  
  abi-${abi} oldmeson_configure $@ || die  
  done  
  # restore SRCDIR  
  SRCDIR="${saved_SRCDIR}"  
 }  
 fi  
   
 if [[ ! -z $(typeset -f meson_src_compile) ]]  
 then  
  # rename the old one  
  old_meson_src_compile=old$(typeset -f meson_src_compile)  
  eval "${old_meson_src_compile}"  
   
 meson_src_compile()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  for abi in ${abis_to_run}  
  do  
  # remove build dir if exist  
  [[ -d ${BUILDDIR}/build-${abi} ]] && rm -rf ${BUILDDIR}/build-${abi}  
   
  # build outside of the source dir  
  install -d ${BUILDDIR}/build-${abi} || die  
  cd ${BUILDDIR}/build-${abi}  
  done  
   
  meson_configure || die  
   
  for abi in ${abis_to_run}  
  do  
  cd ${BUILDDIR}/build-${abi}  
  abi-${abi} oldmninja $@ || die  
  done  
 }  
 fi  
   
 if [[ ! -z $(typeset -f meson_src_check) ]]  
 then  
  # rename the old one  
  old_meson_src_check=old$(typeset -f meson_src_check)  
  eval "${old_meson_check}"  
   
 meson_src_check()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  for abi in ${abis_to_run}  
  do  
  # honor inside and outside build-dir builds  
  if [ -d ${BUILDDIR}/build-${abi} ]  
  then  
  cd ${BUILDDIR}/build-${abi}  
  else  
  cd ${SRCDIR}-${abi}  
  fi  
  meson test || die  
  done  
 }  
 fi  
   
 if [[ ! -z $(typeset -f meson_src_install) ]]  
 then  
  # rename the old one  
  old_meson_src_install=old$(typeset -f meson_src_install)  
  eval "${old_meson_install}"  
   
 meson_src_install()  
 {  
  local abi  
  local abis_to_run="${MULTILIB_ABIS}"  
   
  # respect MULTILIB_ONLY_ABI variable  
  [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}"  
   
  for abi in ${abis_to_run}  
  do  
  # honor inside and outside build-dir builds  
  if [ -d ${BUILDDIR}/build-${abi} ]  
  then  
  cd ${BUILDDIR}/build-${abi}  
  else  
  cd ${SRCDIR}-${abi}  
314   fi   fi
315   abi-${abi} DESTDIR=${BINDIR} oldmninja $@ install || die   abi-${abi} oldmconfigure $@ || die
316   done   done
317  }  }
318  fi  fi
# Line 585  mmake() Line 357  mmake()
357   for abi in ${abis_to_run}   for abi in ${abis_to_run}
358   do   do
359   echo -e "${COLBLUE}*** ${COLGREEN}compiling for ABI -${abi}${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}compiling for ABI -${abi}${COLDEFAULT}"
360   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
361     then
362     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
363     fi
364   abi-${abi} oldmmake $@ || die   abi-${abi} oldmmake $@ || die
365   done   done
366  }  }
# Line 608  minstall() Line 383  minstall()
383   for abi in ${abis_to_run}   for abi in ${abis_to_run}
384   do   do
385   echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}"
386   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
387     then
388     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
389     fi
390   abi-${abi} oldminstall $@ || die   abi-${abi} oldminstall $@ || die
391   done   done
392  }  }
# Line 625  minstall_destdir() Line 403  minstall_destdir()
403   for abi in ${abis_to_run}   for abi in ${abis_to_run}
404   do   do
405   echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}"
406   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
407     then
408     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
409     fi
410   make DESTDIR=${BINDIR} $@ install || die   make DESTDIR=${BINDIR} $@ install || die
411   done   done
412  }  }
# Line 647  mpatch() Line 428  mpatch()
428   for abi in ${abis_to_run}   for abi in ${abis_to_run}
429   do   do
430   echo -e "${COLBLUE}*** ${COLGREEN}appling patch for ABI -${abi}${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}appling patch for ABI -${abi}${COLDEFAULT}"
431   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
432     then
433     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
434     fi
435   oldmpatch $@ || die   oldmpatch $@ || die
436   done   done
437  }  }
# Line 670  mlibtoolize() Line 454  mlibtoolize()
454   for abi in ${abis_to_run}   for abi in ${abis_to_run}
455   do   do
456   echo -e "${COLBLUE}*** ${COLGREEN}running mlibtoolize for ABI -${abi}${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}running mlibtoolize for ABI -${abi}${COLDEFAULT}"
457   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
458     then
459     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
460     fi
461   oldmlibtoolize $@ || die   oldmlibtoolize $@ || die
462   done   done
463  }  }
# Line 693  mautoreconf() Line 480  mautoreconf()
480   for abi in ${abis_to_run}   for abi in ${abis_to_run}
481   do   do
482   echo -e "${COLBLUE}*** ${COLGREEN}running mautoreconf for ABI -${abi}${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}running mautoreconf for ABI -${abi}${COLDEFAULT}"
483   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
484     then
485     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
486     fi
487   oldmautoreconf $@ || die   oldmautoreconf $@ || die
488   done   done
489  }  }
# Line 717  minstalldocs() Line 507  minstalldocs()
507    
508   for abi in ${abis_to_run}   for abi in ${abis_to_run}
509   do   do
510   cd ${SRCDIR}-${abi}/${SRCSUBDIR}   if [[ ${MULTILIB_ENTER_SRCDIR} = true ]]
511     then
512     cd ${SRCDIR}-${abi}/${SRCSUBDIR}
513     fi
514   oldminstalldocs $@ || die   oldminstalldocs $@ || die
515   done   done
516  }  }
517  fi  fi
   
 ##  
 # multilib mbuild wrappers  
 ##  
 multilib_src_prepare()  
 {  
  munpack ${SRCFILE} || die  
 }  
   
 multilib_src_compile()  
 {  
  if [[ ! -z $(typeset -f cmake_src_compile) ]]  
  then  
  cmake_src_compile || die  
  else  
  mconfigure || die  
  mmake || die  
  fi  
 }  
   
 multilib_src_check()  
 {  
  if [[ ! -z $(typeset -f cmake_src_check) ]]  
  then  
  cmake_src_check || die  
  else  
  mmake -j1 -k check || die  
  fi  
 }  
   
 multilib_src_install()  
 {  
  if [[ ! -z $(typeset -f cmake_src_install) ]]  
  then  
  cmake_src_install || die  
  else  
  mmake DESTDIR=${BINDIR} install || die  
  fi  
   
  local i  
  for abi in ${MULTILIB_ABIS}  
  do  
  cd ${SRCDIR}-${abi}/${SRCSUBDIR}  
  for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \  
  FAQ LICENSE NEWS README TODO  
  do  
  if [ -f ${SRCDIR}-${abi}/${i} ]  
  then  
  minstalldocs ${i} || die  
  fi  
  done  
  done  
 }  
   
 export_inherits multilib src_prepare src_compile src_check src_install  

Legend:
Removed from v.29788  
changed lines
  Added in v.31852