This repository has been archived by the owner on Jul 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
/
Copy pathgit-custom-bindir.rb
102 lines (88 loc) · 3.62 KB
/
git-custom-bindir.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#
# Copyright 2014-2020 Chef Software, 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.
#
# NOTE - This is a straight copy of the git.rb definition in omnibus-software
# EXCEPT we specify a custom bindir when running make. We do this because
# we only want to include the Git binaries at the end of a user's path
# when they run `chef shell-init`. This is a temporary solution until we
# shave the yak of moving ruby into /opt/chefdk/bin and putting
# /opt/chefdk/embedded/bin at the end of the user's path.
# TODO - when deleting this, also delete omnibus/config/templates/git-custom-bindir
name "git-custom-bindir"
default_version "2.26.2"
license "LGPL-2.1"
license_file "LGPL-2.1"
skip_transitive_dependency_licensing true
dependency "curl"
dependency "zlib"
dependency "openssl"
dependency "pcre"
dependency "libiconv" # FIXME: can we figure out how to remove this?
dependency "expat"
relative_path "git-#{version}"
version("2.26.2") { source sha256: "e1c17777528f55696815ef33587b1d20f5eec246669f3b839d15dbfffad9c121" }
source url: "https://www.kernel.org/pub/software/scm/git/git-#{version}.tar.gz"
bin_dirs ["#{install_dir}/gitbin", "#{install_dir}/embedded/libexec/git-core"]
build do
env = with_standard_compiler_flags(with_embedded_path)
# We do a distclean so we ensure that the autoconf files are not trying to be
# clever.
make "distclean", env: env
config_hash = {
# Universal options
NO_GETTEXT: "YesPlease",
NEEDS_LIBICONV: "YesPlease",
NO_INSTALL_HARDLINKS: "YesPlease",
NO_PERL: "YesPlease",
NO_PYTHON: "YesPlease",
NO_TCLTK: "YesPlease",
}
if freebsd?
config_hash["CHARSET_LIB"] = "-lcharset"
config_hash["FREAD_READS_DIRECTORIES"] = "UnfortunatelyYes"
config_hash["HAVE_CLOCK_GETTIME"] = "YesPlease"
config_hash["HAVE_CLOCK_MONOTONIC"] = "YesPlease"
config_hash["HAVE_GETDELIM"] = "YesPlease"
config_hash["HAVE_PATHS_H"] = "YesPlease"
config_hash["HAVE_STRINGS_H"] = "YesPlease"
config_hash["PTHREAD_LIBS"] = "-pthread"
config_hash["USE_ST_TIMESPEC"] = "YesPlease"
config_hash["HAVE_BSD_SYSCTL"] = "YesPlease"
config_hash["NO_R_TO_GCC_LINKER"] = "YesPlease"
else
# Linux things!
config_hash["HAVE_PATHS_H"] = "YesPlease"
config_hash["NO_R_TO_GCC_LINKER"] = "YesPlease"
end
erb source: "config.mak.erb",
dest: "#{project_dir}/config.mak",
mode: 0755,
vars: {
cc: env["CC"],
ld: env["LD"],
cflags: env["CFLAGS"],
cppflags: env["CPPFLAGS"],
install: env["INSTALL"],
install_dir: install_dir,
ldflags: env["LDFLAGS"],
shell_path: env["SHELL_PATH"],
config_hash: config_hash,
}
# NOTE - If you run ./configure the environment variables set above will not be
# used and only the command line args will be used. The issue with this is you
# cannot specify everything on the command line that you can with the env vars.
make "prefix=#{install_dir}/embedded bindir=#{install_dir}/gitbin -j #{workers}", env: env
make "prefix=#{install_dir}/embedded bindir=#{install_dir}/gitbin install", env: env
end