image_optim_pack 0.12.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +10 -0
  3. data/.github/dependabot.yml +6 -0
  4. data/.github/workflows/build.yml +47 -0
  5. data/.github/workflows/check.yml +33 -0
  6. data/.github/workflows/docker-build.yml +29 -0
  7. data/.github/workflows/livecheck.yml +35 -0
  8. data/.github/workflows/rubocop.yml +16 -0
  9. data/.gitignore +7 -0
  10. data/.rubocop.yml +97 -0
  11. data/CHANGELOG.markdown +546 -0
  12. data/Dockerfile +184 -0
  13. data/Dockerfile.debian +184 -0
  14. data/Gemfile +10 -0
  15. data/LICENSE.txt +27 -0
  16. data/Makefile +543 -0
  17. data/README.markdown +121 -0
  18. data/acknowledgements/7z.txt +56 -0
  19. data/acknowledgements/advancecomp.txt +674 -0
  20. data/acknowledgements/bmp2png.txt +8 -0
  21. data/acknowledgements/cexcept.txt +8 -0
  22. data/acknowledgements/gifread.txt +14 -0
  23. data/acknowledgements/gifsicle.txt +343 -0
  24. data/acknowledgements/iqa.txt +30 -0
  25. data/acknowledgements/jhead.txt +12 -0
  26. data/acknowledgements/jpeg-archive.txt +20 -0
  27. data/acknowledgements/jpegoptim.txt +339 -0
  28. data/acknowledgements/libjpeg-turbo.txt +27 -0
  29. data/acknowledgements/libjpeg-x86-simd.txt +17 -0
  30. data/acknowledgements/libjpeg.txt +64 -0
  31. data/acknowledgements/liblcms2.txt +21 -0
  32. data/acknowledgements/libpng.txt +90 -0
  33. data/acknowledgements/mozjpeg.txt +7 -0
  34. data/acknowledgements/optipng-authors.txt +26 -0
  35. data/acknowledgements/optipng.txt +21 -0
  36. data/acknowledgements/oxipng.txt +20 -0
  37. data/acknowledgements/pngcrush.txt +35 -0
  38. data/acknowledgements/pngout.txt +9 -0
  39. data/acknowledgements/pngquant.txt +56 -0
  40. data/acknowledgements/smallfry.txt +13 -0
  41. data/acknowledgements/zlib.txt +34 -0
  42. data/acknowledgements/zopfli-contributors.txt +6 -0
  43. data/acknowledgements/zopfli.txt +201 -0
  44. data/checksums.mk +17 -0
  45. data/image_optim_pack-darwin-arm64.gemspec +3 -0
  46. data/image_optim_pack-darwin-x86_64.gemspec +3 -0
  47. data/image_optim_pack-linux-x86_64.gemspec +3 -0
  48. data/image_optim_pack.gemspec +62 -0
  49. data/lib/image_optim/pack.rb +119 -0
  50. data/lib/image_optim_pack.rb +3 -0
  51. data/patches/pngcrush.patch +15 -0
  52. data/script/extract +19 -0
  53. data/script/livecheck +263 -0
  54. data/script/platform_downloads +59 -0
  55. data/script/run +131 -0
  56. data/spec/image_optim/pack_spec.rb +116 -0
  57. data/spec/image_optim_spec.rb +42 -0
  58. data/spec/spec_helper.rb +10 -0
  59. data/vendor/darwin-arm64/advpng +0 -0
  60. data/vendor/darwin-arm64/gifsicle +0 -0
  61. data/vendor/darwin-arm64/jhead +0 -0
  62. data/vendor/darwin-arm64/jpeg-recompress +0 -0
  63. data/vendor/darwin-arm64/jpegoptim +0 -0
  64. data/vendor/darwin-arm64/jpegtran +0 -0
  65. data/vendor/darwin-arm64/libjpeg.dylib +0 -0
  66. data/vendor/darwin-arm64/liblcms2.dylib +0 -0
  67. data/vendor/darwin-arm64/libpng.dylib +0 -0
  68. data/vendor/darwin-arm64/libz.dylib +0 -0
  69. data/vendor/darwin-arm64/optipng +0 -0
  70. data/vendor/darwin-arm64/oxipng +0 -0
  71. data/vendor/darwin-arm64/pngcrush +0 -0
  72. data/vendor/darwin-arm64/pngout +0 -0
  73. data/vendor/darwin-arm64/pngquant +0 -0
  74. metadata +199 -0
@@ -0,0 +1,35 @@
1
+ COPYRIGHT:
2
+
3
+ Copyright (C) 1998-2002, 2006-2014 Glenn Randers-Pehrson
4
+ (glennrp at users.sf.net)
5
+ Portions copyright (C) 2005 Greg Roelofs
6
+
7
+ DISCLAIMERS:
8
+
9
+ The pngcrush computer program is supplied "AS IS". The Author disclaims all
10
+ warranties, expressed or implied, including, without limitation, the
11
+ warranties of merchantability and of fitness for any purpose. The
12
+ Author assumes no liability for direct, indirect, incidental, special,
13
+ exemplary, or consequential damages, which may result from the use of
14
+ the computer program, even if advised of the possibility of such damage.
15
+ There is no warranty against interference with your enjoyment of the
16
+ computer program or against infringement. There is no warranty that my
17
+ efforts or the computer program will fulfill any of your particular purposes
18
+ or needs. This computer program is provided with all faults, and the entire
19
+ risk of satisfactory quality, performance, accuracy, and effort is with
20
+ the user.
21
+
22
+ LICENSE:
23
+
24
+ Permission is hereby irrevocably granted to everyone to use, copy, modify,
25
+ and distribute this source code, or portions hereof, or executable programs
26
+ compiled from it, for any purpose, without payment of any fee, subject to
27
+ the following restrictions:
28
+
29
+ 1. The origin of this source code must not be misrepresented.
30
+
31
+ 2. Altered versions must be plainly marked as such and must not be
32
+ misrepresented as being the original source.
33
+
34
+ 3. This Copyright notice, disclaimer, and license may not be removed
35
+ or altered from any source or altered source distribution.
@@ -0,0 +1,9 @@
1
+ PNGOUT / KZIP license:
2
+
3
+ I have gotten a lot of requests about bundling the command line executables, or releasing the source code to KZIP and PNGOUT. This is my license (updated 01/16/2021):
4
+
5
+ * The command line versions of PNGOUT.EXE and KZIP.EXE are free for use, as are the Mac and Linux ports.
6
+ * You may use PNGOUT- or KZIP-compressed content for non-commercial or commercial purposes.
7
+ * Redistributing, repackaging, or reusing the PNGOUT or KZIP executable is permitted for non-commercial projects that are distributed freely.
8
+ * For commercial requests (such as bundling with a commercial product), please write to my business partner, David Blake.
9
+ * When bundling, my credit (both my name and website) must be clearly displayed in some reasonable fashion that can be seen by an average user.
@@ -0,0 +1,56 @@
1
+ The quantization and dithering code in pngquant is lifted from Jef Poskanzer's
2
+ 'ppmquant', part of his wonderful PBMPLUS tool suite.
3
+
4
+ Greg Roelofs hacked it into a (in his words) "slightly cheesy" 'pamquant' back
5
+ in 1997 (see http://pobox.com/~newt/greg_rgba.html) and finally he ripped out
6
+ the cheesy file-I/O parts and replaced them with nice PNG code in December
7
+ 2000. The PNG reading and writing code is a merged and slightly simplified
8
+ version of readpng, readpng2, and writepng from his book "PNG: The Definitive
9
+ Guide."
10
+ In 2014 Greg has relicensed the code under the simplified BSD license.
11
+
12
+ Note that both licenses are basically BSD-like; that is, use the code however
13
+ you like, as long as you acknowledge its origins.
14
+
15
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16
+
17
+ pngquant.c:
18
+
19
+ © 1989, 1991 by Jef Poskanzer.
20
+
21
+ Permission to use, copy, modify, and distribute this software and its
22
+ documentation for any purpose and without fee is hereby granted, provided
23
+ that the above copyright notice appear in all copies and that both that
24
+ copyright notice and this permission notice appear in supporting
25
+ documentation. This software is provided "as is" without express or
26
+ implied warranty.
27
+
28
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29
+
30
+ pngquant.c and rwpng.c/h:
31
+
32
+ © 1997-2002 by Greg Roelofs; based on an idea by Stefan Schneider.
33
+ © 2009-2014 by Kornel Lesiński.
34
+
35
+ All rights reserved.
36
+
37
+ Redistribution and use in source and binary forms, with or without modification,
38
+ are permitted provided that the following conditions are met:
39
+
40
+ 1. Redistributions of source code must retain the above copyright notice,
41
+ this list of conditions and the following disclaimer.
42
+
43
+ 2. Redistributions in binary form must reproduce the above copyright notice,
44
+ this list of conditions and the following disclaimer in the documentation
45
+ and/or other materials provided with the distribution.
46
+
47
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
51
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
53
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
54
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
55
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2014, Derek Buitenhuis
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,34 @@
1
+ Acknowledgments:
2
+
3
+ The deflate format used by zlib was defined by Phil Katz. The deflate and
4
+ zlib specifications were written by L. Peter Deutsch. Thanks to all the
5
+ people who reported problems and suggested various improvements in zlib; they
6
+ are too numerous to cite here.
7
+
8
+ Copyright notice:
9
+
10
+ (C) 1995-2013 Jean-loup Gailly and Mark Adler
11
+
12
+ This software is provided 'as-is', without any express or implied
13
+ warranty. In no event will the authors be held liable for any damages
14
+ arising from the use of this software.
15
+
16
+ Permission is granted to anyone to use this software for any purpose,
17
+ including commercial applications, and to alter it and redistribute it
18
+ freely, subject to the following restrictions:
19
+
20
+ 1. The origin of this software must not be misrepresented; you must not
21
+ claim that you wrote the original software. If you use this software
22
+ in a product, an acknowledgment in the product documentation would be
23
+ appreciated but is not required.
24
+ 2. Altered source versions must be plainly marked as such, and must not be
25
+ misrepresented as being the original software.
26
+ 3. This notice may not be removed or altered from any source distribution.
27
+
28
+ Jean-loup Gailly Mark Adler
29
+ jloup@gzip.org madler@alumni.caltech.edu
30
+
31
+ If you use the zlib library in a product, we would appreciate *not* receiving
32
+ lengthy legal documents to sign. The sources are provided for free but without
33
+ warranty of any kind. The library has been entirely written by Jean-loup
34
+ Gailly and Mark Adler; it does not include third-party code.
@@ -0,0 +1,6 @@
1
+ Mark Adler
2
+ Jyrki Alakuijala
3
+ Daniel Reed
4
+ Huzaifa Sidhpurwala
5
+ Péter Szabó
6
+ Lode Vandevenne
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2011 Google Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/checksums.mk ADDED
@@ -0,0 +1,17 @@
1
+ ADVANCECOMP_SHA256 := b07d77735540409771cbe1b6df165b5151c11bb9c3d8f01290be0ec88ec3498f
2
+ GIFSICLE_SHA256 := b2711647009fd2a13130f3be160532ed46538e762bfc0f020dea50618a7dc950
3
+ JHEAD_SHA256 := ef89bbcf4f6c25ed88088cf242a47a6aedfff4f08cc7dc205bf3e2c0f10a03c9
4
+ JPEGARCHIVE_SHA256 := 3da16a5abbddd925dee0379aa51d9fe0cba33da0b5703be27c13a2dda3d7ed75
5
+ JPEGOPTIM_SHA256 := 90a309d1c092de358bb411d702281ac3039b489d03adb0bc3c4ef04cf0067d38
6
+ LIBJPEG_SHA256 := 04705c110cb2469caa79fb71fba3d7bf834914706e9641a4589485c1f832565b
7
+ LIBLCMS_SHA256 := d11af569e42a1baa1650d20ad61d12e41af4fead4aa7964a01f93b08b53ab074
8
+ LIBMOZJPEG_SHA256 := 9fcbb7171f6ac383f5b391175d6fb3acde5e64c4c4727274eade84ed0998fcc1
9
+ LIBPNG_SHA256 := 084115c62fe023e3d88cd78764a4d8e89763985ee4b4a085825f7a00d85eafbb
10
+ LIBZ_SHA256 := c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
11
+ OPTIPNG_SHA256 := 25a3bd68481f21502ccaa0f4c13f84dcf6b20338e4c4e8c51f2cefbd8513398c
12
+ OXIPNG_SHA256 := 90c5e32c556c49e8fb2170f281586e87f7619fd574b4ccf1bc76e2f6819bba77
13
+ PNGCRUSH_SHA256 := fed0aaf5c098aa8c7f78c75365cd18d7341417326ecbdba547876b7b4f3df4be
14
+ PNGOUT_LINUX_SHA256 := ac38bba6f0de29033de866538c3afa64341319b695bbe388efbc5fd9e830e928
15
+ PNGOUT_LINUX_STATIC_SHA256 := 7a78ea475d65a00981bf418e5dfa3b34e42d6460fb992340802873bb14b08597
16
+ PNGOUT_DARWIN_SHA256 := 2e3eb79345206040ae3a0d0d0ecfe9ad01d92fe5002b8a1676a65632a56840e1
17
+ PNGQUANT_SHA256 := 68a12bdd8825f9989f4ee9a6ab0b42727dae57728b939ef63453366697a07232
@@ -0,0 +1,3 @@
1
+ # encoding: UTF-8
2
+
3
+ eval "gemspec_path = #{__FILE__.inspect}; #{File.read('image_optim_pack.gemspec')}"
@@ -0,0 +1,3 @@
1
+ # encoding: UTF-8
2
+
3
+ eval "gemspec_path = #{__FILE__.inspect}; #{File.read('image_optim_pack.gemspec')}"
@@ -0,0 +1,3 @@
1
+ # encoding: UTF-8
2
+
3
+ eval "gemspec_path = #{__FILE__.inspect}; #{File.read('image_optim_pack.gemspec')}"
@@ -0,0 +1,62 @@
1
+ # encoding: UTF-8
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'image_optim_pack'
5
+ s.version = '0.12.0'
6
+ s.summary = %q{Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegtran, optipng, oxipng, pngcrush, pngout, pngquant}
7
+ s.homepage = "https://github.com/toy/#{s.name}"
8
+ s.authors = ['Ivan Kuchin']
9
+ s.license = 'MIT'
10
+
11
+ s.required_ruby_version = '>= 1.9.3'
12
+
13
+ s.metadata = {
14
+ 'bug_tracker_uri' => "https://github.com/toy/#{s.name}/issues",
15
+ 'changelog_uri' => "https://github.com/toy/#{s.name}/blob/master/CHANGELOG.markdown",
16
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{s.name}/#{s.version}",
17
+ 'source_code_uri' => "https://github.com/toy/#{s.name}",
18
+ }
19
+
20
+ s.files = `git ls-files`.split("\n")
21
+ if defined?(gemspec_path)
22
+ gem_os, gem_cpu = File.basename(gemspec_path, File.extname(gemspec_path)).split('-').drop(1)
23
+
24
+ s.platform = Gem::Platform.new([gem_cpu, gem_os])
25
+
26
+ cpu_aliases = {
27
+ 'x86_64' => %w[x86_64 amd64],
28
+ }[gem_cpu] || [gem_cpu]
29
+
30
+ possible_vendor_dirs = cpu_aliases.map do |cpu_alias|
31
+ "#{gem_os}-#{cpu_alias}"
32
+ end
33
+
34
+ existing_vendor_dirs = possible_vendor_dirs.select do |vendor_dir|
35
+ File.directory?(File.join('vendor', vendor_dir))
36
+ end
37
+
38
+ vendor_dir = if existing_vendor_dirs.length == 1
39
+ existing_vendor_dirs.first
40
+ else
41
+ message = existing_vendor_dirs.empty? ? 'no vendor dir' : 'multiple vendor dirs'
42
+ fail "#{message} found for os #{gem_os} and cpu #{gem_cpu} out of: #{possible_vendor_dirs.join(', ')}"
43
+ end
44
+
45
+ s.files.reject! do |path|
46
+ parts = path.split('/')
47
+ parts[0] == 'vendor' && parts[1] != vendor_dir
48
+ end
49
+ end
50
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
51
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
52
+ s.require_paths = %w[lib]
53
+
54
+ s.add_dependency 'image_optim', '~> 0.19'
55
+ s.add_dependency 'fspath', '>= 2.1', '< 4'
56
+
57
+ s.add_development_dependency 'rspec', '~> 3.0'
58
+ if RUBY_VERSION >= '2.5'
59
+ s.add_development_dependency 'rubocop', '~> 1.22', '!= 1.22.2'
60
+ s.add_development_dependency 'rubocop-rspec', '~> 2.0'
61
+ end
62
+ end
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fspath'
4
+ require 'image_optim/bin_resolver/bin'
5
+
6
+ class ImageOptim
7
+ # Handle selection of directory with binaries most suitable for current
8
+ # operating system and architecture
9
+ module Pack
10
+ # Path to binary, last two parts are expect to be os/arch
11
+ class Path
12
+ # Path provided to initialize as FSPath
13
+ attr_reader :path
14
+
15
+ # Intended os
16
+ attr_reader :os
17
+
18
+ # Inteded architecture
19
+ attr_reader :arch
20
+
21
+ # Receive path, use last part for arch and last but one part for os
22
+ def initialize(path)
23
+ @path = FSPath(path)
24
+ @os, @arch = @path.basename.to_s.split('-', 2)
25
+ end
26
+
27
+ # Return path converted to string
28
+ def to_s
29
+ path.to_s
30
+ end
31
+
32
+ # Cached array of BinResolver::Bin instances for each bin
33
+ def bins
34
+ @bins ||= bin_paths.map do |bin_path|
35
+ BinResolver::Bin.new(bin_path.basename.to_s, bin_path.to_s)
36
+ end
37
+ end
38
+
39
+ # Return true if all bins can execute and return version
40
+ def all_bins_working?
41
+ bins.all?(&:version)
42
+ end
43
+
44
+ # Return true if all bins can't execute and return version
45
+ def all_bins_failing?
46
+ bins.none?(&:version)
47
+ end
48
+
49
+ # List of bins which can execute and return version
50
+ def working_bins
51
+ bins.select(&:version)
52
+ end
53
+
54
+ # List of bins which can't execute and return version
55
+ def failing_bins
56
+ bins.reject(&:version)
57
+ end
58
+
59
+ private
60
+
61
+ # All children except those starting with 'lib'
62
+ def bin_paths
63
+ path.children.reject{ |child| child.basename.to_s.start_with?('lib', '.') }
64
+ end
65
+ end
66
+
67
+ # downcased `uname -s`
68
+ OS = begin
69
+ `uname -s`.strip.downcase
70
+ rescue Errno::ENOENT
71
+ 'unknown'
72
+ end
73
+
74
+ # downcased `uname -m`
75
+ ARCH = begin
76
+ `uname -m`.strip.downcase
77
+ rescue Errno::ENOENT
78
+ 'unknown'
79
+ end
80
+
81
+ # Path to vendor at root of image_optim_pack
82
+ VENDOR_PATH = FSPath('../../../vendor').expand_path(__FILE__)
83
+
84
+ # List of paths
85
+ PATHS = VENDOR_PATH.glob('*-*').map{ |path| Path.new(path) }
86
+
87
+ class << self
88
+ # Return path to directory with binaries
89
+ # Yields debug messages if block given
90
+ def path
91
+ ordered_by_os_arch_match.find do |path|
92
+ yield "image_optim_pack: #{debug_message(path)}" if block_given?
93
+ path.all_bins_working?
94
+ end
95
+ end
96
+
97
+ private
98
+
99
+ # Order by match of os and architecture
100
+ def ordered_by_os_arch_match
101
+ PATHS.sort_by do |path|
102
+ [path.os == OS ? 0 : 1, path.arch == ARCH ? 0 : 1]
103
+ end
104
+ end
105
+
106
+ # Messages based on success of getting versions of bins
107
+ def debug_message(path)
108
+ case
109
+ when path.all_bins_working?
110
+ "all bins from #{path} worked"
111
+ when path.all_bins_failing?
112
+ "all bins from #{path} failed"
113
+ else
114
+ "#{path.failing_bins.map(&:name).join(', ')} from #{path} failed"
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'image_optim/pack'
@@ -0,0 +1,15 @@
1
+ diff --git a/pngcrush.c b/pngcrush.c
2
+ index d0c387e..ed27eff 100644
3
+ --- a/pngcrush.c
4
+ +++ b/pngcrush.c
5
+ @@ -5520,8 +5520,10 @@ int main(int argc, char *argv[])
6
+ * they were already checked in the pngcrush_measure_idat
7
+ * function
8
+ */
9
+ +# ifdef PNG_IGNORE_ADLER32
10
+ png_set_option(read_ptr, PNG_IGNORE_ADLER32,
11
+ PNG_OPTION_ON);
12
+ +# endif
13
+ png_set_crc_action(read_ptr, PNG_CRC_QUIET_USE,
14
+ PNG_CRC_QUIET_USE);
15
+ }
data/script/extract ADDED
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ if [ "$#" -ne 1 ]; then
6
+ echo "Require name of package as argument" >&2
7
+ exit 1
8
+ fi
9
+
10
+ name="$1"
11
+ upcase=$(echo "$name" | tr a-z A-Z)
12
+ version=$(printenv "${upcase}_VER")
13
+ checksum=$(printenv "${upcase}_SHA256")
14
+ archive="download/${name}-${version}.tar.gz"
15
+ build_dir="build/$name"
16
+
17
+ echo "$checksum $archive" | sha256sum -c
18
+ mkdir -p "$build_dir"
19
+ tar -C "$build_dir" --strip-components=1 -xzf "$archive"