image_optim_pack 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +51 -0
- data/.travis.yml +22 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +27 -0
- data/Makefile +312 -0
- data/README.markdown +77 -0
- data/Vagrantfile +13 -0
- data/acknowledgements/7z.txt +56 -0
- data/acknowledgements/advancecomp.txt +674 -0
- data/acknowledgements/bmp2png.txt +8 -0
- data/acknowledgements/cexcept.txt +8 -0
- data/acknowledgements/gifread.txt +14 -0
- data/acknowledgements/gifsicle.txt +343 -0
- data/acknowledgements/jhead.txt +12 -0
- data/acknowledgements/jpegoptim.txt +339 -0
- data/acknowledgements/libjpeg.txt +64 -0
- data/acknowledgements/libpng.txt +90 -0
- data/acknowledgements/optipng-authors.txt +26 -0
- data/acknowledgements/optipng.txt +21 -0
- data/acknowledgements/pngcrush.txt +35 -0
- data/acknowledgements/pngquant.txt +56 -0
- data/acknowledgements/zlib.txt +34 -0
- data/acknowledgements/zopfli-contributors.txt +6 -0
- data/acknowledgements/zopfli.txt +201 -0
- data/image_optim_pack.gemspec +26 -0
- data/lib/image_optim/pack.rb +110 -0
- data/lib/image_optim_pack.rb +1 -0
- data/script/livecheck +72 -0
- data/script/run +26 -0
- data/script/update_versions +17 -0
- data/script/vm_init +30 -0
- data/spec/image_optim/pack_spec.rb +114 -0
- data/spec/image_optim_spec.rb +109 -0
- data/spec/spec_helper.rb +0 -0
- data/vendor/darwin/i386/advpng +0 -0
- data/vendor/darwin/i386/gifsicle +0 -0
- data/vendor/darwin/i386/jhead +0 -0
- data/vendor/darwin/i386/jpegoptim +0 -0
- data/vendor/darwin/i386/jpegtran +0 -0
- data/vendor/darwin/i386/libjpeg.dylib +0 -0
- data/vendor/darwin/i386/libpng.dylib +0 -0
- data/vendor/darwin/i386/libz.dylib +0 -0
- data/vendor/darwin/i386/optipng +0 -0
- data/vendor/darwin/i386/pngcrush +0 -0
- data/vendor/darwin/i386/pngquant +0 -0
- data/vendor/darwin/x86_64/advpng +0 -0
- data/vendor/darwin/x86_64/gifsicle +0 -0
- data/vendor/darwin/x86_64/jhead +0 -0
- data/vendor/darwin/x86_64/jpegoptim +0 -0
- data/vendor/darwin/x86_64/jpegtran +0 -0
- data/vendor/darwin/x86_64/libjpeg.dylib +0 -0
- data/vendor/darwin/x86_64/libpng.dylib +0 -0
- data/vendor/darwin/x86_64/libz.dylib +0 -0
- data/vendor/darwin/x86_64/optipng +0 -0
- data/vendor/darwin/x86_64/pngcrush +0 -0
- data/vendor/darwin/x86_64/pngquant +0 -0
- data/vendor/linux/i686/advpng +0 -0
- data/vendor/linux/i686/gifsicle +0 -0
- data/vendor/linux/i686/jhead +0 -0
- data/vendor/linux/i686/jpegoptim +0 -0
- data/vendor/linux/i686/jpegtran +0 -0
- data/vendor/linux/i686/libjpeg.so +0 -0
- data/vendor/linux/i686/libpng.so +0 -0
- data/vendor/linux/i686/libz.so +0 -0
- data/vendor/linux/i686/optipng +0 -0
- data/vendor/linux/i686/pngcrush +0 -0
- data/vendor/linux/i686/pngquant +0 -0
- data/vendor/linux/x86_64/advpng +0 -0
- data/vendor/linux/x86_64/gifsicle +0 -0
- data/vendor/linux/x86_64/jhead +0 -0
- data/vendor/linux/x86_64/jpegoptim +0 -0
- data/vendor/linux/x86_64/jpegtran +0 -0
- data/vendor/linux/x86_64/libjpeg.so +0 -0
- data/vendor/linux/x86_64/libpng.so +0 -0
- data/vendor/linux/x86_64/libz.so +0 -0
- data/vendor/linux/x86_64/optipng +0 -0
- data/vendor/linux/x86_64/pngcrush +0 -0
- data/vendor/linux/x86_64/pngquant +0 -0
- metadata +196 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MWEzODQ5MDViOTM0ZWU4MTgwY2EwYWJiMGMwYjg3OTZiZGEyZmI3OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NTJhOGQyMWMwNGM4ODYwYTcxNjNiOGVhNzdjNzQ4NDdmMmJmYjljZg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmYyYWZlYzRjNzdiZmM5MjNmOTIyMDkzMzc4ZWJlNmI2NDQ1NTdhOTE1OWNl
|
10
|
+
M2U5NDlmYWEwM2YyYTIzNDVkYmU3ODhjMjMwZWUwM2MzYWUwYTM4MGVhY2I0
|
11
|
+
Nzc2NGFjY2Y4ZWU4ZmQwMDllZDYwODY5YjgwZDQ4OTAzZTE1YWQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MmZlMWU0MDFhZWRiMTkwOTY3MjA0YmE3MTVjYzIzMTM4N2NiNDM5YjJhY2Nh
|
14
|
+
YzE1OTFlMjU0NjA1ZWI3OWEzYzc3ZjA4NzVjMzk1M2QyOGIzNmE2ZGFiYTlm
|
15
|
+
OTgxNjU0OGYwZGI0Y2ZjNzQ0MmUxZWQwZDQ0MWM0Yjc0Y2ViMjA=
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- '*.gemspec'
|
4
|
+
- Vagrantfile
|
5
|
+
|
6
|
+
Lint/EndAlignment:
|
7
|
+
AlignWith: variable
|
8
|
+
|
9
|
+
Metrics/MethodLength:
|
10
|
+
Max: 15
|
11
|
+
|
12
|
+
Style/AccessModifierIndentation:
|
13
|
+
EnforcedStyle: outdent
|
14
|
+
|
15
|
+
Style/CaseIndentation:
|
16
|
+
IndentWhenRelativeTo: end
|
17
|
+
|
18
|
+
Style/DotPosition:
|
19
|
+
EnforcedStyle: trailing
|
20
|
+
|
21
|
+
Style/DoubleNegation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/Encoding:
|
25
|
+
EnforcedStyle: when_needed
|
26
|
+
|
27
|
+
Style/HashSyntax:
|
28
|
+
EnforcedStyle: hash_rockets
|
29
|
+
|
30
|
+
Style/IfUnlessModifier:
|
31
|
+
MaxLineLength: 40
|
32
|
+
|
33
|
+
Style/IndentHash:
|
34
|
+
EnforcedStyle: consistent
|
35
|
+
|
36
|
+
Style/PercentLiteralDelimiters:
|
37
|
+
PreferredDelimiters:
|
38
|
+
'%w': '[]'
|
39
|
+
'%W': '[]'
|
40
|
+
|
41
|
+
Style/Semicolon:
|
42
|
+
AllowAsExpressionSeparator: true
|
43
|
+
|
44
|
+
Style/SpaceBeforeBlockBraces:
|
45
|
+
EnforcedStyle: no_space
|
46
|
+
|
47
|
+
Style/SpaceInsideHashLiteralBraces:
|
48
|
+
EnforcedStyle: no_space
|
49
|
+
|
50
|
+
Style/TrailingComma:
|
51
|
+
EnforcedStyleForMultiline: comma
|
data/.travis.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.8.7
|
4
|
+
- 1.9.2
|
5
|
+
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
- 2.1.0
|
8
|
+
- ruby-head
|
9
|
+
- jruby-18mode
|
10
|
+
- jruby-19mode
|
11
|
+
- jruby-head
|
12
|
+
- ree
|
13
|
+
script:
|
14
|
+
- make test
|
15
|
+
- bundle exec image_optim --info
|
16
|
+
- bundle exec rspec
|
17
|
+
- '! bundle show rubocop || bundle exec rubocop' # run rubocop only if bundled
|
18
|
+
matrix:
|
19
|
+
fast_finish: true
|
20
|
+
allow_failures:
|
21
|
+
- rvm: ruby-head
|
22
|
+
- rvm: jruby-head
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (c) 2014 Ivan Kuchin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
======================================================================
|
23
|
+
|
24
|
+
All binaries and libraries in vendor directory are written by
|
25
|
+
different authors. References can be found in README.markdown.
|
26
|
+
COPYRIGHTS, DISCLAIMERS, LICENSES and NOTES can be found in
|
27
|
+
acknowledgements directory.
|
data/Makefile
ADDED
@@ -0,0 +1,312 @@
|
|
1
|
+
run : all
|
2
|
+
|
3
|
+
# ====== VERSIONS ======
|
4
|
+
|
5
|
+
ADVANCECOMP_VER := 1.19
|
6
|
+
GIFSICLE_VER := 1.86
|
7
|
+
JHEAD_VER := 2.97
|
8
|
+
JPEGOPTIM_VER := 1.4.1
|
9
|
+
LIBJPEG_VER := 9a
|
10
|
+
LIBPNG_VER := 1.6.14
|
11
|
+
LIBZ_VER := 1.2.8
|
12
|
+
OPTIPNG_VER := 0.7.5
|
13
|
+
PNGCRUSH_VER := 1.7.78
|
14
|
+
PNGQUANT_VER := 2.3.1
|
15
|
+
|
16
|
+
# ====== CONSTANTS ======
|
17
|
+
|
18
|
+
OS := $(shell uname -s | tr A-Z a-z)
|
19
|
+
ARCH := $(shell uname -m)
|
20
|
+
|
21
|
+
IS_DARWIN := $(findstring darwin,$(OS))
|
22
|
+
DLEXT := $(if $(IS_DARWIN),.dylib,.so)
|
23
|
+
|
24
|
+
DL_DIR := $(CURDIR)/download
|
25
|
+
BUILD_ROOT_DIR := $(CURDIR)/build
|
26
|
+
BUILD_DIR := $(BUILD_ROOT_DIR)/$(OS)/$(ARCH)
|
27
|
+
OUTPUT_ROOT_DIR := $(CURDIR)/vendor
|
28
|
+
OUTPUT_DIR := $(OUTPUT_ROOT_DIR)/$(OS)/$(ARCH)
|
29
|
+
|
30
|
+
# ====== HELPERS ======
|
31
|
+
|
32
|
+
downcase = $(shell echo $1 | tr A-Z a-z)
|
33
|
+
|
34
|
+
mkpath := mkdir -p
|
35
|
+
ln_s := ln -sf
|
36
|
+
|
37
|
+
# lock using %.lock dir, download to %.tmp rename to %, remove %.lock
|
38
|
+
define download
|
39
|
+
while ! mkdir $2.lock 2> /dev/null; do sleep 1; done
|
40
|
+
wget -q -O $2.tmp $1
|
41
|
+
mv $2.tmp $2
|
42
|
+
rm -r $2.lock
|
43
|
+
endef
|
44
|
+
|
45
|
+
# ====== ARCHIVES ======
|
46
|
+
|
47
|
+
$(shell $(mkpath) $(DL_DIR)) # just create dl dir
|
48
|
+
|
49
|
+
ARCHIVES :=
|
50
|
+
|
51
|
+
# $1 - name of archive
|
52
|
+
# $2 - url of archive with [VER] for replace with version
|
53
|
+
# $3 - optional addition to version string
|
54
|
+
define archive
|
55
|
+
$1_URL := $(subst [VER],$($1_VER)$(strip $3),$(strip $2))
|
56
|
+
$1_DIR := $(BUILD_DIR)/$(call downcase,$1)
|
57
|
+
$1_TGZ := $(DL_DIR)/$(call downcase,$1)-$($1_VER)$(strip $3).tar.gz
|
58
|
+
ARCHIVES += $1
|
59
|
+
# download archive from url
|
60
|
+
$$($1_TGZ) :; $$(call download,$$($1_URL),$$@)
|
61
|
+
livecheck-$(call downcase,$1) :; @script/livecheck $(call downcase,$1) $($1_VER)
|
62
|
+
endef
|
63
|
+
|
64
|
+
$(eval $(call archive,ADVANCECOMP, http://prdownloads.sourceforge.net/advancemame/advancecomp-[VER].tar.gz?download))
|
65
|
+
$(eval $(call archive,GIFSICLE, http://www.lcdf.org/gifsicle/gifsicle-[VER].tar.gz))
|
66
|
+
$(eval $(call archive,JHEAD, http://www.sentex.net/~mwandel/jhead/jhead-[VER].tar.gz))
|
67
|
+
$(eval $(call archive,JPEGOPTIM, http://www.kokkonen.net/tjko/src/jpegoptim-[VER].tar.gz))
|
68
|
+
$(eval $(call archive,LIBJPEG, http://www.ijg.org/files/jpegsrc.v[VER].tar.gz))
|
69
|
+
$(eval $(call archive,LIBPNG, http://prdownloads.sourceforge.net/libpng/libpng-[VER].tar.gz?download))
|
70
|
+
$(eval $(call archive,LIBZ, http://prdownloads.sourceforge.net/libpng/zlib-[VER].tar.gz?download))
|
71
|
+
$(eval $(call archive,OPTIPNG, http://prdownloads.sourceforge.net/optipng/optipng-[VER].tar.gz?download))
|
72
|
+
$(eval $(call archive,PNGCRUSH, http://prdownloads.sourceforge.net/pmt/pngcrush-[VER].tar.gz?download))
|
73
|
+
$(eval $(call archive,PNGQUANT, https://github.com/pornel/pngquant/archive/[VER].tar.gz))
|
74
|
+
|
75
|
+
# ====== PRODUCTS ======
|
76
|
+
|
77
|
+
$(shell $(mkpath) $(OUTPUT_DIR)) # just create output dir
|
78
|
+
|
79
|
+
PRODUCTS :=
|
80
|
+
|
81
|
+
# $1 - product name
|
82
|
+
# $2 - archive name ($1 if empty)
|
83
|
+
# $3 - basename ($1 if empty)
|
84
|
+
define target
|
85
|
+
$1_BASENAME := $(or $3,$(call downcase,$1))
|
86
|
+
$1_DIR := $($(or $2,$1)_DIR)
|
87
|
+
$1_TGZ := $($(or $2,$1)_TGZ)
|
88
|
+
$1_TARGET := $$($1_DIR)/$$($1_BASENAME)
|
89
|
+
PRODUCTS += $1
|
90
|
+
# first dependency on archive
|
91
|
+
$$($1_TARGET) $$($1_DIR)/__$$(notdir $$($1_TGZ))__ : $$($1_TGZ)
|
92
|
+
# second dependency on check file
|
93
|
+
$$($1_TARGET) : $$($1_DIR)/__$$(notdir $$($1_TGZ))__
|
94
|
+
# copy product to output dir
|
95
|
+
$$(OUTPUT_DIR)/$$($1_BASENAME) : $$($1_TARGET)
|
96
|
+
strip $$< -Sx -o $$@
|
97
|
+
# short name target
|
98
|
+
$(call downcase,$1) : | $$(OUTPUT_DIR)/$$($1_BASENAME)
|
99
|
+
endef
|
100
|
+
|
101
|
+
$(eval $(call target,ADVPNG,ADVANCECOMP))
|
102
|
+
$(eval $(call target,GIFSICLE))
|
103
|
+
$(eval $(call target,JHEAD))
|
104
|
+
$(eval $(call target,JPEGOPTIM))
|
105
|
+
$(eval $(call target,JPEGTRAN,LIBJPEG))
|
106
|
+
$(eval $(call target,LIBJPEG,,libjpeg$(DLEXT)))
|
107
|
+
$(eval $(call target,LIBPNG,,libpng$(DLEXT)))
|
108
|
+
$(eval $(call target,LIBZ,,libz$(DLEXT)))
|
109
|
+
$(eval $(call target,OPTIPNG))
|
110
|
+
$(eval $(call target,PNGCRUSH))
|
111
|
+
$(eval $(call target,PNGQUANT))
|
112
|
+
|
113
|
+
# ====== TARGETS ======
|
114
|
+
|
115
|
+
all : $(call downcase,$(PRODUCTS))
|
116
|
+
$(MAKE) test
|
117
|
+
|
118
|
+
download : $(foreach archive,$(ARCHIVES),$($(archive)_TGZ))
|
119
|
+
download-tidy-up :
|
120
|
+
rm -f $(filter-out $(foreach archive,$(ARCHIVES),$($(archive)_TGZ)),$(wildcard $(DL_DIR)/*.*))
|
121
|
+
|
122
|
+
build : $(foreach product,$(PRODUCTS),$($(product)_TARGET))
|
123
|
+
|
124
|
+
define check_bin
|
125
|
+
@test -f $(OUTPUT_DIR)/$1 || (echo "no $1"; false)
|
126
|
+
@# if bin exists check architecture
|
127
|
+
@test ! -f $(OUTPUT_DIR)/$1 || \
|
128
|
+
file -b $(OUTPUT_DIR)/$1 | grep -q '$(ARCH_STRING)' || \
|
129
|
+
(echo "Expected $(ARCH_STRING), got $$(file -b $(OUTPUT_DIR)/$1)"; false)
|
130
|
+
@# if bin exists check and output version
|
131
|
+
@test ! -f $(OUTPUT_DIR)/$1 || \
|
132
|
+
$(OUTPUT_DIR)/$1 $2 | fgrep --color $3 || \
|
133
|
+
(echo "Expected $3, got $$($(OUTPUT_DIR)/$1 $2)"; false)
|
134
|
+
endef
|
135
|
+
|
136
|
+
ifdef IS_DARWIN
|
137
|
+
test : ARCH_STRING := $(ARCH)
|
138
|
+
else ifeq (i686,$(ARCH))
|
139
|
+
test : ARCH_STRING := Intel 80386
|
140
|
+
else ifeq (x86_64,$(ARCH))
|
141
|
+
test : ARCH_STRING := x86-64
|
142
|
+
endif
|
143
|
+
test :
|
144
|
+
$(if $(ARCH_STRING),,@echo Detecting 'ARCH $(ARCH) for OS $(OS) undefined'; false)
|
145
|
+
$(call check_bin,advpng,--version 2>&1,$(ADVANCECOMP_VER))
|
146
|
+
$(call check_bin,gifsicle,--version,$(GIFSICLE_VER))
|
147
|
+
$(call check_bin,jhead,-V,$(JHEAD_VER))
|
148
|
+
$(call check_bin,jpegoptim,--version,$(JPEGOPTIM_VER))
|
149
|
+
$(call check_bin,jpegtran,-v - 2>&1,$(LIBJPEG_VER))
|
150
|
+
$(call check_bin,optipng,--version,$(OPTIPNG_VER))
|
151
|
+
$(call check_bin,pngcrush,-version 2>&1,$(PNGCRUSH_VER))
|
152
|
+
$(call check_bin,pngquant,--help,$(PNGQUANT_VER))
|
153
|
+
|
154
|
+
livecheck : $(foreach archive,$(ARCHIVES),livecheck-$(call downcase,$(archive)))
|
155
|
+
|
156
|
+
update-versions :
|
157
|
+
cat Makefile | script/update_versions > Makefile.tmp
|
158
|
+
mv Makefile.tmp Makefile
|
159
|
+
|
160
|
+
# ====== CLEAN ======
|
161
|
+
|
162
|
+
clean :
|
163
|
+
rm -rf $(BUILD_DIR)
|
164
|
+
rm -rf $(OUTPUT_DIR)
|
165
|
+
|
166
|
+
clean-all :
|
167
|
+
rm -rf $(BUILD_ROOT_DIR)
|
168
|
+
rm -rf $(OUTPUT_ROOT_DIR)
|
169
|
+
|
170
|
+
clobber : clean-all
|
171
|
+
rm -rf $(DL_DIR)
|
172
|
+
|
173
|
+
# ====== BUILDING ======
|
174
|
+
|
175
|
+
# $1 - name of product
|
176
|
+
# $2 - list of dependency products
|
177
|
+
define depend
|
178
|
+
# depend this product on every specified product
|
179
|
+
$$($1_TARGET) : $(foreach dep,$2,$$($(dep)_TARGET))
|
180
|
+
# depend output of this product on output of every specified product
|
181
|
+
$$(OUTPUT_DIR)/$$($1_BASENAME) : $(foreach dep,$2,$$(OUTPUT_DIR)/$$($(dep)_BASENAME))
|
182
|
+
# add dependent product dir to CPATH, LIBRARY_PATH and PKG_CONFIG_PATH
|
183
|
+
$($1_TARGET) : export CPATH := $(subst $(eval) ,:,$(foreach dep,$2,$$($(dep)_DIR)))
|
184
|
+
$($1_TARGET) : export LIBRARY_PATH := $$(CPATH)
|
185
|
+
$($1_TARGET) : export PKG_CONFIG_PATH := $$(CPATH)
|
186
|
+
endef
|
187
|
+
|
188
|
+
define clean_untar
|
189
|
+
rm -rf $(@D)
|
190
|
+
$(mkpath) $(@D)
|
191
|
+
tar -C $(@D) --strip-components=1 -m -xzf $<
|
192
|
+
touch $(@D)/__$(notdir $<)__
|
193
|
+
endef
|
194
|
+
|
195
|
+
pkgconfig_pwd = perl -pi -e 's/(?<=dir=).*/$$ENV{PWD}/'
|
196
|
+
|
197
|
+
libtool_target_soname = cd $(@D) && perl -pi -e 's/(?<=soname_spec=)".*"/"$(@F)"/' -- libtool
|
198
|
+
|
199
|
+
chrpath_origin = $(if $(IS_DARWIN),,chrpath -r '$$ORIGIN' $1)
|
200
|
+
|
201
|
+
XORIGIN := -Wl,-rpath,XORIGIN
|
202
|
+
XORIGIN := $(if $(IS_DARWIN),,$(XORIGIN))
|
203
|
+
|
204
|
+
export CC = gcc
|
205
|
+
export CXX = g++
|
206
|
+
|
207
|
+
GCC_FLAGS := -O3
|
208
|
+
ifdef IS_DARWIN
|
209
|
+
GCC_FLAGS += -arch $(ARCH)
|
210
|
+
else
|
211
|
+
GCC_FLAGS += -s
|
212
|
+
endif
|
213
|
+
export CFLAGS := $(GCC_FLAGS)
|
214
|
+
export CXXFLAGS := $(GCC_FLAGS)
|
215
|
+
export CPPFLAGS := $(GCC_FLAGS)
|
216
|
+
export LDFLAGS := $(GCC_FLAGS)
|
217
|
+
|
218
|
+
ifdef IS_DARWIN
|
219
|
+
export MACOSX_DEPLOYMENT_TARGET=10.6
|
220
|
+
endif
|
221
|
+
|
222
|
+
## advpng
|
223
|
+
$(eval $(call depend,ADVPNG,LIBZ))
|
224
|
+
$(ADVPNG_TARGET) :; $(clean_untar)
|
225
|
+
cd $(@D) && ./configure LDFLAGS="$(XORIGIN)"
|
226
|
+
cd $(@D) && $(MAKE) advpng
|
227
|
+
$(call chrpath_origin,$@)
|
228
|
+
|
229
|
+
## gifsicle
|
230
|
+
$(GIFSICLE_TARGET) :; $(clean_untar)
|
231
|
+
cd $(@D) && ./configure
|
232
|
+
cd $(@D) && $(MAKE) gifsicle
|
233
|
+
cd $(@D) && $(ln_s) src/gifsicle .
|
234
|
+
|
235
|
+
## jhead
|
236
|
+
$(JHEAD_TARGET) :; $(clean_untar)
|
237
|
+
cd $(@D) && $(MAKE) jhead CC="$(CC) $(GCC_FLAGS)"
|
238
|
+
|
239
|
+
## jpegoptim
|
240
|
+
$(eval $(call depend,JPEGOPTIM,LIBJPEG))
|
241
|
+
$(JPEGOPTIM_TARGET) :; $(clean_untar)
|
242
|
+
cd $(@D) && ./configure LDFLAGS="$(XORIGIN)"
|
243
|
+
cd $(@D) && $(MAKE) jpegoptim
|
244
|
+
$(call chrpath_origin,$@)
|
245
|
+
|
246
|
+
## jpegtran
|
247
|
+
$(eval $(call depend,JPEGTRAN,LIBJPEG))
|
248
|
+
$(JPEGTRAN_TARGET) :; # built in $(LIBJPEG_TARGET)
|
249
|
+
|
250
|
+
## libjpeg
|
251
|
+
$(LIBJPEG_TARGET) :; $(clean_untar)
|
252
|
+
cd $(@D) && ./configure CC="$(CC) $(GCC_FLAGS)"
|
253
|
+
$(libtool_target_soname)
|
254
|
+
ifdef IS_DARWIN
|
255
|
+
cd $(@D) && $(MAKE) libjpeg.la LDFLAGS="-Wl,-install_name,@loader_path/$(@F)"
|
256
|
+
else
|
257
|
+
cd $(@D) && $(MAKE) libjpeg.la
|
258
|
+
endif
|
259
|
+
cd $(@D) && $(MAKE) jpegtran LDFLAGS="$(XORIGIN)"
|
260
|
+
cd $(@D) && $(ln_s) .libs/libjpeg$(DLEXT) .libs/jpegtran .
|
261
|
+
$(call chrpath_origin,$(JPEGTRAN_TARGET))
|
262
|
+
|
263
|
+
## libpng
|
264
|
+
$(eval $(call depend,LIBPNG,LIBZ))
|
265
|
+
$(LIBPNG_TARGET) :; $(clean_untar)
|
266
|
+
cd $(@D) && ./configure CC="$(CC) $(GCC_FLAGS)"
|
267
|
+
cd $(@D) && $(pkgconfig_pwd) -- *.pc
|
268
|
+
cd $(@D) && perl -pi -e 's/(?<=lpng)\d+//g' -- *.pc # %MAJOR%%MINOR% suffix
|
269
|
+
$(libtool_target_soname)
|
270
|
+
ifdef IS_DARWIN
|
271
|
+
cd $(@D) && $(MAKE) libpng16.la LDFLAGS="-Wl,-install_name,@loader_path/$(@F)"
|
272
|
+
else
|
273
|
+
cd $(@D) && $(MAKE) libpng16.la LDFLAGS="$(XORIGIN)"
|
274
|
+
endif
|
275
|
+
cd $(@D) && $(ln_s) .libs/libpng16$(DLEXT) libpng$(DLEXT)
|
276
|
+
$(call chrpath_origin,$@)
|
277
|
+
|
278
|
+
## libz
|
279
|
+
ifdef IS_DARWIN
|
280
|
+
$(LIBZ_TARGET) : export LDSHARED = $(CC) -dynamiclib -install_name @loader_path/$(@F) -compatibility_version 1 -current_version $(LIBZ_VER)
|
281
|
+
else
|
282
|
+
$(LIBZ_TARGET) : export LDSHARED = $(CC) -shared -Wl,-soname,$(@F),--version-script,zlib.map
|
283
|
+
endif
|
284
|
+
$(LIBZ_TARGET) :; $(clean_untar)
|
285
|
+
cd $(@D) && ./configure
|
286
|
+
cd $(@D) && $(pkgconfig_pwd) -- *.pc
|
287
|
+
cd $(@D) && $(MAKE) placebo
|
288
|
+
|
289
|
+
## optipng
|
290
|
+
$(eval $(call depend,OPTIPNG,LIBPNG LIBZ))
|
291
|
+
$(OPTIPNG_TARGET) :; $(clean_untar)
|
292
|
+
cd $(@D) && ./configure -with-system-libs
|
293
|
+
cd $(@D) && $(MAKE) all LDFLAGS="$(XORIGIN) $(GCC_FLAGS)"
|
294
|
+
cd $(@D) && $(ln_s) src/optipng/optipng .
|
295
|
+
$(call chrpath_origin,$@)
|
296
|
+
|
297
|
+
## pngcrush
|
298
|
+
$(eval $(call depend,PNGCRUSH,LIBPNG LIBZ))
|
299
|
+
$(PNGCRUSH_TARGET) :; $(clean_untar)
|
300
|
+
cd $(@D) && rm -f png.h pngconf.h
|
301
|
+
cd $(@D) && $(MAKE) -f Makefile-nolib pngcrush \
|
302
|
+
LIBS="-lpng -lz -lm" \
|
303
|
+
CFLAGS="$(GCC_FLAGS)" \
|
304
|
+
LDFLAGS="$(XORIGIN) $(GCC_FLAGS)"
|
305
|
+
$(call chrpath_origin,$@)
|
306
|
+
|
307
|
+
## pngquant
|
308
|
+
$(eval $(call depend,PNGQUANT,LIBPNG LIBZ))
|
309
|
+
$(PNGQUANT_TARGET) :; $(clean_untar)
|
310
|
+
cd $(@D) && ./configure --without-cocoa --extra-ldflags="$(XORIGIN)"
|
311
|
+
cd $(@D) && $(MAKE) pngquant
|
312
|
+
$(call chrpath_origin,$@)
|
data/README.markdown
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
[![Gem Version](https://img.shields.io/gem/v/image_optim_pack.svg?style=flat)](https://rubygems.org/gems/image_optim_pack)
|
2
|
+
[![Build Status](https://img.shields.io/travis/toy/image_optim_pack/master.svg?style=flat)](https://travis-ci.org/toy/image_optim_pack)
|
3
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/toy/image_optim_pack.svg?style=flat)](https://codeclimate.com/github/toy/image_optim_pack)
|
4
|
+
[![Dependency Status](https://img.shields.io/gemnasium/toy/image_optim_pack.svg?style=flat)](https://gemnasium.com/toy/image_optim_pack)
|
5
|
+
[![Inch CI](http://inch-ci.org/github/toy/image_optim_pack.svg?branch=master&style=flat)](http://inch-ci.org/github/toy/image_optim_pack)
|
6
|
+
|
7
|
+
# image\_optim\_pack
|
8
|
+
|
9
|
+
Precompiled binaries for [`image_optim`](https://github.com/toy/image_optim).
|
10
|
+
|
11
|
+
Contains binaries for Mac OS X (>= 10.6, i386 and x86\_64) and Linux (i686 and x86\_64).
|
12
|
+
|
13
|
+
## Binaries and libraries
|
14
|
+
|
15
|
+
* [advpng](http://advancemame.sourceforge.net/doc-advpng.html) by Andrea Mazzoleni and Filipe Estima ([GNU GPLv3](acknowledgements/advancecomp.txt))
|
16
|
+
* contains parts of [7z](http://7-zip.org) by Igor Pavlov with modifications by Andrea Mazzoleni ([license](acknowledgements/7z.txt))
|
17
|
+
* and [zopfli](https://code.google.com/p/zopfli/) by Lode Vandevenne and Jyrki ([license](acknowledgements/zopfli.txt), [contributors](acknowledgements/zopfli-contributors.txt))
|
18
|
+
* [gifsicle](http://lcdf.org/gifsicle/) by Eddie Kohler ([GNU GPLv2](acknowledgements/gifsicle.txt))
|
19
|
+
* [jhead](http://sentex.net/~mwandel/jhead/) by Matthias Wandel ([public domain](acknowledgements/jhead.txt))
|
20
|
+
* [jpegoptim](http://www.kokkonen.net/tjko/projects.html) by Timo Kokkonen ([GNU GPLv2](acknowledgements/jpegoptim.txt) or later)
|
21
|
+
* [libjpeg and jpegtran](http://ijg.org/) by the Independent JPEG Group ([license](acknowledgements/libjpeg.txt))
|
22
|
+
* [libpng](http://libpng.org/pub/png/) by Guy Eric Schalnat, Andreas Dilger, Glenn Randers-Pehrson and others ([license](acknowledgements/libpng.txt))
|
23
|
+
* [optipng](http://optipng.sourceforge.net/) by Cosmin Truta ([license](acknowledgements/optipng.txt), [authors](acknowledgements/optipng-authors.txt))
|
24
|
+
* contains code based in part on the work of Miyasaka Masaru for BMP support ([license](acknowledgements/bmp2png.txt))
|
25
|
+
* and David Koblas for GIF support ([license](acknowledgements/gifread.txt))
|
26
|
+
* [pngcrush](http://pmt.sourceforge.net/pngcrush/) by Glenn Randers-Pehrson, portions by Greg Roelofs ([license](acknowledgements/pngcrush.txt))
|
27
|
+
* contains [cexcept](http://www.nicemice.net/cexcept/) interface by Adam M. Costello and Cosmin Truta ([license](acknowledgements/cexcept.txt))
|
28
|
+
* [pngquant](http://pngquant.org/) by Kornel Lesiński based on code by Greg Roelofs and Jef Poskanzer after an idea by Stefan Schneider ([license](acknowledgements/pngquant.txt))
|
29
|
+
* [zlib](http://zlib.net/) by Jean-Loup Gailly and Mark Adler ([license](acknowledgements/zlib.txt))
|
30
|
+
|
31
|
+
You can download all source code using gnu make download target:
|
32
|
+
|
33
|
+
```sh
|
34
|
+
make download
|
35
|
+
```
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
|
39
|
+
```sh
|
40
|
+
gem install image_optim image_optim_pack
|
41
|
+
```
|
42
|
+
|
43
|
+
Or add to your `Gemfile`:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
gem 'image_optim'
|
47
|
+
gem 'image_optim_pack'
|
48
|
+
```
|
49
|
+
|
50
|
+
## Development
|
51
|
+
|
52
|
+
Mac OS X binaries and libraries are built on host, others using vagrant.
|
53
|
+
|
54
|
+
```sh
|
55
|
+
script/run # Build and test all for all oses and architectures
|
56
|
+
script/run NO_HALT=1 # Don't halt VMs after building
|
57
|
+
|
58
|
+
make all # Build and copy all to output directory for current os/arch, then test
|
59
|
+
make run # => all
|
60
|
+
|
61
|
+
make test # Test bins for current os/arch
|
62
|
+
make test -i # Continue if one of bins fail
|
63
|
+
|
64
|
+
make download # Download archives
|
65
|
+
make build # Build all without copying to output directory
|
66
|
+
|
67
|
+
make livecheck # Check versions
|
68
|
+
make update-versions # Update versions in Makefile
|
69
|
+
|
70
|
+
make clean # Remove build and output directories for current os/arch
|
71
|
+
make clean-all # Remove build root and output root directories
|
72
|
+
make clobber # `claen-all` and remove download directory
|
73
|
+
```
|
74
|
+
|
75
|
+
## Copyright
|
76
|
+
|
77
|
+
Copyright (c) 2014 Ivan Kuchin. See [LICENSE.txt](LICENSE.txt) for details.
|