brotli 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/brotli/brotli.c +104 -85
- data/ext/brotli/brotli.h +0 -5
- data/ext/brotli/extconf.rb +115 -42
- data/lib/brotli/version.rb +1 -1
- data/vendor/brotli/c/common/version.h +2 -2
- data/vendor/brotli/c/dec/decode.c +59 -30
- data/vendor/brotli/c/include/brotli/decode.h +1 -3
- metadata +5 -21
- data/.github/workflows/main.yml +0 -37
- data/.github/workflows/publish.yml +0 -24
- data/.gitignore +0 -18
- data/.gitmodules +0 -3
- data/.rspec +0 -2
- data/Dockerfile +0 -38
- data/Gemfile +0 -10
- data/Rakefile +0 -42
- data/bin/before_install.sh +0 -9
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/brotli.gemspec +0 -27
- data/smoke.sh +0 -8
- data/vendor/brotli/c/common/dictionary.bin +0 -432
- data/vendor/brotli/c/common/dictionary.bin.br +0 -0
- data/vendor/brotli/c/enc/static_init_lazy.cc +0 -26
|
@@ -1176,7 +1176,7 @@ static BrotliDecoderErrorCode DecodeContextMap(brotli_reg_t context_map_size,
|
|
|
1176
1176
|
|
|
1177
1177
|
/* Decodes a command or literal and updates block type ring-buffer.
|
|
1178
1178
|
Reads 3..54 bits. */
|
|
1179
|
-
static BROTLI_INLINE
|
|
1179
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeBlockTypeAndLength(
|
|
1180
1180
|
int safe, BrotliDecoderState* s, int tree_type) {
|
|
1181
1181
|
brotli_reg_t max_block_type = s->num_block_types[tree_type];
|
|
1182
1182
|
const HuffmanCode* type_tree = &s->block_type_trees[
|
|
@@ -1187,7 +1187,7 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
|
|
|
1187
1187
|
brotli_reg_t* ringbuffer = &s->block_type_rb[tree_type * 2];
|
|
1188
1188
|
brotli_reg_t block_type;
|
|
1189
1189
|
if (max_block_type <= 1) {
|
|
1190
|
-
return
|
|
1190
|
+
return BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH;
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
1193
|
/* Read 0..15 + 3..39 bits. */
|
|
@@ -1197,11 +1197,13 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
|
|
|
1197
1197
|
} else {
|
|
1198
1198
|
BrotliBitReaderState memento;
|
|
1199
1199
|
BrotliBitReaderSaveState(br, &memento);
|
|
1200
|
-
if (!SafeReadSymbol(type_tree, br, &block_type))
|
|
1200
|
+
if (!SafeReadSymbol(type_tree, br, &block_type)) {
|
|
1201
|
+
return BROTLI_DECODER_NEEDS_MORE_INPUT;
|
|
1202
|
+
}
|
|
1201
1203
|
if (!SafeReadBlockLength(s, &s->block_length[tree_type], len_tree, br)) {
|
|
1202
1204
|
s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
|
|
1203
1205
|
BrotliBitReaderRestoreState(br, &memento);
|
|
1204
|
-
return
|
|
1206
|
+
return BROTLI_DECODER_NEEDS_MORE_INPUT;
|
|
1205
1207
|
}
|
|
1206
1208
|
}
|
|
1207
1209
|
|
|
@@ -1217,7 +1219,7 @@ static BROTLI_INLINE BROTLI_BOOL DecodeBlockTypeAndLength(
|
|
|
1217
1219
|
}
|
|
1218
1220
|
ringbuffer[0] = ringbuffer[1];
|
|
1219
1221
|
ringbuffer[1] = block_type;
|
|
1220
|
-
return
|
|
1222
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1221
1223
|
}
|
|
1222
1224
|
|
|
1223
1225
|
static BROTLI_INLINE void DetectTrivialLiteralBlockTypes(
|
|
@@ -1254,62 +1256,68 @@ static BROTLI_INLINE void PrepareLiteralDecoding(BrotliDecoderState* s) {
|
|
|
1254
1256
|
|
|
1255
1257
|
/* Decodes the block type and updates the state for literal context.
|
|
1256
1258
|
Reads 3..54 bits. */
|
|
1257
|
-
static BROTLI_INLINE
|
|
1259
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeLiteralBlockSwitchInternal(
|
|
1258
1260
|
int safe, BrotliDecoderState* s) {
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
+
BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 0);
|
|
1262
|
+
if (result != BROTLI_DECODER_SUCCESS) {
|
|
1263
|
+
return result;
|
|
1261
1264
|
}
|
|
1262
1265
|
PrepareLiteralDecoding(s);
|
|
1263
|
-
return
|
|
1266
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1264
1267
|
}
|
|
1265
1268
|
|
|
1266
|
-
static
|
|
1267
|
-
|
|
1269
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1270
|
+
DecodeLiteralBlockSwitch(BrotliDecoderState* s) {
|
|
1271
|
+
return DecodeLiteralBlockSwitchInternal(0, s);
|
|
1268
1272
|
}
|
|
1269
1273
|
|
|
1270
|
-
static
|
|
1274
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode SafeDecodeLiteralBlockSwitch(
|
|
1271
1275
|
BrotliDecoderState* s) {
|
|
1272
1276
|
return DecodeLiteralBlockSwitchInternal(1, s);
|
|
1273
1277
|
}
|
|
1274
1278
|
|
|
1275
1279
|
/* Block switch for insert/copy length.
|
|
1276
1280
|
Reads 3..54 bits. */
|
|
1277
|
-
static BROTLI_INLINE
|
|
1281
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeCommandBlockSwitchInternal(
|
|
1278
1282
|
int safe, BrotliDecoderState* s) {
|
|
1279
|
-
|
|
1280
|
-
|
|
1283
|
+
BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 1);
|
|
1284
|
+
if (result != BROTLI_DECODER_SUCCESS) {
|
|
1285
|
+
return result;
|
|
1281
1286
|
}
|
|
1282
1287
|
s->htree_command = s->insert_copy_hgroup.htrees[s->block_type_rb[3]];
|
|
1283
|
-
return
|
|
1288
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1284
1289
|
}
|
|
1285
1290
|
|
|
1286
|
-
static
|
|
1287
|
-
|
|
1291
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1292
|
+
DecodeCommandBlockSwitch(BrotliDecoderState* s) {
|
|
1293
|
+
return DecodeCommandBlockSwitchInternal(0, s);
|
|
1288
1294
|
}
|
|
1289
1295
|
|
|
1290
|
-
static
|
|
1291
|
-
|
|
1296
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1297
|
+
SafeDecodeCommandBlockSwitch(BrotliDecoderState* s) {
|
|
1292
1298
|
return DecodeCommandBlockSwitchInternal(1, s);
|
|
1293
1299
|
}
|
|
1294
1300
|
|
|
1295
1301
|
/* Block switch for distance codes.
|
|
1296
1302
|
Reads 3..54 bits. */
|
|
1297
|
-
static BROTLI_INLINE
|
|
1303
|
+
static BROTLI_INLINE BrotliDecoderErrorCode DecodeDistanceBlockSwitchInternal(
|
|
1298
1304
|
int safe, BrotliDecoderState* s) {
|
|
1299
|
-
|
|
1300
|
-
|
|
1305
|
+
BrotliDecoderErrorCode result = DecodeBlockTypeAndLength(safe, s, 2);
|
|
1306
|
+
if (result != BROTLI_DECODER_SUCCESS) {
|
|
1307
|
+
return result;
|
|
1301
1308
|
}
|
|
1302
1309
|
s->dist_context_map_slice = s->dist_context_map +
|
|
1303
1310
|
(s->block_type_rb[5] << BROTLI_DISTANCE_CONTEXT_BITS);
|
|
1304
1311
|
s->dist_htree_index = s->dist_context_map_slice[s->distance_context];
|
|
1305
|
-
return
|
|
1312
|
+
return BROTLI_DECODER_SUCCESS;
|
|
1306
1313
|
}
|
|
1307
1314
|
|
|
1308
|
-
static
|
|
1309
|
-
|
|
1315
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode
|
|
1316
|
+
DecodeDistanceBlockSwitch(BrotliDecoderState* s) {
|
|
1317
|
+
return DecodeDistanceBlockSwitchInternal(0, s);
|
|
1310
1318
|
}
|
|
1311
1319
|
|
|
1312
|
-
static
|
|
1320
|
+
static BROTLI_NOINLINE BrotliDecoderErrorCode SafeDecodeDistanceBlockSwitch(
|
|
1313
1321
|
BrotliDecoderState* s) {
|
|
1314
1322
|
return DecodeDistanceBlockSwitchInternal(1, s);
|
|
1315
1323
|
}
|
|
@@ -1940,6 +1948,9 @@ static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(
|
|
|
1940
1948
|
return BrotliCheckInputAmount(br);
|
|
1941
1949
|
}
|
|
1942
1950
|
|
|
1951
|
+
/* NB: METHOD should return BROTLI_FALSE only in case there is not enough input;
|
|
1952
|
+
in case of "unsafe" execution, when input is guaranteed to be sufficient,
|
|
1953
|
+
result is ignored. */
|
|
1943
1954
|
#define BROTLI_SAFE(METHOD) \
|
|
1944
1955
|
{ \
|
|
1945
1956
|
if (safe) { \
|
|
@@ -1952,6 +1963,22 @@ static BROTLI_INLINE BROTLI_BOOL CheckInputAmount(
|
|
|
1952
1963
|
} \
|
|
1953
1964
|
}
|
|
1954
1965
|
|
|
1966
|
+
/* NB: METHOD should return BROTLI_DECODER_SUCCESS, BROTLI_DECODER_ERROR_*, or
|
|
1967
|
+
BROTLI_DECODER_NEEDS_MORE_INPUT; the later two break the processing. */
|
|
1968
|
+
#define BROTLI_SAFE_WITH_STATUS(METHOD) \
|
|
1969
|
+
{ \
|
|
1970
|
+
BrotliDecoderErrorCode status; \
|
|
1971
|
+
if (safe) { \
|
|
1972
|
+
status = Safe##METHOD; \
|
|
1973
|
+
} else { \
|
|
1974
|
+
status = METHOD; \
|
|
1975
|
+
} \
|
|
1976
|
+
if (status != BROTLI_DECODER_SUCCESS) { \
|
|
1977
|
+
result = status; \
|
|
1978
|
+
goto saveStateAndReturn; \
|
|
1979
|
+
} \
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1955
1982
|
static BROTLI_INLINE BrotliDecoderErrorCode ProcessCommandsInternal(
|
|
1956
1983
|
int safe, BrotliDecoderState* s) {
|
|
1957
1984
|
int pos = s->pos;
|
|
@@ -1991,7 +2018,7 @@ CommandBegin:
|
|
|
1991
2018
|
goto saveStateAndReturn;
|
|
1992
2019
|
}
|
|
1993
2020
|
if (BROTLI_PREDICT_FALSE(s->block_length[1] == 0)) {
|
|
1994
|
-
|
|
2021
|
+
BROTLI_SAFE_WITH_STATUS(DecodeCommandBlockSwitch(s));
|
|
1995
2022
|
goto CommandBegin;
|
|
1996
2023
|
}
|
|
1997
2024
|
/* Read the insert/copy length in the command. */
|
|
@@ -2136,7 +2163,7 @@ CommandPostDecodeLiterals:
|
|
|
2136
2163
|
} else {
|
|
2137
2164
|
/* Read distance code in the command, unless it was implicitly zero. */
|
|
2138
2165
|
if (BROTLI_PREDICT_FALSE(s->block_length[2] == 0)) {
|
|
2139
|
-
|
|
2166
|
+
BROTLI_SAFE_WITH_STATUS(DecodeDistanceBlockSwitch(s));
|
|
2140
2167
|
}
|
|
2141
2168
|
BROTLI_SAFE(ReadDistance(s, br));
|
|
2142
2169
|
}
|
|
@@ -2330,7 +2357,7 @@ CommandPostWrapCopy:
|
|
|
2330
2357
|
}
|
|
2331
2358
|
|
|
2332
2359
|
NextLiteralBlock:
|
|
2333
|
-
|
|
2360
|
+
BROTLI_SAFE_WITH_STATUS(DecodeLiteralBlockSwitch(s));
|
|
2334
2361
|
goto CommandInner;
|
|
2335
2362
|
|
|
2336
2363
|
saveStateAndReturn:
|
|
@@ -2552,6 +2579,8 @@ BrotliDecoderResult BrotliDecoderDecompressStream(
|
|
|
2552
2579
|
if (result != BROTLI_DECODER_SUCCESS) {
|
|
2553
2580
|
break;
|
|
2554
2581
|
}
|
|
2582
|
+
BROTLI_DCHECK(s->meta_block_remaining_len <=
|
|
2583
|
+
(int)BROTLI_BLOCK_SIZE_CAP);
|
|
2555
2584
|
BROTLI_LOG_UINT(s->is_last_metablock);
|
|
2556
2585
|
BROTLI_LOG_UINT(s->meta_block_remaining_len);
|
|
2557
2586
|
BROTLI_LOG_UINT(s->is_metadata);
|
|
@@ -85,9 +85,7 @@ typedef enum {
|
|
|
85
85
|
BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_1, -14) SEPARATOR \
|
|
86
86
|
BROTLI_ERROR_CODE(_ERROR_FORMAT_, PADDING_2, -15) SEPARATOR \
|
|
87
87
|
BROTLI_ERROR_CODE(_ERROR_FORMAT_, DISTANCE, -16) SEPARATOR \
|
|
88
|
-
|
|
89
|
-
/* -17 code is reserved */ \
|
|
90
|
-
\
|
|
88
|
+
BROTLI_ERROR_CODE(_ERROR_FORMAT_, BLOCK_SWITCH, -17) SEPARATOR \
|
|
91
89
|
BROTLI_ERROR_CODE(_ERROR_, COMPOUND_DICTIONARY, -18) SEPARATOR \
|
|
92
90
|
BROTLI_ERROR_CODE(_ERROR_, DICTIONARY_NOT_SET, -19) SEPARATOR \
|
|
93
91
|
BROTLI_ERROR_CODE(_ERROR_, INVALID_ARGUMENTS, -20) SEPARATOR \
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: brotli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- miyucy
|
|
@@ -9,7 +9,7 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
|
-
description: Brotli
|
|
12
|
+
description: Native Ruby bindings for Brotli compression and decompression.
|
|
13
13
|
email:
|
|
14
14
|
- fistfvck@gmail.com
|
|
15
15
|
executables: []
|
|
@@ -17,20 +17,8 @@ extensions:
|
|
|
17
17
|
- ext/brotli/extconf.rb
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
|
-
- ".github/workflows/main.yml"
|
|
21
|
-
- ".github/workflows/publish.yml"
|
|
22
|
-
- ".gitignore"
|
|
23
|
-
- ".gitmodules"
|
|
24
|
-
- ".rspec"
|
|
25
|
-
- Dockerfile
|
|
26
|
-
- Gemfile
|
|
27
20
|
- LICENSE.txt
|
|
28
21
|
- README.md
|
|
29
|
-
- Rakefile
|
|
30
|
-
- bin/before_install.sh
|
|
31
|
-
- bin/console
|
|
32
|
-
- bin/setup
|
|
33
|
-
- brotli.gemspec
|
|
34
22
|
- ext/brotli/brotli.c
|
|
35
23
|
- ext/brotli/brotli.h
|
|
36
24
|
- ext/brotli/buffer.c
|
|
@@ -40,14 +28,11 @@ files:
|
|
|
40
28
|
- lib/brotli/reader.rb
|
|
41
29
|
- lib/brotli/version.rb
|
|
42
30
|
- lib/brotli/writer.rb
|
|
43
|
-
- smoke.sh
|
|
44
31
|
- vendor/brotli/LICENSE
|
|
45
32
|
- vendor/brotli/c/common/constants.c
|
|
46
33
|
- vendor/brotli/c/common/constants.h
|
|
47
34
|
- vendor/brotli/c/common/context.c
|
|
48
35
|
- vendor/brotli/c/common/context.h
|
|
49
|
-
- vendor/brotli/c/common/dictionary.bin
|
|
50
|
-
- vendor/brotli/c/common/dictionary.bin.br
|
|
51
36
|
- vendor/brotli/c/common/dictionary.c
|
|
52
37
|
- vendor/brotli/c/common/dictionary.h
|
|
53
38
|
- vendor/brotli/c/common/dictionary_inc.h
|
|
@@ -142,7 +127,6 @@ files:
|
|
|
142
127
|
- vendor/brotli/c/enc/static_dict_lut_inc.h
|
|
143
128
|
- vendor/brotli/c/enc/static_init.c
|
|
144
129
|
- vendor/brotli/c/enc/static_init.h
|
|
145
|
-
- vendor/brotli/c/enc/static_init_lazy.cc
|
|
146
130
|
- vendor/brotli/c/enc/utf8_util.c
|
|
147
131
|
- vendor/brotli/c/enc/utf8_util.h
|
|
148
132
|
- vendor/brotli/c/enc/write_bits.h
|
|
@@ -162,14 +146,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
162
146
|
requirements:
|
|
163
147
|
- - ">="
|
|
164
148
|
- !ruby/object:Gem::Version
|
|
165
|
-
version: '
|
|
149
|
+
version: '3.1'
|
|
166
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
151
|
requirements:
|
|
168
152
|
- - ">="
|
|
169
153
|
- !ruby/object:Gem::Version
|
|
170
154
|
version: '0'
|
|
171
155
|
requirements: []
|
|
172
|
-
rubygems_version: 4.0.
|
|
156
|
+
rubygems_version: 4.0.20
|
|
173
157
|
specification_version: 4
|
|
174
|
-
summary: Brotli
|
|
158
|
+
summary: Ruby bindings for Brotli compression
|
|
175
159
|
test_files: []
|
data/.github/workflows/main.yml
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
name: Ruby
|
|
2
|
-
|
|
3
|
-
on: [pull_request]
|
|
4
|
-
|
|
5
|
-
jobs:
|
|
6
|
-
build:
|
|
7
|
-
strategy:
|
|
8
|
-
fail-fast: false
|
|
9
|
-
matrix:
|
|
10
|
-
ruby: [3.1, 3.2, 3.3, 3.4]
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v4
|
|
14
|
-
with:
|
|
15
|
-
submodules: true
|
|
16
|
-
- name: Set up Ruby
|
|
17
|
-
uses: ruby/setup-ruby@v1
|
|
18
|
-
with:
|
|
19
|
-
ruby-version: ${{ matrix.ruby }}
|
|
20
|
-
bundler-cache: true
|
|
21
|
-
- name: Run the default task
|
|
22
|
-
run: |
|
|
23
|
-
bundle exec rake clobber
|
|
24
|
-
bundle exec rake compile -- --enable-vendor
|
|
25
|
-
bundle exec rake test
|
|
26
|
-
bundle exec rake build
|
|
27
|
-
gem install --no-document "$(ls pkg/brotli-*.gem)"
|
|
28
|
-
cat <<EOF | ruby
|
|
29
|
-
require "brotli"
|
|
30
|
-
if Brotli.inflate(Brotli.deflate(File.read("README.md"))) == File.read("README.md")
|
|
31
|
-
puts "OK"
|
|
32
|
-
exit 0
|
|
33
|
-
else
|
|
34
|
-
puts "NG"
|
|
35
|
-
exit 0
|
|
36
|
-
end
|
|
37
|
-
EOF
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
name: Publish Gem
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
build:
|
|
10
|
-
if: github.repository == 'miyucy/brotli'
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
permissions:
|
|
13
|
-
contents: write
|
|
14
|
-
id-token: write
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
with:
|
|
18
|
-
submodules: true
|
|
19
|
-
- name: Set up Ruby
|
|
20
|
-
uses: ruby/setup-ruby@v1
|
|
21
|
-
with:
|
|
22
|
-
ruby-version: ruby
|
|
23
|
-
bundler-cache: true
|
|
24
|
-
- uses: rubygems/release-gem@v1
|
data/.gitignore
DELETED
data/.gitmodules
DELETED
data/.rspec
DELETED
data/Dockerfile
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
ARG GCC_VERSION=14
|
|
2
|
-
FROM gcc:${GCC_VERSION}
|
|
3
|
-
|
|
4
|
-
ARG USE_SYSTEM_BROTLI=true
|
|
5
|
-
|
|
6
|
-
# Install Ruby and development dependencies
|
|
7
|
-
RUN apt-get update && apt-get install -y \
|
|
8
|
-
git \
|
|
9
|
-
libbrotli-dev \
|
|
10
|
-
pkg-config \
|
|
11
|
-
ruby \
|
|
12
|
-
ruby-dev \
|
|
13
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
14
|
-
|
|
15
|
-
# Verify GCC version
|
|
16
|
-
RUN gcc --version
|
|
17
|
-
|
|
18
|
-
# Set working directory
|
|
19
|
-
WORKDIR /app
|
|
20
|
-
|
|
21
|
-
# Copy source code
|
|
22
|
-
COPY . .
|
|
23
|
-
|
|
24
|
-
# Install bundler and dependencies
|
|
25
|
-
RUN gem install bundler
|
|
26
|
-
RUN bundle install
|
|
27
|
-
|
|
28
|
-
# Build and test
|
|
29
|
-
RUN if [ "${USE_SYSTEM_BROTLI}" = "true" ]; then \
|
|
30
|
-
echo "Building with system Brotli" && \
|
|
31
|
-
bundle exec rake compile; \
|
|
32
|
-
else \
|
|
33
|
-
echo "Building with vendor Brotli" && \
|
|
34
|
-
bundle exec rake compile -- --enable-vendor; \
|
|
35
|
-
fi
|
|
36
|
-
RUN bundle exec rake test
|
|
37
|
-
|
|
38
|
-
CMD ["bash"]
|
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
require "bundler/setup"
|
|
2
|
-
require "bundler/gem_tasks"
|
|
3
|
-
require "rake/clean"
|
|
4
|
-
require "rake/testtask"
|
|
5
|
-
require "rake/extensiontask"
|
|
6
|
-
|
|
7
|
-
CLEAN.include("ext/brotli/common")
|
|
8
|
-
CLEAN.include("ext/brotli/dec")
|
|
9
|
-
CLEAN.include("ext/brotli/enc")
|
|
10
|
-
CLEAN.include("ext/brotli/include")
|
|
11
|
-
|
|
12
|
-
Rake::TestTask.new(:test) do |t|
|
|
13
|
-
t.libs << "test"
|
|
14
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
|
15
|
-
t.warning = true
|
|
16
|
-
t.verbose = true
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
Rake::ExtensionTask.new("brotli") do |ext|
|
|
20
|
-
ext.lib_dir = "lib/brotli"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
task build: :compile
|
|
24
|
-
task test: :compile
|
|
25
|
-
task default: :test
|
|
26
|
-
|
|
27
|
-
task :docker do
|
|
28
|
-
gcc_versions = ["14", "15"]
|
|
29
|
-
brotli_configs = [true, false]
|
|
30
|
-
gcc_versions.product(brotli_configs).each do |gcc_version, use_system_brotli|
|
|
31
|
-
command = "docker build "\
|
|
32
|
-
"--progress=plain "\
|
|
33
|
-
"--build-arg GCC_VERSION=#{gcc_version} "\
|
|
34
|
-
"--build-arg USE_SYSTEM_BROTLI=#{use_system_brotli} "\
|
|
35
|
-
"-t brotli:#{gcc_version}#{use_system_brotli ? "-use_system_brotli" : ""} ."
|
|
36
|
-
puts "Running: #{command}"
|
|
37
|
-
system command
|
|
38
|
-
unless $?.exited?
|
|
39
|
-
raise "Docker build failed for GCC version #{gcc_version} with use_system_brotli=#{use_system_brotli}"
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
data/bin/before_install.sh
DELETED
data/bin/console
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "brotli"
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
-
# require "pry"
|
|
11
|
-
# Pry.start
|
|
12
|
-
|
|
13
|
-
require "irb"
|
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/brotli.gemspec
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
require_relative "lib/brotli/version"
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |spec|
|
|
4
|
-
spec.name = "brotli"
|
|
5
|
-
spec.version = Brotli::VERSION
|
|
6
|
-
spec.authors = ["miyucy"]
|
|
7
|
-
spec.email = ["fistfvck@gmail.com"]
|
|
8
|
-
|
|
9
|
-
spec.summary = "Brotli compressor/decompressor"
|
|
10
|
-
spec.description = "Brotli compressor/decompressor"
|
|
11
|
-
spec.homepage = "https://github.com/miyucy/brotli"
|
|
12
|
-
spec.license = "MIT"
|
|
13
|
-
|
|
14
|
-
tracked_files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
|
15
|
-
vendored_brotli_files = Dir.chdir(__dir__) do
|
|
16
|
-
Dir["vendor/brotli/c/{common,enc,dec,include}/**/*"].select { |path| File.file?(path) }
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
spec.files = tracked_files
|
|
20
|
-
.reject { |path| path == "vendor/brotli" || path.start_with?("test/") }
|
|
21
|
-
.concat(vendored_brotli_files)
|
|
22
|
-
.append("vendor/brotli/LICENSE")
|
|
23
|
-
.sort
|
|
24
|
-
.uniq
|
|
25
|
-
spec.require_paths = ["lib"]
|
|
26
|
-
spec.extensions = ["ext/brotli/extconf.rb"]
|
|
27
|
-
end
|
data/smoke.sh
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
gem list | grep brotli && gem uninstall --force brotli
|
|
3
|
-
bundle exec rake clobber build
|
|
4
|
-
gem install --force --local "$(ls pkg/brotli-*.gem)"
|
|
5
|
-
cat <<EOF | ruby
|
|
6
|
-
require 'brotli'
|
|
7
|
-
abort if Brotli.inflate(Brotli.deflate(File.read('smoke.sh'))) != File.read('smoke.sh')
|
|
8
|
-
EOF
|