├── .travis.yml ├── Dockerfile ├── LICENSE ├── README.md ├── build_crosstool.sh ├── build_grte.sh ├── check.sh ├── crosstool ├── crosstool-grte-clang.spec ├── crosstool-grte-foo.spec ├── crosstool-grte-gcc.spec ├── gcc-4.4.0-glibc-2.3.6-grte.spec ├── get-clang-svn.sh ├── get-gcc-svn.sh └── scripts │ ├── brp-dup-shared │ ├── crosstool.sh │ └── rpm_to_deb ├── grte ├── argv0switch.c ├── download.sh ├── grte-build ├── grte-package ├── grte-python2.4.6.spec ├── grte.cfg ├── grtev1-debuginfo.spec ├── grtev1-gde.spec ├── grtev1-headers.spec ├── grtev1-runtime.spec ├── grtev1.changelog ├── prepare-sources.sh └── sources │ └── .keep ├── install-bazel.sh ├── install-release.sh ├── release.py ├── upload-github-release.sh └── upstream ├── .keep ├── binutils-2.24-set-section-macros.patch └── clang-grte-runtime.patch /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: true 2 | dist: trusty 3 | 4 | services: 5 | - docker 6 | 7 | cache: 8 | directories: 9 | - $HOME/upstream 10 | - $HOME/sources 11 | - $HOME/output 12 | 13 | # language: cpp 14 | addons: 15 | apt: 16 | sources: 17 | - ubuntu-toolchain-r-test 18 | packages: 19 | - wget 20 | # There packages are needed to build lrte, see build_grte.sh 21 | - texinfo 22 | - texi2html 23 | - xz-utils 24 | - make 25 | - gcc 26 | - g++ 27 | - gawk 28 | - rpm 29 | - alien 30 | - fakeroot 31 | - debhelper 32 | 33 | before_install: 34 | - TAR_DIR=$HOME/upstream ./grte/download.sh 35 | - TAR_DIR=$HOME/upstream ./grte/prepare-sources.sh 36 | 37 | script: 38 | - mkdir -p $HOME/lrte-k8 39 | - ./grte/grte-build $HOME/lrte-k8 $HOME/output 40 | - ./grte/grte-package $HOME/lrte-k8 $HOME/output 41 | 42 | notifications: 43 | email: false 44 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | ADD ./install-*.sh /tmp/ 4 | 5 | RUN /tmp/install-release.sh 6 | RUN /tmp/install-bazel.sh 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | LRTE 2 | ==== 3 | 4 | Fork of https://code.google.com/p/google-search-appliance-mirror/downloads/detail?name=grte-1.2.2-src.tar.bz2&can=2&q= 5 | 6 | Original source code downloaded from: 7 | 8 | https://google-search-appliance-mirror.googlecode.com/files/grte-1.2.2-src.tar.bz2 9 | https://google-search-appliance-mirror.googlecode.com/files/crosstoolv13-gcc-4.4.0-glibc-2.3.6-grte-1.0-36185.src.rpm 10 | https://google-search-appliance-mirror.googlecode.com/files/grte-python2.4-2.4.6-7.src.tar.bz2 11 | 12 | ChangeLog 13 | ========= 14 | 15 | - grte-1.2.2-src.tar.bz2 -> grte with sources stripped 16 | 17 | 18 | Install and Usage 19 | ================= 20 | 21 | It's recommended to just install the precomiled packages from release 22 | page. For example, to install lrtev2 with crosstool v2: 23 | 24 | ``` 25 | apt-get update 26 | apt-get install -y apt-transport-https 27 | echo 'deb https://github.com/bazelment/lrte/releases/download/v3.0_0 ./' >> /etc/apt/sources.list 28 | apt-get update 29 | apt-get install -y --force-yes lrtev3-crosstoolv2-gcc-4.9 lrtev3-crosstoolv2-clang-4.0 30 | 31 | ``` 32 | 33 | On the production machines, you should need to install 34 | ```lrtev3-runtime``` package, which contains the glibc and libstdc++ 35 | libraries. 36 | 37 | Then gcc and clang under /usr/crosstool/v3/gcc-4.9.2-lrtev3/x86/bin 38 | can be used to produce binaries that only work with LRTE, which means 39 | these binaries only depend on glibc and libstdc++ coming from LRTE 40 | runtime, so they can be shipped without worrying about the system's 41 | glibc version. 42 | 43 | Btw: the gcc and clang inside crosstool are linked against LRTE 44 | runtime they can pretty much run on any release of ubuntu or redhat. 45 | 46 | For example: 47 | 48 | ``` 49 | # /usr/lrte/v3/bin/ldd /usr/crosstool/v3/gcc-4.9.2-lrtev3/x86/bin/clang 50 | linux-vdso.so.1 (0x00007ffc388cf000) 51 | libdl.so.2 => /usr/lrte/v3/lib64/libdl.so.2 (0x00007f6e55453000) 52 | libpthread.so.0 => /usr/lrte/v3/lib64/libpthread.so.0 (0x00007f6e55236000) 53 | libz.so.1 => /usr/lrte/v3/lib64/libz.so.1 (0x00007f6e5501c000) 54 | libstdc++.so.6 => /usr/lrte/v3/lib64/libstdc++.so.6 (0x00007f6e54d12000) 55 | libm.so.6 => /usr/lrte/v3/lib64/libm.so.6 (0x00007f6e54a0a000) 56 | libgcc_s.so.1 => /usr/lrte/v3/lib64/libgcc_s.so.1 (0x00007f6e547f4000) 57 | libc.so.6 => /usr/lrte/v3/lib64/libc.so.6 (0x00007f6e54431000) 58 | /usr/lrte/v3/lib64/ld-linux-x86-64.so.2 (0x00007f6e55657000) 59 | ``` 60 | 61 | You can also refer to [build 62 | guide](https://github.com/bazelment/lrte/wiki/Build-Guide) if you prefer 63 | building everything from source code for further customization. -------------------------------------------------------------------------------- /build_crosstool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Take input from /dev/null. 4 | exec < /dev/null 5 | 6 | # stop on any error, echo commands. 7 | set -ex 8 | 9 | # Set locale to C, so that e.g., 'sort' will work consistently regardless 10 | # of system and user environment settings. 11 | LC_ALL=C 12 | export LC_ALL 13 | 14 | absname=`readlink -f "$0"` 15 | absroot="${absname%/*}" 16 | 17 | [ -f "${absroot}/grte/grte.cfg" ] || { 18 | error "could not find ${absroot}/grte/grte.cfg" 19 | } 20 | 21 | . "${absroot}/grte/grte.cfg" 22 | 23 | GRTEROOT="${1}/v${GRTEVERSION}" 24 | tb=`readlink -f "${2}"` 25 | GRTEBASENAME="${GRTE_PACKAGE_PREFIX}$(basename $1)v${GRTEVERSION}" 26 | STAGING="${tb}/staging" 27 | RESULTS="${tb}/results" 28 | DEB_DIR=${RESULTS}/debs 29 | 30 | # Directory that stores upstream sources 31 | CROSSTOOL_SOURCES=$3 32 | 33 | # Crosstool configuration 34 | CROSSTOOL_VERSION="v2" 35 | 36 | CROSSTOOL_GCC_VERSION="4.9" 37 | 38 | # Assume the clang source code is checked out following 39 | # http://clang.llvm.org/get_started.html 40 | CROSSTOOL_CLANG_VERSION="4.0" 41 | 42 | : ${crosstool_rpmver:="1.0"} 43 | # Update this each time new RPM's are built. 44 | : ${crosstool_rpmrel:="8"} 45 | 46 | export PARALLELMFLAGS="${JFLAGS:-j8}" 47 | [ -z "${EMAIL}" ] && { 48 | EMAIL="foo@bar.io" 49 | export EMAIL 50 | } 51 | 52 | # Install the packages for GRTE, mostly GDE 53 | for pkg in runtime headers gde; do 54 | dpkg -i ${DEB_DIR}/${GRTEBASENAME}-${pkg}_${grte_rpmver}-${grte_rpmrel}_amd64.deb 55 | done 56 | 57 | # sed -e "s:/usr/lrte/v3/lib64/::g" -i /usr/lrte/v3/lib64/libm.so 58 | 59 | # Use bash as shell, other "source" command inside rpm spec will fail. 60 | ln -sf /bin/bash /bin/sh 61 | 62 | # install packages that are needed by building binutils and clang 63 | apt-get update 64 | apt-get install -y flex bison rpm texinfo texi2html libxml2-dev make alien wget 65 | 66 | function build_rpm() { 67 | local rpmrel=$1 68 | local spec_file=$2 69 | rpmbuild \ 70 | --dbpath /dev/null \ 71 | --define "_hash_empty_files 1" \ 72 | --define "_sourcedir ${CROSSTOOL_SOURCES}" \ 73 | --define "_topdir ${STAGING}" \ 74 | --define "_rpmtopdir ${STAGING}" \ 75 | --define 'disable_debuginfo t' \ 76 | --define "maintainer_email ${EMAIL}" \ 77 | --define "grte_basename ${GRTEBASENAME}" \ 78 | --define "grte_root ${GRTEROOT}" \ 79 | --define "grte_version ${GRTEVERSION}" \ 80 | --define "grte_gcc_version ${gcc_version}" \ 81 | --define "grte_glibc_version ${glibc_version}" \ 82 | --define "grte_rpmver ${grte_rpmver}" \ 83 | --define "grte_rpmrel ${grte_rpmrel}" \ 84 | --define "binutils_version ${binutils_version}" \ 85 | --define "gmp_version ${gmp_version}" \ 86 | --define "mpfr_version ${mpfr_version}" \ 87 | --define "mpc_version ${mpc_version}" \ 88 | --define "crosstool_scripts ${absroot}/crosstool/scripts" \ 89 | --define "crosstool_version ${CROSSTOOL_VERSION}" \ 90 | --define "crosstool_rpmver ${crosstool_rpmver}" \ 91 | --define "crosstool_rpmrel ${rpmrel}" \ 92 | --define "crosstool_gcc_version ${CROSSTOOL_GCC_VERSION}" \ 93 | --define "gcc_svn_version ${GCC_SVN_VERSION}" \ 94 | --define "crosstool_clang_version ${CROSSTOOL_CLANG_VERSION}" \ 95 | --define "clang_svn_version ${CLANG_SVN_VERSION}" \ 96 | -bb ${spec_file} 97 | } 98 | 99 | function package() { 100 | local name=$1 # gcc, clang 101 | local version=$2 # gcc version, or clang version 102 | local svn_version=$3 103 | local rpm_rel=${crosstool_rpmrel}.${svn_version}svn 104 | build_rpm ${rpm_rel} crosstool/crosstool-grte-${name}.spec 105 | local package_prefix="${GRTEBASENAME}-crosstool${CROSSTOOL_VERSION}-${name}-${version}" 106 | local rpm="RPMS/x86_64/${package_prefix}-${crosstool_rpmver}-${rpm_rel}.x86_64.rpm" 107 | pushd $STAGING 108 | ${absroot}/crosstool/scripts/rpm_to_deb "$rpm" 109 | mv "${package_prefix}_${crosstool_rpmver}-${rpm_rel}_amd64.deb" \ 110 | "${package_prefix}_${crosstool_rpmver}-${rpm_rel}_amd64.changes" \ 111 | "${RESULTS}/debs/" 112 | mv "$rpm" "${RESULTS}/rpms/" 113 | popd 114 | } 115 | 116 | set -e 117 | # For test rpm creation and deb conversion. 118 | # package foo ${CROSSTOOL_GCC_VERSION} ${GCC_SVN_VERSION} 119 | 120 | [ -z "${SKIP_CROSSTOOL_GCC}" ] && { 121 | package gcc ${CROSSTOOL_GCC_VERSION} ${GCC_SVN_VERSION} 122 | } 123 | 124 | # Install the crosstool gcc to build clang 125 | dpkg -i ${DEB_DIR}/${GRTEBASENAME}-crosstool${CROSSTOOL_VERSION}-gcc-${CROSSTOOL_GCC_VERSION}_${crosstool_rpmver}-${crosstool_rpmrel}.${GCC_SVN_VERSION}svn_amd64.deb 126 | 127 | # Build cmake because cmake in ubuntu 13 is too old 128 | mkdir -p ${STAGING}/cmake 129 | CMAKE_VERSION=3.8.2 130 | if [ ! -e ${CROSSTOOL_SOURCES}/cmake-${CMAKE_VERSION}.tar.gz ]; then 131 | pushd ${CROSSTOOL_SOURCES} 132 | wget http://cmake.org/files/v3.8/cmake-${CMAKE_VERSION}.tar.gz 133 | popd 134 | fi 135 | tar zxf ${CROSSTOOL_SOURCES}/cmake-${CMAKE_VERSION}.tar.gz -C ${STAGING}/cmake 136 | pushd ${STAGING}/cmake/cmake-${CMAKE_VERSION} 137 | ./configure --parallel=${PARALLELMFLAGS} 138 | make ${PARALLELMFLAGS} 139 | make install 140 | popd 141 | 142 | package clang ${CROSSTOOL_CLANG_VERSION} ${CLANG_SVN_VERSION} 143 | -------------------------------------------------------------------------------- /build_grte.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This runs inside docker container as root to build GRTE 4 | 5 | set -ex 6 | apt-get update 7 | # Make sure requires packages are installed(either on host or insider 8 | # docker) 9 | # xz-utils: needed to unpack kernel source 10 | # gawk: used by building glibc 11 | # rpm: rpmbuild to build rpm package 12 | # alien, fakeroot, debhelper: convert rpm package to debian package 13 | # python: 2to3 14 | apt-get install -y texinfo texi2html xz-utils make gcc g++ gawk \ 15 | rpm alien fakeroot debhelper python 16 | 17 | GRTE_PREFIX=$1 18 | GRTE_TMPDIR=$2 19 | mkdir ${GRTE_PREFIX} 20 | 21 | rm -rf grte/sources/* 22 | ./grte/prepare-sources.sh 23 | ./grte/grte-build ${GRTE_PREFIX} ${GRTE_TMPDIR} 24 | ./grte/grte-package ${GRTE_PREFIX} ${GRTE_TMPDIR} 25 | -------------------------------------------------------------------------------- /check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check the LRTE runtime and Crosstool can be used. 4 | 5 | absname=`readlink -f "$0"` 6 | absroot="${absname%/*}" 7 | 8 | . "${absroot}/grte/grte.cfg" 9 | 10 | GRTEROOT="${1}/v${GRTEVERSION}" 11 | tb=`readlink -f "${2}"` 12 | GRTEBASENAME="${GRTE_PACKAGE_PREFIX}$(basename $1)v${GRTEVERSION}" 13 | STAGING="${tb}/staging" 14 | RESULTS="${tb}/results" 15 | DEB_DIR=${RESULTS}/debs 16 | 17 | # Install the packages for GRTE 18 | for pkg in runtime headers; do 19 | dpkg -i ${DEB_DIR}/${GRTEBASENAME}-${pkg}_${grte_rpmver}-${grte_rpmrel}_amd64.deb 20 | done 21 | 22 | dpkg -i ${DEB_DIR}/${GRTEBASENAME}-crosstoolv2-*_amd64.deb 23 | 24 | export CROSSTOOL_TOP=/usr/crosstool/v2/gcc-${gcc_version}-${GRTEBASENAME}/x86/bin/ 25 | # Put llvm-symbolizer to the path 26 | export PATH=${CROSSTOOL_TOP}:$PATH 27 | 28 | # Check normal build 29 | ${CROSSTOOL_TOP}/clang++ hello.cc -o /tmp/hello 30 | /tmp/hello 31 | 32 | # Check address sanitizer build 33 | ${CROSSTOOL_TOP}/clang++ -fsanitize=address hello.cc -o /tmp/hello 34 | /tmp/hello 35 | 36 | 37 | -------------------------------------------------------------------------------- /crosstool/crosstool-grte-clang.spec: -------------------------------------------------------------------------------- 1 | %define gcc_glibc_version gcc-%{grte_gcc_version}-%{grte_basename} 2 | %define base_summary Clang %{crosstool_clang_version} for %{grte_root} with %{gcc_glibc_version} 3 | %define _unpackaged_files_terminate_build 1 4 | %define __os_install_post %{nil} 5 | 6 | Summary: %{base_summary} 7 | Name: %{grte_basename}-crosstool%{crosstool_version}-clang-%{crosstool_clang_version} 8 | Version: %{crosstool_rpmver} 9 | Release: %{crosstool_rpmrel} 10 | License: BSD 11 | Group: Development/Languages 12 | Packager: Release Engineer <%{maintainer_email}> 13 | AutoReqProv: no 14 | Requires: %{grte_basename}-runtime %{grte_basename}-headers %{grte_basename}-crosstool%{crosstool_version}-gcc-%{crosstool_gcc_version} 15 | 16 | # Source0: cmake-3.2.3.tar.gz 17 | BuildRoot: %{_tmppath}/%{name}-buildroot 18 | 19 | # Create debuginfo unless disable_debuginfo is defined. 20 | %define make_debuginfo %{?disable_debuginfo:""}%{!?disable_debuginfo:"t"} 21 | 22 | # Remove BuildRoot in %clean unless keep_buildroot is defined. 23 | %define remove_buildroot %{?keep_buildroot:""}%{!?keep_buildroot:"t"} 24 | 25 | %description 26 | Clang %{crosstool_clang_version} to work with %{grte_basename} 27 | 28 | %prep 29 | # %setup -c 30 | # %setup -T -D -a 0 31 | 32 | %define crosstool_top /usr/crosstool/%{crosstool_version} 33 | %define target_top %{crosstool_top}/%{gcc_glibc_version} 34 | %define grte_top %{grte_root} 35 | 36 | %build 37 | export PATH="%{target_top}/x86/bin:%{grte_top}/bin:%{grte_top}/sbin:$PATH" 38 | # export CC="gcc -isystem %{grte_top}/include -L%{grte_top}/lib64" 39 | # export LDFLAGS="-Wl,-I,%{grte_top}/lib64/ld-linux-x86-64.so.2" 40 | # export CFLAGS="-isystem %{grte_top}/include -L%{grte_top}/lib64" 41 | # export CPPFLAGS="-isystem %{grte_top}/include -DGRTE_ROOT='\"%{grte_root}\"'" 42 | WORK_DIR="$RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION" 43 | 44 | # Build cmake because cmake in ubuntu 13 is too old 45 | # mkdir -p ${WORK_DIR}/cmake 46 | # cd ${WORK_DIR}/cmake 47 | # $WORK_DIR/cmake-3.2.3/configure --parallel=${PARALLELMFLAGS} 48 | # make ${PARALLELMFLAGS} 49 | # make install 50 | 51 | mkdir -p ${WORK_DIR}/llvm-build 52 | cd ${WORK_DIR}/llvm-build 53 | cmake -DCMAKE_BUILD_TYPE=Release \ 54 | -DCMAKE_EXE_LINKER_FLAGS="-Wl,-I,%{grte_top}/lib64/ld-linux-x86-64.so.2" \ 55 | -DCLANG_GRTE_ROOT=%{grte_root} \ 56 | -DCMAKE_INSTALL_PREFIX=%{target_top}/x86 \ 57 | -DLLVM_TARGETS_TO_BUILD=host \ 58 | -DLLVM_PARALLEL_COMPILE_JOBS=$PARALLELMFLAGS \ 59 | -DLLVM_BUILD_DOCS=OFF \ 60 | -DLLVM_TOOL_LIBCXX_BUILD=OFF \ 61 | -DLLVM_TOOL_LIBCXXABI_BUILD=OFF \ 62 | -DLLVM_TOOL_DRAGONEGG_BUILD=OFF \ 63 | -DLLVM_TOOL_LLGO_BUILD=OFF \ 64 | -DLLVM_TOOL_LLD_BUILD=OFF \ 65 | -DLLVM_TOOL_LLDB_BUILD=OFF \ 66 | -DLLVM_TOOL_LIBUNWIND_BUILD=OFF \ 67 | -DDEFAULT_SYSROOT=%{grte_top} \ 68 | -DGCC_INSTALL_PREFIX=%{target_top}/x86 \ 69 | -DLLVM_BINUTILS_INCDIR=%{target_top}/x86/include \ 70 | %{_sourcedir}/llvm 71 | make $PARALLELMFLAGS 72 | rm -rf $RPM_BUILD_ROOT 73 | make install DESTDIR=$RPM_BUILD_ROOT 74 | 75 | %install 76 | # Set PATH here so the scripts run by __spec_install_post, which use 77 | # 'strip' from PATH, use the GRTE 'strip'. 78 | export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH" 79 | 80 | %clean 81 | 82 | %files 83 | %defattr(-,root,root) 84 | %{target_top}/x86/bin/* 85 | %{target_top}/x86/include/* 86 | %{target_top}/x86/lib/* 87 | %{target_top}/x86/libexec/* 88 | %{target_top}/x86/share/* 89 | 90 | %changelog 91 | * Mon Jun 12 2017 Release Engineer <%{maintainer_email}> 92 | - Clang %{crosstool_clang_version} with SVN %{clang_svn_version}. 93 | -------------------------------------------------------------------------------- /crosstool/crosstool-grte-foo.spec: -------------------------------------------------------------------------------- 1 | %define gcc_glibc_version gcc-%{grte_gcc_version}-%{grte_basename} 2 | %define base_summary %{gcc_glibc_version} compiler for %{grte_root} 3 | Summary: %{base_summary} 4 | Name: %{grte_basename}-crosstool%{crosstool_version}-foo-%{crosstool_gcc_version} 5 | Version: %{crosstool_rpmver} 6 | Release: %{crosstool_rpmrel} 7 | License: GPL/LGPL 8 | Group: Development/Languages 9 | Packager: Release Engineer <%{maintainer_email}> 10 | AutoReqProv: no 11 | 12 | BuildRoot: %{_tmppath}/%{name}-buildroot 13 | 14 | # Create debuginfo unless disable_debuginfo is defined. 15 | %define make_debuginfo %{?disable_debuginfo:""}%{!?disable_debuginfo:"t"} 16 | %define debug_cflags %{?disable_debuginfo:""}%{!?disable_debuginfo:"-g"} 17 | 18 | # Remove BuildRoot in %clean unless keep_buildroot is defined. 19 | %define remove_buildroot %{?keep_buildroot:""}%{!?keep_buildroot:"t"} 20 | 21 | # Enable bootstrapping unless disable_bootstrap is defined. 22 | %define bootstrap_config_arg %{?disable_bootstrap:"--disable-bootstrap"}%{!?disable_bootstrap:""} 23 | 24 | %description 25 | GCC %{crosstool_gcc_version} to work with %{grte_basename}, @svn %{gcc_svn_version} 26 | 27 | %prep 28 | 29 | %define crosstool_top /usr/crosstool/%{crosstool_version} 30 | %define target_top %{crosstool_top}/%{gcc_glibc_version} 31 | %define grte_top %{grte_root} 32 | 33 | %build 34 | export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH" 35 | WORK_DIR="$RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION" 36 | 37 | TARGET=x86_64-unknown-linux-gnu 38 | PREFIX="$RPM_BUILD_ROOT%{target_top}/x86" 39 | # Make gold the default linker 40 | mkdir -p ${PREFIX} 41 | date > ${PREFIX}/foo 42 | 43 | %install 44 | 45 | %clean 46 | 47 | %files 48 | 49 | %defattr(-,root,root) 50 | %{target_top}/x86/foo 51 | 52 | %changelog 53 | * Mon Jun 01 2015 Ming Zhao 54 | - Test only. 55 | -------------------------------------------------------------------------------- /crosstool/crosstool-grte-gcc.spec: -------------------------------------------------------------------------------- 1 | %define gcc_glibc_version gcc-%{grte_gcc_version}-%{grte_basename} 2 | %define base_summary %{gcc_glibc_version} compiler for %{grte_root} 3 | Summary: %{base_summary} 4 | Name: %{grte_basename}-crosstool%{crosstool_version}-gcc-%{crosstool_gcc_version} 5 | Version: %{crosstool_rpmver} 6 | Release: %{crosstool_rpmrel} 7 | License: GPL/LGPL 8 | Group: Development/Languages 9 | Packager: Release Engineer <%{maintainer_email}> 10 | AutoReqProv: no 11 | Requires: %{grte_basename}-runtime %{grte_basename}-headers 12 | 13 | # Source0: crosstool-scripts.tar.gz 14 | Source0: binutils-%{binutils_version}.tar.bz2 15 | # Patch0: binutils-2.24-set-section-macros.patch 16 | Source1: gmp-%{gmp_version}.tar.bz2 17 | Source2: mpc-%{mpc_version}.tar.gz 18 | Source3: mpfr-%{mpfr_version}.tar.bz2 19 | 20 | BuildRoot: %{_tmppath}/%{name}-buildroot 21 | 22 | # Create debuginfo unless disable_debuginfo is defined. 23 | %define make_debuginfo %{?disable_debuginfo:""}%{!?disable_debuginfo:"t"} 24 | %define debug_cflags %{?disable_debuginfo:""}%{!?disable_debuginfo:"-g"} 25 | 26 | # Remove BuildRoot in %clean unless keep_buildroot is defined. 27 | %define remove_buildroot %{?keep_buildroot:""}%{!?keep_buildroot:"t"} 28 | 29 | # Enable bootstrapping unless disable_bootstrap is defined. 30 | %define bootstrap_config_arg %{?disable_bootstrap:"--disable-bootstrap"}%{!?disable_bootstrap:""} 31 | 32 | %description 33 | GCC %{crosstool_gcc_version} to work with %{grte_basename} 34 | 35 | %prep 36 | %setup -c 37 | %setup -T -D -a 0 38 | %setup -T -D -a 1 39 | %setup -T -D -a 2 40 | %setup -T -D -a 3 41 | 42 | # cd binutils-2.25 43 | # %patch0 -p0 44 | # cd .. 45 | 46 | %define crosstool_top /usr/crosstool/%{crosstool_version} 47 | %define target_top %{crosstool_top}/%{gcc_glibc_version} 48 | %define grte_top %{grte_root} 49 | 50 | %build 51 | BUGURL=http://www.github.com/crosstool/bug 52 | PKGVERSION=CROSSTOOL_%{name}-%{version}-%{release} 53 | # For an actual release build, which doesn't have any special text in the 54 | # Release field, we do not include the version number. This is done so 55 | # that binaries will rebuild identically (if their sources aren't changed) 56 | # in subsequent rebuilds. (We don't use if/else so that this is more 57 | # diffable with other crosstool specs, which always include versions.) 58 | if echo %{release} | grep '^[0-9][0-9]*$' > /dev/null; then 59 | PKGVERSION=CROSSTOOL_%{name} 60 | fi 61 | 62 | source %{crosstool_scripts}/crosstool.sh 63 | 64 | export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH" 65 | 66 | WORK_DIR="$RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION" 67 | 68 | BINUTILS_SRC_SUBDIR="binutils-%{binutils_version}" 69 | GCC_SRC_SUBDIR="gcc-%{crosstool_gcc_version}" 70 | 71 | CFLAGS="-O2 -isystem %{grte_top}/include -L%{grte_top}/lib64" 72 | CC_COMMON="%{grte_top}/bin/gcc -m64 ${CFLAGS}" 73 | CXX_COMMON="%{grte_top}/bin/g++ -m64 ${CFLAGS}" 74 | LDFLAGS="-Wl,-I,%{grte_top}/lib64/ld-linux-x86-64.so.2" 75 | COMMON_GCC_OPTIONS=" \ 76 | --enable-shared=libgcc,libssp,libstdc++\ 77 | --enable-languages=c,c++ --with-sysroot=%{grte_top} \ 78 | --with-runtime-root-prefix=%{grte_top} \ 79 | --with-native-system-header-dir=/include \ 80 | --with-local-prefix=/ \ 81 | --with-bugurl=$BUGURL --with-pkgversion=$PKGVERSION \ 82 | --enable-clocale=gnu \ 83 | --enable-linker-build-id \ 84 | " 85 | 86 | # We build for x86_64 and bootstrap a compiler that supports i686 multilibs. 87 | TARGET=x86_64-unknown-linux-gnu 88 | PREFIX="$RPM_BUILD_ROOT%{target_top}/x86" 89 | DBGSRC_TOP="%{target_top}/x86/debug-src" 90 | DBGSRC_PREFIX="$RPM_BUILD_ROOT$DBGSRC_TOP" 91 | RUNTIME_TOP_32="%{crosstool_top}/i686-unknown-linux-gnu" 92 | RUNTIME_TOP_64="%{crosstool_top}/x86_64-unknown-linux-gnu" 93 | RUNTIME_PREFIX_32="$RPM_BUILD_ROOT$RUNTIME_TOP_32/lib" 94 | RUNTIME_PREFIX_64="$RPM_BUILD_ROOT$RUNTIME_TOP_64/lib64" 95 | HOSTLIB_PREFIX="$WORK_DIR/hostlibs" 96 | debug_map_build_arg= 97 | debug_map_config_arg= 98 | if [ -n "%{make_debuginfo}" ]; then 99 | debug_map_build_arg="-fdebug-prefix-map=$WORK_DIR=$DBGSRC_TOP" 100 | debug_map_config_arg="--with-debug-prefix-map=$WORK_DIR=$DBGSRC_TOP" 101 | fi 102 | export CC="$CC_COMMON $debug_map_build_arg" 103 | export CXX="$CXX_COMMON $debug_map_build_arg" 104 | 105 | # Create deterministic-mode wrappers around GRTE ar and ranlib for builds 106 | # of host libraries. 107 | make_deterministic_ar_wrapper "%{grte_top}" "$WORK_DIR/dar" 108 | make_deterministic_ranlib_wrapper "%{grte_top}" "$WORK_DIR/dranlib" 109 | export "AR=$WORK_DIR/dar" 110 | export "RANLIB=$WORK_DIR/dranlib" 111 | 112 | rm -rf $RPM_BUILD_ROOT 113 | 114 | build_binutils "$WORK_DIR/$BINUTILS_SRC_SUBDIR" "$WORK_DIR/build-binutils" \ 115 | "$PREFIX" "$TARGET" --with-sysroot=%{grte_top} \ 116 | --with-bugurl="$BUGURL" --with-pkgversion="$PKGVERSION" \ 117 | --enable-gold 118 | 119 | export PATH="${PREFIX}/bin:${PREFIX}/sbin:$PATH" 120 | # Checked out into upstream/ from svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9 121 | cp -r %{_sourcedir}/gcc-4_9 $WORK_DIR/gcc-src 122 | mv $WORK_DIR/gmp-%{gmp_version} $WORK_DIR/gcc-src/gmp 123 | mv $WORK_DIR/mpc-%{mpc_version} $WORK_DIR/gcc-src/mpc 124 | mv $WORK_DIR/mpfr-%{mpfr_version} $WORK_DIR/gcc-src/mpfr 125 | 126 | mkdir $WORK_DIR/build-gcc 127 | cd $WORK_DIR/build-gcc 128 | CC=$CC \ 129 | CXX=$CXX \ 130 | CFLAGS=$CFLAGS \ 131 | CXXFLAGS=$CFLAGS \ 132 | LDFLAGS=$LDFLAGS \ 133 | LD_FOR_TARGET=${PREFIX}/bin/ld \ 134 | $WORK_DIR/gcc-src/configure \ 135 | --disable-nls --enable-threads=posix \ 136 | --enable-symvers=gnu --enable-__cxa_atexit \ 137 | --enable-c99 --enable-long-long \ 138 | --with-gnu-as --with-gnu-ld \ 139 | --prefix="%{target_top}/x86" \ 140 | --host="${TARGET}" \ 141 | --build="${TARGET}" \ 142 | --target="${TARGET}" \ 143 | --disable-multilib \ 144 | --with-multilib-list=m64 \ 145 | --enable-targets=all \ 146 | $debug_map_config_arg \ 147 | %{bootstrap_config_arg} \ 148 | $COMMON_GCC_OPTIONS \ 149 | --with-host-libstdcxx="-lstdc++" \ 150 | AR_FOR_TARGET="$WORK_DIR/dar" \ 151 | RANLIB_FOR_TARGET="$WORK_DIR/dranlib" 152 | make $PARALLELMFLAGS FCFLAGS="%{debug_cflags} -O2 $debug_map_build_arg" 153 | make install DESTDIR=$RPM_BUILD_ROOT 154 | 155 | # Would be nice to build these only once (since they're target-independent), 156 | # but currently the debug sources are packaged per-target. 157 | mkdir $WORK_DIR/rebuild-binutils 158 | cd $WORK_DIR/rebuild-binutils 159 | CC=$CC \ 160 | CXX=$CXX \ 161 | CFLAGS=$CFLAGS \ 162 | CXXFLAGS=$CFLAGS \ 163 | LDFLAGS=$LDFLAGS \ 164 | $WORK_DIR/$BINUTILS_SRC_SUBDIR/configure \ 165 | --prefix="%{target_top}/x86" \ 166 | --host="${TARGET}" \ 167 | --build="${TARGET}" \ 168 | --target="${TARGET}" \ 169 | --disable-nls \ 170 | --enable-gold \ 171 | --enable-shared \ 172 | --enable-64-bit-bfd \ 173 | --with-sysroot=%{grte_top} \ 174 | --with-native-lib-dirs=%{grte_top}/lib \ 175 | --with-bugurl="$BUGURL" \ 176 | --with-pkgversion="$PKGVERSION" \ 177 | --enable-gold \ 178 | --enable-plugins 179 | make $PARALLELMFLAGS 180 | make install DESTDIR=$RPM_BUILD_ROOT 181 | 182 | # Make gold the default linker 183 | rm -f ${PREFIX}/bin/ld 184 | ln -s ld.gold ${PREFIX}/bin/ld 185 | 186 | %install 187 | # Set PATH here so the scripts run by __spec_install_post, which use 188 | # 'strip' from PATH, use the GRTE 'strip'. 189 | export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH" 190 | 191 | %clean 192 | # if [ -n "%{remove_buildroot}" ]; then 193 | # rm -rf %{buildroot} 194 | # fi 195 | # 196 | # rm -f %{_rpmdir}/%{_target_cpu}/%{name}-%{version}-%{release}.%{_target_cpu}.rpm 197 | 198 | %files 199 | 200 | %defattr(-,root,root) 201 | %{target_top}/x86/* 202 | 203 | %changelog 204 | * Mon Jun 12 2017 Ming Zhao 205 | - Build gcc 4.9(@svn %{gcc_svn_version}) and binutils 2.28 206 | -------------------------------------------------------------------------------- /crosstool/gcc-4.4.0-glibc-2.3.6-grte.spec: -------------------------------------------------------------------------------- 1 | %define gcc_glibc_version gcc-4.4.0-glibc-2.3.6-grte 2 | %define base_summary %{gcc_glibc_version} compiler 3 | Summary: %{base_summary} 4 | Name: crosstool%{crosstool_version}-%{gcc_glibc_version} 5 | Version: 1.0 6 | Release: 36185 7 | License: GPL/LGPL 8 | Group: Development/Languages 9 | Packager: C Compiler Team 10 | 11 | Source0: crosstool-scripts.tar.gz 12 | Source1: gcc-4.4.0_gg.tar.bz2 13 | Source2: binutils-2.19.1_gg.tar.bz2 14 | Source3: gold-20090815.tar.bz2 15 | Source4: gmp-4.2.4.tar.bz2 16 | Source5: mpfr-2.4.1.tar.bz2 17 | Source6: ppl-0.10.tar.bz2 18 | Source7: cloog-ppl-0.15.tar.gz 19 | Source8: mao-604.tar.bz2 20 | 21 | Patch0: gold-20090818-hidden.patch 22 | Patch1: gold-20090819-debug_msg-test.patch 23 | Patch2: gold-20090824-dash-s.patch 24 | Patch3: gold-20090904-output-perm.patch 25 | Patch4: gold-20091010-searched-file.patch 26 | 27 | BuildRoot: %{_tmppath}/%{name}-buildroot 28 | 29 | # Create debuginfo unless disable_debuginfo is defined. 30 | %define make_debuginfo %{?disable_debuginfo:""}%{!?disable_debuginfo:"t"} 31 | 32 | # Remove BuildRoot in %clean unless keep_buildroot is defined. 33 | %define remove_buildroot %{?keep_buildroot:""}%{!?keep_buildroot:"t"} 34 | 35 | # Enable bootstrapping unless disable_bootstrap is defined. 36 | %define bootstrap_config_arg %{?disable_bootstrap:"--disable-bootstrap"}%{!?disable_bootstrap:""} 37 | 38 | %description 39 | This SRPM builds Google's %{gcc_glibc_version} compilers. 40 | 41 | %prep 42 | %setup -c 43 | %setup -T -D -a 1 44 | %setup -T -D -a 2 45 | %setup -T -D -a 3 46 | %setup -T -D -a 4 47 | %setup -T -D -a 5 48 | %setup -T -D -a 6 49 | %setup -T -D -a 7 50 | %setup -T -D -a 8 51 | 52 | cd gcc-4.4.0 53 | # Fix timestamps of extracted sources. 54 | contrib/gcc_update --touch 55 | cd .. 56 | 57 | cd gold 58 | chmod -R u+w . # Make sure extracted sources are writable. 59 | %patch0 -p0 60 | %patch1 -p0 61 | %patch2 -p0 62 | %patch3 -p0 63 | %patch4 -p0 64 | cd .. 65 | 66 | %define crosstool_top /usr/crosstool/%{crosstool_version} 67 | %define target_top %{crosstool_top}/%{gcc_glibc_version} 68 | %define grte_top /usr/grte/v1 69 | 70 | %build 71 | BUGURL=http://wiki.corp.google.com/Main/CrosstoolV13Issues 72 | PKGVERSION=Google_%{name}-%{version}-%{release} 73 | # For an actual release build, which doesn't have any special text in the 74 | # Release field, we do not include the version number. This is done so 75 | # that binaries will rebuild identically (if their sources aren't changed) 76 | # in subsequent rebuilds. (We don't use if/else so that this is more 77 | # diffable with other crosstool specs, which always include versions.) 78 | if echo %{release} | grep '^[0-9][0-9]*$' > /dev/null; then 79 | PKGVERSION=Google_%{name} 80 | fi 81 | 82 | source scripts/crosstool.sh 83 | 84 | export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH" 85 | 86 | WORK_DIR="$RPM_BUILD_DIR/$RPM_PACKAGE_NAME-$RPM_PACKAGE_VERSION" 87 | BINUTILS_SRC_SUBDIR="binutils-2.19.1" 88 | GCC_SRC_SUBDIR="gcc-4.4.0" 89 | GOLD_SRC_SUBDIR="gold" 90 | GMP_SRC_SUBDIR="gmp-4.2.4" 91 | MPFR_SRC_SUBDIR="mpfr-2.4.1" 92 | PPL_SRC_SUBDIR="ppl-0.10" 93 | CLOOGPPL_SRC_SUBDIR="cloog-ppl" 94 | MAO_SRC_SUBDIR="mao" 95 | 96 | CC_COMMON="%{grte_top}/bin/gcc -m64" 97 | CXX_COMMON="%{grte_top}/bin/g++ -m64" 98 | COMMON_GCC_OPTIONS=" \ 99 | --enable-shared=libgcc,libmudflap,libssp,libstdc++,libgfortran \ 100 | --with-pic=libgfortran \ 101 | --enable-languages=c,c++,fortran --with-sysroot=%{grte_top} \ 102 | --with-runtime-root-prefix=%{grte_top} \ 103 | --with-native-system-header-dir=/include \ 104 | --with-local-prefix=/ \ 105 | --with-bugurl=$BUGURL --with-pkgversion=$PKGVERSION \ 106 | --enable-clocale=gnu \ 107 | --enable-linker-build-id \ 108 | " 109 | 110 | # We build for x86_64 and bootstrap a compiler that supports i686 multilibs. 111 | TARGET=x86_64-unknown-linux-gnu 112 | PREFIX="$RPM_BUILD_ROOT%{target_top}/x86" 113 | DBGSRC_TOP="%{target_top}/x86/debug-src" 114 | DBGSRC_PREFIX="$RPM_BUILD_ROOT$DBGSRC_TOP" 115 | RUNTIME_TOP_32="%{crosstool_top}/i686-unknown-linux-gnu" 116 | RUNTIME_TOP_64="%{crosstool_top}/x86_64-unknown-linux-gnu" 117 | RUNTIME_PREFIX_32="$RPM_BUILD_ROOT$RUNTIME_TOP_32/lib" 118 | RUNTIME_PREFIX_64="$RPM_BUILD_ROOT$RUNTIME_TOP_64/lib64" 119 | HOSTLIB_PREFIX="$WORK_DIR/hostlibs" 120 | debug_map_build_arg= 121 | debug_map_config_arg= 122 | if [ -n "%{make_debuginfo}" ]; then 123 | debug_map_build_arg="-fdebug-prefix-map=$WORK_DIR=$DBGSRC_TOP" 124 | debug_map_config_arg="--with-debug-prefix-map=$WORK_DIR=$DBGSRC_TOP" 125 | fi 126 | export CC="$CC_COMMON $debug_map_build_arg" 127 | export CXX="$CXX_COMMON $debug_map_build_arg" 128 | 129 | # Create deterministic-mode wrappers around GRTE ar and ranlib for builds 130 | # of host libraries. 131 | make_deterministic_ar_wrapper "%{grte_top}" "$WORK_DIR/dar" 132 | make_deterministic_ranlib_wrapper "%{grte_top}" "$WORK_DIR/dranlib" 133 | export "AR=$WORK_DIR/dar" 134 | export "RANLIB=$WORK_DIR/dranlib" 135 | 136 | # Would be nice to build these only once (since they're target-independent), 137 | # but currently the debug sources are packaged per-target. 138 | 139 | # We install gmp since its headers are used by gcc plugins 140 | build_hostlib "$WORK_DIR/$GMP_SRC_SUBDIR" "$WORK_DIR/build-gmp" \ 141 | "$PREFIX" --enable-cxx 142 | 143 | build_hostlib "$WORK_DIR/$MPFR_SRC_SUBDIR" "$WORK_DIR/build-mpfr" \ 144 | "$HOSTLIB_PREFIX" --with-gmp="$PREFIX" 145 | build_hostlib "$WORK_DIR/$PPL_SRC_SUBDIR" "$WORK_DIR/build-ppl" \ 146 | "$HOSTLIB_PREFIX" --with-libgmp-prefix="$PREFIX" \ 147 | --with-cxxflags=-frandom-seed=\$@ 148 | build_hostlib "$WORK_DIR/$CLOOGPPL_SRC_SUBDIR" "$WORK_DIR/build-cloog-ppl" \ 149 | "$HOSTLIB_PREFIX" --with-gmp="$PREFIX" \ 150 | --with-ppl="$HOSTLIB_PREFIX" 151 | 152 | build_binutils "$WORK_DIR/$BINUTILS_SRC_SUBDIR" "$WORK_DIR/build-binutils" \ 153 | "$PREFIX" "$TARGET" --with-sysroot=%{grte_top} \ 154 | --with-bugurl="$BUGURL" --with-pkgversion="$PKGVERSION" \ 155 | --enable-targets=i686-unknown-linux-gnu 156 | 157 | # --with-host-libstdcxx setting is needed to link if using PPL. 158 | build_gcc "$WORK_DIR/$GCC_SRC_SUBDIR" "$WORK_DIR/build-gcc" \ 159 | "$PREFIX" "$TARGET" \ 160 | --enable-multilib \ 161 | --enable-targets=all \ 162 | --with-arch-32=pentium3 \ 163 | --with-tune-32=pentium4 \ 164 | $debug_map_config_arg \ 165 | %{bootstrap_config_arg} \ 166 | $COMMON_GCC_OPTIONS \ 167 | --with-gmp="$PREFIX" \ 168 | --with-mpfr="$HOSTLIB_PREFIX" \ 169 | --with-ppl="$HOSTLIB_PREFIX" \ 170 | --with-cloog="$HOSTLIB_PREFIX" \ 171 | --with-host-libstdcxx="-lstdc++" \ 172 | FCFLAGS="-g -O2 $debug_map_build_arg" \ 173 | AR_FOR_TARGET="$WORK_DIR/dar" \ 174 | RANLIB_FOR_TARGET="$WORK_DIR/dranlib" 175 | archive_ld "$PREFIX" "$TARGET" 176 | build_gold "$WORK_DIR/$GOLD_SRC_SUBDIR" "$WORK_DIR/build-gold" \ 177 | "$PREFIX" "$TARGET" \ 178 | --with-sysroot=%{grte_top} --enable-targets=i686-unknown-linux-gnu \ 179 | --with-bugurl="$BUGURL" --with-pkgversion="$PKGVERSION" 180 | build_mao "$WORK_DIR/$MAO_SRC_SUBDIR" "$WORK_DIR/build-mao" \ 181 | "$PREFIX" "$TARGET" \ 182 | "$WORK_DIR/$BINUTILS_SRC_SUBDIR" \ 183 | "$WORK_DIR/build-binutils" 184 | wrap_gas_with_mao "$WORK_DIR/$MAO_SRC_SUBDIR" "$PREFIX" "$TARGET" 185 | 186 | make_traditional_crosstool_layout "$RPM_BUILD_ROOT" "%{crosstool_top}" \ 187 | "%{gcc_glibc_version}" 188 | 189 | # Now we hack things a bit to support Fortran. For Crosstool v13 GA, we 190 | # released the compiler with a shared libgfortran but did not install 191 | # libgfortran.so in production. The result: http://b/2160690. We need to 192 | # continue to support any binaries which may have been compiled with the GA 193 | # compilers, so libgfortran.so must continue to live in the runtimes package, 194 | # but we're moving to a static libgfortran compiled with -fPIC for code 195 | # compiled with newer compilers. We move the shared libgfortran to a new 196 | # location (in the devel package only) so it won't get picked up by default but 197 | # can be used if needs be. 198 | for lib_base in lib lib64; do 199 | lib_prefix="$RPM_BUILD_ROOT/%{target_top}/x86/$lib_base" 200 | libgfortran_prefix="$lib_prefix/libgfortran" 201 | 202 | mkdir "$libgfortran_prefix" 203 | mv "$lib_prefix/libgfortran.so"* "$libgfortran_prefix" 204 | done 205 | 206 | if [ -n "%{make_debuginfo}" ]; then 207 | # Copy sources into the build area. First we copy the source directories, 208 | # then we copy any files that look like generated or symlinked sources in 209 | # the build directories. 210 | mkdir -p "$DBGSRC_PREFIX" 211 | copy_debug_sources "$WORK_DIR/$BINUTILS_SRC_SUBDIR" \ 212 | "$DBGSRC_PREFIX/$BINUTILS_SRC_SUBDIR" 213 | copy_debug_sources "$WORK_DIR/$GCC_SRC_SUBDIR" \ 214 | "$DBGSRC_PREFIX/$GCC_SRC_SUBDIR" 215 | copy_debug_sources "$WORK_DIR/$GOLD_SRC_SUBDIR" \ 216 | "$DBGSRC_PREFIX/$GOLD_SRC_SUBDIR" 217 | copy_debug_sources "$WORK_DIR/$GMP_SRC_SUBDIR" \ 218 | "$DBGSRC_PREFIX/$GMP_SRC_SUBDIR" 219 | copy_debug_sources "$WORK_DIR/$MPFR_SRC_SUBDIR" \ 220 | "$DBGSRC_PREFIX/$MPFR_SRC_SUBDIR" 221 | copy_debug_sources "$WORK_DIR/$PPL_SRC_SUBDIR" \ 222 | "$DBGSRC_PREFIX/$PPL_SRC_SUBDIR" 223 | copy_debug_sources "$WORK_DIR/$CLOOGPPL_SRC_SUBDIR" \ 224 | "$DBGSRC_PREFIX/$CLOOGPPL_SRC_SUBDIR" 225 | copy_debug_sources "$WORK_DIR/$MAO_SRC_SUBDIR" \ 226 | "$DBGSRC_PREFIX/$MAO_SRC_SUBDIR" 227 | # Need certain directories because they're traversed in debug file name 228 | # specs. Need symlinks copied as files because they point to absolute 229 | # paths. 230 | debugsrc_build_dirs=" 231 | build-binutils 232 | build-cloog 233 | build-gcc 234 | build-gmp 235 | build-gold 236 | build-mpfr 237 | build-ppl 238 | hostlibs 239 | " 240 | (cd $WORK_DIR && \ 241 | find $debugsrc_build_dirs \ 242 | \( -type d -name .libs \) -prune -o \ 243 | \( -name "*.so" \) -prune -o \ 244 | \( -type f -name "*.c" \) -print -o \ 245 | \( -type f -name "*.h" \) -print -o \ 246 | \( -type f -name "*.cc" \) -print -o \ 247 | \( -type f -name "*.tcc" \) -print -o \ 248 | \( -type f -name "*.inc" \) -print -o \ 249 | \( -type f -iname "*.s" \) -print -o \ 250 | \( -type d -name gcc \) -print -o \ 251 | \( -type d -name libgcc \) -print -o \ 252 | -type l -print | \ 253 | cpio -pdL "$DBGSRC_PREFIX") 254 | # Make sure that the debug sources are read-write by root and readable 255 | # by all users. (Sets x bits for all directories, and makes x bits 256 | # for files consistent for user,group,other.) 257 | chmod -R u=rwX,go=rX "$DBGSRC_PREFIX" 258 | 259 | strip_libs_and_make_debuginfo "$PREFIX" "$PREFIX" 260 | strip_libs_and_make_debuginfo "$PREFIX" "$RUNTIME_PREFIX_32" 261 | strip_libs_and_make_debuginfo "$PREFIX" "$RUNTIME_PREFIX_64" 262 | strip_exes_and_make_debuginfo "$PREFIX" "$PREFIX" 263 | fi 264 | 265 | create_file_lists "$RPM_BUILD_ROOT" "%{target_top}" \ 266 | "$RUNTIME_TOP_32" "$RUNTIME_TOP_64" 267 | 268 | 269 | %install 270 | # Set PATH here so the scripts run by __spec_install_post, which use 271 | # 'strip' from PATH, use the GRTE 'strip'. 272 | export PATH="%{grte_top}/bin:%{grte_top}/sbin:$PATH" 273 | 274 | %clean 275 | if [ -n "%{remove_buildroot}" ]; then 276 | rm -rf %{buildroot} 277 | fi 278 | # Remove the top-level RPM, since it's empty. 279 | rm -f %{_rpmdir}/%{_target_cpu}/%{name}-%{version}-%{release}.%{_target_cpu}.rpm 280 | 281 | %files 282 | 283 | # devel package 284 | %package devel 285 | Summary: %{base_summary} for x86_64 and i686 286 | Group: Development/Languages 287 | Requires: grte-runtimes grte-headers 288 | 289 | %description devel 290 | %{summary} 291 | 292 | %files devel -f files.devel 293 | 294 | # runtimes package 295 | %package runtimes 296 | Summary: %{base_summary} runtimes for x86_64 and i686 297 | Group: Development/Languages 298 | Requires: grte-runtimes 299 | 300 | %description runtimes 301 | %{summary} 302 | 303 | %files runtimes -f files.runtimes 304 | 305 | # debuginfo package 306 | %if %{make_debuginfo} 307 | %package debuginfo 308 | Summary: %{base_summary} debuginfo for x86_64 and i686 309 | Group: Development/Languages 310 | 311 | %description debuginfo 312 | %{summary} 313 | 314 | %files debuginfo -f files.debuginfo 315 | %endif 316 | 317 | %changelog 318 | * Sun Nov 01 2009 Ollie Wild 319 | - For bug http://b/2222512 ... 320 | Integrates CL 36173 (rollback of CL 34946). 321 | 322 | * Sat Oct 17 2009 Chris Demetriou 323 | - Bump version number to 1.0. (Integrates all changes from trunk @35850.) 324 | 325 | * Sat Sep 12 2009 Chris Demetriou 326 | - Bump version number to 0.2. (Integrates all changes from trunk @34569.) 327 | 328 | * Fri Aug 07 2009 Chris Demetriou 329 | - Bump version number to 0.1-2 for a build. (Integrates all 330 | changes from trunk.) 331 | 332 | * Mon Aug 03 2009 Chris Demetriou 333 | - Created Crosstool V13 release branch. Bump version number to 334 | 0.1-1 for a build. 335 | -------------------------------------------------------------------------------- /crosstool/get-clang-svn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # Get clang's source code from svn 4 | SVN_TOP=${SVN_TOP:-upstream} 5 | BRANCH=branches/google/stable 6 | cd ${SVN_TOP} 7 | svn co http://llvm.org/svn/llvm-project/llvm/${BRANCH} llvm 8 | svn co http://llvm.org/svn/llvm-project/compiler-rt/${BRANCH} llvm/projects/compiler-rt 9 | svn co http://llvm.org/svn/llvm-project/cfe/${BRANCH} llvm/tools/clang 10 | svn co http://llvm.org/svn/llvm-project/clang-tools-extra/${BRANCH} llvm/tools/clang/tools/extra 11 | -------------------------------------------------------------------------------- /crosstool/get-gcc-svn.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Download gcc code from svn. 4 | SVN_TOP=${SVN_TOP:-upstream} 5 | BRANCH=branches/google/gcc-4_9 6 | cd ${SVN_TOP} 7 | svn co svn://gcc.gnu.org/svn/gcc/${BRANCH} 8 | -------------------------------------------------------------------------------- /crosstool/scripts/brp-dup-shared: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # This script duplicates files with multiple hard links. This prevents RPM 5 | # from generating an rpmlib(PartialHardlinkSets) dependency, which is 6 | # incompatible with older versions of rpm. 7 | # 8 | 9 | if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then 10 | exit 0 11 | fi 12 | 13 | find $RPM_BUILD_ROOT -type f -links +1 \ 14 | -execdir cp -a '{}' '{}.tmp' ';' \ 15 | -execdir mv '{}.tmp' '{}' ';' 16 | -------------------------------------------------------------------------------- /crosstool/scripts/crosstool.sh: -------------------------------------------------------------------------------- 1 | # 2 | # crosstool.sh 3 | # Build a GNU/Linux toolchain 4 | # 5 | # Copyright (c) 2001 by Bill Gatliff, bgat@billgatliff.com 6 | # Copyright (c) 2003 by Dan Kegel, Ixia Communications, 7 | # Copyright (c) 2004,2005 by Dan Kegel, Google, Inc. 8 | # Copyright (c) 2008 by Ollie Wild, Google, Inc. 9 | # All rights reserved. This script is provided under the terms of the GPL. 10 | 11 | # We build native x86_64 compilers with host = build = target to make sure gcc 12 | # bootstraps and all tools have a consistent naming 13 | readonly DEFAULT_HOST=x86_64-unknown-linux-gnu 14 | 15 | # 16 | # Usage: abort MESSAGE... 17 | # 18 | # Print a line including MESSAGE... and exit with a non-zero exit status. 19 | # 20 | abort() { 21 | echo "${FUNCNAME[1]}: $@" 1>&2 22 | exit 1 23 | } 24 | 25 | # 26 | # Usage: logresult STAGE REPRESENTATIVE_FILE 27 | # 28 | # Aborts the build if REPRESENTATIVE_FILE does not exist or is not executable. 29 | # Used to log success or failure of each stage. 30 | # 31 | logresult() { 32 | if test -x $2; then 33 | echo crosstool: $1 built ok 34 | else 35 | abort "Build failed during $1" 36 | fi 37 | } 38 | 39 | # 40 | # Usage: pushd DIR 41 | # 42 | # Add DIR to the top of the directory stack and make it the current working 43 | # directory. 44 | # 45 | push_dir() { 46 | [ $# -eq 1 ] || abort "incorrect call syntax" 47 | pushd "$1" > /dev/null 48 | } 49 | 50 | # 51 | # Usage: pop_dir 52 | # 53 | # Pop the top entry of the directory stack and make the new top the current 54 | # working directory. 55 | # 56 | pop_dir() { 57 | [ $# -eq 0 ] || abort "incorrect call syntax" 58 | popd > /dev/null 59 | } 60 | 61 | # 62 | # Usage: make_distcc_masquerade_dir BUILD_PREFIX 63 | # 64 | # Make distcc masquerade directory for the toolchain currently installed at 65 | # prefix BUILD_PREFIX. 66 | # 67 | make_distcc_masquerade_dir() { 68 | [ $# -eq 1 ] || abort "incorrect call syntax" 69 | 70 | local build_prefix 71 | build_prefix="$1" 72 | 73 | push_dir "$build_prefix" 74 | 75 | # Get list of executables to run via distcc 76 | local distrib_apps=$(cd bin; \ 77 | find . \( -type f -o -type l \) \ 78 | -perm -100 \ 79 | \( -name "*c++" \ 80 | -o -name "*g++" \ 81 | -o -name "*gcc" \ 82 | -o -name "*gcc-[0-9]*[0-9]" \)) 83 | 84 | rm -rf distributed 85 | mkdir distributed 86 | cd distributed 87 | 88 | # Make symlinks to all subdirs of real directory 89 | ln -s ../* . 90 | # but remove symlinks to special cases 91 | rm bin distributed 92 | mkdir bin 93 | 94 | # Make symlinks to all apps in real bin 95 | cd bin 96 | for app in `cd ../../bin; ls`; do 97 | ln -s ../../bin/$app . 98 | done 99 | # but remove symlinks to special cases 100 | rm $distrib_apps 101 | 102 | # and create shell scripts for the special cases 103 | local app 104 | for app in $distrib_apps; do 105 | # canonicalize path by getting rid of extra ./ by find . 106 | app=`echo $app | sed "s,^\./,,g"` 107 | # use readlink to canonicalize paths in the script, so that distccd 108 | # receives the absolute path of the real app that this script shims 109 | cat > $app <<_EOF_ 110 | #!/bin/bash 111 | exec distcc "\$(readlink -mn \${0%/*}/../../bin/$app)" "\$@" 112 | _EOF_ 113 | chmod 755 $app 114 | done 115 | 116 | pop_dir 117 | } 118 | 119 | # 120 | # Usage: strip_libs PREFIX TARGET 121 | # 122 | # Strip shared libraries and static archives using "$PREFIX/bin/strip". 123 | # 124 | strip_libs() { 125 | [ $# -eq 2 ] || abort "incorrect call syntax" 126 | 127 | local prefix target 128 | prefix="$1" 129 | target="$2" 130 | 131 | local file 132 | 133 | # Strip shared libraries. 134 | for file in $(find "$prefix" -type f -a -exec file '{}' ';' | \ 135 | grep ' shared object,' | \ 136 | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'); do 137 | "$prefix/bin/strip" --strip-unneeded "$file" 138 | done 139 | 140 | # Strip debugging symbols from static archives. 141 | for file in $(find "$prefix" -type f -a -exec file '{}' ';' | \ 142 | grep 'current ar archive' | \ 143 | sed -n -e 's/^\(.*\):[ ]*current ar archive/\1/p'); do 144 | "$prefix/bin/strip" -g "$file" 145 | done 146 | } 147 | 148 | # 149 | # Usage: strip_libs_and_make_debuginfo PREFIX DIR_TO_CONVERT 150 | # 151 | # Copy debug symbols from all ELF shared libraries under $DIR_TO_CONVERT 152 | # to debuginfo files. Strip debug symbols from shared libraries and 153 | # create a GNU debuglink to the debuginfo files. 154 | # 155 | # The debuginfo files are placed in the directory ".debug" in the 156 | # original file's directory. They are named $orig_name.debug 157 | # 158 | # Uses "$PREFIX/bin/objcopy". 159 | # 160 | strip_libs_and_make_debuginfo() { 161 | [ $# -eq 2 ] || abort "incorrect call syntax" 162 | 163 | local prefix dir_to_convert 164 | prefix="$1" 165 | dir_to_convert="$2" 166 | 167 | local objcopy 168 | objcopy="$prefix/bin/objcopy" 169 | 170 | local file file_dir file_base debuginfo_dir debuginfo_file 171 | 172 | for file in $(find "$dir_to_convert" \ 173 | \( -type d -a -name .debug -a -prune \) -o \ 174 | \( -type f -a -exec file '{}' ';' \) | \ 175 | grep ' ELF .* shared object,' | \ 176 | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p' | sort); do 177 | file_dir=$(dirname "$file") 178 | file_base=$(basename "$file") 179 | debuginfo_dir="$file_dir/.debug" 180 | debuginfo_file="$file_base.debug" 181 | 182 | # Assume that if the file already has a debug link, that it is a hard-linked 183 | # file and lives in the same directory as its other links. This may not 184 | # be correct in general, but is correct for our tools. 185 | if readelf --sections $file | \ 186 | grep -w '\.gnu_debuglink' > /dev/null 2>&1; then 187 | echo "skipping debuginfo file for $file (already has one)" 188 | continue 189 | fi 190 | 191 | echo "creating debuginfo file for $file" 192 | mkdir -p "$debuginfo_dir" 193 | $objcopy --only-keep-debug "$file" "$debuginfo_dir/$debuginfo_file" 194 | # Clear x bits to keep brp-strip from stripping the .debug file. 195 | chmod -x "$debuginfo_dir/$debuginfo_file" 196 | # Note that the .gnu_debuglink section only keeps the file's basename. 197 | $objcopy \ 198 | --strip-debug \ 199 | --add-gnu-debuglink="$debuginfo_dir/$debuginfo_file" \ 200 | "$file" 201 | done 202 | } 203 | 204 | # 205 | # Usage: strip_exes_and_make_debuginfo PREFIX DIR_TO_CONVERT 206 | # 207 | # Copy debug symbols from all ELF executables under $DIR_TO_CONVERT to 208 | # debuginfo files. Strip debug symbols from executables and create a 209 | # GNU debuglink to the debuginfo files. 210 | # 211 | # The debuginfo files are placed in the directory ".debug" in the 212 | # original file's directory. They are named $orig_name.debug 213 | # 214 | # Uses "$PREFIX/bin/objcopy". 215 | # 216 | strip_exes_and_make_debuginfo() { 217 | [ $# -eq 2 ] || abort "incorrect call syntax" 218 | 219 | local prefix dir_to_convert 220 | prefix="$1" 221 | dir_to_convert="$2" 222 | 223 | local objcopy 224 | objcopy="$prefix/bin/objcopy" 225 | 226 | local file file_dir file_base debuginfo_dir debuginfo_file 227 | 228 | for file in $(find "$dir_to_convert" \ 229 | \( -type d -a -name .debug -a -prune \) -o \ 230 | \( -type f -a -exec file '{}' ';' \) | \ 231 | grep ' ELF .* executable,' | \ 232 | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p' | sort); do 233 | file_dir=$(dirname "$file") 234 | file_base=$(basename "$file") 235 | debuginfo_dir="$file_dir/.debug" 236 | debuginfo_file="$file_base.debug" 237 | 238 | # Assume that if the file already has a debug link, that it is a hard-linked 239 | # file and lives in the same directory as its other links. This may not 240 | # be correct in general, but is correct for our tools. 241 | if readelf --sections $file | \ 242 | grep -w '\.gnu_debuglink' > /dev/null 2>&1; then 243 | echo "skipping debuginfo file for $file (already has one)" 244 | continue 245 | fi 246 | 247 | echo "creating debuginfo file for $file" 248 | mkdir -p "$debuginfo_dir" 249 | $objcopy --only-keep-debug "$file" "$debuginfo_dir/$debuginfo_file" 250 | # Clear x bits to keep brp-strip from stripping the .debug file. 251 | chmod -x "$debuginfo_dir/$debuginfo_file" 252 | # Note that the .gnu_debuglink section only keeps the file's basename. 253 | $objcopy \ 254 | --strip-debug \ 255 | --add-gnu-debuglink="$debuginfo_dir/$debuginfo_file" \ 256 | "$file" 257 | done 258 | } 259 | 260 | # 261 | # Usage: make_symbolic_links INSTALL_DIR TARGET 262 | # 263 | # Convert the files in $INSTALL_DIR/$TARGET/bin into symbolic links to files 264 | # in $INSTALL_DIR/bin. Normally, these are hard links. However, this causes 265 | # recent versions of RPM to generate rpmlib(PartialHardlinkSets) 266 | # dependencies, which are incompatible with the RPM version (4.0.2) in 267 | # production. 268 | # 269 | make_symbolic_links() { 270 | [ $# -eq 2 ] || abort "incorrect call syntax" 271 | 272 | local install_dir target 273 | 274 | install_dir="$1" 275 | target="$2" 276 | 277 | push_dir "$install_dir/$target/bin" 278 | 279 | local file target_file 280 | for file in $(find . -maxdepth 1 -type f -links +1); do 281 | file=$(basename "$file") 282 | target_file="../../bin/$file" 283 | [ -f "$target_file" ] || abort "missing \"$PWD/$target_file\"" 284 | cmp "$file" "$target_file" \ 285 | || abort "\"$PWD/$file\" and \"$PWD/$target_file\" differ" 286 | 287 | rm "$file" 288 | ln -s "$target_file" "$file" 289 | done 290 | 291 | pop_dir 292 | } 293 | 294 | # 295 | # Usage: build_hostlib SRC_DIR BUILD_DIR INSTALL_DIR [CONFIGURE_OPTS...] 296 | # 297 | # Build a host library that is to be used in the GCC build process. 298 | # It is assumed that the library uses a GNU-ish configure script. 299 | # Shared libraries aren't built, because we want these libraries to 300 | # be linked statically into GCC. 301 | # 302 | build_hostlib() { 303 | local src_dir build_dir install_dir 304 | 305 | src_dir="$1" 306 | build_dir="$2" 307 | install_dir="$3" 308 | shift 3 309 | 310 | mkdir -p "$build_dir" 311 | push_dir "$build_dir" 312 | 313 | "$src_dir"/configure --prefix="$install_dir" --disable-shared \ 314 | --build=$DEFAULT_HOST --host=$DEFAULT_HOST \ 315 | --target=$DEFAULT_HOST "$@" 316 | make $PARALLELMFLAGS 317 | make install 318 | 319 | pop_dir 320 | } 321 | 322 | # 323 | # Usage: build_llvm SRC_DIR BUILD_DIR INSTALL_DIR [CONFIGURE_OPTS...] 324 | # 325 | build_llvm() { 326 | local src_dir build_dir install_dir 327 | 328 | src_dir="$1" 329 | build_dir="$2" 330 | install_dir="$3" 331 | shift 3 332 | 333 | mkdir -p "$build_dir" 334 | push_dir "$build_dir" 335 | 336 | "$src_dir"/configure --prefix="$install_dir" "$@" 337 | make $PARALLELMFLAGS 338 | make install 339 | 340 | pop_dir 341 | } 342 | 343 | # 344 | # Usage: build_gdb SRC_DIR BUILD_DIR INSTALL_DIR TARGET [CONFIGURE_OPTS...] 345 | # 346 | # Build gdb and gdbserver. 347 | # 348 | build_gdb() { 349 | local src_dir build_dir install_dir target 350 | 351 | src_dir="$1" 352 | build_dir="$2" 353 | install_dir="$3" 354 | target="$4" 355 | shift 4 356 | 357 | mkdir -p "$build_dir/gdb" 358 | push_dir "$build_dir/gdb" 359 | 360 | "$src_dir"/configure --prefix="$install_dir" --build=$DEFAULT_HOST \ 361 | --target="$target" "$@" 362 | make $PARALLELMFLAGS all 363 | make install 364 | 365 | pop_dir 366 | 367 | mkdir -p "$build_dir/gdbserver" 368 | push_dir "$build_dir/gdbserver" 369 | 370 | CC="$install_dir/bin/$target-gcc" \ 371 | "$src_dir"/gdb/gdbserver/configure --prefix="$install_dir" \ 372 | --build=$DEFAULT_HOST --host="$target" \ 373 | "$@" 374 | make $PARALLELMFLAGS all 375 | make install 376 | 377 | pop_dir 378 | } 379 | 380 | # 381 | # Usage: build_gold SRC_DIR BUILD_DIR INSTALL_DIR TARGET [CONFIGURE_OPTS...] 382 | # 383 | build_gold() { 384 | local src_dir build_dir install_dir target 385 | 386 | src_dir="$1" 387 | build_dir="$2" 388 | install_dir="$3" 389 | target="$4" 390 | shift 4 391 | 392 | mkdir -p "$build_dir" 393 | push_dir "$build_dir" 394 | 395 | "$src_dir"/configure --prefix="$install_dir" --build=$DEFAULT_HOST \ 396 | --target="$target" --enable-gold "$@" 397 | make $PARALLELMFLAGS all-gold 398 | make install-gold 399 | 400 | pop_dir 401 | 402 | make_symbolic_links "$install_dir" $target 403 | } 404 | 405 | # 406 | # Usage: build_binutils SRC_DIR BUILD_DIR INSTALL_DIR TARGET [CONFIGURE_OPTS...] 407 | # 408 | build_binutils() { 409 | local src_dir build_dir install_dir target 410 | 411 | src_dir="$1" 412 | build_dir="$2" 413 | install_dir="$3" 414 | target="$4" 415 | shift 4 416 | 417 | local option host build 418 | for option in "$@"; do 419 | case "$option" in 420 | --host=*) 421 | host=$(echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//') 422 | ;; 423 | --build=*) 424 | build=$(echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//') 425 | ;; 426 | esac 427 | done 428 | 429 | local extra_config_opts; 430 | if [ -z "$host" -a -z "$build" ]; then 431 | extra_config_opts="--build=$DEFAULT_HOST --host=$DEFAULT_HOST" 432 | elif [ -z "$host" ]; then 433 | extra_config_opts="--host=$build" 434 | elif [ -z "$build" ]; then 435 | extra_config_opts="--build=$host" 436 | fi 437 | 438 | mkdir -p "$build_dir" 439 | push_dir "$build_dir" 440 | 441 | "$src_dir"/configure --prefix="$install_dir" --target="$target" \ 442 | --disable-nls $extra_config_opts "$@" 443 | 444 | make $PARALLELMFLAGS all 445 | make install 446 | 447 | pop_dir 448 | 449 | make_symbolic_links "$install_dir" $target 450 | } 451 | 452 | # 453 | # Usage: make_deterministic_ar_wrapper INSTALL_DIR WRAPPER_NAME 454 | # 455 | # Make a wrapper around INSTALL_DIR/ar that adds the 'D' (deterministic mode) 456 | # flag, and removes any'u' (update) flag in ar's operation code. 457 | # 458 | # This uses an absolute path to INSTALL_DIR, so is probably not suitable 459 | # for installation as part of a toolchain. 460 | # 461 | make_deterministic_ar_wrapper() { 462 | local install_dir wrapper_name wrapped_bin 463 | 464 | install_dir="$1" 465 | wrapper_name="$2" 466 | 467 | wrapped_bin=ar 468 | 469 | rm -f $wrapper_name 470 | echo "#!/bin/sh" > $wrapper_name 471 | cat >> $wrapper_name <<__EOF__ 472 | first="\$1"D 473 | shift 474 | case "\$first" in 475 | *u*) first=\`echo "\$first" | sed -e s,u,,g\` 476 | esac 477 | exec $install_dir/bin/$wrapped_bin "\$first" "\$@" 478 | __EOF__ 479 | chmod 555 $wrapper_name 480 | } 481 | 482 | # 483 | # Usage: make_deterministic_ranlib_wrapper INSTALL_DIR WRAPPER_NAME 484 | # 485 | # Make a wrapper for ranlib suitable for use with ar in deterministic mode. 486 | # In this case, ranlib should do nothing, so the wrapper invokes /bin/true 487 | # instead of ranlib. 488 | # 489 | make_deterministic_ranlib_wrapper() { 490 | local install_dir wrapper_name 491 | 492 | install_dir="$1" 493 | wrapper_name="$2" 494 | 495 | rm -f $wrapper_name 496 | echo "#!/bin/true" > $wrapper_name 497 | chmod 555 $wrapper_name 498 | } 499 | 500 | # 501 | # Usage: archive_ld PREFIX TARGET 502 | # 503 | # Move ld into subdirectories named compat-ld. This allows 504 | # the binutils ld to be used in cases where gold is insufficient. 505 | # 506 | archive_ld() { 507 | [ $# -eq 2 ] || abort "incorrect call syntax" 508 | 509 | local prefix target 510 | prefix="$1" 511 | target="$2" 512 | 513 | mkdir -p "$prefix/bin/compat-ld" 514 | mv "$prefix/bin/ld" "$prefix/bin/compat-ld/" 515 | 516 | local target_compat_dir="$prefix/$target/bin/compat-ld" 517 | mkdir -p "$target_compat_dir" 518 | push_dir "$target_compat_dir" 519 | ln -s "../../../bin/compat-ld/ld" ld 520 | pop_dir 521 | 522 | rm "$prefix/$target/bin/ld" 523 | } 524 | 525 | # 526 | # Usage: build_gcc SRC_DIR BUILD_DIR INSTALL_DIR TARGET [CONFIGURE_OPTS...] 527 | # 528 | build_gcc() { 529 | local src_dir build_dir install_dir target 530 | 531 | src_dir="$1" 532 | build_dir="$2" 533 | install_dir="$3" 534 | target="$4" 535 | shift 4 536 | 537 | # TODO(cgd): remove once GCC's fortran library build works right. 538 | # special case: to handle debug prefix mapping, for now we need to override 539 | # FCFLAGS on the make command line. We can't do it in the environment 540 | # (because the variable settings in the makefile will take precedence). 541 | # So we check for FCFLAGS in our arguments, and if it's present then we 542 | # special-case the invocation of 'make'. See bug 1366397. 543 | local fcflags_to_pass="" 544 | 545 | local option host build 546 | for option in "$@"; do 547 | case "$option" in 548 | --host=*) 549 | host=$(echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//') 550 | ;; 551 | --build=*) 552 | build=$(echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//') 553 | ;; 554 | FCFLAGS=*) 555 | fcflags_to_pass="$option" 556 | ;; 557 | esac 558 | done 559 | 560 | local extra_config_opts; 561 | if [ -z "$host" -a -z "$build" ]; then 562 | host=$DEFAULT_HOST 563 | build=$DEFAULT_HOST 564 | extra_config_opts="--build=$build --host=$host" 565 | elif [ -z "$host" ]; then 566 | host=$build 567 | extra_config_opts="--host=$host" 568 | elif [ -z "$build" ]; then 569 | build=$host 570 | extra_config_opts="--build=$build" 571 | fi 572 | 573 | mkdir -p "$build_dir" 574 | push_dir "$build_dir" 575 | 576 | # --enable-symvers=gnu is really only needed for sh4 to work around a 577 | # detection problem. It only matters for gcc-3.2.x and later, I think. 578 | # 579 | # --disable-nls works around a crash bug on ppc405, but also embedded 580 | # systems don't really need message catalogs... 581 | # 582 | # --with-gnu-as and --with-gnu-ld control features specific to the 583 | # GNU assembler and linker and are NOT auto-detected by the compiler 584 | # configuration process. 585 | "$src_dir"/configure --prefix="$install_dir" --target=$target \ 586 | --disable-nls --enable-threads=posix \ 587 | --enable-symvers=gnu --enable-__cxa_atexit \ 588 | --enable-c99 --enable-long-long \ 589 | --with-gnu-as --with-gnu-ld \ 590 | $extra_config_opts "$@" 591 | 592 | if [ $host != $build ]; then 593 | make $PARALLELMFLAGS all-build-libiberty || true 594 | fi 595 | 596 | # TODO(cgd): see comments above. 597 | if [ -n "$fcflags_to_pass" ]; then 598 | SHELL=/bin/sh make $PARALLELMFLAGS "$fcflags_to_pass" all 599 | else 600 | SHELL=/bin/sh make $PARALLELMFLAGS all 601 | fi 602 | make install 603 | 604 | pop_dir 605 | 606 | make_symbolic_links "$install_dir" $target 607 | } 608 | 609 | # 610 | # Usage: create_file_lists RPM_BUILD_ROOT TARGET_TOP RUNTIME_TOP_32 \ 611 | # RUNTIME_TOP_64 612 | # 613 | # Create file lists to be used for RPM packaging in the current working 614 | # directory. 615 | # 616 | # Layout of the directory that is searched is assumed to be the following: 617 | # 618 | # RPM_BUILD_ROOT/ 619 | # TARGET_TOP/ 620 | # bin/... 621 | # man/... 622 | # ... 623 | # debug-src/... 624 | # RUNTIME_TOP/ 625 | # ... 626 | # 627 | # Within any of these directories, .debug directories may exist which 628 | # contain debug info files. 629 | # 630 | # This function creates three file lists, named: 631 | # files.devel 632 | # files.runtimes 633 | # files.debuginfo 634 | # 635 | # The "debuginfo" file list includes the debug-src directory and all 636 | # of its contents. 637 | # 638 | # The "runtimes" file list includes all of RUNTIMES except for any 639 | # .debug directories. 640 | # 641 | # Last but not lest, the "devel" file list includes everything else. 642 | # 643 | create_file_lists() { 644 | local rpm_build_root="$1" 645 | local top="$2" 646 | local runtime_top_32="$3" 647 | local runtime_top_64="$4" 648 | 649 | local target_top="$top/x86" 650 | local dbgsrc_top="$target_top/debug-src" 651 | local top_prefix="$rpm_build_root$top" 652 | local dbgsrc_prefix="$rpm_build_root$dbgsrc_top" 653 | local target_prefix="$rpm_build_root$target_top" 654 | local runtime_prefix_32="$rpm_build_root$runtime_top_32" 655 | local runtime_prefix_64="$rpm_build_root$runtime_top_64" 656 | 657 | # Create devel files list. 658 | echo "%defattr(-,root,root)" > "files.devel" 659 | echo "%docdir $target_top/man" >> "files.devel" 660 | echo "%docdir $target_top/info" >> "files.devel" 661 | # All directories except the src, runtimes, and .debug dirs. 662 | find $top_prefix \( -type d -name .debug -prune -o \ 663 | -type d -wholename "$dbgsrc_prefix" -prune -o \ 664 | -type d -wholename "$runtime_prefix_32" -prune -o \ 665 | -type d -wholename "$runtime_prefix_64" -prune -o \ 666 | -type d -print \) | \ 667 | sed -e "s|^$rpm_build_root||" -e 's|^|%dir |' \ 668 | >> "files.devel" 669 | # ... and the contents of those directories 670 | find $top_prefix \( -type d -name .debug -prune -o \ 671 | -type d -wholename "$dbgsrc_prefix" -prune -o \ 672 | -type d -wholename "$runtime_prefix_32" -prune -o \ 673 | -type d -wholename "$runtime_prefix_64" -prune -o \ 674 | ! -type d -print \) | \ 675 | sed -e "s|^$rpm_build_root||" \ 676 | >> "files.devel" 677 | 678 | # Create runtimes file list. 679 | echo "%defattr(-,root,root)" > "files.runtimes" 680 | # Only the runtime tree, but prune any debug directories. 681 | find $runtime_prefix_32 $runtime_prefix_64 \( -type d -name .debug -prune -o \ 682 | -type d -print \) | \ 683 | sed -e "s|^$rpm_build_root||" -e 's|^|%dir |' \ 684 | >> "files.runtimes" 685 | # ... and the contents of those directories 686 | find $runtime_prefix_32 $runtime_prefix_64 \( -type d -name .debug -prune -o \ 687 | ! -type d -print \) | \ 688 | sed -e "s|^$rpm_build_root||" \ 689 | >> "files.runtimes" 690 | 691 | # Create the debuginfo file list. It contains *everyting* in 692 | # $dbgsrc_prefix and everything in each debug dir. 693 | echo "%defattr(-,root,root)" > "files.debuginfo" 694 | echo "$dbgsrc_prefix" | \ 695 | sed -e "s|^$rpm_build_root||" \ 696 | >> "files.debuginfo" 697 | find $target_prefix $runtime_prefix_32 $runtime_prefix_64 \ 698 | \( -type d -wholename "$dbgsrc_prefix" -prune -o \ 699 | -type d -name .debug -prune -print \) | \ 700 | sed -e "s|^$rpm_build_root||" \ 701 | >> "files.debuginfo" 702 | } 703 | 704 | # 705 | # Performs a traditional crosstool build. 706 | # 707 | # Before calling this function, the following required variables must be set: 708 | # 709 | # PREFIX toolchain installation prefix 710 | # BUILD_DIR directory where tools are built 711 | # SRC_DIR directory where the (unpacked) sources reside 712 | # BINUTILS_DIR bare name of the binutils source directory 713 | # GCC_DIR bare name of the gcc source directory 714 | # GLIBC_DIR bare name of the glibc source directory 715 | # TARGET Gnu target identifier (e.g. pentium-linux) 716 | # TARGET_CFLAGS compiler flags needed when building glibc (-O recommended) 717 | # 718 | # One of these variables must be set: 719 | # 720 | # LINUX_SANITIZED_HEADER_DIR bare name of linux-libc-headers directory 721 | # LINUX_DIR bare name of linux source directory 722 | # 723 | # Other variables are optional. 724 | # 725 | build_crosstool() { 726 | # Execute in a subshell. Kind of a bummer but this script leaks. 727 | ( 728 | # Validate required variables. 729 | test -z "${PREFIX}" && abort "Please set PREFIX to where you want the toolchain installed." 730 | test -z "${BUILD_DIR}" && abort "Please set BUILD_DIR to the directory where the tools are to be built" 731 | test -z "${SRC_DIR}" && abort "Please set SRC_DIR to the directory where the source tarballs are to be unpacked" 732 | test -z "${BINUTILS_DIR}" && abort "Please set BINUTILS_DIR to the bare filename of the binutils tarball or directory" 733 | test -z "${GCC_DIR}" && abort "Please set GCC_DIR to the bare filename of the gcc tarball or directory" 734 | test -z "${GLIBC_DIR}" && abort "Please set GLIBC_DIR to the bare filename of the glibc tarball or directory" 735 | test -z "${TARGET}" && abort "Please set TARGET to the Gnu target identifier (e.g. pentium-linux)" 736 | test -z "${TARGET_CFLAGS}" && abort "Please set TARGET_CFLAGS to any compiler flags needed when building glibc (-O recommended)" 737 | 738 | if test -z "${LINUX_SANITIZED_HEADER_DIR}" ; then 739 | test -z "${LINUX_DIR}" && abort "Please set either LINUX_DIR or LINUX_SANITIZED_HEADER_DIR to the bare filename of the tarball or directory containing the kernel headers" 740 | LINUX_HEADER_DIR="${LINUX_DIR}" 741 | else 742 | test -n "${LINUX_DIR}" && echo "You set both LINUX_DIR and LINUX_SANITIZED_HEADER_DIR - ignoring LINUX_DIR" 743 | LINUX_HEADER_DIR="${LINUX_SANITIZED_HEADER_DIR}" 744 | fi 745 | 746 | 747 | # Optional variables. 748 | if test -z "${GCC_CORE_DIR}"; then 749 | echo "GCC_CORE_DIR not set, so using $GCC_DIR for bootstrap compiler" 750 | GCC_CORE_DIR="${GCC_DIR}" 751 | fi 752 | test -z "${BINUTILS_EXTRA_CONFIG}" && echo "BINUTILS_EXTRA_CONFIG not set, so not passing any extra options to binutils' configure script" 753 | test -z "${GCC_EXTRA_CONFIG}" && echo "GCC_EXTRA_CONFIG not set, so not passing any extra options to gcc's configure script" 754 | test -z "${GLIBC_EXTRA_CONFIG}" && echo "GLIBC_EXTRA_CONFIG not set, so not passing any extra options to glibc's configure script" 755 | test -z "${GLIBC_EXTRA_ENV}" && echo "GLIBC_EXTRA_ENV not set, so not passing any extra environment variables to glibc's configure script" 756 | test -z "${GLIBC_EXTRA_CC_ARGS}" && echo "GLIBC_EXTRA_CC_ARGS not set, so not passing any extra options to gcc when building glibc" 757 | test -z "${EXTRA_TARGET_CFLAGS}" && echo "EXTRA_TARGET_CFLAGS not set, so not passing any extra cflags to gcc when building glibc" 758 | test -z "${USE_SYSROOT}" && echo "USE_SYSROOT not set, so not configuring with --with-sysroot" 759 | test -z "${GCC_BUILD}" && echo "GCC_BUILD not set, assuming BUILD=output of config.guess" 760 | test -z "${GCC_HOST}" && echo "GCC_HOST not set, assuming HOST=BUILD" 761 | test -z "${KERNELCONFIG}" && test ! -f ${LINUX_DIR}/.config && echo "KERNELCONFIG not set, and no .config file found, so not configuring linux kernel" 762 | test -z "${KERNELCONFIG}" || test -r "${KERNELCONFIG}" || abort "Can't read file KERNELCONFIG = $KERNELCONFIG, please fix." 763 | test -z "${GCC_LANGUAGES}" && echo "GCC_LANGUAGES not set, assuming c,c++" 764 | GCC_LANGUAGES=${GCC_LANGUAGES-"c,c++"} 765 | BUILD=${GCC_BUILD-`$SRC_DIR/$GCC_DIR/config.guess`} 766 | test -z "$BUILD" && abort "bug: BUILD not set?!" 767 | 768 | if test -z "${GLIBC_ADDON_OPTIONS}"; then 769 | echo "GLIBC_ADDON_OPTIONS not set, so guessing addons from GLIBCTHREADS_FILENAME and GLIBCCRYPT_FILENAME" 770 | # this is lame, need to fix this for nptl later? 771 | # (nptl is an addon, but it's shipped in the main tarball) 772 | GLIBC_ADDON_OPTIONS="=" 773 | case "${GLIBCTHREADS_FILENAME}" in 774 | *linuxthreads*) GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS}linuxthreads," ;; 775 | esac 776 | # crypt is only an addon for glibc-2.1.x 777 | test -z "${GLIBCCRYPT_FILENAME}" || GLIBC_ADDON_OPTIONS="${GLIBC_ADDON_OPTIONS}crypt," 778 | fi 779 | 780 | # Add some default glibc config options if not given by user. These used to be hardcoded. 781 | DEFAULT_GLIBC_EXTRA_CONFIG="" 782 | case "${GLIBC_EXTRA_CONFIG}" in 783 | *enable-kernel*) ;; 784 | *) DEFAULT_GLIBC_EXTRA_CONFIG="${DEFAULT_GLIBC_EXTRA_CONFIG} --enable-kernel=2.4.3" 785 | esac 786 | case "${GLIBC_EXTRA_CONFIG}" in 787 | *-tls*) ;; 788 | *) DEFAULT_GLIBC_EXTRA_CONFIG="${DEFAULT_GLIBC_EXTRA_CONFIG} --without-tls" 789 | esac 790 | case "${GLIBC_EXTRA_CONFIG}" in 791 | *-__thread*) ;; 792 | *) DEFAULT_GLIBC_EXTRA_CONFIG="${DEFAULT_GLIBC_EXTRA_CONFIG} --without-__thread" 793 | esac 794 | 795 | # One is forbidden 796 | test -z "${LD_LIBRARY_PATH}" || abort "glibc refuses to build if LD_LIBRARY_PATH is set. Please unset it before running this script." 797 | 798 | # And one is derived if unset. 799 | test -z "${GLIBCTHREADS_FILENAME}" && 800 | GLIBCTHREADS_FILENAME=`echo $GLIBC_DIR | sed 's/glibc-/glibc-linuxthreads-/'` 801 | 802 | # Check for a few prerequisites that have tripped people up. 803 | awk '/x/' < /dev/null || abort "You need awk to build a toolchain." 804 | test -z "${CFLAGS}" || abort "Don't set CFLAGS, it screws up the build" 805 | test -z "${CXXFLAGS}" || abort "Don't set CXXFLAGS, it screws up the build" 806 | bison --version > /dev/null || abort "You don't have bison installed" 807 | flex --version > /dev/null || abort "You don't have flex installed" 808 | 809 | #--------------------------------------------------------- 810 | 811 | if test "$GCC_HOST" != ""; then 812 | # Modify $BUILD so gcc never, ever thinks $build = $host 813 | UNIQUE_BUILD=`echo $BUILD | sed s/-/-build_/` 814 | CANADIAN_BUILD="--build=$UNIQUE_BUILD" 815 | echo "canadian cross, configuring gcc & binutils with $CANADIAN_BUILD" 816 | # make sure we have a host compiler (since $GCC_HOST-gcc won't work) 817 | "$CC" --version || abort "Must set CC to a compiler targeting $GCC_HOST. PATH is $PATH" 818 | "$AR" --version || abort "Must set AR to a version of 'ar' targeting $GCC_HOST. PATH is $PATH" 819 | # make sure we have a target compiler (otherwise glibc configure will fail) 820 | "$TARGET-gcc" --version || abort "Could not execute $TARGET-gcc. PATH is $PATH" 821 | else 822 | GCC_HOST=$BUILD 823 | CANADIAN_BUILD="" 824 | fi 825 | 826 | 827 | # Modify GCC_HOST to never be equal to $BUILD or $TARGET 828 | # This strange operation causes gcc to always generate a cross-compiler 829 | # even if the build machine is the same kind as the host. 830 | # This is why CC has to be set when doing a canadian cross; 831 | # you can't find a host compiler by appending -gcc to our whacky $GCC_HOST 832 | # Kludge: it is reported that the above causes canadian crosses with 833 | # cygwin hosts to fail, so avoid it just in that one case. It would be 834 | # cleaner to just move this into the non-canadian case 835 | # above, but I'm afraid that might cause some configure script somewhere 836 | # to decide that since build==host, they could run host binaries. 837 | # 838 | # if host is cygwin and this is not a canadian build, modify GCC_HOST 839 | case "$GCC_HOST,$CANADIAN_BUILD," in 840 | *cygwin*,?*,) ;; 841 | *) GCC_HOST=`echo $GCC_HOST | sed s/-/-host_/` ;; 842 | esac 843 | 844 | set -ex 845 | 846 | # map TARGET to Linux equivalent 847 | case $TARGET in 848 | alpha*) ARCH=alpha ;; 849 | arm*) ARCH=arm ;; 850 | cris*) ARCH=cris ;; 851 | hppa*) ARCH=parisc ;; 852 | i*86*|pentium*) ARCH=i386 ;; 853 | i4004) abort "ENOMEM" ;; 854 | ia64*) ARCH=ia64 ;; 855 | mips*) ARCH=mips ;; 856 | m68k*) ARCH=m68k ;; 857 | powerpc64*) ARCH=ppc64 ;; 858 | powerpc*) ARCH=ppc ;; 859 | ppc*) abort "Target $TARGET incompatible with binutils and gcc regression tests; use target powerpc-* or powerpc64-* instead";; 860 | s390*) ARCH=s390 ;; 861 | sh*) ARCH=sh ;; 862 | sparc64*) ARCH=sparc64 ;; 863 | sparc*) ARCH=sparc ;; 864 | vax*) ARCH=vax ;; 865 | x86_64*) ARCH=x86_64 ;; 866 | *) abort "Bad target $TARGET" 867 | esac 868 | 869 | # Make all paths absolute (it's so confusing otherwise) 870 | # FIXME: this doesn't work well with some automounters 871 | PREFIX=`mkdir -p $PREFIX; cd $PREFIX; pwd` 872 | BUILD_DIR=`mkdir -p $BUILD_DIR; cd $BUILD_DIR; pwd` 873 | SRC_DIR=`cd $SRC_DIR; pwd` 874 | BINUTILS_DIR=`cd ${SRC_DIR}/${BINUTILS_DIR}; pwd` 875 | GCC_DIR=`cd ${SRC_DIR}/${GCC_DIR}; pwd` 876 | GCC_CORE_DIR=`cd ${SRC_DIR}/${GCC_CORE_DIR}; pwd` 877 | LINUX_HEADER_DIR=`cd ${SRC_DIR}/${LINUX_HEADER_DIR}; pwd` 878 | GLIBC_DIR=`cd ${SRC_DIR}/${GLIBC_DIR}; pwd` 879 | 880 | # Always install the bootstrap gcc (used to build glibc) 881 | # somewhere it can't interfere with the final gcc. 882 | CORE_PREFIX=$BUILD_DIR/gcc-core-prefix 883 | 884 | # If user isn't doing a canadian cross, add the target compiler's bin to 885 | # the path, so we can use the compiler we build to build glibc etc. 886 | if test "$CANADIAN_BUILD" = ""; then 887 | PATH="${PREFIX}/bin:$CORE_PREFIX/bin:${PATH}" 888 | export PATH 889 | fi 890 | 891 | # test that we have write permissions to the install dir 892 | mkdir -p ${PREFIX}/${TARGET} 893 | touch ${PREFIX}/${TARGET}/test-if-write 894 | test -w ${PREFIX}/${TARGET}/test-if-write || abort "You don't appear to have write permissions to ${PREFIX}/${TARGET}." 895 | rm -f ${PREFIX}/${TARGET}/test-if-write 896 | 897 | if test -z "$USE_SYSROOT"; then 898 | # plain old way. all libraries in prefix/target/lib 899 | SYSROOT=${PREFIX}/${TARGET} 900 | HEADERDIR=$SYSROOT/include 901 | # hack! Always use --with-sysroot for binutils. 902 | # binutils 2.14 and later obey it, older binutils ignore it. 903 | # Lets you build a working 32->64 bit cross gcc 904 | BINUTILS_SYSROOT_ARG="--with-sysroot=${SYSROOT}" 905 | # Use --with-headers, else final gcc will define disable_glibc while building libgcc, and you'll have no profiling 906 | GCC_SYSROOT_ARG_CORE="--without-headers" 907 | GCC_SYSROOT_ARG="--with-headers=${HEADERDIR}" 908 | GLIBC_SYSROOT_ARG=prefix= 909 | else 910 | # spiffy new sysroot way. libraries split between 911 | # prefix/target/sys-root/lib and prefix/target/sys-root/usr/lib 912 | SYSROOT=${PREFIX}/${TARGET}/sys-root 913 | HEADERDIR=$SYSROOT/usr/include 914 | BINUTILS_SYSROOT_ARG="--with-sysroot=${SYSROOT}" 915 | GCC_SYSROOT_ARG="--with-sysroot=${SYSROOT}" 916 | GCC_SYSROOT_ARG_CORE=$GCC_SYSROOT_ARG 917 | GLIBC_SYSROOT_ARG="" 918 | # glibc's prefix must be exactly /usr, else --with-sysroot'd 919 | # gcc will get confused when $sysroot/usr/include is not present 920 | # Note: --prefix=/usr is magic! See http://www.gnu.org/software/libc/FAQ.html#s-2.2 921 | fi 922 | 923 | # Make lib directory in sysroot, else the ../lib64 hack used by 32 -> 64 bit 924 | # crosscompilers won't work, and build of final gcc will fail with 925 | # "ld: cannot open crti.o: No such file or directory" 926 | mkdir -p $SYSROOT/lib 927 | mkdir -p $SYSROOT/usr/lib 928 | 929 | echo 930 | echo "Building for --target=$TARGET, --prefix=$PREFIX" 931 | 932 | #--------------------------------------------------------- 933 | # Use sanitized headers, if available 934 | if test -z "$LINUX_SANITIZED_HEADER_DIR" ; then 935 | echo Prepare kernel headers 936 | else 937 | echo Copy sanitized headers 938 | fi 939 | 940 | cd $LINUX_HEADER_DIR 941 | mkdir -p $HEADERDIR 942 | 943 | # no indentation for now because indentation levels are rising too high 944 | if test -z "$LINUX_SANITIZED_HEADER_DIR" ; then 945 | 946 | if test -f "$KERNELCONFIG" ; then 947 | cp $KERNELCONFIG .config 948 | fi 949 | if test -f .config; then 950 | yes "" | make ARCH=$ARCH oldconfig 951 | fi 952 | 953 | # autodetect kernel version from contents of Makefile 954 | KERNEL_VERSION=`awk '/^VERSION =/ { print $3 }' $LINUX_HEADER_DIR/Makefile` 955 | KERNEL_PATCHLEVEL=`awk '/^PATCHLEVEL =/ { print $3 }' $LINUX_HEADER_DIR/Makefile` 956 | 957 | case "$KERNEL_VERSION.$KERNEL_PATCHLEVEL.x" in 958 | 2.2.x|2.4.x) make ARCH=$ARCH symlinks include/linux/version.h 959 | ;; 960 | 2.6.x) case $ARCH in 961 | sh*) # sh does secret stuff in 'make prepare' that can't be triggered separately, 962 | # but happily, it doesn't use target gcc, so we can use it. 963 | # Update: this fails on 2.6.11, as it installs elfconfig.h, which requires target compiler :-( 964 | make ARCH=$ARCH prepare include/linux/version.h 965 | ;; 966 | arm*|cris*) make ARCH=$ARCH include/asm include/linux/version.h include/asm-$ARCH/.arch 967 | ;; 968 | mips*) # for linux-2.6, 'make prepare' for mips doesn't 969 | # actually create any symlinks. Hope generic is ok. 970 | # Note that glibc ignores all -I flags passed in CFLAGS, 971 | # so you have to use -isystem. 972 | make ARCH=$ARCH include/asm include/linux/version.h 973 | TARGET_CFLAGS="$TARGET_CFLAGS -isystem $LINUX_HEADER_DIR/include/asm-mips/mach-generic" 974 | ;; 975 | *) make ARCH=$ARCH include/asm include/linux/version.h 976 | ;; 977 | esac 978 | ;; 979 | *) abort "Unsupported kernel version $KERNEL_VERSION.$KERNEL_PATCHLEVEL" 980 | esac 981 | cp -r include/asm-generic $HEADERDIR/asm-generic 982 | 983 | fi # test -z "$LINUX_SANITIZED_HEADER_DIR" 984 | 985 | cp -r include/linux $HEADERDIR 986 | cp -r include/asm-${ARCH} $HEADERDIR/asm 987 | 988 | cd $BUILD_DIR 989 | 990 | #--------------------------------------------------------- 991 | echo Build binutils 992 | 993 | build_binutils "$BINUTILS_DIR" "$BUILD_DIR/build-binutils" \ 994 | "$PREFIX" "$TARGET" $CANADIAN_BUILD --host=$GCC_HOST \ 995 | ${BINUTILS_EXTRA_CONFIG} $BINUTILS_SYSROOT_ARG 996 | 997 | if test x"$CORE_PREFIX" != x"$PREFIX"; then 998 | # if we're using a different core compiler, make binutils available to it 999 | # gcc searches in $CORE_PREFIX/$TARGET/bin for tools like 'ar', 'as', and 'ld' 1000 | # instead of the location its configure script claims it searches (gcc_cv_as), grr 1001 | mkdir -p $CORE_PREFIX/$TARGET/bin 1002 | for tool in ar as ld strip; do 1003 | # Remove old symlink to avoid clash on rerun 1004 | # ln -snf is safe, but not portable. 1005 | # Can't test for existence of symlinks reliably 1006 | # rm -f returns nonzero status on Solaris if it fails, so || true to keep script from aborting 1007 | rm -f $CORE_PREFIX/$TARGET/bin/$tool || true 1008 | ln -s $PREFIX/bin/$TARGET-$tool $CORE_PREFIX/$TARGET/bin/$tool 1009 | done 1010 | fi 1011 | 1012 | # test to see if this step passed 1013 | logresult binutils ${PREFIX}/bin/${TARGET}-ld 1014 | 1015 | #--------------------------------------------------------- 1016 | echo "Install glibc headers needed to build bootstrap compiler -- but only if gcc-3.x" 1017 | 1018 | # Only need to install bootstrap glibc headers for gcc-3.0 and above? Or maybe just gcc-3.3 and above? 1019 | # See also http://gcc.gnu.org/PR8180, which complains about the need for this step. 1020 | # Don't install them if they're already there (it's really slow) 1021 | if grep -q 'gcc-[34]' ${GCC_CORE_DIR}/ChangeLog && test '!' -f $HEADERDIR/features.h; then 1022 | mkdir -p build-glibc-headers; cd build-glibc-headers 1023 | 1024 | if test '!' -f Makefile; then 1025 | # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions. 1026 | # 1. override CC to keep glibc's configure from using $TARGET-gcc. 1027 | # 2. disable linuxthreads, which needs a real cross-compiler to generate tcb-offsets.h properly 1028 | # 3. build with gcc 3.2 or later 1029 | # Compare these options with the ones used when building glibc for real below - they're different. 1030 | # As of glibc-2.3.2, to get this step to work for hppa-linux, you need --enable-hacker-mode 1031 | # so when configure checks to make sure gcc has access to the assembler you just built... 1032 | # Alternately, we could put ${PREFIX}/${TARGET}/bin on the path. 1033 | # Set --build so maybe we don't have to specify "cross-compiling=yes" below (haven't tried yet) 1034 | # Note: the warning 1035 | # "*** WARNING: Are you sure you do not want to use the `linuxthreads'" 1036 | # *** add-on?" 1037 | # is ok here, since all we want are the basic headers at this point. 1038 | # Override libc_cv_ppc_machine so glibc-cvs doesn't complain 1039 | # 'a version of binutils that supports .machine "altivec" is needed'. 1040 | libc_cv_ppc_machine=yes \ 1041 | CC=gcc-3.3 \ 1042 | ${GLIBC_DIR}/configure --prefix=/usr \ 1043 | --build=$BUILD --host=$TARGET \ 1044 | --without-cvs --disable-sanity-checks --with-headers=$HEADERDIR \ 1045 | --enable-hacker-mode 1046 | fi 1047 | 1048 | if grep -q GLIBC_2.3 ${GLIBC_DIR}/ChangeLog; then 1049 | # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c, which fails without a real cross-compiler. 1050 | # Fortunately, we don't need errlist-compat.c, since we just need .h files, 1051 | # so work around this by creating a fake errlist-compat.c and satisfying its dependencies. 1052 | # Another workaround might be to tell configure to not use any cross options to $(CC). 1053 | # The real fix would be to get install-headers to not generate errlist-compat.c. 1054 | # Note: BOOTSTRAP_GCC is used by patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch 1055 | libc_cv_ppc_machine=yes \ 1056 | make CFLAGS=-DBOOTSTRAP_GCC sysdeps/gnu/errlist.c 1057 | mkdir -p stdio-common 1058 | # sleep for 2 seconds for benefit of filesystems with lousy time resolution, like FAT, 1059 | # so make knows for sure errlist-compat.c doesn't need generating 1060 | sleep 2 1061 | touch stdio-common/errlist-compat.c 1062 | fi 1063 | # Note: BOOTSTRAP_GCC is used by patches/glibc-2.3.5/glibc-mips-bootstrap-gcc-header-install.patch 1064 | libc_cv_ppc_machine=yes \ 1065 | make cross-compiling=yes install_root=${SYSROOT} CFLAGS=-DBOOTSTRAP_GCC $GLIBC_SYSROOT_ARG install-headers 1066 | 1067 | # Two headers -- stubs.h and features.h -- aren't installed by install-headers, 1068 | # so do them by hand. We can tolerate an empty stubs.h for the moment. 1069 | # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html 1070 | 1071 | mkdir -p $HEADERDIR/gnu 1072 | touch $HEADERDIR/gnu/stubs.h 1073 | cp ${GLIBC_DIR}/include/features.h $HEADERDIR/features.h 1074 | # Building the bootstrap gcc requires either setting inhibit_libc, or 1075 | # having a copy of stdio_lim.h... see 1076 | # http://sources.redhat.com/ml/libc-alpha/2003-11/msg00045.html 1077 | cp bits/stdio_lim.h $HEADERDIR/bits/stdio_lim.h 1078 | 1079 | # Following error building gcc-4.0.0's gcj: 1080 | # error: bits/syscall.h: No such file or directory 1081 | # solved by following copy; see 1082 | # http://sourceware.org/ml/crossgcc/2005-05/msg00168.html 1083 | # but it breaks arm, see http://sourceware.org/ml/crossgcc/2006-01/msg00091.html 1084 | # so uncomment this if you need it 1085 | cp misc/syscall-list.h $HEADERDIR/bits/syscall.h 1086 | 1087 | cd .. 1088 | fi 1089 | 1090 | #--------------------------------------------------------- 1091 | echo "Build gcc-core (just enough to build glibc)" 1092 | 1093 | mkdir -p build-gcc-core; cd build-gcc-core 1094 | 1095 | echo Copy headers to install area of bootstrap gcc, so it can build libgcc2 1096 | mkdir -p $CORE_PREFIX/$TARGET/include 1097 | cp -r $HEADERDIR/* $CORE_PREFIX/$TARGET/include 1098 | 1099 | # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) 1100 | # Use funky prefix so it doesn't contaminate real prefix, in case GCC_DIR != GCC_CORE_DIR 1101 | 1102 | if test '!' -f Makefile; then 1103 | ${GCC_CORE_DIR}/configure $CANADIAN_BUILD --target=$TARGET --host=$GCC_HOST --prefix=$CORE_PREFIX \ 1104 | --with-local-prefix=${SYSROOT} \ 1105 | --disable-multilib \ 1106 | --with-newlib \ 1107 | ${GCC_EXTRA_CONFIG} \ 1108 | ${GCC_SYSROOT_ARG_CORE} \ 1109 | --disable-nls \ 1110 | --enable-threads=no \ 1111 | --enable-symvers=gnu \ 1112 | --enable-__cxa_atexit \ 1113 | --enable-languages=c \ 1114 | --disable-shared 1115 | fi 1116 | 1117 | test "$CANADIAN_BUILD" = "" || make $PARALLELMFLAGS all-build-libiberty || true 1118 | SHELL=/bin/sh make $PARALLELMFLAGS all-gcc 1119 | make install-gcc 1120 | 1121 | # Create symbolic links mapping libgcc_eh.a to libgcc.a. This is required 1122 | # to build glibc later. 1123 | locale libgcc libgcc_eh 1124 | for libgcc in $(find "$CORE_PREFIX" -name libgcc.a); do 1125 | libgcc_eh="$(dirname "$libgcc")/libgcc_eh.a" 1126 | [ -e "$libgcc_eh" ] || ln -s "$libgcc" "$libgcc_eh" 1127 | done 1128 | 1129 | cd .. 1130 | 1131 | logresult gcc-core $CORE_PREFIX/bin/${TARGET}-gcc 1132 | 1133 | #--------------------------------------------------------- 1134 | echo Build glibc and linuxthreads 1135 | 1136 | mkdir -p build-glibc; cd build-glibc 1137 | 1138 | # sh4 really needs to set configparms as of gcc-3.4/glibc-2.3.2 1139 | # note: this is awkward, doesn't work well if you need more than one line in configparms 1140 | echo ${GLIBC_CONFIGPARMS} > configparms 1141 | 1142 | if test '!' -f Makefile; then 1143 | # Configure with --prefix the way we want it on the target... 1144 | # There are a whole lot of settings here. You'll probably want 1145 | # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG 1146 | # Compare these options with the ones used when installing the glibc headers above - they're different. 1147 | # Adding "--without-gd" option to avoid error "memusagestat.c:36:16: gd.h: No such file or directory" 1148 | # See also http://sources.redhat.com/ml/libc-alpha/2000-07/msg00024.html. 1149 | # Set BUILD_CC, or you won't be able to build datafiles 1150 | # Set --build, else glibc-2.3.2 will think you're not cross-compiling, and try to run the test programs 1151 | 1152 | # For glibc 2.3.4 and later we need to set some autoconf cache 1153 | # variables, because nptl/sysdeps/pthread/configure.in does not 1154 | # work when cross-compiling. 1155 | if test -d ${GLIBC_DIR}/nptl; then 1156 | libc_cv_forced_unwind=yes 1157 | libc_cv_c_cleanup=yes 1158 | export libc_cv_forced_unwind libc_cv_c_cleanup 1159 | fi 1160 | 1161 | BUILD_CC=gcc CFLAGS="$TARGET_CFLAGS $EXTRA_TARGET_CFLAGS" CC="${TARGET}-gcc $GLIBC_EXTRA_CC_ARGS" \ 1162 | AR=${TARGET}-ar RANLIB=${TARGET}-ranlib \ 1163 | ${GLIBC_DIR}/configure --prefix=/usr \ 1164 | --build=$BUILD --host=$TARGET \ 1165 | ${GLIBC_EXTRA_CONFIG} ${DEFAULT_GLIBC_EXTRA_CONFIG} \ 1166 | --without-cvs --disable-profile --disable-debug --without-gd \ 1167 | --enable-add-ons${GLIBC_ADDON_OPTIONS} --with-headers=$HEADERDIR 1168 | fi 1169 | 1170 | # If this fails with an error like this: 1171 | # ... linux/autoconf.h: No such file or directory 1172 | # then you need to set the KERNELCONFIG variable to point to a .config file for this arch. 1173 | # The following architectures are known to need kernel .config: alpha, arm, ia64, s390, sh, sparc 1174 | # Note: LD and RANLIB needed by glibc-2.1.3's c_stub directory, at least on macosx 1175 | # No need for PARALLELMFLAGS here, Makefile already reads this environment variable 1176 | make LD=${TARGET}-ld RANLIB=${TARGET}-ranlib all 1177 | make install_root=${SYSROOT} $GLIBC_SYSROOT_ARG install 1178 | 1179 | # This doesn't seem to work when building a crosscompiler, 1180 | # as it tries to execute localedef using the just-built ld.so!? 1181 | #make localedata/install-locales install_root=${SYSROOT} 1182 | 1183 | # Fix problems in linker scripts. 1184 | # 1185 | # 1. Remove absolute paths 1186 | # Any file in a list of known suspects that isn't a symlink is assumed to be a linker script. 1187 | # FIXME: test -h is not portable 1188 | # FIXME: probably need to check more files than just these three... 1189 | # Need to use sed instead of just assuming we know what's in libc.so because otherwise alpha breaks 1190 | # 1191 | # 2. Remove lines containing BUG per http://sources.redhat.com/ml/bug-glibc/2003-05/msg00055.html, 1192 | # needed to fix gcc-3.2.3/glibc-2.3.2 targeting arm 1193 | # 1194 | # To make "strip *.so.*" not fail (ptxdist does this), rename to .so_orig rather than .so.orig 1195 | for file in libc.so libpthread.so libgcc_s.so; do 1196 | for lib in lib lib64 usr/lib usr/lib64; do 1197 | if test -f ${SYSROOT}/$lib/$file && test ! -h ${SYSROOT}/$lib/$file; then 1198 | mv ${SYSROOT}/$lib/$file ${SYSROOT}/$lib/${file}_orig 1199 | sed 's,/usr/lib/,,g;s,/usr/lib64/,,g;s,/lib/,,g;s,/lib64/,,g;/BUG in libc.scripts.output-format.sed/d' < ${SYSROOT}/$lib/${file}_orig > ${SYSROOT}/$lib/$file 1200 | fi 1201 | done 1202 | done 1203 | cd .. 1204 | 1205 | test -f ${SYSROOT}/lib/libc.a || test -f ${SYSROOT}/lib64/libc.a || test -f ${SYSROOT}/usr/lib/libc.a || test -f ${SYSROOT}/usr/lib64/libc.a || abort Building libc failed 1206 | 1207 | #--------------------------------------------------------- 1208 | echo Build final gcc 1209 | 1210 | build_gcc "$GCC_DIR" "$BUILD_DIR/build-gcc" "$PREFIX" $TARGET \ 1211 | $CANADIAN_BUILD --host=$GCC_HOST ${GCC_EXTRA_CONFIG} \ 1212 | $GCC_SYSROOT_ARG --with-local-prefix=${SYSROOT} \ 1213 | --enable-languages="$GCC_LANGUAGES" 1214 | 1215 | logresult "final gcc" ${PREFIX}/bin/${TARGET}-gcc 1216 | 1217 | #--------------------------------------------------------- 1218 | 1219 | echo Cross-toolchain build complete. Result in ${PREFIX}. 1220 | ) 1221 | } 1222 | 1223 | # Copy debug sources, but prune source which are not 1224 | # useful for debugging. See http://b/1416593 1225 | copy_debug_sources() { 1226 | [ $# -eq 2 ] || abort "incorrect call syntax" 1227 | local src=$1 1228 | local dst=$2 1229 | [[ -z "$src" ]] && abort "empty src" 1230 | [[ -z "$dst" ]] && abort "empty dst" 1231 | 1232 | push_dir "$src" && 1233 | find . \ 1234 | \( -type d -name 'tests' -prune \) -o \ 1235 | \( -type d -name 'testsuite' -prune \) -o \ 1236 | \( -type d -name 'java' -prune \) -o \ 1237 | \( -type d -name 'libjava' -prune \) -o \ 1238 | \( -type d -name 'examples' -prune \) -o \ 1239 | -print | cpio -pdm "$dst" && 1240 | pop_dir 1241 | } 1242 | 1243 | # 1244 | # Usage: build_mao SRC_DIR BUILD_DIR INSTALL_DIR TARGET \ 1245 | # BINUTILS_SRC_DIR BINUTILS_BUILD_DIR 1246 | # 1247 | build_mao() { 1248 | [ $# -eq 6 ] || abort "incorrect call syntax" 1249 | local src_dir=$1 1250 | local build_dir=$2 1251 | local install_dir=$3 1252 | local target=$4 1253 | local binutils_src_dir=$5 1254 | local binutils_build_dir=$6 1255 | 1256 | # The mao build process has no configure step and its Makefile sets a 1257 | # bunch of variables, we need to configure all of those variables via 1258 | # the make command line. 1259 | local -a mao_make_args=( 1260 | CC="$CC" 1261 | TARGET="$target" 1262 | LOCALEDIR="$install_dir/share" 1263 | BINUTILSRC="$binutils_src_dir" 1264 | BINUTILOBJ="$binutils_build_dir" 1265 | PYTHON="" 1266 | PYTHONLIB="" 1267 | PYTHONINCL="" 1268 | PYTHONLDOPTS="" 1269 | ) 1270 | 1271 | # We need to make the build directory and tell the mao build to put its 1272 | # outputs there. Also, the program name it tries to install is not 1273 | # appropriate, so we have it install in its build directory, and install 1274 | # manually later. 1275 | mkdir -p $build_dir 1276 | mao_make_args+=( 1277 | SRCDIR="$src_dir/src" 1278 | OBJDIR="$build_dir" 1279 | BINDIR="$build_dir" 1280 | HEADERDIR="$build_dir/include" 1281 | ) 1282 | 1283 | # And, do the build. This creates the file mao-$target in BUILD_DIR. 1284 | push_dir "$build_dir" 1285 | make $PARALLELMFLAGS -f "$src_dir/src/Makefile" "${mao_make_args[@]}" 1286 | make -f "$src_dir/src/Makefile" "${mao_make_args[@]}" headers 1287 | pop_dir 1288 | 1289 | # Install the mao binary under INSTALL_DIR, with a symlink as is done 1290 | # for the other GNU tools. (This will be used by mao's as wrapper.) 1291 | mkdir -p "$install_dir/bin" 1292 | cp -p "$build_dir/mao-$target" "$install_dir/bin/mao" 1293 | cp -a "$build_dir/include" "$install_dir/mao-include" 1294 | chmod -R o+r "$install_dir/mao-include" 1295 | mkdir -p "$install_dir/$target/bin" 1296 | ln -s "../../bin/mao" "$install_dir/$target/bin/mao" 1297 | } 1298 | 1299 | # 1300 | # Usage: wrap_gcc_with_clang PREFIX TEMPLATE INSTALL_DIR 1301 | # 1302 | # Changes gcc and g++ to be scripts that preprocess the input with clang and 1303 | # compile with gcc. 1304 | # 1305 | wrap_gcc_with_clang() { 1306 | [ $# -eq 3 ] || abort "incorrect call syntax" 1307 | local prefix=$1 1308 | local template=$2 1309 | local install_dir=$3 1310 | 1311 | echo $prefix 1312 | echo $template 1313 | echo $install_dir 1314 | 1315 | push_dir $prefix/bin 1316 | mv gcc original-gcc 1317 | mv g++ original-g++ 1318 | sed \ 1319 | -e "s|CLANG|$install_dir/x86/bin/clang|" \ 1320 | -e "s|GCC|$install_dir/x86/bin/original-gcc|" \ 1321 | < $template > gcc 1322 | chmod 755 gcc 1323 | cp gcc g++ 1324 | pop_dir 1325 | } 1326 | 1327 | # 1328 | # Usage: make_traditional_crosstool_layout RPMBUILD INSTALL_PREFIX GCC_DIR 1329 | # 1330 | # Creates symlinks and scripts that emulate the old layout used by 1331 | # previous versions of crosstool. 1332 | # 1333 | make_traditional_crosstool_layout() { 1334 | [ $# -eq 3 ] || abort "incorrect call syntax" 1335 | local rpmbuild=$1 1336 | local top=$2 1337 | local gcc_dir=$3 1338 | 1339 | local old_top=$top/$gcc_dir 1340 | 1341 | local top_prefix=$rpmbuild/$top 1342 | local old_top_prefix=$rpmbuild/$old_top 1343 | local x86_dir=$old_top/x86 1344 | local x86_prefix=$rpmbuild/$x86_dir 1345 | 1346 | # Will be replaced by a script. 1347 | rm $x86_prefix/bin/x86_64-unknown-linux-gnu-* 1348 | 1349 | local all_apps=$(cd $x86_prefix/bin; find . -type f -perm -100) 1350 | local gcc_apps=$(cd $x86_prefix/bin; \ 1351 | find . -type f -perm -100 \ 1352 | \( -name "c++" \ 1353 | -o -name "gfortran" \ 1354 | -o -name "g++" \ 1355 | -o -name "cpp" \ 1356 | -o -name "gcc" \ 1357 | -o -name "gcc-[0-9]*[0-9]" \)) 1358 | 1359 | for target in i686-unknown-linux-gnu x86_64-unknown-linux-gnu; do 1360 | local target_prefix=$old_top_prefix/$target 1361 | local target_libdir 1362 | 1363 | case $target in 1364 | i686-unknown-linux-gnu) 1365 | target_libdir=lib 1366 | target_gcc_opt=-m32 1367 | ;; 1368 | x86_64-unknown-linux-gnu) 1369 | target_libdir=lib64 1370 | target_gcc_opt=-m64 1371 | ;; 1372 | esac 1373 | local runtime_prefix=$top_prefix/$target/$target_libdir 1374 | 1375 | ln -s x86 $target_prefix 1376 | 1377 | mkdir -p $runtime_prefix 1378 | cp -a $x86_prefix/$target_libdir/*.so* $runtime_prefix 1379 | 1380 | # Used by blaze for setting rpath 1381 | mkdir -p $x86_prefix/$target 1382 | ln -s ../$target_libdir $x86_prefix/$target 1383 | 1384 | for app in $all_apps 1385 | do 1386 | dir=$(dirname $app) 1387 | app=$(basename $app) 1388 | target_app=$x86_prefix/bin/$dir/$target-$app 1389 | [ -e $target_app -o -L $target_app ] && rm $target_app 1390 | ln -s "$app" "$target_app" 1391 | done 1392 | 1393 | for app in $gcc_apps 1394 | do 1395 | # canonicalize path by getting rid of extra ./ by find . 1396 | app=`echo $app | sed "s,^\./,,g"` 1397 | target_app=$x86_prefix/bin/$target-$app 1398 | [ -e $target_app -o -L $target_app ] && rm $target_app 1399 | cat < $target_app 1400 | #!/bin/bash 1401 | exec \${0%/*}/$app -no-canonical-prefixes $target_gcc_opt "\$@" 1402 | EOF 1403 | chmod 755 $target_app 1404 | done 1405 | 1406 | done 1407 | make_distcc_masquerade_dir $x86_prefix 1408 | } 1409 | 1410 | # 1411 | # Usage: wrap_gas_with_mao MAO_SRC_DIR INSTALL_DIR TARGET 1412 | # 1413 | # Moves the GNU assembler binaries into 'compat-as' subdirectories. 1414 | # Installs the mao wrapper script as 'as', and tweaks it so that it 1415 | # can find the mao and GNU as binaries as we've installed them. 1416 | # 1417 | wrap_gas_with_mao() { 1418 | [ $# -eq 3 ] || abort "incorrect call syntax" 1419 | local mao_src_dir=$1 1420 | local install_dir=$2 1421 | local target=$3 1422 | 1423 | # Move the existing 'as' binaries into a compat-as subdir. 1424 | mkdir -p "$install_dir/bin/compat-as" 1425 | mv "$install_dir/bin/as" "$install_dir/bin/compat-as/as" 1426 | rm -f "$install_dir/$target/bin/as" 1427 | mkdir -p "$install_dir/$target/bin/compat-as" 1428 | ln -s "../../../bin/compat-as/as" \ 1429 | "$install_dir/$target/bin/compat-as/as" 1430 | 1431 | # Copy the mao wrapper into place as 'as' so that it will be used 1432 | # by the compiler. Adjust the script so that the binaries used for 1433 | # mao and GNU as are correct. 1434 | sed \ 1435 | -e "/local mao_bin=/s,/mao\$,/mao," \ 1436 | -e "/local as_bin=/s,/as-orig\$,/compat-as/as," \ 1437 | < $mao_src_dir/scripts/as > "$install_dir/bin/as" 1438 | chmod 755 "$install_dir/bin/as" 1439 | sed \ 1440 | -e "/local as_bin=/s,/as-orig\$,/compat-as/as," \ 1441 | < $mao_src_dir/scripts/as > "$install_dir/$target/bin/as" 1442 | chmod 755 "$install_dir/$target/bin/as" 1443 | } 1444 | -------------------------------------------------------------------------------- /crosstool/scripts/rpm_to_deb: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # 3 | # Copyright 2008 Google Inc. 4 | # All Rights Reserved. 5 | # Author: Ollie Wild (aaw@google.com) 6 | # 7 | # Usage: rpm_to_deb RPM1 ... 8 | # 9 | # Convert a list of RPM packages to Debian packages. Preserve package 10 | # dependencies. 11 | # 12 | 13 | MAKE_SRC_DEB= 14 | BINARY_DEB_ARCH=$(dpkg --print-architecture) 15 | 16 | 17 | # Usage: fix_section DIR RPM 18 | # 19 | # Updates the section of the unpacked Debian source archive at DIR based on 20 | # the group of RPM. 21 | # 22 | fix_section() { 23 | [ $# -eq 2 ] || exit 1 24 | 25 | local dir rpm 26 | dir="$1" 27 | rpm="$2" 28 | 29 | # Grab the group from the rpm file. 30 | local group 31 | group="$(rpm -q --queryformat "%{GROUP}" -p "$rpm")" 32 | 33 | local section 34 | case "$group" in 35 | Development/*) 36 | section=devel 37 | ;; 38 | */Libraries) 39 | section=libs 40 | ;; 41 | *) 42 | echo "unrecognized package group" 1>&2 43 | exit 1 44 | ;; 45 | esac 46 | 47 | # Fixup the section. 48 | sed -i -e 's/^\(Section:\).*$/\1 '"$section"'/' "$dir/debian/control" 49 | } 50 | 51 | 52 | # Usage: fix_maintainer DIR RPM 53 | # 54 | # Updates the maintainer of the unpacked Debian source archive at DIR to match 55 | # the packager of RPM. 56 | # 57 | fix_maintainer() { 58 | [ $# -eq 2 ] || exit 1 59 | 60 | local dir rpm 61 | dir="$1" 62 | rpm="$2" 63 | 64 | # Grab the maintainer from the rpm file. 65 | local maintainer 66 | maintainer="$(rpm -q --queryformat "%{PACKAGER}" -p "$rpm")" 67 | 68 | # Fixup the maintainer. 69 | sed -i -e 's/^\(Maintainer:\).*$/\1 '"$maintainer"'/' "$dir/debian/control" 70 | } 71 | 72 | 73 | # 74 | # Usage: fix_depends DIR RPM 75 | # 76 | # Updates the dependencies of the unpacked Debian source archive at DIR to 77 | # match the dependencies in RPM. 78 | # 79 | fix_depends() { 80 | [ $# -eq 2 ] || exit 1 81 | 82 | local dir rpm 83 | dir="$1" 84 | rpm="$2" 85 | 86 | # Grab package dependencies. Ignore specific files, rpmlib and perl features. 87 | # Remove package version since the format is defferent from rpm to deb. 88 | # Format the dependencies. 89 | local depends 90 | depends="$(rpm -qRp "$rpm" | \ 91 | sed -e '/^rpmlib/d' -e '/^perl(/d' -e '/^\//d' -e 'H' -e 's/ *$//' | \ 92 | cut -d ' ' -f 1 | \ 93 | tr '\n' ',' | \ 94 | sed -e 's/,$//')" 95 | 96 | # Fixup dependencies. 97 | sed -i -e 's/^\(Depends:\).*$/\1 '"$depends"'/' "$dir/debian/control" 98 | } 99 | 100 | 101 | # 102 | # Usage: fix_arch DIR ARCH 103 | # 104 | # Converts the architecture of the unpacked Debian source archive at DIR to 105 | # ARCH. Typical values are i386, amd64, and any. 106 | # 107 | fix_arch() { 108 | [ $# -eq 2 ] || exit 1 109 | 110 | local dir arch 111 | dir="$1" 112 | arch="$2" 113 | 114 | # Modify the architecture. 115 | sed -i -e 's/^\(Architecture:\).*$/\1 '"$arch"'/' "$dir/debian/control" 116 | } 117 | 118 | 119 | # 120 | # Usage: fix_description DIR 121 | # 122 | # Remove any references to alien from the unpacked Debian source archive 123 | # at DIR. 124 | # 125 | fix_description() { 126 | [ $# -eq 1 ] || exit 1 127 | 128 | local dir 129 | dir="$1" 130 | 131 | # This is just a fancy way of deleting the last two lines from the control 132 | # file. 133 | sed -i -e '$d' "$dir/debian/control" 134 | sed -i -e '$d' "$dir/debian/control" 135 | } 136 | 137 | # 138 | # Usage: fix_standards_version DIR 139 | # 140 | # Insert a "Standards-Version: 3.8.0" specification into the Debian source 141 | # archive at DIR. 142 | # 143 | fix_standards_version() { 144 | [ $# -eq 1 ] || exit 1 145 | 146 | local dir 147 | dir="$1" 148 | 149 | sed -i -e '/^Source:/a\ 150 | Standards-Version: 3.8.0' "$dir/debian/control" 151 | } 152 | 153 | # 154 | # Usage: fix_build_depends DIR 155 | # 156 | # Insert a "Build-Depends: debhelper (>= 6.0.0)" specification into the 157 | # Debian source archive at DIR. Verifies that there is no Build-Depends 158 | # line already in the file. 159 | # 160 | fix_build_depends() { 161 | [ $# -eq 1 ] || exit 1 162 | 163 | local dir 164 | dir="$1" 165 | 166 | if grep '^Build-Depends:' "$dir/debian/control" > /dev/null 2>&1; then 167 | echo "$dir/debian/control already contains a Build-Depends line." 1>&2 168 | exit 1 169 | fi 170 | 171 | sed -i -e '/^Source:/a\ 172 | Build-Depends: debhelper (>= 5.0.0)' "$dir/debian/control" 173 | } 174 | 175 | # 176 | # Usage: fix_changelog DIR RPM 177 | # 178 | # Transform the changelog in RPM into something suitable for the Debian 179 | # source archive at DIR. 180 | # 181 | # Actually, right now this just fakes up a chnagelog that's slightly less 182 | # bogus than what alien makes by default. (Alien puts a bad user name into 183 | # the change log, because it's run under fakeroot, and also seems to stuff 184 | # one line of the change description at the end of the file. 185 | # 186 | fix_changelog() { 187 | [ $# -eq 2 ] || exit 1 188 | 189 | local dir 190 | dir="$1" 191 | local rpm 192 | rpm="$2" 193 | 194 | local today=$(date -R) 195 | 196 | # Keep the first line, it's easier than trying to figure out the 197 | # package name and version in this script. 198 | head -n 1 "$dir/debian/changelog" > "$dir/debian/changelog.tmp" 199 | cat >> "$dir/debian/changelog.tmp" < $today 204 | EOF 205 | mv -f "$dir/debian/changelog.tmp" "$dir/debian/changelog" 206 | } 207 | 208 | convert_rpm() { 209 | [ $# -eq 1 ] || exit 1 210 | 211 | local rpm 212 | rpm="$1" 213 | echo "Converting $rpm" 214 | 215 | # Run alien to generate a temporary build directory. Store the name of the 216 | # directory. 217 | local dir 218 | dir="$(alien --single --keep-version "$rpm" | \ 219 | sed -e 's/^Directory //' -e 's/ prepared\.$//')" 220 | 221 | # Touch up the build directory. 222 | fix_depends "$dir" "$rpm" 223 | fix_maintainer "$dir" "$rpm" 224 | fix_section "$dir" "$rpm" 225 | fix_description "$dir" 226 | fix_standards_version "$dir" 227 | fix_build_depends "$dir" 228 | fix_changelog "$dir" "$rpm" 229 | 230 | # Build the final package. 231 | if [ $MAKE_SRC_DEB ]; then 232 | fix_arch "$dir" any 233 | pushd "$dir" > /dev/null 234 | dpkg-buildpackage -S -us -uc 235 | popd > /dev/null 236 | else 237 | fix_arch "$dir" "$BINARY_DEB_ARCH" 238 | pushd "$dir" > /dev/null 239 | dpkg-buildpackage -B -uc -a"$BINARY_DEB_ARCH" 240 | popd > /dev/null 241 | fi 242 | 243 | # Remove the temporary directory. 244 | rm -rf "$dir" 245 | } 246 | 247 | convert_rpm_list() { 248 | local rpm 249 | for rpm in "$@"; do 250 | convert_rpm "$rpm" 251 | done 252 | } 253 | 254 | main() { 255 | # We must be run as root. Otherwise, generate an error. 256 | if [ "$(whoami)" != "root" ]; then 257 | echo "$(basename "$0") must be run as root (or via fakeroot)" 1>&2 258 | exit 1 259 | fi 260 | 261 | # It is recommended that the EMAIL environment variable be set. Otherwise, 262 | # alien will attempt to generate one, which will almost certainly be wrong. 263 | if [ -z "$EMAIL" ]; then 264 | cat <&2 265 | *************************************************************************** 266 | * WARNING: It is recommended that you set the EMAIL environment variable. * 267 | * Otherwise, alien will choose one and it will probably be wrong. * 268 | *************************************************************************** 269 | EOF 270 | fi 271 | 272 | # Parse command-line options. 273 | while [ $# -ne 0 ]; do 274 | case "$1" in 275 | -s|--source) 276 | MAKE_SRC_DEB=1 277 | shift 278 | ;; 279 | --binary-deb-arch=*) 280 | BINARY_DEB_ARCH=$(echo "$1" | sed -e 's,^--binary-deb-arch=,,') 281 | shift 282 | ;; 283 | *) 284 | break; 285 | ;; 286 | esac 287 | done 288 | 289 | convert_rpm_list "$@" 290 | } 291 | 292 | main "$@" 293 | -------------------------------------------------------------------------------- /grte/argv0switch.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | /* 8 | * argv0switch - a very simple program to exec other programs based on 9 | * the architecture. This comes from the need to have both 32- and 64-bit 10 | * binaries present on the system, but where the current location and names 11 | * of such executables can not be changed, for whatever reason. As a trivial 12 | * example, we want /usr/bin/gdb to always be gdb, but we want it to invoke 13 | * gdb32 if the platform is 32-bit, or gdb64 if the platform is 64-bit. 14 | * 15 | * The program is intentionally very very dumb. All it does is append the 16 | * text "32" or "64" to whatever argv[0] is, and exec's that. Thus, you would 17 | * only use this in real cases where you have 32 and 64 bit versions of a 18 | * binary. If the path in argv[0] is absolute or explicitly relative, then 19 | * this uses execv(). If it is neither, it uses execvp. 20 | */ 21 | 22 | int 23 | main (int argc, char *argv[]) 24 | { 25 | struct utsname sys_uname; 26 | char *newprog; 27 | const char *suffix = 0; 28 | 29 | if (-1 == uname (&sys_uname)) { 30 | perror ("uname"); 31 | exit (255); 32 | } 33 | 34 | /* Leave space for the 32 or 64, plus the NULL */ 35 | newprog = malloc (strlen (argv[0]) + 3); 36 | strcpy (newprog, argv[0]); 37 | 38 | /* 39 | * ASSUMPTION: If the architecture contains the string 64, then we want 40 | * to run the 64-bit version of the program. If ever a 32-bit platform 41 | * is invented that has the string "64" in its architecture, this will 42 | * break. 43 | */ 44 | suffix = "32"; 45 | if ((char *)0 != strstr (sys_uname.machine, "64")) 46 | suffix = "64"; 47 | 48 | strcat (newprog, suffix); 49 | 50 | /* 51 | * If any part of argv[0] contains a '/' character, it means the invocation 52 | * was absolute or explicitly relative. That is, it is not being exec'ed 53 | * via the PATH. In such cases, we don't exec via the PATH either. If no 54 | * such character exists there, then we exec via the PATH. 55 | */ 56 | if ((char *)0 == strchr (newprog, '/')) { 57 | return execvp (newprog, argv); 58 | } else { 59 | return execv (newprog, argv); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /grte/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | absname=`readlink -f "$0"` 4 | absroot="$(dirname $absname)" 5 | cfg="${absroot}/grte.cfg" 6 | 7 | [ -f $cfg ] || { 8 | echo "could not find $cfg" 9 | exit 1 10 | } 11 | 12 | . "$cfg" 13 | 14 | if [[ -n $TAR_DIR ]]; then 15 | echo "changing to $TAR_DIR" 16 | test -d $TAR_DIR || mkdir -p $TAR_DIR 17 | cd $TAR_DIR 18 | else 19 | echo "no sources" 20 | fi 21 | 22 | alias wget='wget -c' 23 | wget https://ftp.gnu.org/gnu/glibc/glibc-${glibc_version}.tar.bz2 24 | wget http://ftp.gnu.org/gnu/binutils/binutils-${binutils_version}.tar.bz2 25 | wget https://ftp.gnu.org/gnu/gcc/gcc-${gcc_version}/gcc-${gcc_version}.tar.bz2 26 | wget https://ftp.gnu.org/gnu/gmp/gmp-${gmp_version}.tar.bz2 27 | wget https://ftp.gnu.org/gnu/mpfr/mpfr-${mpfr_version}.tar.bz2 28 | wget https://ftp.gnu.org/gnu/mpc/mpc-${mpc_version}.tar.gz 29 | wget http://zlib.net/zlib-${zlib_version}.tar.gz 30 | wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-${headers26}.tar.xz 31 | -------------------------------------------------------------------------------- /grte/grte-package: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # This file takes the output of the grte-build script, which is a set of 5 | # directoryies in $BUILD/final/packaging, and creates a set of tar files 6 | # that can be subsequently fed into alien or extracted and packaged with 7 | # RPM or the like. This does considerable massaging of the handoffs in 8 | # order to reduce the installation footprint as much as possible (for the 9 | # runtime portion that will be installed on production machines) and which 10 | # gives developers the maximum flexibility for the development portion 11 | # that is installed on developer workstations. 12 | # 13 | # This script re-arranges things such that the following is true for the 14 | # runtime stuff: 15 | # 1. The 2.4 kernel, linuxthreads based C library is kept in 16 | # $GRTEROOT/lib and $GRTEROOT/lib64. The TLS-aware NPTL versions 17 | # (2.6 kernel) are kept in $GRTEROOT/lib/tls and $GRTEROOT/lib64/tls. 18 | # 2. Only the 2.6 based gconv modules will be installed in 19 | # $GRTEROOT/lib/gconv and $GRTEROOT/lib64/gconv. If this proves to be 20 | # a problem this script will need to be adjusted to put the 2.4 ones 21 | # there and the 2.6 ones in $GRTEROOT/lib/gconv/tls etc. 22 | # 3. All other shared libraries are only compiled once and go into 23 | # $GRTEROOT/lib and $GRTEROOT/lib64. 24 | # 4. The shared portions of GCC are part of this runtime package. 25 | # 26 | # For the stuff that goes on developer workstations things are arranged 27 | # such that the following is true: 28 | # 1. The headers in $GRTEROOT/include will be the 2.6-based headers. 29 | # The 2.4 based ones will be installed in $GRTEROOT/include/kernel-2.4. 30 | # 2. The static libraries in $GRTEROOT/lib{64} are the 2.6 based ones as 31 | # well. The 2.4 based static libraries are installed in 32 | # $GRTEROOT/lib{64}/linuxthreads. 33 | 34 | # Take input from /dev/null. 35 | exec < /dev/null 36 | 37 | # stop on any error, echo commands. 38 | set -ex 39 | 40 | # Set locale to C, so that e.g., 'sort' will work consistently regardless 41 | # of system and user environment settings. 42 | LC_ALL=C 43 | export LC_ALL 44 | 45 | absname=`readlink -f "$0"` 46 | absroot="${absname%/*}" 47 | # rpmbuild='/home/build/buildtools/buildhelpers/v2/rpm-4.4.1/bin/rpmbuild' 48 | rpmbuild='rpmbuild' 49 | 50 | [ -f "${absroot}/grte.cfg" ] || { 51 | error "could not find ${absroot}/grte.cfg" 52 | } 53 | 54 | . "${absroot}/grte.cfg" 55 | 56 | usage() { 57 | # Stop echoing commands so the error is more readable. 58 | set +x 59 | cat < /dev/null 2>&1; then 110 | # Files are the same 111 | cp -rp "${dir32}/${f}" "${final}/${f}" 112 | else 113 | # 114 | # The files differ. We need to merge them with suitable wrappers. 115 | # 116 | 117 | # 118 | # A few headers commonly included (indirectly) by Google code can 119 | # benefit from multiple-inclusion protection and the platform 120 | # #ifdefs confuse this, so we add guards for them. 121 | # 122 | # We set include_guard to be the guard macro, or empty if no 123 | # additional guards should be added. 124 | # 125 | case ${f} in 126 | ./bits/pthreadtypes.h | \ 127 | ./bits/wchar.h | \ 128 | ./bits/wordsize.h ) 129 | include_guard=$(echo "${f}" | tr ./a-z __A-Z | \ 130 | sed -e 's,^,_GRTE_INCLUDE,' -e 's,__*,_,g') 131 | ;; 132 | * ) 133 | include_guard= 134 | ;; 135 | esac 136 | 137 | : > "${final}/${f}" 138 | if [ -n "$include_guard" ]; then 139 | echo "#ifndef $include_guard" >> "${final}/${f}" 140 | echo "#define $include_guard" >> "${final}/${f}" 141 | fi 142 | echo "#if defined(__x86_64__) || !defined(__i386__)" >> "${final}/${f}" 143 | cat "${dir64}/${f}" >> "${final}/${f}" 144 | echo "#else /* !defined(__x86_64__) || defined(__i386__) */" >> "${final}/${f}" 145 | cat "${dir32}/${f}" >> "${final}/${f}" 146 | echo "#endif /* !defined(__x86_64__) || defined(__i386__) */" >> "${final}/${f}" 147 | if [ -n "$include_guard" ]; then 148 | echo "#endif /* $include_guard */" >> "${final}/${f}" 149 | fi 150 | fi 151 | else 152 | # 153 | # The file exists only for 32-bit 154 | # 155 | echo "#if !defined(__x86_64__)" > "${final}/${f}" 156 | cat "${dir32}/${f}" >> "${final}/${f}" 157 | echo "#endif /* !defined(__x86_64__) */" >> "${final}/${f}" 158 | fi 159 | done 160 | 161 | for l in `find . -type l`; do 162 | cp -r "${dir32}/${l}" "${final}/$l" 163 | done 164 | } # end of if copying dir32(m32 = 1) 165 | 166 | # 167 | # Have to do it all over again using the 64-bit headers as the source as 168 | # there may be headers that only exist in the 64-bit arena. 169 | # 170 | cd "${dir64}" 171 | for d in `find . -type d`; do 172 | [ -d "${final}/${d}" ] || mkdir -p "${final}/${d}" 173 | done 174 | 175 | for f in `find . -type f`; do 176 | [ -f "${dir32}/${f}" ] || { 177 | # 178 | # The file exists only for 64-bit 179 | # 180 | echo "#if defined(__x86_64__) || !defined(__i386__)" > "${final}/${f}" 181 | cat "${dir64}/${f}" >> "${final}/${f}" 182 | echo "#endif /* defined(__x86_64__) || !defined(__i386__) */" >> "${final}/${f}" 183 | } 184 | done 185 | 186 | for l in `find . -type l`; do 187 | [ -h "${final}/${l}" ] || cp -r "${dir64}/${l}" "${final}/$l" 188 | done 189 | 190 | cd "${oldpwd}" 191 | } 192 | 193 | # 194 | # Merge binary trees. The purpose of this is to put both the 32-bit and 195 | # 64-bit versions of a few special programs on teh system, and have a 196 | # switcher that detects the kernel type and runs either the 64-bit version 197 | # or the 32-bit version, depending on which kernel is being used. 198 | # 199 | merge_binaries() { 200 | oldpwd=`pwd` 201 | dir32="${1}" 202 | dir64="${2}" 203 | final="${3}" 204 | [ -d "${final}" ] || mkdir -p "${final}" 205 | 206 | [ "${grte_m32}" = "0" ] || { 207 | cd "${dir32}" 208 | for f in `find . -type f`; do 209 | if [ -f "${dir64}/${f}" ]; then 210 | ft=`file $f 2> /dev/null` 211 | case "${ft}" in 212 | *ELF*) 213 | cp -rp "${dir32}/${f}" "${final}/${f}32" 214 | cp -rp "${dir64}/${f}" "${final}/${f}64" 215 | ln -s "${GRTEROOT}/bin/argv0switch" "${final}/${f}" 216 | ;; 217 | *) cp -rp "${dir64}/${f}" "${final}/${f}" 218 | ;; 219 | esac 220 | else 221 | cp -rp "${dir32}/${f}" "${final}/${f}" 222 | fi 223 | done 224 | 225 | for l in `find . -type l`; do 226 | cp -r "${dir32}/${l}" "${final}/$l" 227 | done 228 | } 229 | 230 | cd "${dir64}" 231 | for f in `find . -type f`; do 232 | if [ ! -f "${dir32}/${f}" ]; then 233 | cp -rp "${dir64}/${f}" "${final}/${f}" 234 | fi 235 | done 236 | 237 | for l in `find . -type l`; do 238 | [ -h "${final}/${l}" ] || cp -r "${dir64}/${l}" "${final}/$l" 239 | done 240 | 241 | cd "${oldpwd}" 242 | } 243 | 244 | # 245 | # Package the sources, putting them into a bzip2'd tar file. 246 | # 247 | # TODO(cgd): convert this to check out / package the sources before 248 | # building, then use the packaged source to do the build. 249 | # 250 | package_sources() { 251 | typeset oldpwd="${PWD}" 252 | typeset tdir 253 | typeset gdir="${GRTEBASENAME}-${grte_rpmver}.${grte_rpmrel}" 254 | typeset tarfile="${gdir}-src.tar.bz2" 255 | typeset srcs_to_package=" 256 | argv0switch.c 257 | grte-build 258 | grte-package 259 | grte.cfg 260 | grtev1-gde.spec 261 | grtev1-headers.spec 262 | grtev1-runtime.spec 263 | grtev1-debuginfo.spec 264 | grtev1.changelog 265 | sources 266 | " 267 | typeset file_to_link 268 | 269 | tdir="$(mktemp -d -t grte-sources.XXXXXX)" || { 270 | error "could not create temporary directory for source archive" 271 | } 272 | 273 | cd "${tdir}" 274 | mkdir "${gdir}" 275 | cd "${gdir}" 276 | for file_to_link in $srcs_to_package; do 277 | ln -s "${SRC}/${file_to_link}" . 278 | done 279 | 280 | cd "${tdir}" 281 | tar -c -j -h --owner=root --group=root -f "${STAGING}/${tarfile}" \ 282 | "${gdir}" || { 283 | cd "${oldpwd}" 284 | rm -fr "${tdir}" 285 | error "failed to create source tar file '${tarfile}'" 286 | } 287 | 288 | cd "${oldpwd}" 289 | rm -fr "${tdir}" 290 | } 291 | 292 | [ $# -eq 2 ] || usage 293 | [ -d "$2" ] || usage "$2 is not a directory" 294 | [ -d "$2/final/packaging" ] || usage "$2 doesnt contain a full build" 295 | 296 | case "$1" in 297 | *\.\.*) error "GRTEROOT must be an absolute path name" ;; 298 | /*) ;; 299 | *) error "GRTEROOT must be an absolute path name" ;; 300 | esac 301 | 302 | tb=`readlink -f "${2}"` 303 | SRC="${absroot}" 304 | [ -d "${SRC}" -a -f "${SRC}/grtev1-runtime.spec" ] || { 305 | error "must be invoked from GRTE source directory" 306 | } 307 | 308 | GRTEROOT="$1/v${GRTEVERSION}" 309 | GRTEBASENAME="${GRTE_PACKAGE_PREFIX}$(basename $1)v${GRTEVERSION}" 310 | BUILDDIR="${tb}" 311 | PKGROOT="${tb}/final/packaging" 312 | HDRS24="${tb}/final/headers24" 313 | HDRS26="${tb}/final/headers26" 314 | STAGING="${tb}/staging" 315 | RESULTS="${tb}/results" 316 | objcopy="${PKGROOT}/binutils${GRTEROOT}/bin/objcopy" 317 | 318 | RTDIR="${STAGING}/grtev${GRTEVERSION}-runtime${GRTEROOT}" 319 | DBGDIR="${STAGING}/grtev${GRTEVERSION}-debuginfo${GRTEROOT}" 320 | HDRDIR="${STAGING}/grtev${GRTEVERSION}-headers${GRTEROOT}" 321 | DSDIR="${STAGING}/grtev${GRTEVERSION}-gde${GRTEROOT}" 322 | 323 | rtlibdir="${RTDIR}/lib" 324 | rtlib64dir="${RTDIR}/lib64" 325 | glibcrt="2.6" 326 | [ "${grte_support_kernel24}" = "0" ] || { 327 | rtlibdir="${rtlibdir}/tls" 328 | rtlib64dir="${rtlib64dir}/tls" 329 | glibcrt="2.4" 330 | } 331 | 332 | [ -z "${SKIP_PREP}" ] && { 333 | rm -fr "${STAGING}" 334 | mkdir "${STAGING}" 335 | 336 | rm -fr "${RESULTS}" 337 | mkdir "${RESULTS}" 338 | 339 | cd "${STAGING}" 340 | mkdir -p "${rtlibdir}" 341 | mkdir -p "${rtlib64dir}" 342 | mkdir -p "${RTDIR}/bin" 343 | mkdir -p "${RTDIR}/sbin" 344 | mkdir -p "${RTDIR}/etc" 345 | mkdir -p "${RTDIR}/share" 346 | 347 | # Subdirectories containing debug info are created as needed. 348 | mkdir -p "${DBGDIR}" 349 | 350 | mkdir -p "${HDRDIR}/include" 351 | mkdir -p "${HDRDIR}/lib" 352 | mkdir -p "${HDRDIR}/lib64" 353 | [ "${grte_support_kernel24}" = "0" ] || { 354 | mkdir -p "${HDRDIR}/include/linux-2.4" 355 | mkdir -p "${HDRDIR}/lib/linuxthreads" 356 | mkdir -p "${HDRDIR}/lib64/linuxthreads" 357 | } 358 | 359 | mkdir -p "${DSDIR}/lib" 360 | mkdir -p "${DSDIR}/lib64" 361 | mkdir -p "${DSDIR}/include" 362 | [ "${grte_support_kernel24}" = "0" ] || { 363 | mkdir -p "${DSDIR}/lib/linuxthreads" 364 | mkdir -p "${DSDIR}/lib64/linuxthreads" 365 | mkdir -p "${DSDIR}/include/linux-2.4" 366 | } 367 | mkdir -p "${DSDIR}/bin" 368 | mkdir -p "${DSDIR}/sbin" 369 | mkdir -p "${DSDIR}/etc" 370 | 371 | # First is basic glibc stuff 372 | [ "${grte_m32}" = "0" ] || cp -f "${PKGROOT}/argv0switch" "${RTDIR}/bin" 373 | 374 | ln -s /usr/share/zoneinfo "${RTDIR}/share/zoneinfo" 375 | ln -s /etc/localtime "${RTDIR}/etc/localtime" 376 | 377 | [ "${grte_m32}" = "0" ] || { 378 | cp -rp "${PKGROOT}/glibc/${glibcrt}/32bit${GRTEROOT}/lib/gconv" "${RTDIR}/lib" 379 | cp -rp "${PKGROOT}/glibc/${glibcrt}/32bit${GRTEROOT}/lib/locale" "${RTDIR}/lib" 380 | } 381 | 382 | cp -rp "${PKGROOT}/glibc/${glibcrt}/64bit${GRTEROOT}/lib64/gconv" "${RTDIR}/lib64" 383 | cp -rp "${PKGROOT}/glibc/${glibcrt}/64bit${GRTEROOT}/lib64/locale" "${RTDIR}/lib64" 384 | 385 | # 386 | # The vast majority of the glibc support binaries only go in the GDE. We will 387 | # manually move the ones that remain back into the runtime package below. 388 | # 389 | merge_binaries "${PKGROOT}/glibc/${glibcrt}/32bit${GRTEROOT}/bin" \ 390 | "${PKGROOT}/glibc/${glibcrt}/64bit${GRTEROOT}/bin" \ 391 | "${DSDIR}/bin" 392 | merge_binaries "${PKGROOT}/glibc/${glibcrt}/32bit${GRTEROOT}/sbin" \ 393 | "${PKGROOT}/glibc/${glibcrt}/64bit${GRTEROOT}/sbin" \ 394 | "${DSDIR}/sbin" 395 | 396 | mv -f "${DSDIR}/bin/"getconf* "${RTDIR}/bin" 397 | mv -f "${DSDIR}/bin/"iconv* "${RTDIR}/bin" 398 | mv -f "${DSDIR}/bin/ldd" "${RTDIR}/bin" 399 | mv -f "${DSDIR}/bin/mtrace" "${RTDIR}/bin" 400 | mv -f "${DSDIR}/bin/"pcprof* "${RTDIR}/bin" 401 | mv -f "${DSDIR}/bin/"sprof* "${RTDIR}/bin" 402 | mv -f "${DSDIR}/bin/xtrace" "${RTDIR}/bin" 403 | 404 | mv -f "${DSDIR}/sbin/"iconv* "${RTDIR}/sbin" 405 | mv -f "${DSDIR}/sbin/"ldconfig* "${RTDIR}/sbin" 406 | 407 | # Remove nscd and nscd_nischeck. 408 | rm -f "${DSDIR}/sbin/"nscd* 409 | 410 | [ "${grte_m32}" = "0" ] || cp -rp "${PKGROOT}/glibc/2.6/32bit${GRTEROOT}/lib/"/*.so* "${rtlibdir}" 411 | cp -rp "${PKGROOT}/glibc/2.6/64bit${GRTEROOT}/lib64/"/*.so* "${rtlib64dir}" 412 | 413 | [ "${grte_support_kernel24}" = "0" ] || { 414 | cp -rp "${PKGROOT}/glibc/2.4/32bit${GRTEROOT}/lib/"/*.so* "${RTDIR}/lib" 415 | cp -rp "${PKGROOT}/glibc/2.4/64bit${GRTEROOT}/lib64/"/*.so* "${RTDIR}/lib64" 416 | 417 | # Remove the extraneous RTLDs. 418 | rm -f "${RTDIR}/lib/tls/ld-linux"* "${RTDIR}/lib64/tls/ld-linux"* 419 | rm -f "${RTDIR}/lib/tls/ld-${glibc_version}.so" 420 | rm -f "${RTDIR}/lib64/tls/ld-${glibc_version}.so" 421 | } 422 | 423 | # Must copy 32-bit second so we get the 32-bit version of pt_chown 424 | cp -rp "${PKGROOT}/glibc/${glibcrt}/64bit${GRTEROOT}/libexec" "${RTDIR}" 425 | [ "${grte_m32}" = "0" ] || { 426 | cp -rp "${PKGROOT}/glibc/${glibcrt}/32bit${GRTEROOT}/libexec" "${RTDIR}" 427 | cp -rp "${PKGROOT}/glibc/${glibcrt}/32bit${GRTEROOT}/etc/rpc" "${DSDIR}/etc" 428 | } 429 | [ "${grte_m32}" = "0" ] && { 430 | touch "${DSDIR}/etc/keep-gde" 431 | } 432 | 433 | # Now the gcc runtimes 434 | [ "${grte_m32}" = "0" ] || cp -rp "${PKGROOT}/gcc${GRTEROOT}/lib"/*.so* "${RTDIR}/lib" 435 | cp -rp "${PKGROOT}/gcc${GRTEROOT}/lib64"/*.so* "${RTDIR}/lib64" 436 | cp -rp "${PKGROOT}/gcc${GRTEROOT}/share" "${RTDIR}" 437 | rm -fr "${RTDIR}/share/locale" 438 | # Remove info and man 439 | rm -rf "${RTDIR}/share/info" "${RTDIR}/share/man" 440 | # Convert python pretty printer from python2 to python3 441 | 2to3 -w -n ${RTDIR}/share/gcc-*/python/libstdcxx/v6/printers.py 442 | [ "${grte_java}" = "2" ] && { 443 | cp -rp "${PKGROOT}/gcc${GRTEROOT}/lib/security" "${RTDIR}/lib" 444 | cp -rp "${PKGROOT}/gcc${GRTEROOT}/lib/logging.properties" "${RTDIR}/lib" 445 | cp -rp "${PKGROOT}/gcc${GRTEROOT}/lib64/security" "${RTDIR}/lib64" 446 | cp -rp "${PKGROOT}/gcc${GRTEROOT}/lib64/logging.properties" "${RTDIR}/lib64" 447 | } 448 | 449 | # 450 | # Remove the Java runtimes if we have been told to do that 451 | # 452 | if [ "${grte_java}" = "2" ]; then 453 | cp -rp "${PKGROOT}/gcc${GRTEROOT}/lib/gcj-${gcc_version}" "${RTDIR}/lib" 454 | else 455 | rm -fr ${RTDIR}/lib/libgcj* 456 | rm -fr ${RTDIR}/lib64/libgcj* 457 | rm -fr ${RTDIR}/share/java 458 | fi 459 | 460 | # Now the zlib shared libraries 461 | [ "${grte_m32}" = "0" ] || cp -rp "${PKGROOT}/zlib${GRTEROOT}/lib"/*.so* "${RTDIR}/lib" 462 | cp -rp "${PKGROOT}/zlib${GRTEROOT}/lib64"/*.so* "${RTDIR}/lib64" 463 | 464 | [ "${grte_python_support}" = "0" ] || { 465 | # Now the ncurses shared libraries 466 | cp -rp "${PKGROOT}/ncurses${GRTEROOT}/lib"/*.so* "${RTDIR}/lib" 467 | cp -rp "${PKGROOT}/ncurses${GRTEROOT}/lib64"/*.so* "${RTDIR}/lib64" 468 | 469 | # Now the readline shared libraries 470 | cp -rp "${PKGROOT}/readline${GRTEROOT}/lib"/*.so* "${RTDIR}/lib" 471 | cp -rp "${PKGROOT}/readline${GRTEROOT}/lib64"/*.so* "${RTDIR}/lib64" 472 | 473 | # Now for bzip2 libraries and binaries 474 | cp -rp "${PKGROOT}/bzip2${GRTEROOT}/lib"/*.so* "${RTDIR}/lib" 475 | cp -rp "${PKGROOT}/bzip2${GRTEROOT}/lib64"/*.so* "${RTDIR}/lib64" 476 | cp -rp "${PKGROOT}/bzip2${GRTEROOT}/bin"/* "${DSDIR}/bin" 477 | 478 | # Now for BerkelyDB 479 | cp -rp "${PKGROOT}/db${GRTEROOT}/lib"/*.so* "${RTDIR}/lib" 480 | cp -rp "${PKGROOT}/db${GRTEROOT}/lib64"/*.so* "${RTDIR}/lib64" 481 | 482 | # Now for gdbm 483 | cp -rp "${PKGROOT}/gdbm${GRTEROOT}/lib"/*.so* "${RTDIR}/lib" 484 | cp -rp "${PKGROOT}/gdbm${GRTEROOT}/lib64"/*.so* "${RTDIR}/lib64" 485 | } # end of python support 486 | 487 | tlsdir= 488 | tls64dir= 489 | [ "${grte_support_kernel24}" = "0" ] || { 490 | tlsdir="lib/tls" 491 | tls64dir="lib64/tls" 492 | } 493 | 494 | # Fix the linker scripts to remove absolute paths 495 | [ "${grte_m32}" = "0" ] || { 496 | for file in libc.so libpthread.so; do 497 | for dir in lib ${tlsdir}; do 498 | sed -e "s,${GRTEROOT}/lib/,,g" "${RTDIR}/${dir}/${file}" \ 499 | > "${RTDIR}/${dir}/${file}.jkj" 500 | cp -f "${RTDIR}/${dir}/${file}.jkj" "${RTDIR}/${dir}/${file}" 501 | rm -f "${RTDIR}/${dir}/${file}.jkj" 502 | done 503 | done 504 | } 505 | 506 | for file in libc.so libpthread.so; do 507 | for dir in lib64 ${tls64dir}; do 508 | sed -e "s,${GRTEROOT}/lib64/,,g" "${RTDIR}/${dir}/${file}" \ 509 | > "${RTDIR}/${dir}/${file}.jkj" 510 | cp -f "${RTDIR}/${dir}/${file}.jkj" "${RTDIR}/${dir}/${file}" 511 | rm -f "${RTDIR}/${dir}/${file}.jkj" 512 | done 513 | done 514 | 515 | # 516 | # We want the RTLD to look in the system location too so we create an 517 | # ld.so.conf that contains those directories 518 | # Add empty ld.so.conf and ld.so.cache 519 | # 520 | cat > "${RTDIR}/etc/ld.so.conf" < "${RTDIR}/etc/ld.so.nohwcap" < /dev/null 2>&1; then 920 | error "$dir/debian/control already contains a Build-Depends line." 921 | fi 922 | 923 | # Fixup dependencies, section and maintainer. We also remove references to 924 | # alien from the description. We set the architecture to the native 925 | # Debian architecture too, so that we do not make assumptions about the 926 | # build machine. Per request from the Goobuntu team, add in a 927 | # Standards-Version keyword to stop their build system from ejecting 928 | # warnings. Finally, we add a Build-Depends reference do debhelper so 929 | # that 'dput -ls' doesn't error out. 930 | mv -f "${dir}/debian/control" "${dir}/debian/control.grte" 931 | sed -e 's/^\(Depends:\).*$/\1 '"${depends}"'/' \ 932 | -e 's/^\(Architecture:\).*$/\1 DUMMY/' \ 933 | -e 's/^\(Section:\).*$/\1 '"${section}"'/' \ 934 | -e '/^Description/,/^[^ ]/ { /^ \./d; /Converted.*by alien/d}' \ 935 | -e 's/^\(Maintainer:\).*$/\1 '"${maintainer}"'/' \ 936 | -e '/^Source:/a\ 937 | Build-Depends: debhelper (>= 5.0.0)\ 938 | Standards-Version: 3.8.0' \ 939 | "${dir}/debian/control.grte" > "${dir}/debian/control" 940 | chmod 644 "${dir}/debian/control" 941 | rm -f "${dir}/debian/control.grte" 942 | 943 | # 944 | # Fixes to the rules file to suit the gHardy team. 945 | # 946 | tmprules=$(mktemp -t grtepackage.XXXXXX) 947 | mv -f "${dir}/debian/rules" "${tmprules}" 948 | if [ "${glibc_version}" != "2.25" ] 949 | then 950 | echo "Please update -Xld- version to ${glibc_version}" 951 | exit 1 952 | fi 953 | sed -e 's/^#[ ]*dh_fixperms$/ dh_fixperms -Xld-2.25.so/' \ 954 | -e '/dh_shlibdeps/d' \ 955 | -e '/dh_clean/ s/-k -d//' \ 956 | "${tmprules}" > "${dir}/debian/rules" 957 | chmod 755 "${dir}/debian/rules" 958 | 959 | # 960 | # Create a boilerplate changelog file that suits the needs of the gHardy 961 | # team. 962 | # 963 | today=$(date -R) 964 | cat > "${dir}/debian/changelog" < ${today} 970 | EOF 971 | 972 | # Build the source package. 973 | mv -f "${dir}/debian/control" "${dir}/debian/control.cvt" 974 | sed -e 's/^\(Architecture:\).*$/\1 any/' \ 975 | "${dir}/debian/control.cvt" > "${dir}/debian/control" 976 | rm -f "${dir}/debian/control.cvt" 977 | cd "${dir}" 978 | fakeroot dpkg-buildpackage -S -us -uc 979 | cd "${opwd}" 980 | 981 | [ "${grte_m32}" = "0" ] || { 982 | # Build the i386 package 983 | mv -f "${dir}/debian/control" "${dir}/debian/control.cvt" 984 | sed -e 's/^\(Architecture:\).*$/\1 i386/' \ 985 | "${dir}/debian/control.cvt" > "${dir}/debian/control" 986 | rm -f "${dir}/debian/control.cvt" 987 | cd "${dir}" 988 | fakeroot dpkg-buildpackage -B -uc -ai386 989 | cd "${opwd}" 990 | } 991 | 992 | # Build the amd64 package 993 | mv -f "${dir}/debian/control" "${dir}/debian/control.cvt" 994 | sed -e 's/^\(Architecture:\).*$/\1 amd64/' \ 995 | "${dir}/debian/control.cvt" > "${dir}/debian/control" 996 | rm -f "${dir}/debian/control.cvt" 997 | cd "${dir}" 998 | fakeroot dpkg-buildpackage -B -uc -aamd64 999 | cd "${opwd}" 1000 | 1001 | # Remove the temporary directory. 1002 | rm -rf "${dir}" "${tmprules}" 1003 | } 1004 | 1005 | # Create the final handoff directories. 1006 | mkdir "${RESULTS}/debs" "${RESULTS}/rpms" "${RESULTS}/sdebs" \ 1007 | "${RESULTS}/sources" 1008 | 1009 | # Create each RPM and the corresponding debs and sdeb. 1010 | for package in grte-runtime grte-headers grte-gde grte-debuginfo; do 1011 | specfile=`echo $package | sed -e 's,grte,grtev1,'`.spec 1012 | buildroot=`echo $package | sed -e "s,grte,grtev${GRTEVERSION},"` 1013 | package_name=$(echo $package | sed -e "s,grte,${GRTEBASENAME},") 1014 | # --define "_buildrootdir ${STAGING}/grtev${GRTEVERSION}-${package}" 1015 | cd "${STAGING}" 1016 | ${rpmbuild} \ 1017 | --define "_hash_empty_files 1" \ 1018 | --define "maintainer_email ${EMAIL}" \ 1019 | --define "GRTEBUILD ${STAGING}" \ 1020 | --define "_topdir ${STAGING}" \ 1021 | --define "_rpmtopdir ${STAGING}" \ 1022 | --define "_builddir ${STAGING}/${buildroot}" \ 1023 | --define "buildroot ${STAGING}/${buildroot}" \ 1024 | --define "grte_basename ${GRTEBASENAME}" \ 1025 | --define "grte_root ${GRTEROOT}" \ 1026 | --define "grte_version ${GRTEVERSION}" \ 1027 | --define "grte_gcc_version ${gcc_version}" \ 1028 | --define "grte_glibc_version ${glibc_version}" \ 1029 | --define "grte_rpmver ${grte_rpmver}" \ 1030 | --define "grte_rpmrel ${grte_rpmrel}" \ 1031 | --define "grte_changelog ${SRC}/grtev1.changelog" \ 1032 | --dbpath /dev/null --target=${rpm_arch} -bb "${SRC}/${specfile}" 1033 | convert_rpm "${package_name}" 1034 | 1035 | mv "${STAGING}/${package_name}_${grte_rpmver}-${grte_rpmrel}_amd64.deb" \ 1036 | "${STAGING}/${package_name}_${grte_rpmver}-${grte_rpmrel}_amd64.changes" \ 1037 | "${RESULTS}/debs" 1038 | 1039 | [ "${grte_m32}" = "0" ] || { 1040 | mv "${STAGING}/${package_name}_${grte_rpmver}-${grte_rpmrel}_i386.deb" \ 1041 | "${STAGING}/${package_name}_${grte_rpmver}-${grte_rpmrel}_i386.changes" \ 1042 | "${RESULTS}/debs" 1043 | } 1044 | 1045 | mv "${STAGING}/${package_name}-${grte_rpmver}-${grte_rpmrel}.${rpm_arch}.rpm" \ 1046 | "${RESULTS}/rpms" 1047 | 1048 | mv "${STAGING}/${package_name}_${grte_rpmver}-${grte_rpmrel}.dsc" \ 1049 | "${STAGING}/${package_name}_${grte_rpmver}-${grte_rpmrel}.tar.gz" \ 1050 | "${STAGING}/${package_name}_${grte_rpmver}-${grte_rpmrel}_source.changes" \ 1051 | "${RESULTS}/sdebs" 1052 | done 1053 | 1054 | # Package up the sources used to build the release. 1055 | cd "${STAGING}" 1056 | package_sources 1057 | mv "${STAGING}/${GRTEBASENAME}-${grte_rpmver}.${grte_rpmrel}-src.tar.bz2" \ 1058 | "${RESULTS}/sources" 1059 | 1060 | # We're done! 1061 | exit 0 1062 | -------------------------------------------------------------------------------- /grte/grte-python2.4.6.spec: -------------------------------------------------------------------------------- 1 | # 2 | # Python2.4.6 base spec file 3 | # $Id: //depot/google_vendor_src_branch/python/grte-python2.4.6.spec#1 $ 4 | # 5 | 6 | # This file should be kept in sync with the grte-python2.4-2.4.6-debian-* 7 | # files. 8 | 9 | %define include_tkinter 0 10 | 11 | %define name grte-python 12 | 13 | # major package version (ie. grte-python2.2, 2.3, etc.) 14 | %define rel_ver 2.4 15 | %define binsuffix %{rel_ver} 16 | # python.org code release 17 | %define version 2.4.6 18 | # google release version (tracks internal changes) 19 | %define release 7 20 | 21 | %define __prefix /usr/grte/v1 22 | %define __debugdir /usr/lib/debug 23 | 24 | # Should unpackaged files in a build root terminate a build? 25 | # 26 | # Yes: The Python build script ignores errors when building extension 27 | # modules, meaning that we may be missing arbitrary modules. 28 | # Therefore we have a complete manifest of shared libraries below, and 29 | # set these variables to enforce that manifest. 30 | %define _unpackaged_files_terminate_build 1 31 | %define _missing_doc_files_terminate_build 1 32 | 33 | Summary: A high-level object-oriented programming language. 34 | Name: %{name}%{binsuffix} 35 | Version: %{version} 36 | Release: %{release} 37 | License: Python Software Foundation License Version 2 38 | Group: Development/Languages 39 | Source: Python-%{version}.tgz 40 | Prefix: %{__prefix} 41 | Packager: Thomas Wouters 42 | AutoProv: no 43 | AutoReqProv: no 44 | Requires: grte-runtimes >= 1.0 45 | 46 | %description 47 | Python package for the Google Runtime Environment (GRTE). 48 | 49 | $Id: //depot/google_vendor_src_branch/python/grte-python2.4.6.spec#1 $ 50 | 51 | %package devel 52 | Summary: The libraries and header files needed for Python extension development. 53 | Group: Development/Libraries 54 | AutoProv: no 55 | AutoReqProv: no 56 | Requires: %{name} = %{version} 57 | 58 | %description devel 59 | Python 'devel' package for the Google Runtime Environment (GRTE). 60 | The 'devel' package holds files necessary to compile extensions 61 | against this Python version, using distutils. It also holds the debug 62 | symbols of shared libraries. 63 | 64 | $Id: //depot/google_vendor_src_branch/python/grte-python2.4.6.spec#1 $ 65 | 66 | %package test 67 | Summary: Self-tests for the Python scripting language. 68 | Group: Development/Languages 69 | AutoProv: no 70 | AutoReqProv: no 71 | Requires: %{name} = %{version} 72 | 73 | %description test 74 | Self-tests of the Python package for the Google Runtime Environment (GRTE). 75 | 76 | $Id: //depot/google_vendor_src_branch/python/grte-python2.4.6.spec#1 $ 77 | 78 | %package tkinter 79 | Summary: Do not install or use this package 80 | Group: Development/Library 81 | AutoProv: no 82 | AutoReqProv: no 83 | Requires: %{name} = %{version} 84 | 85 | %description tkinter 86 | This package doesn't work due to lack of Tk libraries on prod71 87 | machines. Do not use. 88 | 89 | $Id: //depot/google_vendor_src_branch/python/grte-python2.4.6.spec#1 $ 90 | 91 | %prep 92 | 93 | # Sources are already unpacked in Perforce 94 | 95 | %build 96 | 97 | # Build is done by setup-grte-python246.sh 98 | 99 | %install 100 | 101 | # Install is done by setup-grte-python246.sh 102 | 103 | %clean 104 | 105 | # No thanks 106 | 107 | %files 108 | %defattr(-,root,root,-) 109 | 110 | %{__prefix}/piii-linux/bin/python%{rel_ver} 111 | 112 | %{__prefix}/piii-linux/lib/python%{rel_ver}/*.doc 113 | %{__prefix}/piii-linux/lib/python%{rel_ver}/*.py* 114 | %{__prefix}/piii-linux/lib/python%{rel_ver}/*.txt 115 | %{__prefix}/piii-linux/lib/python%{rel_ver}/bsddb/*.py* 116 | # exclude %{__prefix}/piii-linux/lib/python%{rel_ver}/bsddb/test 117 | %{__prefix}/piii-linux/lib/python%{rel_ver}/compiler 118 | # exclude %{__prefix}/piii-linux/lib/python%{rel_ver}/config 119 | %{__prefix}/piii-linux/lib/python%{rel_ver}/curses 120 | %{__prefix}/piii-linux/lib/python%{rel_ver}/email/*.py* 121 | # exclude %{__prefix}/piii-linux/lib/python%{rel_ver}/email/test 122 | %{__prefix}/piii-linux/lib/python%{rel_ver}/encodings 123 | %{__prefix}/piii-linux/lib/python%{rel_ver}/hotshot 124 | # exclude %{__prefix}/piii-linux/lib/python%{rel_ver}/idlelib 125 | # listed below %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload 126 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-old 127 | # exclude %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-tk 128 | %{__prefix}/piii-linux/lib/python%{rel_ver}/logging 129 | %{__prefix}/piii-linux/lib/python%{rel_ver}/plat-linux2 130 | %{__prefix}/piii-linux/lib/python%{rel_ver}/site-packages 131 | %{__prefix}/piii-linux/lib/python%{rel_ver}/xml 132 | 133 | # All extension modules are individually listed to ensure that they 134 | # all were successfully built. 135 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/array.so 136 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/audioop.so 137 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/binascii.so 138 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_bisect.so 139 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_bsddb.so 140 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/bz2.so 141 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/cmath.so 142 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_codecs_cn.so 143 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_codecs_hk.so 144 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_codecs_iso2022.so 145 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_codecs_jp.so 146 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_codecs_kr.so 147 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_codecs_tw.so 148 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/collections.so 149 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/cPickle.so 150 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/crypt.so 151 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/cStringIO.so 152 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_csv.so 153 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_curses_panel.so 154 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_curses.so 155 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/datetime.so 156 | # GRTE's GDBM doesn't provide NDBM support, so dbm.so does not work 157 | # exclude %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/dbm.so 158 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/dl.so 159 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/fcntl.so 160 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/gdbm.so 161 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/grp.so 162 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_heapq.so 163 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_hotshot.so 164 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/imageop.so 165 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/itertools.so 166 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/linuxaudiodev.so 167 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_locale.so 168 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/math.so 169 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/md5.so 170 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/mmap.so 171 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_multibytecodec.so 172 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/nis.so 173 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/operator.so 174 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/ossaudiodev.so 175 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/parser.so 176 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/pyexpat.so 177 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_random.so 178 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/readline.so 179 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/regex.so 180 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/resource.so 181 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/rgbimg.so 182 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/select.so 183 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/sha.so 184 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_socket.so 185 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_ssl.so 186 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/strop.so 187 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/struct.so 188 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/syslog.so 189 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/termios.so 190 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/time.so 191 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/timing.so 192 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/unicodedata.so 193 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_weakref.so 194 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/zlib.so 195 | 196 | %{__prefix}/k8-linux/bin/python%{rel_ver} 197 | 198 | %{__prefix}/k8-linux/lib/python%{rel_ver}/*.doc 199 | %{__prefix}/k8-linux/lib/python%{rel_ver}/*.py* 200 | %{__prefix}/k8-linux/lib/python%{rel_ver}/*.txt 201 | %{__prefix}/k8-linux/lib/python%{rel_ver}/bsddb/*.py* 202 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/bsddb/test 203 | %{__prefix}/k8-linux/lib/python%{rel_ver}/compiler 204 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/config 205 | %{__prefix}/k8-linux/lib/python%{rel_ver}/curses 206 | %{__prefix}/k8-linux/lib/python%{rel_ver}/email/*.py* 207 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/email/test 208 | %{__prefix}/k8-linux/lib/python%{rel_ver}/encodings 209 | %{__prefix}/k8-linux/lib/python%{rel_ver}/hotshot 210 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/idlelib 211 | # listed below %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload 212 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-old 213 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-tk 214 | %{__prefix}/k8-linux/lib/python%{rel_ver}/logging 215 | %{__prefix}/k8-linux/lib/python%{rel_ver}/plat-linux2 216 | %{__prefix}/k8-linux/lib/python%{rel_ver}/site-packages 217 | %{__prefix}/k8-linux/lib/python%{rel_ver}/xml 218 | 219 | # All extension modules are individually listed to ensure that they 220 | # all were successfully built. 221 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/array.so 222 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/audioop.so 223 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/binascii.so 224 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_bisect.so 225 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_bsddb.so 226 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/bz2.so 227 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/cmath.so 228 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_codecs_cn.so 229 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_codecs_hk.so 230 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_codecs_iso2022.so 231 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_codecs_jp.so 232 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_codecs_kr.so 233 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_codecs_tw.so 234 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/collections.so 235 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/cPickle.so 236 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/crypt.so 237 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/cStringIO.so 238 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_csv.so 239 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_curses_panel.so 240 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_curses.so 241 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/datetime.so 242 | # GRTE's GDBM doesn't provide NDBM support, so dbm.so does not work 243 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/dbm.so 244 | # dl.so doesn't work in 64-bit builds 245 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/dl.so 246 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/fcntl.so 247 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/gdbm.so 248 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/grp.so 249 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_heapq.so 250 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_hotshot.so 251 | # imageop.so doesn't work in 64-bit builds 252 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/imageop.so 253 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/itertools.so 254 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/linuxaudiodev.so 255 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_locale.so 256 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/math.so 257 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/md5.so 258 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/mmap.so 259 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_multibytecodec.so 260 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/nis.so 261 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/operator.so 262 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/ossaudiodev.so 263 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/parser.so 264 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/pyexpat.so 265 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_random.so 266 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/readline.so 267 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/regex.so 268 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/resource.so 269 | # rgbimg.so doesn't work in 64-bit builds 270 | # exclude %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/rgbimg.so 271 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/select.so 272 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/sha.so 273 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_socket.so 274 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_ssl.so 275 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/strop.so 276 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/struct.so 277 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/syslog.so 278 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/termios.so 279 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/time.so 280 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/timing.so 281 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/unicodedata.so 282 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_weakref.so 283 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/zlib.so 284 | 285 | %files devel 286 | %defattr(-,root,root,-) 287 | 288 | %{__prefix}/piii-linux/bin/idle2.4 289 | %{__prefix}/piii-linux/bin/pydoc2.4 290 | %{__prefix}/piii-linux/include 291 | %{__prefix}/piii-linux/lib/python%{rel_ver}/config 292 | %{__prefix}/piii-linux/lib/python%{rel_ver}/idlelib 293 | %{__prefix}/piii-linux/lib/python%{rel_ver}/distutils 294 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_testcapi.so 295 | %{__debugdir}%{__prefix}/piii-linux/bin/python%{rel_ver} 296 | %{__debugdir}%{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/*.so 297 | 298 | %{__prefix}/k8-linux/bin/idle2.4 299 | %{__prefix}/k8-linux/bin/pydoc2.4 300 | %{__prefix}/k8-linux/include 301 | %{__prefix}/k8-linux/lib/python%{rel_ver}/config 302 | %{__prefix}/k8-linux/lib/python%{rel_ver}/idlelib 303 | %{__prefix}/k8-linux/lib/python%{rel_ver}/distutils 304 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_testcapi.so 305 | %{__debugdir}%{__prefix}/k8-linux/bin/python%{rel_ver} 306 | %{__debugdir}%{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/*.so 307 | 308 | %files test 309 | %defattr(-,root,root,-) 310 | 311 | %{__prefix}/piii-linux/lib/python%{rel_ver}/test 312 | %{__prefix}/piii-linux/lib/python%{rel_ver}/bsddb/test 313 | %{__prefix}/piii-linux/lib/python%{rel_ver}/email/test 314 | 315 | %{__prefix}/k8-linux/lib/python%{rel_ver}/test 316 | %{__prefix}/k8-linux/lib/python%{rel_ver}/bsddb/test 317 | %{__prefix}/k8-linux/lib/python%{rel_ver}/email/test 318 | 319 | # The tkinter package is unusable, but we build it anyway to shut up 320 | # rpmbuild warnings about unused files in the build root. 321 | %files tkinter 322 | %defattr(-,root,root) 323 | 324 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-tk 325 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-tk 326 | %if %{include_tkinter} 327 | %{__prefix}/piii-linux/lib/python%{rel_ver}/lib-dynload/_tkinter.so* 328 | %{__prefix}/k8-linux/lib/python%{rel_ver}/lib-dynload/_tkinter.so* 329 | %endif 330 | 331 | %changelog 332 | * Mon Nov 23 2009 Thomas Wouters 2.4.6-7 333 | - Depend on grte-runtimes 1.0-or-later instead of just 1.0. 334 | 335 | * Thu Nov 19 2009 Thomas Wouters 2.4.6-6 336 | - Work around a potential but improbable backward compatibility issue 337 | when embedding Python in grte-python2.4-2.4.6-5. 338 | 339 | * Tue Nov 12 2009 Thomas Wouters 2.4.6-5 340 | - Backport upstream r60097, fixing some pathologically bad performance 341 | in the subprocess module. 342 | 343 | * Fri Oct 30 2009 Thomas Wouters 2.4.6-4 344 | - Build the 64-bit library using -fPIC, allowing static linking. 345 | 346 | * Fri Sep 11 2009 Thomas Wouters 2.4.6-3 347 | - Fix incorrect detection of availability of -fwrapv, causing a build 348 | without it. 349 | 350 | * Wed Sep 9 2009 Thomas Wouters 2.4.6-2 351 | - Fix http://b/1769064, incorrect encoding aliases for UTF-8. 352 | - Fix http://b/1943315, a deadlock when mixing threads and fork(). 353 | - Properly pass -fwrapv to gcc while building. 354 | - Fix potential issues with the mmap module in 64-bit builds. 355 | 356 | * Wed Jan 14 2009 Thomas Wouters 2.4.6-1 357 | - Update to upstream version 2.4.6. 358 | 359 | * Mon Sep 15 2008 Thomas Wouters 2.4.5-8 360 | - Change build script to keep as many files as possible identical 361 | and with the same timestamps as the last RPM pushed to prod71. 362 | - Use relative instead of absolute symlinks for the .py symlinks 363 | from piii-linux to k8-linux. 364 | 365 | * Mon Jul 28 2008 Thomas Wouters 2.4.5-7 366 | - Fix detection of readline > 4.0 by explicitly linking against termcap 367 | from /usr/lib. 368 | - Fix IPv6 support in socket.getaddrinfo() 369 | - Backport upstream r65481, preventing another infinite loop in 370 | impossible situations. 371 | 372 | * Mon May 12 2008 Thomas Wouters 2.4.5-6 373 | - Dump debug symbols in /usr/lib/debug and package them in the 374 | devel package. 375 | 376 | * Mon Mar 31 2008 Thomas Wouters 2.4.5-5 377 | - Strip just debug symbols from /usr/bin/python2.4, not all symbols, 378 | and recompile the .pyc files after modifying the .py files so the 379 | timestamps are correct. 380 | 381 | * Tue Mar 25 2008 Thomas Wouters 2.4.5-4 382 | - Make a few identical ancillary files symlinks. 383 | 384 | * Mon Mar 24 2008 Thomas Wouters 2.4.5-3 385 | - Rebuild with --with-cxx=no to avoid linking with g++ and introducing 386 | a dependency on libstdc++.so.6. 387 | 388 | * Fri Mar 21 2008 Thomas Wouters 2.4.5-2 389 | - Backport upstream r60148, preventing an infinite loop deep in 390 | thread-switching mechanics (aborting instead.) 391 | 392 | * Wed Feb 13 2008 Thomas Wouters 2.4.5-1 393 | - Initial build. 394 | -------------------------------------------------------------------------------- /grte/grte.cfg: -------------------------------------------------------------------------------- 1 | 2 | # Configuration file to list common version numbers used during building 3 | # the Google Runtime Environment (GRTE). 4 | # 5 | 6 | # 7 | # Set the main GRTE version number here. 8 | # 9 | : ${GRTEVERSION:="3"} 10 | 11 | # 12 | # For building RPM packages, set the package version and release here. 13 | # The version is unlikely to ever need to change until the main GRTE 14 | # version above is changed, but the release needs to be modified each 15 | # time there is a recompile and re-distribution of the RPMs. 16 | # 17 | : ${grte_rpmver:="1.0"} 18 | 19 | # Update this each time new RPM's are built. 20 | : ${grte_rpmrel:="0"} 21 | 22 | # 23 | # Set this to 1 if you want to build GCJ (the GNU Java Compiler). This makes 24 | # the runtime huge and adds a significant amount of time to the build. This 25 | # can take 3 values: 26 | # 0 - don't build Java/gcj at all. 27 | # 1 - build it but exclude it from the runtime and put it only in the GDE. 28 | # 2 - build it and put the GCJ runtime in the GRTE runtime. 29 | # 30 | : ${grte_java:="0"} 31 | 32 | 33 | # Set this to 1 if you want to build libraries that can be used to 34 | # build python, which include db, bzip2, gdbm, ncurses, readline. 35 | : ${grte_python_support:="0"} 36 | 37 | # 38 | # Set this to 1 if you want to build 32bit support. 39 | : ${grte_m32:="0"} 40 | 41 | # 42 | # Decide if you want 2.4 kernel support. If you do, glibc needs to be 43 | # compiled a number of times, some for 2.4 kernels and some for 2.6 kernels. 44 | # If you only want 2.6 kernel support, leave this as 0. 45 | # 46 | : ${grte_support_kernel24:="0"} 47 | 48 | # 49 | # Set the minimum kernel versions supported 50 | # 51 | : ${grte_kernel24:="2.4.18"} 52 | : ${grte_kernel26:="2.6.9"} 53 | 54 | # 55 | # Version numbers of the default archives 56 | # 57 | : ${gcc_version:="4.9.4"} 58 | : ${glibc_version:="2.25"} 59 | : ${headers24:="2.4.31"} 60 | : ${headers26:="3.2.63"} 61 | : ${binutils_version:="2.28"} 62 | : ${zlib_version:="1.2.11"} 63 | : ${gmp_version:="6.1.2"} 64 | : ${mpfr_version:="3.1.5"} 65 | : ${mpc_version:="1.0.3"} 66 | : ${bzip2_version:="1.0.5"} 67 | : ${bdb_version:="4.4.20"} 68 | : ${gdbm_version:="1.8.3"} 69 | : ${ncurses_version:="5.6"} 70 | : ${readline_version:="5.2"} 71 | -------------------------------------------------------------------------------- /grte/grtev1-debuginfo.spec: -------------------------------------------------------------------------------- 1 | %define _tmppath %{GRTEBUILD} 2 | %define _topdir %{GRTEBUILD} 3 | %define _rpmtopdir %{GRTEBUILD} 4 | %define _builddir %{GRTEBUILD}/grtev%{grte_version}-debuginfo 5 | %define _rpmdir %{_rpmtopdir} 6 | %define _sourcedir %{_rpmtopdir} 7 | %define _specdir %{_rpmtopdir} 8 | %define _srcrpmdir %{_rpmtopdir} 9 | %define _build_name_fmt %{name}-%{version}-%{release}.%{arch}.rpm 10 | %define _unpackaged_files_terminate_build 1 11 | %define __os_install_post %{nil} 12 | 13 | Summary: Linux C/C++ Runtime Environment (LRTE) Version %{grte_version} Debug Symbols 14 | Name: %{grte_basename}-debuginfo 15 | Version: %{grte_rpmver} 16 | Release: %{grte_rpmrel} 17 | License: GPL 18 | Group: Development/Debuggers 19 | BuildRoot: %{_tmppath}/grtev%{grte_version}-debuginfo 20 | AutoReqProv: no 21 | Packager: Release Engineer <%{maintainer_email}> 22 | 23 | %description 24 | Debug symbols for the libaries in the %{grte_basename}-runtimes package. 25 | 26 | %prep 27 | 28 | %build 29 | 30 | %install 31 | 32 | %post 33 | 34 | %files 35 | %defattr(-,root,root) 36 | %{grte_root}/bin/.debug 37 | %{grte_root}/debug-src 38 | %{grte_root}/lib64/.debug 39 | %{grte_root}/lib64/gconv/.debug 40 | %{grte_root}/libexec/gcc/x86_64-linux-gnu/%{grte_gcc_version}/.debug 41 | %{grte_root}/libexec/gcc/x86_64-linux-gnu/%{grte_gcc_version}/install-tools/.debug 42 | %{grte_root}/libexec/gcc/x86_64-linux-gnu/%{grte_gcc_version}/plugin/.debug 43 | %{grte_root}/sbin/.debug 44 | %{grte_root}/x86_64-linux-gnu/bin/.debug 45 | 46 | %include %{grte_changelog} 47 | -------------------------------------------------------------------------------- /grte/grtev1-gde.spec: -------------------------------------------------------------------------------- 1 | %define _tmppath %{GRTEBUILD} 2 | %define _topdir %{GRTEBUILD} 3 | %define _rpmtopdir %{GRTEBUILD} 4 | %define _builddir %{GRTEBUILD}/grtev%{grte_version}-gde 5 | %define _rpmdir %{_rpmtopdir} 6 | %define _sourcedir %{_rpmtopdir} 7 | %define _specdir %{_rpmtopdir} 8 | %define _srcrpmdir %{_rpmtopdir} 9 | %define _build_name_fmt %{name}-%{version}-%{release}.%{arch}.rpm 10 | %define _unpackaged_files_terminate_build 1 11 | %define __os_install_post %{nil} 12 | 13 | Summary: LRTE Version %{grte_version} Development Environment (GDE to build crosstools) 14 | Name: %{grte_basename}-gde 15 | Version: %{grte_rpmver} 16 | Release: %{grte_rpmrel} 17 | License: GPL 18 | Group: Development/Debuggers 19 | BuildRoot: %{_tmppath}/grtev%{grte_version}-gde 20 | AutoReqProv: no 21 | Requires: %{grte_basename}-runtime %{grte_basename}-headers 22 | Packager: Release Engineer <%{maintainer_email}> 23 | 24 | %description 25 | GNU C Compiler (GCC) Version %{grte_gcc_version} and supporting files for developing 26 | applications that use the Linux C/C++ Runtime Environment (LRTE). This 27 | package includes the static versions of all of the libraries provided 28 | in the LRTE Runtimes package, as well as the compiler itself. This also 29 | includes all of the header files fo the standard C library, GMP and 30 | MPFR. 31 | 32 | %prep 33 | 34 | %build 35 | 36 | %install 37 | 38 | %post 39 | 40 | %files 41 | %defattr(-,root,root) 42 | %{grte_root}/etc/* 43 | %{grte_root}/bin/* 44 | %{grte_root}/sbin/* 45 | %{grte_root}/include/* 46 | %{grte_root}/lib/* 47 | %{grte_root}/lib64/* 48 | %{grte_root}/libexec/gcc/* 49 | %{grte_root}/share/locale/* 50 | %{grte_root}/share/i18n/charmaps/* 51 | %{grte_root}/share/i18n/locales/* 52 | %{grte_root}/x86_64-linux-gnu/* 53 | 54 | %include %{grte_changelog} 55 | -------------------------------------------------------------------------------- /grte/grtev1-headers.spec: -------------------------------------------------------------------------------- 1 | %define _tmppath %{GRTEBUILD} 2 | %define _topdir %{GRTEBUILD} 3 | %define _rpmtopdir %{GRTEBUILD} 4 | %define _rpmdir %{_rpmtopdir} 5 | %define _sourcedir %{_rpmtopdir} 6 | %define _specdir %{_rpmtopdir} 7 | %define _srcrpmdir %{_rpmtopdir} 8 | %define _build_name_fmt %{name}-%{version}-%{release}.%{arch}.rpm 9 | %define _unpackaged_files_terminate_build 1 10 | %define __os_install_post %{nil} 11 | 12 | Summary: Google Runtime Environment (GRTE) Version 1 Headers 13 | Name: %{grte_basename}-headers 14 | Version: %{grte_rpmver} 15 | Release: %{grte_rpmrel} 16 | License: GPL 17 | Group: Development/Debuggers 18 | BuildRoot: %{_tmppath}/grtev%{grte_version}-headers 19 | AutoReqProv: no 20 | Requires: %{grte_basename}-runtime 21 | Packager: Release Engineer <%{maintainer_email}> 22 | 23 | %description 24 | Headers and static libraries required for compiling applications which 25 | target LRTE. 26 | 27 | %prep 28 | 29 | %build 30 | 31 | %install 32 | 33 | %post 34 | 35 | %files 36 | %defattr(-,root,root) 37 | %{grte_root}/include/* 38 | %{grte_root}/lib/* 39 | %{grte_root}/lib64/* 40 | 41 | %include %{grte_changelog} 42 | -------------------------------------------------------------------------------- /grte/grtev1-runtime.spec: -------------------------------------------------------------------------------- 1 | %define _tmppath %{GRTEBUILD} 2 | %define _topdir %{GRTEBUILD} 3 | %define _rpmtopdir %{GRTEBUILD} 4 | %define _rpmdir %{_rpmtopdir} 5 | %define _sourcedir %{_rpmtopdir} 6 | %define _specdir %{_rpmtopdir} 7 | %define _srcrpmdir %{_rpmtopdir} 8 | %define _build_name_fmt %{name}-%{version}-%{release}.%{arch}.rpm 9 | %define _unpackaged_files_terminate_build 1 10 | %define __os_install_post %{nil} 11 | 12 | Summary: Linux C/C++ Runtime Environment (LRTE) Version %{grte_version} Runtimes 13 | Name: %{grte_basename}-runtime 14 | Version: %{grte_rpmver} 15 | Release: %{grte_rpmrel} 16 | License: GPL 17 | Group: Development/Debuggers 18 | BuildRoot: %{_tmppath}/grtev%{grte_version}-runtime 19 | AutoReqProv: no 20 | Packager: Release Engineer <%{maintainer_email}> 21 | 22 | %description 23 | Basic runtime environment for all portable Linux C/C++ applications. This includes 24 | both the 32 and 64 bit standard C library, based on glibc %{grte_glibc_version}, as 25 | well as the GCC runtime support libraries used by the LRTE Development 26 | Environment. 27 | 28 | 29 | %prep 30 | 31 | %build 32 | 33 | %install 34 | 35 | %post 36 | %{grte_root}/sbin/ldconfig 2>/dev/null 37 | 38 | %files 39 | %defattr(-,root,root) 40 | %config %{grte_root}/etc/ld.so.conf 41 | %config %{grte_root}/etc/ld.so.nohwcap 42 | %config %{grte_root}/etc/ld.so.cache 43 | %config %{grte_root}/lib64/gconv/gconv-modules 44 | %{grte_root}/bin 45 | %{grte_root}/etc/localtime 46 | %{grte_root}/sbin 47 | %{grte_root}/share/zoneinfo 48 | %{grte_root}/lib64/*.so* 49 | %{grte_root}/lib64/gconv/*.so* 50 | %{grte_root}/lib64/locale/locale-archive 51 | %{grte_root}/libexec/getconf 52 | %{grte_root}/share/gcc-*/python/* 53 | # Short symlinks to the LRTE dynamic loader, for PT_INTERP binary editing. 54 | %{grte_root}/ld32 55 | %{grte_root}/ld64 56 | 57 | %include %{grte_changelog} 58 | -------------------------------------------------------------------------------- /grte/grtev1.changelog: -------------------------------------------------------------------------------- 1 | # Changelog for GRTE v1 RPMs 2 | 3 | %changelog 4 | * Sat May 30 2015 Ming Zhao 5 | - Initial version based on the open source version from 6 | https://code.google.com/p/google-search-appliance-mirror/downloads/detail?name=grte-1.2.2-src.tar.bz2&can=2&q= 7 | 8 | * Mon Dec 07 2009 Paul Pluzhnikov 9 | - Bumped RPM release number for 1.2-2 release (fixed permissions). 10 | - Integrated CL 36773-p2 to isolate against current umask 11 | 12 | * Mon Dec 07 2009 Paul Pluzhnikov 13 | - Bumped RPM release number for 1.2-1 release. (Minor version bump needed 14 | so that other packages that want to use the new symlinks can depend on 15 | this release.) 16 | 17 | * Mon Dec 07 2009 Paul Pluzhnikov 18 | - For bug http://b/1277482 -- create new symlinks for grte ELF interpreters 19 | with short pathnames. 20 | 21 | * Mon Dec 07 2009 Paul Pluzhnikov 22 | - Integrated CLs 36734-p2 and 36751-p2. This makes building grte on release 23 | branch possible on gHardy, and (almost) bit-identical to previous builds 24 | (which were done on gDapper). 25 | 26 | * Sat Nov 21 2009 Chris Demetriou 27 | - Bumped RPM release number for 1.1-1 release. (Minor version bump needed 28 | so that other packages that want to use the new symlinks can depend on 29 | this release.) 30 | 31 | * Sat Nov 21 2009 Chris Demetriou 32 | - For bug http://b/1277482, add symlinks /lib/ld-grte1.so.2 and 33 | /lib/ld-grte1-x86-64.so.2 to provide short paths to the GRTE dynamic loader 34 | (suitable for binary editing existing binaries' PT_INTERP sections). 35 | 36 | * Tue Sep 22 2009 Paul Pluzhnikov 37 | - For bug http://b/2136142 -- ensure proper stack alignment for SSE2 in 38 | 32-bit makecontext. 39 | 40 | * Fri Aug 21 2009 Chris Demetriou 41 | - Bumped RPM release number for 1.0-38 release. 42 | 43 | * Wed Aug 19 2009 Paul Pluzhnikov 44 | - Initialize __google_auxv only once. 45 | 46 | * Fri Jul 31 2009 Paul Pluzhnikov 47 | - Initialize __google_auxv before shared library initializers are run. 48 | Export it from ld-2.3.6.so, so google3 shared libraries could be 49 | loaded into executables built against grte-1.0-34 and earlier. 50 | 51 | * Thu May 14 2009 Chris Demetriou 52 | - Bumped RPM release number for 1.0-37 release. 53 | 54 | * Wed May 13 2009 Chris Demetriou 55 | - For bug http://b/1784538 fix assertion failure that occurs when the dynamic 56 | loader's realloc cannot get memory contiguous with the original allocation. 57 | 58 | * Mon Apr 13 2009 Chris Demetriou 59 | - Bumped RPM release number for 1.0-36 release. 60 | 61 | * Mon Apr 13 2009 Chris Demetriou 62 | - For bugs http://b/1760338 and http://b/1784891 fix libtool .la files 63 | so they don't contain directories inappropriate for the given library 64 | type (32-bit / 64-bit). (Does not affect grte-runtimes.) 65 | 66 | * Fri Mar 13 2009 Chris Demetriou 67 | - Bumped RPM release number for 1.0-35 release. 68 | 69 | * Fri Mar 13 2009 Paul Pluzhnikov 70 | - Export ___google_auxv (Google-specific modification), so google3 71 | debugging support code can reliably acess it. 72 | 73 | * Fri Mar 13 2009 Chris Demetriou 74 | - Fix issue in which mpfr was not correctly using 'ar D' to build 75 | bit-identical archives. (Does not affect grte-runtimes.) 76 | 77 | * Thu Mar 12 2009 Chris Demetriou 78 | - Add support for 'deterministic mode' ('D' flag) in ar. Use it when 79 | building to make .a files rebuild bit-identical from the same inputs. 80 | Also, do not package 'nscd' binaries in grte-gde (since they differ 81 | from build to build, and are unneeded). Finally, when gzipping locale 82 | data, use the '-n' flag to avoid including timestamps in the .gz files. 83 | (Only the .gz timestamp change affects the grte-runtimes package.) 84 | 85 | * Tue Mar 10 2009 Chris Demetriou 86 | - For bug http://b/1218530, fix stack-usage issues in iconv_open, 87 | strcoll_l, and an internal stdio routine caused by alloca overuse. 88 | 89 | * Fri Mar 06 2009 Chris Demetriou 90 | - For bug http://b/1218561 integrate version 1.72 of upstream posix/glob.c, 91 | which fixes overuse of alloca that can cause stack overflow. 92 | 93 | * Thu Feb 12 2009 Chris Demetriou 94 | - Bumped RPM release number for 1.0-34 release. 95 | 96 | * Thu Feb 12 2009 Chris Demetriou 97 | - For bug http://b/1218561 apply upstream patch to to avoid stack 98 | overuse when initgroups is called. 99 | 100 | * Tue Jan 27 2009 Paul Pluzhnikov 101 | - Enable --build-id for everything built by GRTE/gcc. 102 | 103 | * Tue Jan 13 2009 Paul Pluzhnikov 104 | - For bug http://b/1566762 prune "garbage" from debuginfo. 105 | 106 | * Thu Nov 13 2008 Chris Demetriou 107 | - Bumped RPM release number for 1.0-33 release. 108 | 109 | * Tue Nov 11 2008 Chris Demetriou 110 | - Revert fix for for bug http://b/1093328 (added on 2008-11-04). 111 | 112 | * Fri Nov 07 2008 Chris Demetriou 113 | - Bumped RPM release number for 1.0-32 release. 114 | 115 | * Thu Nov 06 2008 Chris Demetriou 116 | - For bug http://b/1423672 improve header packaging to keep GRTE headers 117 | from defeating GCC's multiple-inclusion optimizations. This results 118 | in a 20+% reduction in number of included headers while building 119 | a particular Google application. 120 | 121 | * Tue Nov 04 2008 Chris Demetriou 122 | - For bug http://b/1093328 fix thread-creation performance issue 123 | when low 2GB of memory is full. 124 | 125 | * Fri Oct 17 2008 Chris Demetriou 126 | - Bumped RPM release number for 1.0-31 release. 127 | 128 | * Fri Oct 17 2008 Chris Demetriou 129 | - For bug http://b/1412129 fix issue with 'clone' unwind info 130 | that could cause programs to hang on C++ exceptions. 131 | 132 | * Mon Sep 15 2008 Chris Demetriou 133 | - Bumped RPM release number for 1.0-30 release. 134 | 135 | * Mon Sep 15 2008 Chris Demetriou 136 | - For bug http://b/1157323 remove deprecation warnings from sys_nerr and 137 | sys_errlist, since they warn even if referenced only from debug info. 138 | 139 | * Mon Sep 15 2008 Chris Demetriou 140 | - Bumped RPM release number for 1.0-29 release. 141 | 142 | * Mon Sep 15 2008 Chris Demetriou 143 | - Fix packaging issue in which links to getconf32/getconf64 were being 144 | shipped as real files (instead of symlinks) due to debuginfo generation. 145 | 146 | * Fri Sep 12 2008 Chris Demetriou 147 | - Bumped RPM release number for 1.0-28 release. 148 | 149 | * Fri Sep 12 2008 Chris Demetriou 150 | - Rework the way Debian packages are created, so that .changes 151 | files are built for all packages. 152 | 153 | * Fri Sep 12 2008 Chris Demetriou 154 | - For bug http://b/1373618 fix use of uninitialized memory when 155 | creating the .gnu_debuglink section. 156 | 157 | * Thu Sep 11 2008 Chris Demetriou 158 | - Bumped RPM release number for 1.0-27 release. 159 | 160 | * Thu Sep 11 2008 Chris Demetriou 161 | - Add a Build-Depends line to the Debian source package control file, 162 | to satisfy lintian. 163 | 164 | * Tue Sep 09 2008 Chris Demetriou 165 | - For bug http://b/1157323 force Berkeley DB installation not to strip 166 | executables, generate debug files as the last step of package-gathering 167 | (after gathering all of the executables), and clean up debuginfo package 168 | directory list (to include new directories which contain debug files). 169 | 170 | * Tue Sep 09 2008 Chris Demetriou 171 | - For bug http://b/1157323 build argv0switch with debugging. 172 | 173 | * Mon Sep 08 2008 Chris Demetriou 174 | - For bug http://b/1157323 various improvements to build and packaging, the 175 | largest being to package the sources used for the build into a 'debug-src' 176 | directory, and use -fdebug-prefix-map to translate the original source 177 | paths to reference that directory. The other minor changes here: build 178 | with 'set -ex' to print commands and stop on error, fix missing 179 | regenerated file for -fdebug-prefix-map that caused the option not to be 180 | passed to the assembler, and fix the GCC configure script's detection of 181 | the GNU assembler [us]leb128 directives. 182 | 183 | * Thu Sep 04 2008 Chris Demetriou 184 | - Bumped RPM release number for 1.0-26 release. 185 | 186 | * Thu Sep 04 2008 Chris Demetriou 187 | - For http://b/1157323 rename the grte-runtimes-debuginfo package 188 | to be just grte-debuginfo. 189 | 190 | * Wed Sep 03 2008 Chris Demetriou 191 | - For bug http://b/1157323 back-port support from gcc 4.3.1 192 | for -fdebug-prefix-map. 193 | 194 | * Fri Aug 29 2008 Chris Demetriou 195 | - For bug http://b/1347519 back-port change from GCC which 196 | avoids installing .gch files (precompiled headers). 197 | 198 | * Wed Aug 27 2008 Chris Demetriou 199 | - For http://b/1345873 link argv0switch against GRTE libraries 200 | and dynamic loader. 201 | 202 | * Wed Aug 27 2008 Chris Demetriou 203 | - Fix changelog inclusion in grte-gde and grte-headers packages. 204 | 205 | * Sun Aug 17 2008 Chris Demetriou 206 | - Bumped RPM release number for 1.0-25 release. 207 | 208 | * Sun Aug 17 2008 Chris Demetriou 209 | - For http://b/1186325 fix configure tests for various features to 210 | use -fPIC, so that they test the features correctly on x86_64. 211 | 212 | * Sat Aug 16 2008 Chris Demetriou 213 | - For http://b/1151796 and http://b/1152032 fix unwind information 214 | for memcmp and clone. 215 | 216 | * Sat Aug 16 2008 Chris Demetriou 217 | - For http://b/1212500 fix x86_64 offsets into ucontext_t used 218 | to store certain data, fixing getcontext() et al. 219 | 220 | * Sat Aug 16 2008 Chris Demetriou 221 | - For http://b/798841 make x86_64 pthread_once retain required 222 | stack alignment. 223 | 224 | * Sat Aug 16 2008 Chris Demetriou 225 | - For http://b/1157323 create a new grte-runtimes-debuginfo package. 226 | Make symbols-only .debug files corresponding to each library 227 | in the grte-runtimes packages, and have a GNU debuginfo link from 228 | the grte-runtimes libraries to the .debug files with symbols. 229 | 230 | * Wed Aug 13 2008 Chris Demetriou 231 | - For http://b/1157323 build all GRTE libraries with debugging 232 | information enabled. This has no effect on the runtime libraries 233 | other than to rename a number of symbols in glibc (which are 234 | effectively local labels, but are not named as such by glibc). 235 | 236 | * Sun Aug 10 2008 Chris Demetriou 237 | - Improvements to the build process, including scripts to integrate 238 | changes to the release branch, to label releases, and to do 239 | one-command builds. 240 | 241 | * Sun Aug 10 2008 Chris Demetriou 242 | - Integrate remains of CL 12994 (set Packager RPM tags) missed in 243 | a previous integrate, and integrate CL 13170 (fix various gHardy 244 | packaging issues). For http://b/1259934 245 | 246 | * Wed Aug 6 2008 Chris Demetriou 247 | - Bumped RPM release number for 1.0-24 release. 248 | 249 | * Tue Aug 5 2008 Chris Demetriou 250 | - Improve repeatability of GCC builds: avoid dates in manual pages, 251 | don't put build dates in Fortran .mod files, and build libstdc++-v3 252 | PCH files with -frandom-seed=$@. For http://b/1284236 253 | 254 | * Tue Aug 5 2008 Chris Demetriou 255 | - Improve repeatability of GRTE builds: Set size of undefined symbols 256 | from dynamic libraries (in executables and other dynamic libraries) 257 | to zero. For http://b/1284236 258 | 259 | * Mon Jul 21 2008 Chris Demetriou 260 | - Bumped RPM release number for 1.0-23 release. 261 | 262 | * Mon Jul 21 2008 Chris Demetriou 263 | - Support kernel version 2.6.9, to enable use of GRTE on RH AS 4. 264 | 265 | * Fri Jul 18 2008 Chris Demetriou 266 | - Integrate CL 13188: Disable static link warnings for the functions: 267 | dlopen, dlmopen, initgroups, getgrouplist, getaddrinfo. 268 | 269 | * Thu Jul 10 2008 Kean Johnston 270 | - Bumped RPM release number for 1.0-22 release. (This changelog 271 | entry was added after the release was created.) 272 | 273 | * Sat Jul 5 2008 Chris Demetriou 274 | - In grte-build, set LC_ALL=C when building to avoid environment 275 | dependencies. Also, sync LC_ALL and /dev/null-as-stdin changes 276 | to grte-package. (No change to generated binaries). 277 | - Tweak glibc errlist build slightly to be deterministic when built 278 | different versions of GNU awk. (No change to generated binaries). 279 | 280 | * Tue Jul 1 2008 Kean Johnston 281 | - Bumped RPM release number for 1.0-21 release. 282 | - Updated ld.so.conf to explicitly include the correct list of search 283 | directories. Fixes 1242661. 284 | 285 | * Mon Jun 30 2008 Chris Demetriou 286 | - Fix for NSS 'cache' service not working by resyncing to current 287 | NSS cache code. 288 | 289 | * Tue May 27 2008 Kean Johnston 290 | - Bumped RPM release number for 1.0-20 release. 291 | 292 | * Mon May 26 2008 Chris Demetriou 293 | - Bumped RPM release number for 1.0-19 release. 294 | 295 | * Mon May 26 2008 Chris Demetriou 296 | - Integrated CL 12074: Backport unwind info for lll_mutex_lock and 297 | related functions (lowlevellock functions) from current glibc sources. 298 | - Integrated CL 12075: Add unwind info to i486 and x86_64 299 | pthread_rwlock_timed{rd,wr}lock. 300 | - Integrated CL 12076: Add unwind info to i486 pthread_rwlock_{rd,wr,un}lock. 301 | - Integrated CL 12077: Add unwind info to i486 sem_post function. 302 | - Integrated CL 12078: Add unwind info to i486 pthread_cond_{broadcast,signal}. 303 | - Integrated CL 12079: Add unwind info to i486 pthread_barrier_wait. 304 | - Integrated CL 12080: README.google entry for unwind descriptor additions. 305 | - Integrated CL 12092: Document release build restrictions + branch location. 306 | - Integrated CL 12108: Add warnings to build script for possible release 307 | build issues. 308 | 309 | * Fri May 23 2008 Kean Johnston and Chris Demetriou 310 | - Bumped RPM release number for new release. 311 | - Changed libc to not include date/time specific build strings for later 312 | reproducability. 313 | - Changed build script to fix ncurses build reproducability issue. 314 | - Changed gdbm to remove date/time stamps for reproducability. 315 | - Changed libstdc++ build to use a consistent random seed for reproducability. 316 | -------------------------------------------------------------------------------- /grte/prepare-sources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | exec < /dev/null 4 | 5 | # stop on any error, echo commands. 6 | set -ex 7 | 8 | # Set locale to C, so that e.g., 'sort' will work consistently regardless 9 | # of system and user environment settings. 10 | LC_ALL=C 11 | export LC_ALL 12 | 13 | # The 'gzip' environment variable passes flags to gzip. We set -n to 14 | # avoid putting timestamps and filenames in gzip files. This enables 15 | # deterministic builds. 16 | GZIP=-n 17 | export GZIP 18 | 19 | absname=`readlink -f "$0"` 20 | absroot="${absname%/*}" 21 | 22 | [ -f "${absroot}/grte.cfg" ] || { 23 | error "could not find ${absroot}/grte.cfg" 24 | } 25 | 26 | . "${absroot}/grte.cfg" 27 | 28 | OSRC="${absroot}/sources" 29 | TAR_DIR=`readlink -f ${TAR_DIR:-/sources}` 30 | 31 | echo "Unpack sources to ${OSRC}" 32 | mkdir -p "${OSRC}" 33 | cd "${OSRC}" 34 | 35 | tar zxf ${TAR_DIR}/zlib-${zlib_version}.tar.gz 36 | tar jxf ${TAR_DIR}/gcc-${gcc_version}.tar.bz2 37 | tar jxf ${TAR_DIR}/gmp-${gmp_version}.tar.bz2 38 | tar jxf ${TAR_DIR}/mpfr-${mpfr_version}.tar.bz2 39 | tar zxf ${TAR_DIR}/mpc-${mpc_version}.tar.gz 40 | mv gmp-${gmp_version} gcc-${gcc_version}/gmp 41 | mv mpfr-${mpfr_version} gcc-${gcc_version}/mpfr 42 | mv mpc-${mpc_version} gcc-${gcc_version}/mpc 43 | cp gcc-${gcc_version}/gcc/Makefile.in gcc-Makefile.in.orig 44 | tar Jxf ${TAR_DIR}/linux-${headers26}.tar.xz 45 | make -C linux-${headers26} headers_install \ 46 | INSTALL_HDR_PATH=${OSRC}/linux-libc-headers-${headers26} \ 47 | ARCH=x86 48 | tar jxf ${TAR_DIR}/binutils-${binutils_version}.tar.bz2 49 | cd binutils-${binutils_version} 50 | # patch -p0 < ${TAR_DIR}/binutils-2.24-set-section-macros.patch 51 | find . -iname *.info -exec touch {} \; 52 | find . -iname *.po -exec touch {} \; 53 | cd "${OSRC}" 54 | tar jxf ${TAR_DIR}/glibc-${glibc_version}.tar.bz2 55 | -------------------------------------------------------------------------------- /grte/sources/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bazelment/lrte/87dd6c8c0d7fcb445038a7939f8674d803ad251f/grte/sources/.keep -------------------------------------------------------------------------------- /install-bazel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Guarantee that if any statement fails, the script bails immediate. 4 | set -e 5 | 6 | # Add the Google Bazel PPA; can only be done after we have curl 7 | echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list 8 | curl -L https://bazel.build/bazel-release.pub.gpg | apt-key add - 9 | 10 | # Magical apt-get update incantation to only update a single source from here: 11 | # https://askubuntu.com/questions/65245/apt-get-update-only-for-a-specific-repository/65250 12 | apt-get update -o Dir::Etc::sourcelist="sources.list.d/bazel.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" 13 | 14 | # git is used when bazel needs to get certain workspace status 15 | apt-get install -y bazel git python 16 | -------------------------------------------------------------------------------- /install-release.sh: -------------------------------------------------------------------------------- 1 | # This script will install the prebuilt release deb packages hosted by 2 | # github. 3 | 4 | # Make sure apt support pulling package using https 5 | apt-get update 6 | # apt-add-repository belongs to software-properties-common 7 | apt-get install -y apt-transport-https software-properties-common curl 8 | apt-add-repository 'deb https://github.com/mzhaom/lrte/releases/download/v3.0_0 ./' 9 | apt-get update 10 | apt-get install -y --force-yes lrtev3-crosstoolv2-gcc-4.9 lrtev3-crosstoolv2-clang-4.0 11 | -------------------------------------------------------------------------------- /release.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 -u 2 | 3 | '''Release both LRTE and crosstool by building them inside docker 4 | container''' 5 | 6 | import argparse 7 | import os 8 | import os.path 9 | import subprocess 10 | 11 | def start_container(docker_image, command, 12 | container_name = None, 13 | attach_stdin = False, 14 | attach_stderr = False, 15 | attach_stdout = False, 16 | privileged = False, 17 | workdir = None, 18 | mounts = [], 19 | portmap = {}, 20 | environment = {}, 21 | start_subprocess = True): 22 | '''Start a docker container with the given image and command. 23 | 24 | If the container_name is not None, the container will be forcibly removed 25 | first. 26 | 27 | Mounts is a list of tuple (host_file, container_file), which means 28 | a "host_file"(or directory) on host should be mounted as 29 | "container_file" inside the container. 30 | 31 | portmap is map from container_port to host_port, these ports 32 | insider container will be exposed by docker as host_port on the 33 | host side. 34 | 35 | If start_subprocess is True, docker run will run as a subprocess, 36 | otherwise os.exec will be used to replace the current process. 37 | ''' 38 | if container_name: 39 | subprocess.call(['/usr/bin/docker', 'rm', '-f', container_name], 40 | stderr = subprocess.DEVNULL) 41 | cmd = ['/usr/bin/docker', 'run', '-i', '-t', 42 | '--net=bridge', '--rm'] 43 | if privileged: 44 | cmd.append('--privileged') 45 | if container_name: 46 | cmd.append('--name=' + container_name) 47 | # Attach stderr and stdout 48 | if attach_stdin: 49 | cmd += ['-a', 'stdin'] 50 | if attach_stdout: 51 | cmd += ['-a', 'stdout'] 52 | if attach_stderr: 53 | cmd += ['-a', 'stderr'] 54 | if workdir: 55 | cmd += ['-w', workdir] 56 | for env_name, env_value in environment.items(): 57 | cmd += ['-e', '%s=%s' %(env_name, env_value)] 58 | for c_port, h_port in portmap.items(): 59 | cmd.append('--publish=%d:%d' % (h_port, c_port)) 60 | # mount what we need 61 | for host_fname, container_fname in mounts: 62 | cmd += ['-v', '%s:%s' % (host_fname, container_fname)] 63 | cmd.append(docker_image) 64 | if type(command) == str: 65 | cmd.append(command) 66 | else: 67 | cmd += command 68 | print("=== Running %s" % (str(cmd))) 69 | if start_subprocess: 70 | subprocess.check_call(cmd) 71 | else: 72 | os.execv(cmd[0], cmd) 73 | 74 | 75 | def get_svn_revision(svn_directory, svn_url): 76 | try: 77 | svn_version = subprocess.check_output( 78 | ['svn info |grep Revision:'], 79 | shell=True, universal_newlines=True, 80 | cwd=svn_directory) 81 | return svn_version.split(': ')[1].strip() 82 | except subprocess.CalledProcessError: 83 | print('Please checkout code from ' + svn_url) 84 | raise 85 | 86 | 87 | def main(): 88 | parser = argparse.ArgumentParser( 89 | description = __doc__, 90 | formatter_class=argparse.ArgumentDefaultsHelpFormatter, 91 | ) 92 | parser.add_argument('--docker_image', default='build', 93 | help='Name of the docker image to use') 94 | parser.add_argument('--email', default=os.getenv('EMAIL', default='foo@bar.io'), 95 | help='Email address used as package maintainer') 96 | parser.add_argument('--output', default=os.path.join(os.path.dirname(__file__), 'output'), 97 | help='Directory to store the output') 98 | parser.add_argument('--debug', action='store_true', 99 | help='Start the docker container using bash') 100 | parser.add_argument('--lrte_prefix', default='/usr/lrte', 101 | help='Directory prefix where lrte gets installed') 102 | parser.add_argument('--lrte_package_prefix', default='', 103 | help='Prefix used in names of lrte packages, by default, ' 104 | 'the packages are name like lrtev1-runtime_1.0-3_amd64.deb, ' 105 | 'setting a prefix like xyz will name the package like ' 106 | 'xyzlrtev1-runtime_1.0-3_amd64.deb') 107 | parser.add_argument('--lrte_skip', choices=['step1', 'step2', 'final'], action='append', 108 | help='Steps to skip when building LRTE(which could be step1, step2, final)') 109 | parser.add_argument('--upstream_source', default=os.path.join(os.path.dirname(__file__), 'upstream'), 110 | help='Directory that stores original downloaded packages, like glibc code') 111 | parser.add_argument('--actions', choices=['lrte', 'crosstool', 'check'], nargs='+', 112 | help='Select the actions to perform') 113 | parser.add_argument('--crosstool_skip', choices=['gcc'], action='append', 114 | help='Steps to skip when building crosstool') 115 | 116 | args = parser.parse_args() 117 | 118 | mounts = [] 119 | topdir = os.path.abspath(os.path.dirname(__file__)) 120 | mounts.append((topdir, topdir)) 121 | # Output dir in docker 122 | output_dir = '/output' 123 | sources_dir = '/sources' # This has to match TAR_DIR in prepare-sources.sh 124 | mounts.append((os.path.abspath(args.output), output_dir)) 125 | mounts.append((os.path.abspath(args.upstream_source), sources_dir)) 126 | 127 | env = { 128 | 'JFLAGS' : '-j8', 129 | 'GRTE_PACKAGE_PREFIX' : args.lrte_package_prefix, 130 | } 131 | if args.email: 132 | env['EMAIL'] = args.email 133 | if args.lrte_skip: 134 | for skip in args.lrte_skip: 135 | env['SKIP_' + skip.upper()] = '1' 136 | 137 | if not os.path.isdir(args.output): 138 | os.makedirs(args.output) 139 | 140 | if args.debug: 141 | start_container(args.docker_image, 142 | ['/bin/bash'], 143 | workdir = topdir, 144 | attach_stdin = True, 145 | attach_stdout = True, 146 | attach_stderr = True, 147 | mounts = mounts, 148 | start_subprocess=False, 149 | environment = env) 150 | 151 | lrte_output = os.path.join(args.output, 'lrte') 152 | lrte_output_in_docker = os.path.join(output_dir, 'lrte') 153 | 154 | if 'lrte' in args.actions: 155 | start_container(args.docker_image, 156 | ['./build_grte.sh', args.lrte_prefix, lrte_output_in_docker], 157 | workdir = topdir, 158 | attach_stdin = True, 159 | attach_stdout = True, 160 | attach_stderr = True, 161 | mounts = mounts, 162 | environment = env) 163 | print('deb packages: %s' % (os.path.join(lrte_output, 'results/debs'))) 164 | print('rpm packages: %s' % (os.path.join(lrte_output, 'results/rpms'))) 165 | 166 | if 'crosstool' in args.actions: 167 | if not os.path.isdir(os.path.join(lrte_output, 'results/debs')): 168 | raise Exception(os.path.join(lrte_output, 'results/debs') + ' does not exit, please build LRTE packages first') 169 | env['GCC_SVN_VERSION'] = get_svn_revision( 170 | os.path.join(args.upstream_source, 'gcc-4_9'), 171 | 'svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9') 172 | env['CLANG_SVN_VERSION'] = get_svn_revision( 173 | os.path.join(args.upstream_source, 'llvm/tools/clang'), 174 | 'http://clang.llvm.org/get_started.html') 175 | if args.crosstool_skip: 176 | for skip in args.crosstool_skip: 177 | env['SKIP_CROSSTOOL_' + skip.upper()] = '1' 178 | start_container(args.docker_image, 179 | ['./build_crosstool.sh', args.lrte_prefix, 180 | lrte_output_in_docker, 181 | sources_dir], 182 | workdir = topdir, 183 | attach_stdin = True, 184 | attach_stdout = True, 185 | attach_stderr = True, 186 | mounts = mounts, 187 | environment = env) 188 | 189 | if 'check' in args.actions: 190 | if not os.path.isdir(os.path.join(lrte_output, 'results/debs')): 191 | raise Exception(os.path.join(lrte_output, 'results/debs') + ' does not exit, please build LRTE packages first') 192 | start_container(args.docker_image, 193 | ['./check.sh', args.lrte_prefix, 194 | lrte_output_in_docker], 195 | workdir = topdir, 196 | attach_stdin = True, 197 | attach_stdout = True, 198 | attach_stderr = True, 199 | mounts = mounts, 200 | environment = env) 201 | 202 | 203 | 204 | if __name__ == '__main__': 205 | main() 206 | -------------------------------------------------------------------------------- /upload-github-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Upload generated packages as github release 4 | # 5 | # Prerequisites: 6 | # 1. github-release tool(https://github.com/aktau/github-release) is available in path. 7 | # 2. Environment variables are set: 8 | # - GITHUB_USER 9 | # - GITHUB_TOKEN 10 | # - RELEASE_TAG 11 | 12 | function upload() { 13 | local fname=$1 14 | local name=$(basename ${fname}) 15 | echo "upload $fname" 16 | github-release upload -r lrte -t ${RELEASE_TAG} -n ${name} -f ${fname} 17 | } 18 | 19 | function error() { 20 | echo "$@" 21 | exit 1 22 | } 23 | 24 | if [ -z $RELEASE_TAG ]; then 25 | error "RELEASE_TAG environment variable needs to be set, like v2.0_0" 26 | fi 27 | 28 | set -e 29 | 30 | for fname in $@; do 31 | upload ${fname} 32 | done 33 | github-release info -r lrte -t ${RELEASE_TAG} 34 | -------------------------------------------------------------------------------- /upstream/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bazelment/lrte/87dd6c8c0d7fcb445038a7939f8674d803ad251f/upstream/.keep -------------------------------------------------------------------------------- /upstream/binutils-2.24-set-section-macros.patch: -------------------------------------------------------------------------------- 1 | diff -rcp ../binutils-2.24.orig/bfd/bfd-in2.h bfd/bfd-in2.h 2 | *** ../binutils-2.24.orig/bfd/bfd-in2.h 2014-04-22 12:03:35.226872578 +0100 3 | --- bfd/bfd-in2.h 2014-04-22 12:07:51.556393678 +0100 4 | *************** typedef struct bfd_section *sec_ptr; 5 | *** 294,302 **** 6 | 7 | #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) 8 | 9 | - #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) 10 | - #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) 11 | - #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) 12 | /* Find the address one past the end of SEC. */ 13 | #define bfd_get_section_limit(bfd, sec) \ 14 | (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ 15 | --- 294,299 ---- 16 | *************** struct relax_table { 17 | *** 1592,1597 **** 18 | --- 1589,1620 ---- 19 | int size; 20 | }; 21 | 22 | + /* Note: the following are provided as inline functions rather than macros 23 | + because not all callers use the return value. A macro implementation 24 | + would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some 25 | + compilers will complain about comma expressions that have no effect. */ 26 | + static inline bfd_boolean 27 | + bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) 28 | + { 29 | + ptr->userdata = val; 30 | + return TRUE; 31 | + } 32 | + 33 | + static inline bfd_boolean 34 | + bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) 35 | + { 36 | + ptr->vma = ptr->lma = val; 37 | + ptr->user_set_vma = TRUE; 38 | + return TRUE; 39 | + } 40 | + 41 | + static inline bfd_boolean 42 | + bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) 43 | + { 44 | + ptr->alignment_power = val; 45 | + return TRUE; 46 | + } 47 | + 48 | /* These sections are global, and are managed by BFD. The application 49 | and target back end are not permitted to change the values in 50 | these sections. */ 51 | diff -rcp ../binutils-2.24.orig/bfd/bfd-in.h bfd/bfd-in.h 52 | *** ../binutils-2.24.orig/bfd/bfd-in.h 2014-04-22 12:03:35.272868967 +0100 53 | --- bfd/bfd-in.h 2014-04-22 12:06:12.850914084 +0100 54 | *************** typedef struct bfd_section *sec_ptr; 55 | *** 287,295 **** 56 | 57 | #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) 58 | 59 | - #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) 60 | - #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) 61 | - #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) 62 | /* Find the address one past the end of SEC. */ 63 | #define bfd_get_section_limit(bfd, sec) \ 64 | (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ 65 | --- 287,292 ---- 66 | diff -rcp ../binutils-2.24.orig/bfd/section.c bfd/section.c 67 | *** ../binutils-2.24.orig/bfd/section.c 2014-04-22 12:03:35.215873442 +0100 68 | --- bfd/section.c 2014-04-22 12:06:55.795118059 +0100 69 | *************** CODE_FRAGMENT 70 | *** 542,547 **** 71 | --- 542,573 ---- 72 | . int size; 73 | .}; 74 | . 75 | + .{* Note: the following are provided as inline functions rather than macros 76 | + . because not all callers use the return value. A macro implementation 77 | + . would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some 78 | + . compilers will complain about comma expressions that have no effect. *} 79 | + .static inline bfd_boolean 80 | + .bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) 81 | + .{ 82 | + . ptr->userdata = val; 83 | + . return TRUE; 84 | + .} 85 | + . 86 | + .static inline bfd_boolean 87 | + .bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) 88 | + .{ 89 | + . ptr->vma = ptr->lma = val; 90 | + . ptr->user_set_vma = TRUE; 91 | + . return TRUE; 92 | + .} 93 | + . 94 | + .static inline bfd_boolean 95 | + .bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) 96 | + .{ 97 | + . ptr->alignment_power = val; 98 | + . return TRUE; 99 | + .} 100 | + . 101 | .{* These sections are global, and are managed by BFD. The application 102 | . and target back end are not permitted to change the values in 103 | . these sections. *} 104 | -------------------------------------------------------------------------------- /upstream/clang-grte-runtime.patch: -------------------------------------------------------------------------------- 1 | Index: CMakeLists.txt 2 | =================================================================== 3 | --- CMakeLists.txt (revision 305394) 4 | +++ CMakeLists.txt (working copy) 5 | @@ -239,6 +239,12 @@ 6 | add_definitions( -DCLANG_VENDOR="${CLANG_VENDOR} " ) 7 | endif() 8 | 9 | +set(CLANG_GRTE_ROOT "" CACHE STRING 10 | + "Root directory of GRTE runtime.") 11 | +if( CLANG_GRTE_ROOT ) 12 | + add_definitions( -DGRTE_ROOT="${CLANG_GRTE_ROOT}" ) 13 | +endif() 14 | + 15 | set(CLANG_REPOSITORY_STRING "" CACHE STRING 16 | "Vendor-specific text for showing the repository the source is taken from.") 17 | 18 | Index: lib/Driver/ToolChains/Linux.cpp 19 | =================================================================== 20 | --- lib/Driver/ToolChains/Linux.cpp (revision 305394) 21 | +++ lib/Driver/ToolChains/Linux.cpp (working copy) 22 | @@ -577,8 +577,8 @@ 23 | 24 | if (Distro == Distro::Exherbo && (Triple.getVendor() == llvm::Triple::UnknownVendor || 25 | Triple.getVendor() == llvm::Triple::PC)) 26 | - return "/usr/" + Triple.str() + "/lib/" + Loader; 27 | - return "/" + LibDir + "/" + Loader; 28 | + return GRTE_ROOT "/usr/" + Triple.str() + "/lib/" + Loader; 29 | + return GRTE_ROOT "/" + LibDir + "/" + Loader; 30 | } 31 | 32 | void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs, 33 | --------------------------------------------------------------------------------