diff --git a/config/software/git.rb b/config/software/git.rb index afc6ab8e7b6e54e622f8eefd5e455293aa715e4e_Y29uZmlnL3NvZnR3YXJlL2dpdC5yYg==..d1e4d3eb45cffd036735a5743f9ec1481a7852ac_Y29uZmlnL3NvZnR3YXJlL2dpdC5yYg== 100644 --- a/config/software/git.rb +++ b/config/software/git.rb @@ -57,6 +57,10 @@ # Similar is the case for SLES OSs also. git_cflags += ' -std=gnu99' if OhaiHelper.get_centos_version.to_i == 7 || OhaiHelper.os_platform == 'sles' + # NOTE: the Git software definition is in the process of being deprecated in favour of bundling + # Git with Gitaly. Any changes to the following build options must be replicated to the Gitaly + # software definition at config/software/gitaly.rb in the env hash. See + # https://gitlab.com/gitlab-org/gitaly/-/issues/6195 for more information. build_options = [ "# Added by Omnibus git software definition git.rb", "GIT_APPEND_BUILD_OPTIONS += CURLDIR=#{install_dir}/embedded", diff --git a/config/software/gitaly.rb b/config/software/gitaly.rb index afc6ab8e7b6e54e622f8eefd5e455293aa715e4e_Y29uZmlnL3NvZnR3YXJlL2dpdGFseS5yYg==..d1e4d3eb45cffd036735a5743f9ec1481a7852ac_Y29uZmlnL3NvZnR3YXJlL2dpdGFseS5yYg== 100644 --- a/config/software/gitaly.rb +++ b/config/software/gitaly.rb @@ -31,6 +31,13 @@ dependency 'libicu' dependency 'omnibus-gitlab-gems' +# Dependencies for building Git as part of Gitaly +dependency 'zlib' +dependency 'openssl' unless Build::Check.use_system_ssl? +dependency 'curl' +dependency 'pcre2' +dependency 'libiconv' + # Technically, gitaly depends on git also. But because of how omnibus arranges # components to be built, this causes git to be built early in the process. But # in our case, git is built from gitaly source code. This results in git @@ -47,7 +54,26 @@ build do env = with_standard_compiler_flags(with_embedded_path) + git_cflags = '-fno-omit-frame-pointer' + + # CentOS 7 uses gcc v4.8.5, which uses C90 (`-std=gnu90`) by default. + # C11 is a newer standard than C90, and gcc v5.1.0 switched the default + # from `std=gnu90` to `std=gnu11`. + # Git v2.35 added a balloon test that will fail the build if + # C99 is not supported. On other platforms, C11 may be required + # (https://gitlab.com/gitlab-org/gitlab-git/-/commit/7bc341e21b5). + # Similar is the case for SLES OSs also. + git_cflags += ' -std=gnu99' if OhaiHelper.get_centos_version.to_i == 7 || OhaiHelper.os_platform == 'sles' + + env['CURLDIR'] = "#{install_dir}/embedded" + env['ICONVDIR'] = "#{install_dir}/embedded" + env['ZLIB_PATH'] = "#{install_dir}/embedded" + env['NEEDS_LIBICONV'] = 'YesPlease' + env['NO_R_TO_GCC_LINKER'] = 'YesPlease' + env['INSTALL_SYMLINKS'] = 'YesPlease' + env['CFLAGS'] = "\"#{git_cflags}\"" + if Build::Check.use_system_ssl? env['CMAKE_FLAGS'] = OpenSSLHelper.cmake_flags env['PKG_CONFIG_PATH'] = OpenSSLHelper.pkg_config_dirs env['FIPS_MODE'] = '1' @@ -50,7 +76,9 @@ if Build::Check.use_system_ssl? env['CMAKE_FLAGS'] = OpenSSLHelper.cmake_flags env['PKG_CONFIG_PATH'] = OpenSSLHelper.pkg_config_dirs env['FIPS_MODE'] = '1' + else + env['OPENSSLDIR'] = "#{install_dir}/embedded" end make "install PREFIX=#{install_dir}/embedded", env: env