diff options
Diffstat (limited to '~coadde/cross-binutils/PKGBUILD')
-rw-r--r-- | ~coadde/cross-binutils/PKGBUILD | 113 |
1 files changed, 69 insertions, 44 deletions
diff --git a/~coadde/cross-binutils/PKGBUILD b/~coadde/cross-binutils/PKGBUILD index cb84cae3a..e1a8985f3 100644 --- a/~coadde/cross-binutils/PKGBUILD +++ b/~coadde/cross-binutils/PKGBUILD @@ -13,8 +13,7 @@ # | * | mipsel | mipsel | unknown | elf | no | bin/sys | # | * | mips | mips | unknown | elf | no | bin/sys | # | x86_64 | x86_64 | x86_64 | unknown | linux-gnu|gnu<|elf | yes | bin/sys | -# | i[5-7]86 | i[5-7]86 | i[5-7]86 | pc | linux-gnu|gnu|elf | no | bin/sys | -# | * | i486 | i486 | unknown | elf | no | bin/sys | +# | i[5-7]86 | i[5-7]86 | i[5-7]86 | pc | linux-gnu|gnu| | no | bin/sys | # | * | i386 | i386 | unknown | elf | no | bin/sys | # | armv8-a | aarch64 | aarch64 | unknown | linux-gnu|elf | yes | - | # | armv8-a | aarch64_be | aarch64_be | unknown | linux-gnu|elf | yes | - | @@ -45,6 +44,17 @@ # | - | or32 | or32 | unknown | linux-gnu<|elf< | no | bin/sys | # +-------------+-------------+-------------+----------+----------------------------------+-----------+---------+ +# For "DOSBox" +# +-------------+-------------+-------------+----------+----------------------------------+-----------+---------+ +# | * | i386 | i386 | pc | msdosdjgpp | no | bin/sys | +# +-------------+-------------+-------------+----------+----------------------------------+-----------+---------+ + +# For "Wine" +# +-------------+-------------+-------------+----------+----------------------------------+-----------+---------+ +# | * | x86_64 | x86_64 | unknown | mingw64 | yes | bin/sys | +# | * | i386 | i386 | unknown | mingw32 | no | bin/sys | +# +-------------+-------------+-------------+----------+----------------------------------+-----------+---------+ + # * : Any supported by architecture. # - : None. # @ : bin/sys (Only sh4 and sh4l support) @@ -57,47 +67,64 @@ _multilib_list=('mips64el' 'mips64' 'x86_64' 'aarch64' 'aarch64_be' 'sparc64' 'i #--------------------------------------------------------------------------------------------------------------------------------------------- -_pkgname="binutils" - ### Base FLAGS: ### -_CARCH="x86_64" +# For custom name. +_pkgname="binutils" +_pkgver="2.23.2" +_pkgrel="2" +# For binutils-common ("${_pkgname}-common${_pkgflag}${_verflag}") release. +_pkgrelb="2" +# For _target-binutils ("${_target}-${_pkgname}${_multilib_name}${_ath9k_htc_name}${_pkgflag}${_verflag}") release. +_pkgrelc="2" +# For older version. +_add_version_name="no" +# For custom pkg. +_pkgflag="" + +### Architecture FLAGS: ### +# CARCH flag +_CARCH="mips64" +# CHOST flags _host="${_CARCH}" _machine="unknown" _system="linux-gnu" -_multilib="no" +# Multilib flag +_multilib="yes" ### Patch FLAGS: ### _patch_ath9k_htc_fw="no" #--------------------------------------------------------------------------------------------------------------------------------------------- -_target="${_host}-${_machine}-${_system}" +# For older version. +[[ ${_add_version_name} == yes ]] && _verflag="-v${_pkgver}" -# For "_multilib" -[[ ${_multilib} == "yes" ]] && { - _multilib_name="-multilib" - _multilib_desc=" for multilib" -} -for _arch_multilib in ${_multilib_list[@]}; do - [[ ${_CARCH} != ${_arch_multilib} ]] && _multilib="no" -done +# For Architecture. +_target="${_host}-${_machine}-${_system}" # For "_patch_ath9k_htc_fw" +[[ ${_CARCH} != xtensa ]] && _patch_ath9k_htc_fw="no" [[ ${_patch_ath9k_htc_fw} == "yes" ]] && { _ath9k_htc_name="-ath9k-htc" _ath9k_htc_desc=" adapted for ath9k-htc firmware" _multilib="no" } -[[ ${_CARCH} != xtensa ]] && _patch_ath9k_htc_fw="no" + +# For "_multilib" +[[ ${_CARCH} != $(echo ${_multilib_list[@]} | sed 's| |\n|g' | grep -x ${_CARCH}) ]] && _multilib="no" +[[ ${_multilib} == "yes" ]] && { + _multilib_name="-multilib" + _multilib_desc=" for multilib" +} #--------------------------------------------------------------------------------------------------------------------------------------------- pkgname=( - "${_target}-${_pkgname}${_multilib_name}${_ath9k_htc_name}" - "${_pkgname}-common" + "${_target}-${_pkgname}${_multilib_name}${_ath9k_htc_name}${_pkgflag}${_verflag}" + "${_pkgname}-common${_pkgflag}${_verflag}" ) -pkgver=2.23.2 -pkgrel=2 +pkgver=${_pkgver} +pkgrel=${_pkgrel} arch=("${_carch_list[@]}") url="http://www.gnu.org/software/${_pkgname}/" license=('GPL2') @@ -142,13 +169,11 @@ build() { cd ${srcdir}/${_pkgname}-build [[ $CARCH != ${_CARCH} ]] && _TARGET="--target=${_target}" - for _arch_multilib2 in ${_multilib_list[@]}; do - if [[ ${_CARCH} == ${_arch_multilib2} ]]; then - _LIB_PATH="--with-lib-path=/usr/lib:/usr/lib32:/usr/local/lib:/usr/local/lib32:/usr/${_target}/lib:/usr/${_target}/lib32" - else - _LIB_PATH="--with-lib-path=/usr/lib:/usr/local/lib:/usr/${_target}/lib" - fi - done + if [[ ${_CARCH} == $(echo ${_multilib_list[@]} | sed 's| |\n|g' | grep -x ${_CARCH}) ]]; then + _LIB_PATH="--with-lib-path=/usr/lib:/usr/lib32:/usr/local/lib:/usr/local/lib32:/usr/${_target}/lib:/usr/${_target}/lib32" + else + _LIB_PATH="--with-lib-path=/usr/lib:/usr/local/lib:/usr/${_target}/lib" + fi if [[ ${_multilib} == "yes" ]]; then _MULTILIB='--enable-multilib' @@ -156,7 +181,7 @@ build() { _MULTILIB='--disable-multilib' fi - ${srcdir}/${_pkgname}-${pkgver}/configure --prefix=/opt/${pkgname[0]}/${pkgver} \ + ${srcdir}/${_pkgname}-${pkgver}/configure --prefix=/opt/${pkgname[0]/${_verflag}/}/${pkgver} \ $_TARGET $_LIB_PATH \ --program-prefix=${_target}- \ --program-suffix=${_multilib_name}${_ath9k_htc_name}-${pkgver} \ @@ -171,7 +196,7 @@ build() { msg "Check the host environment and makes sure all the necessary tools are available" make configure-host - make tooldir=/opt/${pkgname[0]}/${pkgver} + make tooldir=/opt/${pkgname[0]/${_verflag}/}/${pkgver} } #--------------------------------------------------------------------------------------------------------------------------------------------- @@ -187,7 +212,7 @@ check() { #--------------------------------------------------------------------------------------------------------------------------------------------- _target-binutils() { - pkgrel=$pkgrel + pkgrel=${_pkgrelc} pkgdesc="A set of programs to assemble and manipulate binary and object files${_multilib_desc}${_ath9k_htc_desc}. (${_target} architecture)" depends=('glibc>=2.17' 'zlib' "${_pkgname}-common") [[ $CHOST == ${_target} ]] && provides=("${_pkgname}=${pkgver}") @@ -200,7 +225,7 @@ _target-binutils() { install="${_target}-${_pkgname}${_multilib_name}${_ath9k_htc_name}.install" cd ${srcdir}/${_pkgname}-build - make prefix=${pkgdir}/opt/${pkgname}/${pkgver} tooldir=${pkgdir}/opt/${pkgname}/${pkgver} install + make prefix=${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver} tooldir=${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver} install # temp # msg "!!! Move 'bin', 'include' and 'share' dir to /usr, !!!" @@ -215,8 +240,8 @@ _target-binutils() { [[ $CARCH != ${_CARCH} ]] && { msg "Move 'lib' files and directories, and remove architecture directories" - mv -v ${pkgdir}/opt/${pkgname}/${pkgver}/{$CHOST/${_target}/lib/*,lib} - rmdir -v ${pkgdir}/opt/${pkgname}/${pkgver}/$CHOST/{${_target}/{lib,},} + mv -v ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/{$CHOST/${_target}/lib/*,lib} + rmdir -v ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/$CHOST/{${_target}/{lib,},} } msg "Change lib-path on ldscripts files" @@ -224,7 +249,7 @@ _target-binutils() { /^SEARCH_DIR/ s|/${pkgver}/lib|/${pkgver}/lib32|g; /^SEARCH_DIR/ s|/${pkgver}/lib3264|/${pkgver}/lib|g; /^SEARCH_DIR/ s|/${pkgver}/lib32x32|/${pkgver}/lib|g; - " ${pkgdir}/opt/${pkgname}/${pkgver}/lib/ldscripts/* + " ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/lib/ldscripts/* _removebin=(ar as nm objcopy objdump ranlib strip) for _rbin in ${_removebin[@]}; do @@ -235,10 +260,10 @@ _target-binutils() { msg "Create links for libraries" install -vd ${pkgdir}/{usr/${_target},etc/ld.so.conf.d} ln -vs ../lib ${pkgdir}/usr/${_target}/lib - echo /opt/${pkgname}/${pkgver}/lib > ${pkgdir}/etc/ld.so.conf.d/${pkgname}-${pkgver}.conf + echo /opt/${pkgname/${_verflag}/}/${pkgver}/lib > ${pkgdir}/etc/ld.so.conf.d/${pkgname}-${pkgver}.conf msg "Install PIC libiberty.a" - install -vm644 libiberty/pic/libiberty.a ${pkgdir}/opt/${pkgname[0]}/${pkgver}/lib + install -vm644 libiberty/pic/libiberty.a ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/lib msg "Remove unnecessaries manuals and create links for manuals" _man=$(ls -1A ${pkgdir}/usr/share/man/man1) @@ -348,34 +373,34 @@ package_or32-unknown-elf-binutils() { _target-binutils; } #--------------------------------------------------------------------------------------------------------------------------------------------- package_binutils-common() { - pkgrel=$pkgrel + pkgrel=${_pkgrelb} pkgdesc="A set of programs to assemble and manipulate binary and object files. (headers, docs and locales files only)" arch=('any') depends=('linktools') install="${_pkgname}.install" cd ${srcdir}/${_pkgname}-build - make prefix=${pkgdir}/opt/${pkgname}/${pkgver} tooldir=${pkgdir}/opt/${pkgname}/${pkgver} install + make prefix=${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver} tooldir=${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver} install [[ $CARCH != ${_CARCH} ]] && { msg "Move 'include' files and directories" - mv -v ${pkgdir}/opt/${pkgname}/${pkgver}/{$CHOST/${_target}/include,} + mv -v ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/{$CHOST/${_target}/include,} } msg "Add some useful headers" - install -vm644 ${srcdir}/${_pkgname}-${pkgver}/include/{demangle,libiberty}.h ${pkgdir}/opt/${pkgname}/${pkgver}/include + install -vm644 ${srcdir}/${_pkgname}-${pkgver}/include/{demangle,libiberty}.h ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/include msg "Remove unnecessaries files and directories" - rm -vr ${pkgdir}/opt/${pkgname}/${pkgver}/{bin,lib} + rm -vr ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/{bin,lib} [[ $CARCH != ${_CARCH} ]] && { - rm -vr ${pkgdir}/opt/${pkgname}/${pkgver}/$CHOST + rm -vr ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/$CHOST } msg "Rename manuals" - _man=$(ls -1A ${pkgdir}/opt/${pkgname}/${pkgver}/share/man/man1) + _man=$(ls -1A ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/share/man/man1) for _man_stage1 in ${_man[@]}; do _man_stage2=${_man_stage1/${_multilib_name}${_ath9k_htc_name}-${pkgver}/} _manuals=${_man_stage2/${_target}-/} - mv -v ${pkgdir}/opt/${pkgname}/${pkgver}/share/man/man1/{${_man_stage1},${_manuals}} + mv -v ${pkgdir}/opt/${pkgname/${_verflag}/}/${pkgver}/share/man/man1/{${_man_stage1},${_manuals}} done } |