]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/subversion/get-deps.sh
NDFREE(): Fix unlocking for LOCKPARENT|LOCKLEAF and ndp->ni_dvp == ndp->ni_vp.
[FreeBSD/FreeBSD.git] / contrib / subversion / get-deps.sh
1 #!/bin/sh
2 #
3 #
4 # Licensed to the Apache Software Foundation (ASF) under one
5 # or more contributor license agreements.  See the NOTICE file
6 # distributed with this work for additional information
7 # regarding copyright ownership.  The ASF licenses this file
8 # to you under the Apache License, Version 2.0 (the
9 # "License"); you may not use this file except in compliance
10 # with the License.  You may obtain a copy of the License at
11 #
12 #   http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing,
15 # software distributed under the License is distributed on an
16 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 # KIND, either express or implied.  See the License for the
18 # specific language governing permissions and limitations
19 # under the License.
20 #
21 #
22 #
23 # get-deps.sh -- download the dependencies useful for building Subversion
24 #
25
26 # If changing this file please take care to try to make your changes as
27 # portable as possible.  That means at a minimum only use POSIX supported
28 # features and functions.  However, it may be desirable to use an even
29 # more narrow set of features than POSIX, e.g. Solaris /bin/sh only has
30 # a subset of the POSIX shell features.  If in doubt, limit yourself to
31 # features already used in the file.  Reviewing the history of changes
32 # may be useful as well.
33
34 APR_VERSION=${APR_VERSION:-"1.4.6"}
35 APU_VERSION=${APU_VERSION:-"1.5.1"}
36 SERF_VERSION=${SERF_VERSION:-"1.3.8"}
37 ZLIB_VERSION=${ZLIB_VERSION:-"1.2.8"}
38 SQLITE_VERSION=${SQLITE_VERSION:-"3.8.11.1"}
39 # Used to construct the SQLite download URL.
40 SQLITE_VERSION_REL_YEAR=2015
41 GTEST_VERSION=${GMOCK_VERSION:-"1.7.0"}
42 GMOCK_VERSION=${GMOCK_VERSION:-"1.7.0"}
43 HTTPD_VERSION=${HTTPD_VERSION:-"2.4.10"}
44 APR_ICONV_VERSION=${APR_ICONV_VERSION:-"1.2.1"}
45
46 APR=apr-${APR_VERSION}
47 APR_UTIL=apr-util-${APU_VERSION}
48 SERF=serf-${SERF_VERSION}
49 ZLIB=zlib-${ZLIB_VERSION}
50 SQLITE_VERSION_LIST=`echo $SQLITE_VERSION | sed -e 's/\./ /g'`
51 SQLITE=sqlite-amalgamation-`printf %d%02d%02d%02d $SQLITE_VERSION_LIST`
52 GTEST=release-${GTEST_VERSION}
53 GTEST_URL=https://github.com/google/googletest/archive
54 GMOCK=release-${GMOCK_VERSION}
55 GMOCK_URL=https://github.com/google/googlemock/archive
56
57 HTTPD=httpd-${HTTPD_VERSION}
58 APR_ICONV=apr-iconv-${APR_ICONV_VERSION}
59
60 BASEDIR=`pwd`
61 TEMPDIR=$BASEDIR/temp
62
63 HTTP_FETCH=
64 [ -z "$HTTP_FETCH" ] && type wget  >/dev/null 2>&1 && HTTP_FETCH="wget -q -nc"
65 [ -z "$HTTP_FETCH" ] && type curl  >/dev/null 2>&1 && HTTP_FETCH="curl -sOL"
66 [ -z "$HTTP_FETCH" ] && type fetch >/dev/null 2>&1 && HTTP_FETCH="fetch -q"
67
68 # Need this uncommented if any of the specific versions of the ASF tarballs to
69 # be downloaded are no longer available on the general mirrors.
70 APACHE_MIRROR=http://archive.apache.org/dist
71
72 # helpers
73 usage() {
74     echo "Usage: $0"
75     echo "Usage: $0 [ apr | serf | zlib | sqlite | googlemock ] ..."
76     exit $1
77 }
78
79 # getters
80 get_apr() {
81     cd $TEMPDIR
82     test -d $BASEDIR/apr      || $HTTP_FETCH $APACHE_MIRROR/apr/$APR.tar.bz2
83     test -d $BASEDIR/apr-util || $HTTP_FETCH $APACHE_MIRROR/apr/$APR_UTIL.tar.bz2
84     cd $BASEDIR
85
86     test -d $BASEDIR/apr      || bzip2 -dc $TEMPDIR/$APR.tar.bz2 | tar -xf -
87     test -d $BASEDIR/apr-util || bzip2 -dc $TEMPDIR/$APR_UTIL.tar.bz2 | tar -xf -
88
89     test -d $BASEDIR/apr      || mv $APR apr
90     test -d $BASEDIR/apr-util || mv $APR_UTIL apr-util
91 }
92
93 get_serf() {
94     test -d $BASEDIR/serf && return
95
96     cd $TEMPDIR
97     $HTTP_FETCH https://archive.apache.org/dist/serf/$SERF.tar.bz2
98     cd $BASEDIR
99
100     bzip2 -dc $TEMPDIR/$SERF.tar.bz2 | tar -xf -
101
102     mv $SERF serf
103 }
104
105 get_zlib() {
106     test -d $BASEDIR/zlib && return
107
108     cd $TEMPDIR
109     $HTTP_FETCH http://sourceforge.net/projects/libpng/files/zlib/$ZLIB_VERSION/$ZLIB.tar.gz
110     cd $BASEDIR
111
112     gzip -dc $TEMPDIR/$ZLIB.tar.gz | tar -xf -
113
114     mv $ZLIB zlib
115 }
116
117 get_sqlite() {
118     test -d $BASEDIR/sqlite-amalgamation && return
119
120     cd $TEMPDIR
121     $HTTP_FETCH https://www.sqlite.org/$SQLITE_VERSION_REL_YEAR/$SQLITE.zip
122     cd $BASEDIR
123
124     unzip -q $TEMPDIR/$SQLITE.zip
125
126     mv $SQLITE sqlite-amalgamation
127
128 }
129
130 get_googlemock() {
131     test -d $BASEDIR/googlemock && return
132
133     cd $TEMPDIR
134     $HTTP_FETCH ${GTEST_URL}/${GTEST}.zip
135     unzip -q ${GTEST}.zip
136     rm -f ${GTEST}.zip
137
138     $HTTP_FETCH ${GMOCK_URL}/${GMOCK}.zip
139     unzip -q ${GMOCK}.zip
140     rm -f ${GMOCK}.zip
141
142     cd $BASEDIR
143     mkdir googlemock
144     mv $TEMPDIR/googletest-release-${GTEST_VERSION} googlemock/googletest
145     mv $TEMPDIR/googlemock-release-${GMOCK_VERSION} googlemock/googlemock
146 }
147
148 # main()
149 get_deps() {
150     mkdir -p $TEMPDIR
151
152     for i in zlib serf sqlite-amalgamation apr apr-util gmock-fused; do
153       if [ -d $i ]; then
154         echo "Local directory '$i' already exists; the downloaded copy won't be used" >&2
155       fi
156     done
157
158     if [ $# -gt 0 ]; then
159       for target in "$@"; do
160         if [ "$target" != "deps" ]; then
161           get_$target || usage
162         else
163           usage
164         fi
165       done
166     else
167       get_apr
168       get_serf
169       get_zlib
170       get_sqlite
171
172       echo
173       echo "If you require mod_dav_svn, the recommended version of httpd is:"
174       echo "   $APACHE_MIRROR/httpd/$HTTPD.tar.bz2"
175
176       echo
177       echo "If you require apr-iconv, its recommended version is:"
178       echo "   $APACHE_MIRROR/apr/$APR_ICONV.tar.bz2"
179     fi
180
181     rm -rf $TEMPDIR
182 }
183
184 get_deps "$@"