blob: 25ee62bae720d47a06fc1e31cf33e17577e027a7 [file] [log] [blame]
#! /bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
######################################################################
# Download and build a new Corinthia on linux, assuming that you
# already have all the supporting libraries installed and your git set
# up with your comitter id.
#
# The script also makes a TAG and/or a ctags file if it finds the
# emacs or vi init files in your home directory.
#
# Usage: build-corinthia <name of directory>
readonly TARGET_DIR=($1)
if [[ ${TARGET_DIR} == 'help' ||
${TARGET_DIR} == '--help' ||
${TARGET_DIR} == '-h' ]]; then
echo ''
echo ' Download and build a new Corinthia on linux, assuming that you'
echo ' already have all the supporting libraries installed and your git set'
echo ' up with your comitter id.'
echo ''
echo ' The script also makes a TAG and/or a ctags file if it finds the'
echo ' emacs or vi init files in your home directory.'
echo ''
echo ' Usage: build-corinthia <name of new directory>'
echo ''
exit
fi
if [[ -z ${TARGET_DIR} ]]; then
echo 'Usage: build-corinthia <name of new directory>';
exit;
fi
if [[ -d ${TARGET_DIR} ]]; then
echo "The directory \"$TARGET_DIR\" already exists.";
exit;
fi
mkdir ${TARGET_DIR}
cd ${TARGET_DIR}
git clone https://git-wip-us.apache.org/repos/asf/incubator-corinthia.git
if [[ ! -d 'incubator-corinthia' ]]; then
echo "build-corinthia: git clone failed."
cd ..
rmdir ${TARGET_DIR}
exit
fi
cd "incubator-corinthia"
readonly CORINTHIA_CURRENT=$(pwd)
# make a fresh TAGS FILE for emacs and/or vi (some people use both!)
if [[ -e "$HOME/.emacs" ]]; then
find . -name "*.[ch]" -print0 | xargs -0 etags -
fi
if [[ -e "$HOME/.vimrc" || -e "$HOME/.gvimrc" ]]; then
find . -name "*.[ch]" -print0 | xargs -0 ctags -
fi
# Build outside of the source tree in a build directory
mkdir "build"
cd "build"
cmake -G "Unix Makefiles" ${CORINTHIA_CURRENT}
make
# Report results
echo "Corinthia build complete in $CORINTHIA_CURRENT"
if [[ -e "../TAGS" ]]; then
echo "TAGS file for Emacs built."
fi
if [[ -e "../tags" ]]; then
echo "tags file for vi built."
fi
echo "Environment variable suggestion: "
echo " set DOCFORMATS_DIR=${CORINTHIA_CURRENT}"
echo " cmake -G \"Unix Makefiles\" \$DOCFORMATS_DIR"