| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright © 2004-2005 The Trustees of Indiana University and Indiana |
| 4 | # University Research and Technology |
| 5 | # Corporation. All rights reserved. |
| 6 | # Copyright © 2004-2005 The University of Tennessee and The University |
| 7 | # of Tennessee Research Foundation. All rights |
| 8 | # reserved. |
| 9 | # Copyright © 2004-2005 High Performance Computing Center Stuttgart, |
| 10 | # University of Stuttgart. All rights reserved. |
| 11 | # Copyright © 2004-2005 The Regents of the University of California. |
| 12 | # All rights reserved. |
| 13 | # Copyright © 2008-2013 Cisco Systems, Inc. All rights reserved. |
| 14 | # Copyright © 2012-2022 Inria. All rights reserved. |
| 15 | # $COPYRIGHT$ |
| 16 | # |
| 17 | # Additional copyrights may follow |
| 18 | # |
| 19 | # $HEADER$ |
| 20 | # |
| 21 | |
| 22 | ######################################################################### |
| 23 | # Make greek and non-greek distribution (i.e., non-snapshot) tarballs |
| 24 | ######################################################################### |
| 25 | |
| 26 | # |
| 27 | # Version of auto tools that we want |
| 28 | # |
| 29 | |
| 30 | AM_TARGET_VERSION=1.16.5 |
| 31 | AC_TARGET_VERSION=2.71 |
| 32 | LT_TARGET_VERSION=2.4.7 |
| 33 | |
| 34 | # |
| 35 | # First things first -- check that the auto versions that we have are |
| 36 | # the ones that we want. |
| 37 | # |
| 38 | |
| 39 | check_gnu_version() { |
| 40 | prog="$1" |
| 41 | target="$2" |
| 42 | |
| 43 | ver="`$prog --version | head -n 1 | cut -d\ -f 4`" |
| 44 | if test "$ver" != "$target"; then |
| 45 | cat <<EOF |
| 46 | ERROR: Program "$prog" does not have the correct/expected version: |
| 47 | Found: $ver |
| 48 | |
| 49 | Expected versions: |
| 50 | Automake: $AM_TARGET_VERSION |
| 51 | Autoconf: $AC_TARGET_VERSION |
| 52 | Libtool: $LT_TARGET_VERSION |
| 53 | |
| 54 | Either change this script to match the found version, or install |
| 55 | the correct version of the tools. |
| 56 | EOF |
| 57 | exit 1 |
| 58 | fi |
| 59 | } |
| 60 | |
| 61 | # |
| 62 | # Subroutine to actually make a tarball |
| 63 | # |
| 64 | |
| 65 | make_tarball() { |
| 66 | # |
| 67 | # Autogen |
| 68 | # |
| 69 | echo "*** Removing old configure..." |
| 70 | # Ensure that configure is re-generated -- sometimes it won't be |
| 71 | # (if it hasn't changed), and therefore VERSION could be newer |
| 72 | # than configure, and that leads to all kinds of problems |
| 73 | rm -f configure |
| 74 | |
| 75 | echo "*** Running autogen.sh..." |
| 76 | rm -f success |
| 77 | (./autogen.sh 2>&1 && touch success) | tee auto.out |
| 78 | if test ! -f success; then |
| 79 | echo "Autogen failed. Aborting" |
| 80 | exit 1 |
| 81 | fi |
| 82 | |
| 83 | # |
| 84 | # Configure |
| 85 | # |
| 86 | echo "*** Running configure..." |
| 87 | rm -f success |
| 88 | (./configure 2>&1 && touch success) | tee config.out |
| 89 | if test ! -f success; then |
| 90 | echo "Configure failed. Aborting" |
| 91 | exit 1 |
| 92 | fi |
| 93 | |
| 94 | # |
| 95 | # Explicitly create the doxygen docs |
| 96 | # |
| 97 | echo "*** Making doxygen docs..." |
| 98 | cd doc |
| 99 | rm -rf doxygen-doc |
| 100 | rm -f success |
| 101 | (make doc 2>&1 && touch success) | tee doc.out |
| 102 | if test ! -f success; then |
| 103 | echo "Making doxygen docs failed. Aborting" |
| 104 | exit 1 |
| 105 | fi |
| 106 | |
| 107 | # |
| 108 | # Explicitly create the README file |
| 109 | # |
| 110 | echo "*** Making README..." |
| 111 | rm -rf ../README |
| 112 | rm -f success |
| 113 | (make readme 2>&1 && touch success) | tee readme.out |
| 114 | if test ! -f success; then |
| 115 | echo "Making README failed. Aborting" |
| 116 | exit 1 |
| 117 | fi |
| 118 | rm -f success |
| 119 | cd .. |
| 120 | |
| 121 | # |
| 122 | # make tarball |
| 123 | # |
| 124 | echo "*** Running make distcheck..." |
| 125 | save_LD=$LD_LIBRARY_PATH |
| 126 | LD_LIBRARY_PATH= |
| 127 | rm -f success |
| 128 | (make distcheck 2>&1 && touch success) | tee dist.out |
| 129 | if test ! -f success; then |
| 130 | echo "Make distcheck failed. Aborting" |
| 131 | exit 1 |
| 132 | fi |
| 133 | rm -f success |
| 134 | LD_LIBRARY_PATH=$save_LD |
| 135 | |
| 136 | echo "*** All done" |
| 137 | } |
| 138 | |
| 139 | ######################################################################### |
| 140 | # main |
| 141 | ######################################################################### |
| 142 | |
| 143 | echo "*** Checking GNU tools versions..." |
| 144 | check_gnu_version automake $AM_TARGET_VERSION |
| 145 | check_gnu_version autoconf $AC_TARGET_VERSION |
| 146 | check_gnu_version libtool $LT_TARGET_VERSION |
| 147 | |
| 148 | # |
| 149 | # Verify that we're in a top hwloc dir |
| 150 | # |
| 151 | echo "*** Checking to ensure in top-level HWLOC directory..." |
| 152 | if test -f VERSION -a -f configure.ac -a -f config/hwloc.m4 -a -e .git; then |
| 153 | happy=1 |
| 154 | else |
| 155 | echo "Do not appear to be in a hwloc git clone top directory. Abort!" |
| 156 | exit 1 |
| 157 | fi |
| 158 | |
| 159 | # |
| 160 | # Set VERSION to not build a snapshot |
| 161 | # |
| 162 | echo "*** Git reverting VERSION files..." |
| 163 | git diff VERSION | patch -p1 -R |
| 164 | |
| 165 | # |
| 166 | # Substitute in the release date and disable snapshot build |
| 167 | # |
| 168 | echo "*** Substituting in release date and disabling snapshot..." |
| 169 | release_date=`export LANG=; export LC_ALL=; export LC_TIME=; date '+%b %d, %Y'` |
| 170 | sed -e "s/^date=.*/date=\"$release_date\"/" \ |
| 171 | -e "s/^snapshot=.*/snapshot=0/" \ |
| 172 | VERSION > VERSION.new |
| 173 | cp -f VERSION.new VERSION |
| 174 | rm -f VERSION.new |
| 175 | |
| 176 | # |
| 177 | # Make 2 tarballs: |
| 178 | # |
| 179 | # - one with the greek |
| 180 | # - one without the greek |
| 181 | # |
| 182 | # unless the user specifically said --greekonly, then only make the |
| 183 | # greek tarball. Making both tarballs at once allows us to guarantee |
| 184 | # to have two tarballs -- one greek and one not -- that have exactly |
| 185 | # the same git describe (as opposed to, for example, running this |
| 186 | # script to make a greek tarball, then running it again to make a |
| 187 | # non-greek tarball -- there is a race condition that someone could |
| 188 | # commit in the meantime and change the git describe number in the 2nd |
| 189 | # tarball) |
| 190 | # |
| 191 | |
| 192 | # First, make greek tarball |
| 193 | |
| 194 | echo "*** Making greek tarball" |
| 195 | make_tarball |
| 196 | |
| 197 | # Now if ! --greekonly, make the non-greek tarball |
| 198 | |
| 199 | if test "$1" != "-greekonly" -a "$1" != "--greekonly"; then |
| 200 | echo "*** REMOVING ALL GREEK FROM VERSION NUMBERS!!" |
| 201 | sed -e 's/^greek=.*/greek=/' VERSION > VERSION.new |
| 202 | cp -f VERSION.new VERSION |
| 203 | rm -f VERSION.new |
| 204 | echo "Making non-greek tarball" |
| 205 | make_tarball |
| 206 | fi |
| 207 | |
| 208 | # Put the VERSION and README files back the way they were |
| 209 | echo "*** Reverting VERSION and README files" |
| 210 | git diff VERSION README | patch -p1 -R |