File: distscript.sh

package info (click to toggle)
hwloc 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 23,512 kB
  • sloc: ansic: 61,341; xml: 13,559; sh: 7,753; makefile: 2,154; javascript: 1,071; cpp: 93; sed: 5
file content (127 lines) | stat: -rwxr-xr-x 3,665 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/sh -f
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright © 2004-2005 The Trustees of Indiana University and Indiana
#                         University Research and Technology
#                         Corporation.  All rights reserved.
# Copyright © 2004-2005 The University of Tennessee and The University
#                         of Tennessee Research Foundation.  All rights
#                         reserved.
# Copyright © 2004-2005 High Performance Computing Center Stuttgart,
#                         University of Stuttgart.  All rights reserved.
# Copyright © 2004-2005 The Regents of the University of California.
#                         All rights reserved.
# Copyright © 2010-2014   Inria.  All rights reserved.
# Copyright © 2009-2014 Cisco Systems, Inc.  All rights reserved.
# See COPYING in top-level directory.
#

builddir="`pwd`"

srcdir=$1
cd "$srcdir"
srcdir=`pwd`
cd "$builddir"

distdir="$builddir/$2"
HWLOC_VERSION=$3

if test "$distdir" = ""; then
    echo "Must supply relative distdir as argv[2] -- aborting"
    exit 1
elif test "$HWLOC_VERSION" = ""; then
    echo "Must supply version as argv[1] -- aborting"
    exit 1
fi

#========================================================================

start=`date`
cat <<EOF

Creating hwloc distribution
In directory: `pwd`
Srcdir: $srcdir
Builddir: $builddir
Version: $HWLOC_VERSION
Started: $start

EOF

umask 022

if test ! -d "$distdir"; then
    echo "*** ERROR: dist dir does not exist"
    echo "*** ERROR:   $distdir"
    exit 1
fi

if test ! -d $srcdir/doc/doxygen-doc; then
    echo "*** The srcdir does not already have a doxygen-doc tree built."
    echo "*** hwloc's config/distscript.csh requires the docs to be built"
    echo "*** in the srcdir before executing 'make dist'."
    exit 1
fi

# Trivial helper function
doit() {
    echo $*
    eval $*
}

echo "*** Copying doxygen-doc tree to dist..."
echo "*** Directory: srcdir: $srcdir, distdir: $distdir, pwd: `pwd`"
doit mkdir -p $distdir/doc/doxygen-doc
doit chmod -R a=rwx $distdir/doc/doxygen-doc
doit rm -rf $distdir/doc/doxygen-doc

# We want to copy the entire directory tree to the distdir.  In some
# cases, doxygen-doc may be a sym link, so we want the copy to follow
# the sym links.  It's a bit of a portability nightmare, so try a few
# different ways...
# This seems to work on OS X and Linux (but not Solaris)
doit "tar c -C $srcdir -h -f - doc/doxygen-doc | tar x -C $distdir -f -"
if test ! -d $distdir/doc/doxygen-doc; then
    # This seems to work on Linux and Solaris
    doit cp -rpf $srcdir/doc/doxygen-doc/ $distdir/doc
fi
if test ! -d $distdir/doc/doxygen-doc; then
    # This seems to work on OS X (probably redundant, but we know it works)
    doit cp -rpf $srcdir/doc/doxygen-doc $distdir/doc
fi
# If we still failed, just error out
if test ! -d $distdir/doc/doxygen-doc; then
    echo "ERROR: Cannot seem to copy a directory to the distdir :-("
    exit 1
fi

echo "*** Copying new README"
ls -lf $distdir/README
doit cp -pf $srcdir/README $distdir

#########################################################
# VERY IMPORTANT: Now go into the new distribution tree #
#########################################################
cd "$distdir"
echo "*** Now in distdir: $distdir"

#
# Remove all the latex source files from the distribution tree (the
# PDFs are still there; we're just removing the latex source because
# some of the filenames get really, really long...).
#

echo "*** Removing latex source from dist tree"
doit rm -rf doc/doxygen-doc/latex

#
# All done
#

cat <<EOF
*** hwloc version $HWLOC_VERSION distribution created

Started: $start
Ended:   `date`

EOF