diff options
Diffstat (limited to '~coadde/cross-binutils')
6 files changed, 388 insertions, 0 deletions
diff --git a/~coadde/cross-binutils/PKGBUILD b/~coadde/cross-binutils/PKGBUILD new file mode 100644 index 000000000..9a3a4b521 --- /dev/null +++ b/~coadde/cross-binutils/PKGBUILD @@ -0,0 +1,307 @@ +# Maintainer: Márcio Silva <coadde@lavabit.com> +# Contributor: André Silva <emulatorman@lavabit.com> + +# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc + +_pkgname="binutils" + +#+-------------------+-----------------------+-------------+------------------------------+ +#| _CARCH | _os (GNU/Linux-libre) | _os (GNU) | _os (GNU/Linux-libre uClibc) | +#+-------------------+-----------------------+-------------+------------------------------+ +#| mips64el | unknown-linux-gnu | - | unknown-uclinux-gnu | +#| x86_64 | unknown-linux-gnu | unknown-gnu | unknown-uclinux-gnu | +#| i[65]86 | pc-linux-gnu | pc-gnu | unknown-uclinux-gnu | +#| aarch64{,_be} | unknown-linux-gnu | - | unknown-uclinux-gnu | +#| arm{,v[765]}{,eb} | unknown-linux-gnueabi | - | unknown-uclinux-gnueabi | +#| sparc64 | unknown-linux-gnu | - | - | +#| ia64 | unknown-linux-gnu | - | - | +#+-------------------+-----------------------+-------------+------------------------------+ + +#+----------------+--------------------+ +#| _CARCH | _os (ELF/EABI) | +#+----------------+--------------------+ +#| xtensa | unknown-elf | +#| mips64{,el} | unknown-elf | +#| mips32{,el} | unknown-elf | +#| x86_64 | unknown-elf | +#| i[653]86 | unknown-elf | +#| aarch64{,_be} | unknown-elf | +#| arm{,eb} | unknown-eabi | +#| powerpc64{,le} | unknown-{elf,eabi} | +#| powerpc32{,le} | unknown-{elf,eabi} | +#| sh64{,l} | unknown-elf | +#| sh{,l} | unknown-elf | +#| m68k | unknown-elf | +#+----------------+--------------------+ + +### Base FLAGS: ### +_CARCH="i686" +_os="pc-linux-gnu" +_target="${_CARCH}-${_os}" +_multilib="no" + +### Patch FLAGS: ### +_patch_ath9k_htc_fw="no" + +[[ ${_multilib} == "yes" ]] && { + _multilib_name="-multilib" + _multilib_desc=" for multilib" +} + +# For "_patch_ath9k_htc_fw" +[[ ${_patch_ath9k_htc_fw} == "yes" ]] && { + _ath9k_htc_name="-ath9k-htc" + _ath9k_htc_desc=" adapted for ath9k-htc firmware" + _multilib="no" +} + +pkgname=( + "${_target}-${_pkgname}${_multilib}${_ath9k_htc_name}" + "${_pkgname}-common" +) +pkgver=2.23.2 +pkgrel=2 +arch=('i686' 'x86_64' 'mips64el') +url="http://www.gnu.org/software/${_pkgname}/" +license=('GPL2') +groups=('cross-devel') +checkdepends=('dejagnu' 'bc') +[[ ${_multilib} == "yes" ]] && makedepends=('gcc-multilib') # makedepends=("$CHOST-gcc-multilib") # Make sure we compile this with gcc-multilib +options=('!libtool' '!distcc' '!ccache') +source=(ftp://ftp.gnu.org/gnu/${_pkgname}/${_pkgname}-${pkgver}.tar.bz2{,.sig} + ${_pkgname}-2.23.2-texinfo-5.0.patch) +md5sums=('4f8fa651e35ef262edc01d60fb45702e' + 'dfde4428f08d91f309cdcfe92bf28d08' + '34e439ce23213a91e2af872dfbb5094c') + +[[ ${_patch_ath9k_htc_fw} == "yes" ]] && { + source+=("_patch_ath9k_htc_fw.patch::https://raw.github.com/qca/open-ath9k-htc-firmware/1.3.2/local/patches/${_pkgname}.patch") + md5sums+=('7077126d96e9a755a0eaddb5505efe68') +} + +prepare() { + cd ${srcdir}/${_pkgname}-${pkgver} + + msg "http://sourceware.org/git/?p=${_pkgname}.git;a=patch;h=e02bf935" + msg "http://sourceware.org/git/?p=${_pkgname}.git;a=patch;h=935f8542" + patch -p1 -i ${srcdir}/${_pkgname}-2.23.2-texinfo-5.0.patch + + [[ ${_patch_ath9k_htc_fw} == "yes" ]] && { + patch -p1 -i ${srcdir}/_patch_ath9k_htc_fw.patch + } + + msg "hack! - libiberty configure tests for header files using" "$CPP $CPPFLAGS" + sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure + + mkdir -v ${srcdir}/${_pkgname}-build +} + +build() { + cd ${srcdir}/${_pkgname}-build + + msg "The 'lib64(lib)' and 'lib(lib32)' will be fixed on _target-binutils() on ldscripts files" + [[ $CARCH != ${_CARCH} ]] && _TARGET="--target=${_target}" + if [[ $CARCH == x86_64 || $CARCH == mips64el || $CARCH == aarch64 || $CARCH == aarch64_be || $CARCH == sparc64 || $CARCH == ia64 ]]; then + _LIB_PATH="--with-lib-path=/usr/lib64:/usr/lib:/usr/local/lib64:/usr/local/lib:/usr/${_target}/lib64:/usr/${_target}/lib" + else + _LIB_PATH="--with-lib-path=/usr/lib32:/usr/local/lib32:/usr/${_target}/lib32" + fi + + if [[ ${_multilib} == "yes" ]]; then + _MULTILIB='--enable-multilib' + else + _MULTILIB='--disable-multilib' + fi + + ${srcdir}/binutils-${pkgver}/configure --prefix=/opt/${pkgname[0]}/${pkgver} \ + $_TARGET $_LIB_PATH \ + --program-prefix=${_target}- \ + --with-bugurl=https://labs.parabola.nu/ \ + --enable-ld=default --enable-gold \ + --enable-plugins --enable-threads \ + --with-pic --enable-shared \ + --disable-werror ${_MULTILIB} + # !!! Disabled, due which problematic libretools (prepare() and build() with --bindir, --includedir and --datarootdir)" !!! + #--bindir=/usr/bin --includedir=/usr/include --datarootdir=/usr/share \ + + msg "Check the host environment and makes sure all the necessary tools are available" + make configure-host + + make tooldir=/opt/${pkgname[0]}/${pkgver} +} + +check() { + cd ${srcdir}/${_pkgname}-build + + msg "Unset LDFLAGS as testsuite makes assumptions about which ones are active" + msg "do not abort on errors - manually check log files" + make LDFLAGS="" -k check || true +} + +_target-binutils() { + pkgrel=$pkgrel + 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}") + if [[ ${_multilib} == "yes" ]]; then + conflicts=("${pkgname}") + groups+=('multilib-devel') + else + groups+=('base-devel') + fi + groups+=("${_target}-devel") + install="${_target}-${_pkgname}.install" + + cd ${srcdir}/${_pkgname}-build + make prefix=${pkgdir}/opt/${pkgname}/${pkgver} tooldir=${pkgdir}/opt/${pkgname}/${pkgver} install + + # temp # + msg "!!! Move 'bin', 'include' and 'share' dir to /usr, !!!" + msg "!!! due which problematic libretools ('prepare()' and 'build()' with --bindir, --includedir and --datarootdir) !!!" + install -vd ${pkgdir}/usr + if [[ $CARCH == ${_CARCH} ]]; then + mv -v ${pkgdir}/{opt/${pkgname}/${pkgver}/{bin,include,share},usr} + else + mv -v ${pkgdir}/{opt/${pkgname}/${pkgver}/{bin,$CHOST/${_target}/include,share},usr} + fi + # temp # + + [[ $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,},} + } + + msg "Change lib-path on ldscripts files" + sed -i "/^SEARCH_DIR/ s|/${_target}/lib|/lib|g; + /^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/* + + _removebin=(ar as nm objcopy objdump ranlib strip) + for _rbin in ${_removebin[@]}; do + msg "Remove conflicting binaries" + rm -v ${pkgdir}/usr/bin/${_rbin[@]} + done + + 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 + + msg "Install PIC libiberty.a" + install -vm644 libiberty/pic/libiberty.a ${pkgdir}/opt/${pkgname[0]}/${pkgver}/lib + + msg "Remove unnecessaries manuals and create links for manuals" + _man=$(ls -1A ${pkgdir}/usr/share/man/man1) + for _man_stage1 in ${_man[@]}; do + _man_stage2=${_man_stage1/-${pkgver}/} + _manuals=${_man_stage2/${_target}-/} + rm -v ${pkgdir}/usr/share/man/man1/${_man_stage1} + ln -vs ${_manuals}.gz ${pkgdir}/usr/share/man/man1/${_man_stage1}.gz + done + + msg "Remove unnecessaries files and directories" + rm -vr ${pkgdir}/usr/{include,share/{info,locale}} +} + +# GNU/Linux-libre with GNU C Library (glibc) +package_mips64el-unknown-linux-gnu-binutils() { _target-binutils; } +package_x86_64-unknown-linux-gnu-binutils() { _target-binutils; } +package_i686-pc-linux-gnu-binutils() { _target-binutils; } +package_i586-pc-linux-gnu-binutils() { _target-binutils; } +package_aarch64-unknown-linux-gnu-binutils() { _target-binutils; } +package_aarch64_be-unknown-linux-gnu-binutils() { _target-binutils; } +package_arm-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_armeb-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_armv7-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_armv7eb-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_armv6-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_armv6eb-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_armv5-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_armv5eb-unknown-linux-gnueabi-binutils() { _target-binutils; } +package_sparc64-unknown-linux-gnu-binutils() { _target-binutils; } +package_ia64-unknown-linux-gnu-binutils() { _target-binutils; } + +# GNU +package_x86_64-unknown-gnu-binutils() { _target-binutils; } +package_i686-pc-gnu-binutils() { _target-binutils; } +package_i586-pc-gnu-binutils() { _target-binutils; } + +# GNU/Linux-libre with uClibc +package_mips64el-unknown-uclinux-gnu-binutils() { _target-binutils; } +package_x86_64-unknown-uclinux-gnu-binutils() { _target-binutils; } +package_i686-pc-uclinux-gnu-binutils() { _target-binutils; } +package_i586-pc-uclinux-gnu-binutils() { _target-binutils; } +package_aarch64-unknown-uclinux-gnu-binutils() { _target-binutils; } +package_arm-unknown-uclinux-gnueabi-binutils() { _target-binutils; } +package_armeb-unknown-uclinux-gnueabi-binutils() { _target-binutils; } +package_armv7-unknown-uclinux-gnueabi-binutils() { _target-binutils; } +package_armv7eb-unknown-uclinux-gnueabi-binutils() { _target-binutils; } +package_armv6-unknown-uclinux-gnueabi-binutils() { _target-binutils; } +package_armv6eb-unknown-uclinux-gnueabi-binutils() { _target-binutils; } +package_armv5-unknown-uclinux-gnueabi-binutils() { _target-binutils; } +package_armv5eb-unknown-uclinux-gnueabi-binutils() { _target-binutils; } + +# ELF or EABI only +package_xtensa-unknown-elf-binutils() { _target-binutils; } +package_xtensa-unknown-elf-binutils-ath9k_htc() { _target-binutils; } +package_mips64el-unknown-elf-binutils() { _target-binutils; } +package_mips64-unknown-elf-binutils() { _target-binutils; } +package_mips32el-unknown-elf-binutils() { _target-binutils; } +package_mips32-unknown-elf-binutils() { _target-binutils; } +package_x86_64-unknown-elf-binutils() { _target-binutils; } +package_i686-unknown-elf-binutils() { _target-binutils; } +package_i586-unknown-elf-binutils() { _target-binutils; } +package_i386-unknown-elf-binutils() { _target-binutils; } +package_aarch64-unknown-elf-binutils() { _target-binutils; } +package_aarch64_be-unknown-elf-binutils() { _target-binutils; } +package_arm-unknown-eabi-binutils() { _target-binutils; } +package_armeb-unknown-eabi-binutils() { _target-binutils; } +package_powerpc64-unknown-elf-binutils() { _target-binutils; } +package_powerpc64le-unknown-elf-binutils() { _target-binutils; } +package_powerpc32-unknown-elf-binutils() { _target-binutils; } +package_powerpc32le-unknown-elf-binutils() { _target-binutils; } +package_powerpc64-unknown-eabi-binutils() { _target-binutils; } +package_powerpc64le-unknown-eabi-binutils() { _target-binutils; } +package_powerpc32-unknown-eabi-binutils() { _target-binutils; } +package_powerpc32le-unknown-eabi-binutils() { _target-binutils; } +package_sh64-unknown-elf-binutils() { _target-binutils; } +package_sh64l-unknown-elf-binutils() { _target-binutils; } +package_sh-unknown-elf-binutils() { _target-binutils; } +package_shl-unknown-elf-binutils() { _target-binutils; } +package_m68k-unknown-elf-binutils() { _target-binutils; } + +package_binutils-common() { + pkgrel=$pkgrel + 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 + + [[ $CARCH != ${_CARCH} ]] && { + msg "Move 'include' files and directories" + mv -v ${pkgdir}/opt/${pkgname}/${pkgver}/{$CHOST/${_target}/include,} + } + + msg "Add some useful headers" + install -vm644 ${srcdir}/${_pkgname}-${pkgver}/include/{demangle,libiberty}.h ${pkgdir}/opt/${pkgname}/${pkgver}/include + + msg "Remove unnecessaries files and directories" + rm -vr ${pkgdir}/opt/${pkgname}/${pkgver}/{bin,lib} + [[ $CARCH != ${_CARCH} ]] && { + rm -vr ${pkgdir}/opt/${pkgname}/${pkgver}/$CHOST + } + + msg "Rename manuals" + _man=$(ls -1A ${pkgdir}/opt/${pkgname}/${pkgver}/share/man/man1) + for _man_stage1 in ${_man[@]}; do + _man_stage2=${_man_stage1/-${pkgver}/} + _manuals=${_man_stage2/${_target}-/} + mv -v ${pkgdir}/opt/${pkgname}/${pkgver}/share/man/man1/{${_man_stage1},${_manuals}} + done +} diff --git a/~coadde/cross-binutils/binutils.install b/~coadde/cross-binutils/binutils.install new file mode 100644 index 000000000..9de0533ee --- /dev/null +++ b/~coadde/cross-binutils/binutils.install @@ -0,0 +1,17 @@ +infodir=usr/share/info +filelist=(as.info bfd.info binutils.info gprof.info ld.info) + +post_upgrade() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info $infodir/$file.gz $infodir/dir 2> /dev/null + done +} + +pre_remove() { + [ -x usr/bin/install-info ] || return 0 + for file in ${filelist[@]}; do + install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null + done +} + diff --git a/~coadde/cross-binutils/i586-pc-linux-gnu-binutils.install b/~coadde/cross-binutils/i586-pc-linux-gnu-binutils.install new file mode 100644 index 000000000..f14abdfaa --- /dev/null +++ b/~coadde/cross-binutils/i586-pc-linux-gnu-binutils.install @@ -0,0 +1,16 @@ +_pkgname=i586-pc-linux-gnu-binutils + +post_install() { + linktools set $_pkgname + linktools update binutils +} + +post_upgrade() { + post_install +} + +pre_remove() { + [[ $_pkgname == $(linktools check) ]] && { + linktools unset + } +} diff --git a/~coadde/cross-binutils/i686-pc-linux-gnu-binutils.install b/~coadde/cross-binutils/i686-pc-linux-gnu-binutils.install new file mode 100644 index 000000000..a0498ff51 --- /dev/null +++ b/~coadde/cross-binutils/i686-pc-linux-gnu-binutils.install @@ -0,0 +1,16 @@ +_pkgname=i686-pc-linux-gnu-binutils + +post_install() { + linktools set $_pkgname + linktools update binutils +} + +post_upgrade() { + post_install +} + +pre_remove() { + [[ $_pkgname == $(linktools check) ]] && { + linktools unset + } +} diff --git a/~coadde/cross-binutils/mips64el-unknown-linux-gnu-binutils.install b/~coadde/cross-binutils/mips64el-unknown-linux-gnu-binutils.install new file mode 100644 index 000000000..21b4a2af2 --- /dev/null +++ b/~coadde/cross-binutils/mips64el-unknown-linux-gnu-binutils.install @@ -0,0 +1,16 @@ +_pkgname=mips64el-unknown-linux-gnu-binutils + +post_install() { + linktools set $_pkgname + linktools update binutils +} + +post_upgrade() { + post_install +} + +pre_remove() { + [[ $_pkgname == $(linktools check) ]] && { + linktools unset + } +} diff --git a/~coadde/cross-binutils/x86_64-unknown-linux-gnu-binutils.install b/~coadde/cross-binutils/x86_64-unknown-linux-gnu-binutils.install new file mode 100644 index 000000000..299a9675f --- /dev/null +++ b/~coadde/cross-binutils/x86_64-unknown-linux-gnu-binutils.install @@ -0,0 +1,16 @@ +_pkgname=x86_64-unknown-linux-gnu-binutils + +post_install() { + linktools set $_pkgname + linktools update binutils +} + +post_upgrade() { + post_install +} + +pre_remove() { + [[ $_pkgname == $(linktools check) ]] && { + linktools unset + } +} |