Blame autogen.sh

Packit Service 724aca
#!/bin/bash
Packit Service 724aca
#
Packit Service 724aca
#  Copyright (C) 2014 - 2019 Intel Corporation.
Packit Service 724aca
#  All rights reserved.
Packit Service 724aca
#
Packit Service 724aca
#  Redistribution and use in source and binary forms, with or without
Packit Service 724aca
#  modification, are permitted provided that the following conditions are met:
Packit Service 724aca
#  1. Redistributions of source code must retain the above copyright notice(s),
Packit Service 724aca
#     this list of conditions and the following disclaimer.
Packit Service 724aca
#  2. Redistributions in binary form must reproduce the above copyright notice(s),
Packit Service 724aca
#     this list of conditions and the following disclaimer in the documentation
Packit Service 724aca
#     and/or other materials provided with the distribution.
Packit Service 724aca
#
Packit Service 724aca
#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
Packit Service 724aca
#  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
Packit Service 724aca
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
Packit Service 724aca
#  EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
Packit Service 724aca
#  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Packit Service 724aca
#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
Packit Service 724aca
#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
Packit Service 724aca
#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
Packit Service 724aca
#  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
Packit Service 724aca
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit Service 724aca
#
Packit Service 724aca
Packit Service 724aca
set -e
Packit Service 724aca
Packit Service 724aca
# If the VERSION file does not exist, then create it based on git
Packit Service 724aca
# describe or if not in a git repo just set VERSION to 0.0.0.
Packit Service 724aca
# Determine VERSION scheme, based on git:
Packit Service 724aca
# -if HEAD is tag annotated - it is official release e.g. setting VERSION to "1.9.0"
Packit Service 724aca
# -if HEAD is not tag annotated - it is snapshot e.g. setting VERSION to "1.8.0+dev19+g1c93b2d"
Packit Service 724aca
Packit Service 724aca
if [ ! -f VERSION ]; then
Packit Service 724aca
    if [ -f .git/config ]; then
Packit Service 724aca
        sha=$(git describe --long | awk -F- '{print $(NF)}')
Packit Service 724aca
        release=$(git describe --long | awk -F- '{print $(NF-1)}')
Packit Service 724aca
        version=$(git describe --long | sed -e "s|\(.*\)-$release-$sha|\1|" -e "s|-|+|g" -e "s|^v||")
Packit Service 724aca
        if [ ${release} != "0" ]; then
Packit Service 724aca
            echo "WARNING: No annotated tag referring to this commit was found, setting version to development build " 2>&1
Packit Service 724aca
            version=${version}+dev${release}+${sha}
Packit Service 724aca
        else
Packit Service 724aca
            echo "Annotated tag referring to this commit was found, setting version as an official release" 2>&1
Packit Service 724aca
            version=${version}
Packit Service 724aca
        fi
Packit Service 724aca
    else
Packit Service 724aca
        echo "WARNING: VERSION file does not exist and working directory is not a git repository, setting version to 0.0.0" 2>&1
Packit Service 724aca
        version=0.0.0
Packit Service 724aca
    fi
Packit Service 724aca
    echo $version > VERSION
Packit Service 724aca
fi
Packit Service 724aca
Packit Service 724aca
autoreconf --install
Packit Service 724aca