Simplify build

We only compile for a single platform, the one inside our container.
Since we do that, we can massively simplify this build.

Change-Id: Ic7d088fd85f2cf88838cb83524aaf1c8b2e858bf
This commit is contained in:
Monty Taylor 2020-05-18 16:33:42 -05:00
parent e0a596bf15
commit f19e38dab5
13 changed files with 42 additions and 466 deletions

1
.gitignore vendored
View File

@ -6,7 +6,6 @@ zuul-preview/zuul-preview
*.so
# autotools
Makefile
config.h
config.log
config.status

View File

@ -22,8 +22,6 @@ RUN cd / && bindep -l newline > /output/bindep/run.txt
RUN apt-get install -y $(bindep -b compile)
COPY . /src
RUN cd /src \
&& autoreconf -fi \
&& ./configure --with-comment=$(git describe --always) \
&& make \
&& make install

32
Makefile Normal file
View File

@ -0,0 +1,32 @@
BUILDTYPE ?= Release
PREFIX := /usr/local
LDFLAGS := -lssl -lcrypto -lboost_system -lcpprest -pthread
WARNING_FLAGS := -pedantic -Werror -Wall -Wextra -Weffc++ -Wundef -Wshadow -Wstrict-aliasing -Wswitch-enum -Wformat=2 -Wattributes -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wold-style-cast -Wconversion -Wframe-larger-than=32768 -Wredundant-decls
COMMON_FLAGS := -g -pthread -std=gnu++14 -fdiagnostics-show-option -fdiagnostics-generate-patch
RELEASE_FLAGS := -O2 -DNDEBUG
DEBUG_FLAGS := -O0 -DDEBUG -fno-inline-functions -fno-omit-frame-pointer
ifeq ($(BUILDTYPE),Release)
CXXFLAGS := $(CXXFLAGS) $(COMMON_FLAGS) $(WARNING_FLAGS) $(RELEASE_FLAGS)
else
CXXFLAGS := $(CXXFLAGS) $(COMMON_FLAGS) $(WARNING_FLAGS) $(DEBUG_FLAGS)
endif
all: zuul-preview
install: zuul-preview
mkdir -p $(PREFIX)/bin
cp zuul-preview $(PREFIX)/bin/zuul-preview
uninstall:
rm $(PREFIX)/bin/zuul-preview
zuul-preview: main.o
g++ -o $@ $^ $(LDFLAGS)
%.o: %.cc
g++ $(CXXFLAGS) -c -o $@ $<
clean:
rm -f ./zuul-preview *.o

View File

@ -1,33 +0,0 @@
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
ACLOCAL_AMFLAGS = -I m4
SUFFIXES =
SUBDIRS= .
DIST_SUBDIRS = ${SUBDIRS}
EXTRA_DIST = \
${top_srcdir}/m4/*m4 \
${top_srcdir}/bindep.txt \
${top_srcdir}/README.rst
bin_PROGRAMS = zuul-preview/zuul-preview
zuul_preview_zuul_preview_LDADD = ${LTLIBCPPREST}
zuul_preview_zuul_preview_SOURCES = \
zuul-preview/main.cc

View File

@ -13,7 +13,13 @@ a Zuul API configured by the environment variable ``$ZUUL_API_URL``.
Building
--------
First you need some dependencies:
The best way to do it is to just build the docker container:
.. code-block:: bash
docker build .
But, if you want to build locally ... first you need some dependencies:
.. code-block:: bash
@ -24,6 +30,4 @@ Then you can build the code:
.. code-block:: bash
autoreconf -fi
./configure
make
make

View File

@ -1,10 +1,6 @@
make [compile test]
g++ [compile test]
autoconf [compile test]
automake [compile test]
libtool [compile test]
autoconf-archive [compile test]
gnulib [compile test]
gettext [compile test]
libcpprest-dev [compile test]
libboost-system-dev [compile test]
libcpprest
libboost-system1.71.0

View File

@ -1,23 +0,0 @@
#!/bin/sh
# Copyright (c) 2016 Red Hat, Inc.
#
# Licensed 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.
if [ ! -f configure ]; then
autoreconf -fi
fi
if [ ! -f Makefile ]; then
./configure
fi
make

View File

@ -1,70 +0,0 @@
dnl -*- bash -*-
dnl Process this file with autoconf to produce a configure script.
dnl Copyright 2009 Sun Microsystems, Inc.
dnl Copyright 2019 Red Hat, Inc.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; version 2 of the License.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
AC_INIT(
[zuul_preview],
[1.0],
[http://storyboard.openstack.org],
[zuul-preview],
[http://zuul-ci.org/])
AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar])
AC_PREREQ(2.59)dnl Minimum Autoconf version required.
AX_CHECK_ENABLE_DEBUG
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_ARG_PROGRAM
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([zuul-preview/main.cc])
LT_PREREQ([2.4])
LT_INIT
LT_LANG([C++])
OPENDEV_CANONICAL_TARGET
REQUIRE_LIBCPPREST
#########################################################################
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
echo "---"
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
echo ""
echo " * Installation prefix: $prefix"
echo " * System type: $host_vendor-$host_os"
echo " * Host CPU: $host_cpu"
echo " * C++ Flags: $AM_CXXFLAGS"
echo " * CPP Flags: $AM_CPPFLAGS"
echo " * LIBS: $LIBS"
echo " * Debug enabled: $enable_debug"
echo " * Coverage enabled: $enable_code_coverage"
echo ""
echo "---"

View File

@ -1,58 +0,0 @@
# Copyright (C) 2009 Sun Microsystems, Inc.
# Copyright (C) 2019 Red Hat, Inc
# This file is free software; The Autoconf Macro copyright holders
# give unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
AC_DEFUN([OPENDEV_CANONICAL_TARGET],[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_CXX])
# We need to prevent canonical target
# from injecting -O2 into CFLAGS - but we won't modify anything if we have
# set CFLAGS on the command line, since that should take ultimate precedence
AS_IF([test "x${ac_cv_env_CFLAGS_set}" = "x"],
[CFLAGS=""])
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
[CXXFLAGS=""])
AX_IS_RELEASE(always)
AM_SILENT_RULES([yes])
AX_CXX_COMPILE_STDCXX([14],[],[mandatory])
AM_PROG_CC_C_O
AC_PROG_CC_STDC
gl_VISIBILITY
OPENDEV_OPTIMIZE
OPENDEV_WARNINGS
AC_ARG_WITH([comment],
[AS_HELP_STRING([--with-comment],
[Comment about compilation environment. @<:@default=off@:>@])],
[with_comment=$withval],
[with_comment=no])
AS_IF([test "$with_comment" != "no"],[
COMPILATION_COMMENT=$with_comment
],[
COMPILATION_COMMENT="Source distribution (${PANDORA_RELEASE_COMMENT})"
])
AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"],
[Comment about compilation environment])
AX_PTHREAD([
AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}"
AM_LDFLAGS="${PTHREAD_LIBS} ${AM_LDFLAGS}"
LIBS="${PTHREAD_LIBS} ${LIBS}"
], [AC_MSG_ERROR([${PACKAGE} requires pthreads])])
AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_LDFLAGS])
])

View File

@ -1,49 +0,0 @@
# Copyright (C) 2019 Red Hat, Inc
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Macro's copyright owner. When you make
# and distribute a modified version of the Autoconf Macro, you may extend
# this special exception to the GPL to apply to your modified version as well.
AC_DEFUN([OPENDEV_OPTIMIZE],[
AC_REQUIRE([AX_CODE_COVERAGE])
AM_CPPFLAGS="-g ${AM_CPPFLAGS}"
AS_IF([test "$enable_code_coverage" = "yes"],[
AM_CPPFLAGS="${AM_CPPFLAGS} ${CODE_COVERAGE_CPPFLAGS}"
AM_CFLAGS="${AM_CFLAGS} ${CODE_COVERAGE_CFLAGS}"
AM_CXXFLAGS="${AM_CXXFLAGS} ${CODE_COVERAGE_CXXFLAGS}"
AM_LDFLAGS="${AM_LDFLAGS} ${CODE_COVERAGE_LDFLAGS}"
])
OPTIMIZE_CFLAGS="-O2"
OPTIMIZE_CXXFLAGS="-O2"
AS_IF([test "$enable_debug" = "no"],[
# Optimized version. No debug
AM_CFLAGS="${AM_CFLAGS} ${OPTIMIZE_CFLAGS}"
AM_CXXFLAGS="${AM_CXXFLAGS} ${OPTIMIZE_CXXFLAGS}"
])
])

View File

@ -1,169 +0,0 @@
# Copyright (C) 2009 Sun Microsystems, Inc.
# Copyright (C) 2019 Red Hat, Inc
# This file is free software; The Autoconf Macro copyright holders
# give unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
AC_DEFUN([OPENDEV_WARNINGS],[
AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option],
[ac_cv_safe_to_use_fdiagnostics_show_option_],
[save_CFLAGS="$CFLAGS"
CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[])],
[ac_cv_safe_to_use_fdiagnostics_show_option_=yes],
[ac_cv_safe_to_use_fdiagnostics_show_option_=no])
CFLAGS="$save_CFLAGS"])
AS_IF([test "$ac_cv_safe_to_use_fdiagnostics_show_option_" = "yes"],
[F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option"])
AC_CACHE_CHECK([whether it is safe to use -floop-parallelize-all],
[ac_cv_safe_to_use_floop_parallelize_all_],
[save_CFLAGS="$CFLAGS"
CFLAGS="-floop-parallelize-all ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[])],
[ac_cv_safe_to_use_floop_parallelize_all_=yes],
[ac_cv_safe_to_use_floop_parallelize_all_=no])
CFLAGS="$save_CFLAGS"])
AS_IF([test "$ac_cv_safe_to_use_floop_parallelize_all_" = "yes"],
[F_LOOP_PARALLELIZE_ALL="-floop-parallelize-all"])
BASE_WARNINGS="-Wextra -pedantic -Wall -Wundef -Wshadow ${F_DIAGNOSTICS_SHOW_OPTION} ${F_LOOP_PARALLELIZE_ALL} -Wstrict-aliasing -Wswitch-enum "
CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings"
CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
AC_CACHE_CHECK([whether it is safe to use -Wextra],[ac_cv_safe_to_use_Wextra_],[
save_CFLAGS="$CFLAGS"
CFLAGS="-Wextra -pedantic -Wextra ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[
#include <stdio.h>
]], [[]]
)],
[ac_cv_safe_to_use_Wextra_=yes],
[ac_cv_safe_to_use_Wextra_=no])
CFLAGS="$save_CFLAGS"
])
AS_IF([test "$ac_cv_safe_to_use_Wextra_" = "yes"],
[BASE_WARNINGS="${BASE_WARNINGS} -Wextra"],
[BASE_WARNINGS="${BASE_WARNINGS} -W"])
AC_CACHE_CHECK([whether it is safe to use -Wformat],[ac_cv_safe_to_use_wformat_],[
save_CFLAGS="$CFLAGS"
dnl Use -Werror here instead of -Wextra so that we don't spew
dnl conversion warnings to all the tarball folks
CFLAGS="-Wformat -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
void foo();
void foo()
{
uint64_t test_u= 0;
printf("This is a %" PRIu64 "test\n", test_u);
}
]],[[
foo();
]]
)],
[ac_cv_safe_to_use_wformat_=yes],
[ac_cv_safe_to_use_wformat_=no])
CFLAGS="$save_CFLAGS"])
AS_IF([test "$ac_cv_safe_to_use_wformat_" = "yes"],
[BASE_WARNINGS="${BASE_WARNINGS} -Wformat=2"],
[BASE_WARNINGS="${BASE_WARNINGS} -Wno-format"])
AC_CACHE_CHECK([whether it is safe to use -Wconversion],[ac_cv_safe_to_use_wconversion_],[
save_CFLAGS="$CFLAGS"
dnl Use -Werror here instead of -Wextra so that we don't spew
dnl conversion warnings to all the tarball folks
CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[
#include <stdbool.h>
void foo(bool a)
{
(void)a;
}
]],[[
foo(0);
]]
)],
[ac_cv_safe_to_use_wconversion_=yes],
[ac_cv_safe_to_use_wconversion_=no])
CFLAGS="$save_CFLAGS"])
AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
[W_CONVERSION="-Wconversion"])
CC_WARNINGS="${BASE_WARNINGS} -Werror -Wattributes -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL} ${W_CONVERSION}"
CXX_WARNINGS="${BASE_WARNINGS} -Werror -Wattributes -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy ${CXX_WARNINGS_FULL} ${W_CONVERSION}"
AC_CACHE_CHECK([whether it is safe to use -Wframe-larger-than],[ac_cv_safe_to_use_Wframe_larger_than_],[
AC_LANG_PUSH(C++)
save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="-Werror -pedantic -Wframe-larger-than=32768 ${AM_CXXFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[
#include <stdio.h>
]], [[]]
)],
[ac_cv_safe_to_use_Wframe_larger_than_=yes],
[ac_cv_safe_to_use_Wframe_larger_than_=no])
CXXFLAGS="$save_CXXFLAGS"
AC_LANG_POP()
])
AS_IF([test "$ac_cv_safe_to_use_Wframe_larger_than_" = "yes"],
[CXX_WARNINGS="${CXX_WARNINGS} -Wframe-larger-than=32768"])
AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],[ac_cv_safe_to_use_Wlogical_op_],[
save_CFLAGS="$CFLAGS"
CFLAGS="-Wextra -pedantic -Wlogical-op ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[
#include <stdio.h>
]], [[]]
)],
[ac_cv_safe_to_use_Wlogical_op_=yes],
[ac_cv_safe_to_use_Wlogical_op_=no])
CFLAGS="$save_CFLAGS"])
AS_IF([test "$ac_cv_safe_to_use_Wlogical_op_" = "yes"],
[CC_WARNINGS="${CC_WARNINGS} -Wlogical-op"])
AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls from C++],[ac_cv_safe_to_use_Wredundant_decls_],[
AC_LANG_PUSH(C++)
save_CXXFLAGS="${CXXFLAGS}"
CXXFLAGS="-Wextra -pedantic -Wredundant-decls ${AM_CXXFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[
template <typename E> struct C { void foo(); };
template <typename E> void C<E>::foo() { }
template <> void C<int>::foo();
AC_INCLUDES_DEFAULT
])],
[ac_cv_safe_to_use_Wredundant_decls_=yes],
[ac_cv_safe_to_use_Wredundant_decls_=no])
CXXFLAGS="${save_CXXFLAGS}"
AC_LANG_POP()])
AS_IF([test "$ac_cv_safe_to_use_Wredundant_decls_" = "yes"],
[CXX_WARNINGS="${CXX_WARNINGS} -Wredundant-decls"],
[CXX_WARNINGS="${CXX_WARNINGS} -Wno-redundant-decls"])
])

View File

@ -1,50 +0,0 @@
# Copyright (C) 2019 Red Hat, Inc
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Macro's copyright owner. When you make
# and distribute a modified version of the Autoconf Macro, you may extend
# this special exception to the GPL to apply to your modified version as well.
AC_DEFUN([REQUIRE_LIBCPPREST],[
# --------------------------------------------------------------------
# Check for libcpprest
# --------------------------------------------------------------------
AC_LANG_PUSH([C++])
AX_CHECK_OPENSSL([],
AC_MSG_ERROR([openssl is required for ${PACKAGE}.]))
AX_BOOST_BASE(1.62)
AX_BOOST_SYSTEM
AX_CHECK_LIBRARY([LIBCPPREST], [cpprest/http_client.h], [cpprest], [],
[AC_MSG_ERROR([Unable to find libcpprest])])
AC_LANG_POP()
AS_IF([test "x${ac_cv_lib_cpprest_utility__datetime__utc_now__}" = "xno"],
AC_MSG_ERROR([libcpprest is required for ${PACKAGE}.]))
LIBS="${LIBS} ${OPENSSL_LIBS} ${BOOST_SYSTEM_LIB} -lcpprest"
AM_CXXFLAGS="${AM_CXXFLAGS} ${OPENSSL_CFLAGS} ${LIBCPPREST_CFLAGS}"
AM_LDFLAGS="${AM_LDFLAGS} ${OPENSSL_LDFLAGS} ${LIBCPPREST_LDFLAGS}"
])

View File

@ -23,7 +23,6 @@
* that to look up a build URL which it emits on standard output.
*/
#include <config.h>
#include <pthread.h>
#include <boost/optional.hpp>
#include <cpprest/http_client.h>