1#!/bin/sh 2 3# 4# Copyright 2014-2016 Nest Labs Inc. All Rights Reserved. 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# 18 19# 20# Description: 21# This file implements a script which, when run from a project 22# build directory (either disparate or colocated with the 23# source), will attempt to clean the build directory, rebootstrap 24# the package, and then rerun the configuration script for the 25# package with the provided arguments. 26# 27# This script is particularly useful when you are changing the 28# configuration script and testing those changes. 29# 30 31srcdir=`dirname ${0}` 32builddir=. 33 34# Bring the package build back to a pristine state. 35 36if [ -f config.status ]; then 37 make maintainer-clean 38fi 39 40# Change directories to the package source and rebootstrap the package. 41 42pushd ${srcdir} 43 44./bootstrap 45bootstrap_status=$? 46 47popd 48 49# If the package was successfully bootstrapped, configure it. 50 51if [ ${bootstrap_status} -eq 0 ]; then 52 ${srcdir}/configure $* 53else 54 exit ${bootstrap_status} 55fi 56