tebako 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CMakeLists.txt +4 -5
- data/README.adoc +1 -1
- data/exe/tebako +3 -2
- data/exe/tebako-packager +94 -0
- data/lib/tebako/cli.rb +3 -5
- data/lib/tebako/cli_helpers.rb +12 -5
- data/lib/tebako/error.rb +1 -1
- data/lib/tebako/packager/pass1.rb +111 -109
- data/lib/tebako/packager/pass2.rb +306 -308
- data/lib/tebako/packager.rb +17 -77
- data/lib/tebako/version.rb +1 -1
- data/lib/{cli.rb → tebako.rb} +7 -1
- data/tools/.gitattributes +4 -0
- data/tools/.github/workflows/lint.yml +41 -0
- data/tools/README.md +5 -0
- data/tools/ci-scripts/arm-brew-install.sh +43 -0
- data/tools/ci-scripts/arm-brew-setup.sh +33 -0
- data/tools/ci-scripts/level-up.sh +35 -0
- data/tools/ci-scripts/patch-fbthrift.sh +92 -0
- data/tools/ci-scripts/patch-folly.sh +447 -0
- data/tools/ci-scripts/patch-system-includes.sh +59 -0
- data/tools/ci-scripts/x86-brew-install.sh +43 -0
- data/tools/ci-scripts/x86-brew-setup.sh +33 -0
- data/tools/cmake-scripts/def-external-project.cmake +96 -0
- data/tools/cmake-scripts/macos-environment.cmake +116 -0
- data/tools/cmake-scripts/msys-environment.cmake +78 -0
- data/tools/cmake-scripts/setup-openssl.cmake +69 -0
- data/tools/cmake-scripts/version.cmake +162 -0
- data/tools/include/pro-statvfs.h +57 -0
- metadata +22 -3
data/lib/tebako/packager.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
# Copyright (c) 2021-2023 [Ribose Inc](https://www.ribose.com).
|
@@ -36,18 +35,24 @@ require_relative "packager/pass2"
|
|
36
35
|
module Tebako
|
37
36
|
# Tebako packaging support (internal)
|
38
37
|
module Packager
|
39
|
-
FILES_TO_RESTORE = [
|
40
|
-
|
41
|
-
|
38
|
+
FILES_TO_RESTORE = %w[
|
39
|
+
main.c
|
40
|
+
dir.c
|
41
|
+
dln.c
|
42
|
+
file.c
|
43
|
+
io.c
|
44
|
+
tool/mkconfig.rb
|
42
45
|
].freeze
|
43
46
|
|
44
|
-
FILES_TO_RESTORE_MSYS = [
|
45
|
-
|
46
|
-
|
47
|
+
FILES_TO_RESTORE_MSYS = %w[
|
48
|
+
ruby.c
|
49
|
+
win32/win32.c
|
50
|
+
win32/file.c
|
51
|
+
win32/dir.h
|
47
52
|
].freeze
|
48
53
|
|
49
|
-
FILES_TO_RESTORE_MUSL = [
|
50
|
-
|
54
|
+
FILES_TO_RESTORE_MUSL = %w[
|
55
|
+
thread_pthread.c
|
51
56
|
].freeze
|
52
57
|
|
53
58
|
class << self
|
@@ -84,7 +89,7 @@ module Tebako
|
|
84
89
|
# puts " ... creating pristine ruby environment at #{src_dir} [patience, it will take some time]"
|
85
90
|
# out, st = Open3.capture2e("cmake", "-E", "chdir", ruby_source_dir, "make", "install")
|
86
91
|
# print out if st.exitstatus != 0 || verbose
|
87
|
-
# raise
|
92
|
+
# raise Tebako::Error.new("stash [make install] failed with code #{st.exitstatus}") if st.exitstatus != 0
|
88
93
|
# end
|
89
94
|
|
90
95
|
puts " ... saving pristine ruby environment to #{stash_dir}"
|
@@ -111,7 +116,7 @@ module Tebako
|
|
111
116
|
end
|
112
117
|
|
113
118
|
def restore_and_save(fname)
|
114
|
-
raise
|
119
|
+
raise Tebako::Error, "Could not save #{fname} because it does not exist." unless File.exist?(fname)
|
115
120
|
|
116
121
|
old_fname = "#{fname}.old"
|
117
122
|
if File.exist?(old_fname)
|
@@ -128,7 +133,7 @@ module Tebako
|
|
128
133
|
end
|
129
134
|
|
130
135
|
def patch_file(fname, mapping)
|
131
|
-
raise
|
136
|
+
raise Tebako::Error, "Could not patch #{fname} because it does not exist." unless File.exist?(fname)
|
132
137
|
|
133
138
|
puts " ... patching #{fname}"
|
134
139
|
restore_and_save(fname)
|
@@ -143,68 +148,3 @@ module Tebako
|
|
143
148
|
end
|
144
149
|
end
|
145
150
|
end
|
146
|
-
|
147
|
-
begin
|
148
|
-
unless ARGV.length.positive?
|
149
|
-
raise Tebako::TebakoError, "Tebako script needs at least 1 arguments (command), none has been provided."
|
150
|
-
end
|
151
|
-
|
152
|
-
case ARGV[0]
|
153
|
-
when "pass1"
|
154
|
-
# ARGV[0] -- command
|
155
|
-
# ARGV[1] -- OSTYPE
|
156
|
-
# ARGV[2] -- RUBY_SOURCE_DIR
|
157
|
-
# ARGV[3] -- FS_MOUNT_POINT
|
158
|
-
# ARGV[4] -- DATA_SRC_DIR
|
159
|
-
# ARGV[5] -- RUBY_VER
|
160
|
-
unless ARGV.length == 6
|
161
|
-
raise Tebako::TebakoError,
|
162
|
-
"pass1 script expects 6 arguments, #{ARGV.length} has been provided."
|
163
|
-
end
|
164
|
-
|
165
|
-
Tebako::Packager.pass1(ARGV[1], ARGV[2], ARGV[3], ARGV[4], ARGV[5])
|
166
|
-
when "stash"
|
167
|
-
# ARGV[0] -- command
|
168
|
-
# ARGV[1] -- DATA_SRC_DIR
|
169
|
-
# ARGV[2] -- RUBY_STASH_DIR
|
170
|
-
unless ARGV.length == 3
|
171
|
-
raise Tebako::TebakoError,
|
172
|
-
"stash script expects 3 arguments, #{ARGV.length} has been provided."
|
173
|
-
end
|
174
|
-
|
175
|
-
Tebako::Packager.stash(ARGV[1], ARGV[2])
|
176
|
-
when "pass2"
|
177
|
-
# ARGV[0] -- command
|
178
|
-
# ARGV[1] -- OSTYPE
|
179
|
-
# ARGV[2] -- RUBY_SOURCE_DIR
|
180
|
-
# ARGV[3] -- DEPS_LIB_DIR
|
181
|
-
# ARGV[4] -- DATA_SRC_DIR
|
182
|
-
# ARGV[5] -- RUBY_STASH_DIR
|
183
|
-
# ARGV[6] -- RUBY_VER
|
184
|
-
unless ARGV.length == 7
|
185
|
-
raise Tebako::TebakoError,
|
186
|
-
"pass1 script expects 7 arguments, #{ARGV.length} has been provided."
|
187
|
-
end
|
188
|
-
|
189
|
-
Tebako::Packager.stash(ARGV[4], ARGV[5])
|
190
|
-
Tebako::Packager.pass2(ARGV[1], ARGV[2], ARGV[3], ARGV[6])
|
191
|
-
when "deploy"
|
192
|
-
# ARGV[0] -- command
|
193
|
-
# ARGV[1] -- FS_STASH_DIR
|
194
|
-
# ARGV[2] -- DATA_SRC_DIR
|
195
|
-
# ARGV[3] -- DATA_PRE_DIR
|
196
|
-
# ARGV[4] -- DATA_BIN_DIR
|
197
|
-
unless ARGV.length == 5
|
198
|
-
raise Tebako::TebakoError,
|
199
|
-
"deploy script expects 5 arguments, #{ARGV.length} has been provided."
|
200
|
-
end
|
201
|
-
Tebako::Packager.deploy(ARGV[1], ARGV[2], ARGV[3], ARGV[4])
|
202
|
-
else
|
203
|
-
raise Tebako::TebakoError, "Tebako script cannot process #{ARGV[0]} command"
|
204
|
-
end
|
205
|
-
rescue Tebako::TebakoError => e
|
206
|
-
puts "Tebako script failed: #{e.message} [#{e.error_code}]"
|
207
|
-
exit(e.error_code)
|
208
|
-
end
|
209
|
-
|
210
|
-
exit(0)
|
data/lib/tebako/version.rb
CHANGED
data/lib/{cli.rb → tebako.rb}
RENAMED
@@ -25,4 +25,10 @@
|
|
25
25
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
26
26
|
# POSSIBILITY OF SUCH DAMAGE.
|
27
27
|
|
28
|
-
|
28
|
+
# Tebako - an executable packager
|
29
|
+
# Core module
|
30
|
+
module Tebako
|
31
|
+
end
|
32
|
+
|
33
|
+
require_relative "tebako/version"
|
34
|
+
require_relative "tebako/error"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (c) 2022, [Ribose Inc](https://www.ribose.com).
|
2
|
+
# All rights reserved.
|
3
|
+
# This file is a part of tebako
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions
|
7
|
+
# are met:
|
8
|
+
# 1. Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer in the
|
12
|
+
# documentation and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
15
|
+
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
16
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
17
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
18
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
19
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
20
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
21
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
22
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
23
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
24
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
|
26
|
+
name: lint
|
27
|
+
|
28
|
+
on:
|
29
|
+
push:
|
30
|
+
branches: [ master ]
|
31
|
+
pull_request:
|
32
|
+
workflow_dispatch:
|
33
|
+
|
34
|
+
jobs:
|
35
|
+
shellcheck:
|
36
|
+
runs-on: ubuntu-latest
|
37
|
+
steps:
|
38
|
+
- uses: actions/checkout@v3
|
39
|
+
- uses: ludeeus/action-shellcheck@master
|
40
|
+
env:
|
41
|
+
SHELLCHECK_OPTS: -x
|
data/tools/README.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
[![lint](https://github.com/tamatebako/macos-cross-compile/actions/workflows/lint.yml/badge.svg)](https://github.com/tamatebako/macos-cross-compile/actions/workflows/lint.yml)
|
2
|
+
|
3
|
+
## Tebako portability tools ##
|
4
|
+
|
5
|
+
This repository contains cmake, shell scripts and include files aimed to support tebako builds on different platforms.
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#! /bin/bash
|
2
|
+
#
|
3
|
+
# Copyright (c) 2022, [Ribose Inc](https://www.ribose.com).
|
4
|
+
# All rights reserved.
|
5
|
+
# This file is a part of tebako
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions
|
9
|
+
# are met:
|
10
|
+
# 1. Redistributions of source code must retain the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
18
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
20
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
21
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
22
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
23
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
24
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
25
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
26
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
29
|
+
|
30
|
+
# for zsh
|
31
|
+
# https://stackoverflow.com/questions/6715388/variable-expansion-is-different-in-zsh-from-that-in-bash
|
32
|
+
# setopt sh_word_split
|
33
|
+
|
34
|
+
DIR0="$( cd "$1" && pwd )"
|
35
|
+
DIR1="$DIR0/arm-homebrew"
|
36
|
+
|
37
|
+
for bottle in "${@:2}"
|
38
|
+
do
|
39
|
+
echo "Installing $bottle"
|
40
|
+
response=$("$DIR1/bin/brew" fetch --force --bottle-tag=arm64_big_sur "$bottle" | grep "Downloaded to")
|
41
|
+
IFS=" " read -r -a parsed <<< "$response"
|
42
|
+
"$DIR1/bin/brew" install "${parsed[2]}"
|
43
|
+
done
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#! /bin/bash
|
2
|
+
#
|
3
|
+
# Copyright (c) 2022, [Ribose Inc](https://www.ribose.com).
|
4
|
+
# All rights reserved.
|
5
|
+
# This file is a part of tebako
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions
|
9
|
+
# are met:
|
10
|
+
# 1. Redistributions of source code must retain the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
18
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
20
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
21
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
22
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
23
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
24
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
25
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
26
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
29
|
+
|
30
|
+
DIR0="$( cd "$1" && pwd )"
|
31
|
+
DIR1="$DIR0/arm-homebrew"
|
32
|
+
mkdir "$DIR1"
|
33
|
+
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C "$DIR1"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#! /bin/bash
|
2
|
+
#
|
3
|
+
# Copyright (c) 2022, [Ribose Inc](https://www.ribose.com).
|
4
|
+
# All rights reserved.
|
5
|
+
# This file is a part of tebako
|
6
|
+
#
|
7
|
+
# Redistribution and use in source and binary forms, with or without
|
8
|
+
# modification, are permitted provided that the following conditions
|
9
|
+
# are met:
|
10
|
+
# 1. Redistributions of source code must retain the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
18
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
19
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
20
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
21
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
22
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
23
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
24
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
25
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
26
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
29
|
+
|
30
|
+
# for zsh
|
31
|
+
# https://stackoverflow.com/questions/6715388/variable-expansion-is-different-in-zsh-from-that-in-bash
|
32
|
+
# setopt sh_word_split
|
33
|
+
|
34
|
+
DIR0="$( cd "$1" && pwd )"
|
35
|
+
echo "$DIR0"
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#! /bin/bash
|
2
|
+
# Copyright (c) 2022, [Ribose Inc](https://www.ribose.com).
|
3
|
+
# All rights reserved.
|
4
|
+
# This file is a part of tebako
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions
|
8
|
+
# are met:
|
9
|
+
# 1. Redistributions of source code must retain the above copyright
|
10
|
+
# notice, this list of conditions and the following disclaimer.
|
11
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
# notice, this list of conditions and the following disclaimer in the
|
13
|
+
# documentation and/or other materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
16
|
+
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
17
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
18
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
19
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
20
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
21
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
22
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
23
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
24
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
25
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
26
|
+
|
27
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
28
|
+
|
29
|
+
# ....................................................
|
30
|
+
restore_and_save() {
|
31
|
+
echo "Patching $1"
|
32
|
+
test -e "$1.old" && cp -f "$1.old" "$1"
|
33
|
+
cp -f "$1" "$1.old"
|
34
|
+
}
|
35
|
+
|
36
|
+
do_patch() {
|
37
|
+
restore_and_save "$1"
|
38
|
+
sed -i "s/$2/$3/g" "$1"
|
39
|
+
}
|
40
|
+
|
41
|
+
# ....................................................
|
42
|
+
# Surprise, surprise ... Upstream project shall found boost libraries for fbthrift
|
43
|
+
# https://github.com/facebook/fbthrift/commit/c23af9dee42374d43d2f10e0e07edf1c1c97c328
|
44
|
+
|
45
|
+
|
46
|
+
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "linux-musl"* || "$OSTYPE" == "msys" ]]; then
|
47
|
+
gSed="sed"
|
48
|
+
# shellcheck disable=SC2251
|
49
|
+
! IFS= read -r -d '' sbst << EOM
|
50
|
+
find_package(OpenSSL REQUIRED)
|
51
|
+
# -- Start of tebako patch --
|
52
|
+
find_package(Boost 1.65 REQUIRED COMPONENTS filesystem)
|
53
|
+
include_directories(\${Boost_INCLUDE_DIRS})
|
54
|
+
# -- End of tebako patch --
|
55
|
+
EOM
|
56
|
+
|
57
|
+
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
58
|
+
gSed="gsed"
|
59
|
+
|
60
|
+
# shellcheck disable=SC2251
|
61
|
+
! IFS= read -r -d '' sbst << EOM
|
62
|
+
find_package(OpenSSL REQUIRED)
|
63
|
+
# -- Start of tebako patch --
|
64
|
+
find_package(Boost 1.65 REQUIRED COMPONENTS filesystem)
|
65
|
+
include_directories(\${Boost_INCLUDE_DIRS})
|
66
|
+
# Suppress superfluous randlib warnings about \"*.a\" having no symbols on MacOSX.
|
67
|
+
set(CMAKE_C_ARCHIVE_CREATE \"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>\")
|
68
|
+
set(CMAKE_CXX_ARCHIVE_CREATE \"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>\")
|
69
|
+
set(CMAKE_C_ARCHIVE_FINISH \"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>\")
|
70
|
+
set(CMAKE_CXX_ARCHIVE_FINISH \"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>\")
|
71
|
+
# -- End of tebako patch --
|
72
|
+
EOM
|
73
|
+
|
74
|
+
else
|
75
|
+
echo "Unknown OSTYPE=$OSTYPE"
|
76
|
+
exit 1
|
77
|
+
fi
|
78
|
+
|
79
|
+
restore_and_save "$1/CMakeLists.txt"
|
80
|
+
re="find_package(OpenSSL REQUIRED)"
|
81
|
+
"$gSed" -i "s/$re/${sbst//$'\n'/"\\n"}/g" "$1/CMakeLists.txt"
|
82
|
+
|
83
|
+
if [[ "$OSTYPE" == "msys" ]]; then
|
84
|
+
re="if(WIN32)"
|
85
|
+
sbst="if(MSVC) # tebako patched"
|
86
|
+
do_patch "$1/thrift/compiler/CMakeLists.txt" "$re" "$sbst"
|
87
|
+
|
88
|
+
re="ftruncate(file\.fd(), finalBufferSize);"
|
89
|
+
sbst="folly::portability::unistd::ftruncate(file.fd(), finalBufferSize); \/* tebako patched *\/"
|
90
|
+
do_patch "$1/thrift/lib/cpp2/frozen/FrozenUtil.h" "$re" "$sbst"
|
91
|
+
|
92
|
+
fi
|