blurhash 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/gempush.yml +41 -0
- data/.gitignore +3 -0
- data/.travis.yml +13 -2
- data/Gemfile.lock +20 -22
- data/README.md +3 -1
- data/Rakefile +2 -2
- data/blurhash.gemspec +3 -4
- data/ext/blurhash/extconf.rb +1 -0
- data/lib/blurhash.rb +36 -1
- data/lib/blurhash/version.rb +1 -1
- metadata +10 -25
- data/ext/blurhash/Makefile +0 -263
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 381e067e655d0fd61e599af18c7951edc74633aecd10f772d51a62663fd5ed81
|
4
|
+
data.tar.gz: ebf8bf63a7298910138bca9f3a5b474b20faf6fba714e37e29e4dcf2d9af220c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3205e7819848acf8d93556798220a6ce35e0573ad9158d39a8d506bd9e4ce4eede390e48ca7d0267afd6d4900930348d933a50c9d150394cfc73f7d70dc491fa
|
7
|
+
data.tar.gz: c13a6011e9b751b18f75c775528109f49ceb7b4e54c502425b859fd851c7887be82fe8737d1ef53df127edc3933d944dbbc645a75edc4647acf6a84d77f332ae
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
name: Build + Publish
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@master
|
15
|
+
- name: Set up Ruby 2.6
|
16
|
+
uses: actions/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
version: 2.6.x
|
19
|
+
|
20
|
+
- name: Publish to GPR
|
21
|
+
run: |
|
22
|
+
mkdir -p $HOME/.gem
|
23
|
+
touch $HOME/.gem/credentials
|
24
|
+
chmod 0600 $HOME/.gem/credentials
|
25
|
+
printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
26
|
+
gem build *.gemspec
|
27
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
28
|
+
env:
|
29
|
+
GEM_HOST_API_KEY: ${{secrets.GPR_AUTH_TOKEN}}
|
30
|
+
OWNER: Gargron
|
31
|
+
|
32
|
+
- name: Publish to RubyGems
|
33
|
+
run: |
|
34
|
+
mkdir -p $HOME/.gem
|
35
|
+
touch $HOME/.gem/credentials
|
36
|
+
chmod 0600 $HOME/.gem/credentials
|
37
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
38
|
+
gem build *.gemspec
|
39
|
+
gem push *.gem
|
40
|
+
env:
|
41
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,5 +1,16 @@
|
|
1
|
+
arch:
|
2
|
+
- amd64
|
3
|
+
- arm64
|
4
|
+
- ppc64le
|
5
|
+
- s390x
|
6
|
+
addons:
|
7
|
+
apt:
|
8
|
+
packages:
|
9
|
+
- libmagick++-dev
|
1
10
|
sudo: false
|
2
11
|
language: ruby
|
3
12
|
rvm:
|
4
|
-
- 2.
|
5
|
-
|
13
|
+
- 2.7.0
|
14
|
+
- 2.6.5
|
15
|
+
- 2.6.1
|
16
|
+
before_install: gem install bundler -v 2.1.4
|
data/Gemfile.lock
CHANGED
@@ -1,42 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
blurhash (0.1.
|
5
|
-
ffi (~> 1.
|
4
|
+
blurhash (0.1.5)
|
5
|
+
ffi (~> 1.14)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
diff-lcs (1.
|
11
|
-
ffi (1.
|
12
|
-
rake (
|
13
|
-
rake-compiler (1.
|
10
|
+
diff-lcs (1.4.4)
|
11
|
+
ffi (1.14.2)
|
12
|
+
rake (13.0.3)
|
13
|
+
rake-compiler (1.1.1)
|
14
14
|
rake
|
15
|
-
|
16
|
-
|
17
|
-
rspec-
|
18
|
-
rspec-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
rspec-expectations (3.8.2)
|
15
|
+
rspec (3.10.0)
|
16
|
+
rspec-core (~> 3.10.0)
|
17
|
+
rspec-expectations (~> 3.10.0)
|
18
|
+
rspec-mocks (~> 3.10.0)
|
19
|
+
rspec-core (3.10.1)
|
20
|
+
rspec-support (~> 3.10.0)
|
21
|
+
rspec-expectations (3.10.1)
|
23
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
-
rspec-support (~> 3.
|
25
|
-
rspec-mocks (3.
|
23
|
+
rspec-support (~> 3.10.0)
|
24
|
+
rspec-mocks (3.10.1)
|
26
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-support (3.
|
26
|
+
rspec-support (~> 3.10.0)
|
27
|
+
rspec-support (3.10.1)
|
29
28
|
|
30
29
|
PLATFORMS
|
31
30
|
ruby
|
32
31
|
|
33
32
|
DEPENDENCIES
|
34
33
|
blurhash!
|
35
|
-
bundler (~>
|
36
|
-
rake (~>
|
34
|
+
bundler (~> 2.0)
|
35
|
+
rake (~> 13.0)
|
37
36
|
rake-compiler
|
38
|
-
rmagick (~> 3.1.0)
|
39
37
|
rspec (~> 3.0)
|
40
38
|
|
41
39
|
BUNDLED WITH
|
42
|
-
|
40
|
+
2.2.7
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
To generate the blurhash string from an image file, you need to read in the image pixel data yourself, for example with RMagick:
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
require 'blurhash'
|
@@ -33,6 +33,8 @@ image = Magick::ImageList.new('foo.png')
|
|
33
33
|
puts Blurhash.encode(image.columns, image.rows, image.export_pixels)
|
34
34
|
```
|
35
35
|
|
36
|
+
To display the visual component once you have the blurhash string, you need another library in JavaScript, Swift, Kotlin and so on. Fore more information, see [the original blurhash repository](https://github.com/woltapp/blurhash).
|
37
|
+
|
36
38
|
## Development
|
37
39
|
|
38
40
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/Rakefile
CHANGED
@@ -8,8 +8,8 @@ require "rake/extensiontask"
|
|
8
8
|
task :build => :compile
|
9
9
|
|
10
10
|
Rake::ExtensionTask.new("blurhash") do |ext|
|
11
|
-
ext.name
|
12
|
-
ext.lib_dir = "
|
11
|
+
ext.name = "encode"
|
12
|
+
ext.lib_dir = "ext/blurhash"
|
13
13
|
end
|
14
14
|
|
15
15
|
task :default => [:clobber, :compile, :spec]
|
data/blurhash.gemspec
CHANGED
@@ -21,11 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
spec.extensions = ['ext/blurhash/extconf.rb']
|
23
23
|
|
24
|
-
spec.add_dependency 'ffi', '~> 1.
|
24
|
+
spec.add_dependency 'ffi', '~> 1.14'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
27
|
-
spec.add_development_dependency 'rake', '~>
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
27
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
28
28
|
spec.add_development_dependency 'rake-compiler'
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
-
spec.add_development_dependency 'rmagick', '~> 3.1.0'
|
31
30
|
end
|
data/ext/blurhash/extconf.rb
CHANGED
data/lib/blurhash.rb
CHANGED
@@ -11,11 +11,46 @@ module Blurhash
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
def self.components(str)
|
15
|
+
size_flag = Base83.decode83(str[0])
|
16
|
+
y_comp = (size_flag / 9) + 1
|
17
|
+
x_comp = (size_flag % 9) + 1
|
18
|
+
|
19
|
+
return if str.size != 4 + 2 * x_comp * y_comp
|
20
|
+
|
21
|
+
[x_comp, y_comp]
|
22
|
+
end
|
23
|
+
|
14
24
|
module Unstable
|
15
25
|
extend FFI::Library
|
16
|
-
ffi_lib File.join(File.expand_path(
|
26
|
+
ffi_lib File.join(File.expand_path(File.dirname(__FILE__)), '..', 'ext', 'blurhash', 'encode.' + RbConfig::CONFIG['DLEXT'])
|
17
27
|
attach_function :blurHashForPixels, %i(int int int int pointer size_t), :string
|
18
28
|
end
|
19
29
|
|
30
|
+
module Base83
|
31
|
+
DIGIT_CHARACTERS = %w(
|
32
|
+
0 1 2 3 4 5 6 7 8 9
|
33
|
+
A B C D E F G H I J
|
34
|
+
K L M N O P Q R S T
|
35
|
+
U V W X Y Z a b c d
|
36
|
+
e f g h i j k l m n
|
37
|
+
o p q r s t u v w x
|
38
|
+
y z # $ % * + - .
|
39
|
+
: ; = ? @ [ ] ^ _ {
|
40
|
+
| } ~
|
41
|
+
).freeze
|
42
|
+
|
43
|
+
def self.decode83(str)
|
44
|
+
value = 0
|
45
|
+
|
46
|
+
str.each_char.with_index do |c, i|
|
47
|
+
digit = DIGIT_CHARACTERS.find_index(c)
|
48
|
+
value = value * 83 + digit
|
49
|
+
end
|
50
|
+
|
51
|
+
value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
20
55
|
private_constant :Unstable
|
21
56
|
end
|
data/lib/blurhash/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blurhash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugen Rochko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.14'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: '1.14'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake-compiler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rmagick
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 3.1.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 3.1.0
|
97
83
|
description:
|
98
84
|
email:
|
99
85
|
- eugen@zeonfederated.com
|
@@ -102,6 +88,7 @@ extensions:
|
|
102
88
|
- ext/blurhash/extconf.rb
|
103
89
|
extra_rdoc_files: []
|
104
90
|
files:
|
91
|
+
- ".github/workflows/gempush.yml"
|
105
92
|
- ".gitignore"
|
106
93
|
- ".rspec"
|
107
94
|
- ".travis.yml"
|
@@ -114,7 +101,6 @@ files:
|
|
114
101
|
- bin/console
|
115
102
|
- bin/setup
|
116
103
|
- blurhash.gemspec
|
117
|
-
- ext/blurhash/Makefile
|
118
104
|
- ext/blurhash/encode.c
|
119
105
|
- ext/blurhash/encode.h
|
120
106
|
- ext/blurhash/extconf.rb
|
@@ -139,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
125
|
- !ruby/object:Gem::Version
|
140
126
|
version: '0'
|
141
127
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.6.13
|
128
|
+
rubygems_version: 3.0.3
|
144
129
|
signing_key:
|
145
130
|
specification_version: 4
|
146
131
|
summary: Encode an image as a small string that can saved in the database and used
|
data/ext/blurhash/Makefile
DELETED
@@ -1,263 +0,0 @@
|
|
1
|
-
|
2
|
-
SHELL = /bin/sh
|
3
|
-
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
-
V = 0
|
6
|
-
Q1 = $(V:1=)
|
7
|
-
Q = $(Q1:0=@)
|
8
|
-
ECHO1 = $(V:1=@ :)
|
9
|
-
ECHO = $(ECHO1:0=@ echo)
|
10
|
-
NULLCMD = :
|
11
|
-
|
12
|
-
#### Start of system configuration section. ####
|
13
|
-
|
14
|
-
srcdir = .
|
15
|
-
topdir = /home/eugr/.rbenv/versions/2.4.2/include/ruby-2.4.0
|
16
|
-
hdrdir = $(topdir)
|
17
|
-
arch_hdrdir = /home/eugr/.rbenv/versions/2.4.2/include/ruby-2.4.0/x86_64-linux
|
18
|
-
PATH_SEPARATOR = :
|
19
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
-
prefix = $(DESTDIR)/home/eugr/.rbenv/versions/2.4.2
|
21
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
-
exec_prefix = $(prefix)
|
25
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
-
sitedir = $(rubylibprefix)/site_ruby
|
37
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
-
archincludedir = $(includedir)/$(arch)
|
41
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
-
archlibdir = $(libdir)/$(arch)
|
43
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
-
mandir = $(datarootdir)/man
|
45
|
-
localedir = $(datarootdir)/locale
|
46
|
-
libdir = $(exec_prefix)/lib
|
47
|
-
psdir = $(docdir)
|
48
|
-
pdfdir = $(docdir)
|
49
|
-
dvidir = $(docdir)
|
50
|
-
htmldir = $(docdir)
|
51
|
-
infodir = $(datarootdir)/info
|
52
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
-
oldincludedir = $(DESTDIR)/usr/include
|
54
|
-
includedir = $(prefix)/include
|
55
|
-
localstatedir = $(prefix)/var
|
56
|
-
sharedstatedir = $(prefix)/com
|
57
|
-
sysconfdir = $(prefix)/etc
|
58
|
-
datadir = $(datarootdir)
|
59
|
-
datarootdir = $(prefix)/share
|
60
|
-
libexecdir = $(exec_prefix)/libexec
|
61
|
-
sbindir = $(exec_prefix)/sbin
|
62
|
-
bindir = $(exec_prefix)/bin
|
63
|
-
archdir = $(rubyarchdir)
|
64
|
-
|
65
|
-
|
66
|
-
CC = gcc
|
67
|
-
CXX = g++
|
68
|
-
LIBRUBY = $(LIBRUBY_A)
|
69
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
70
|
-
LIBRUBYARG_SHARED = -Wl,-rpath,$(libdir) -L$(libdir)
|
71
|
-
LIBRUBYARG_STATIC = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
|
72
|
-
empty =
|
73
|
-
OUTFLAG = -o $(empty)
|
74
|
-
COUTFLAG = -o $(empty)
|
75
|
-
CSRCFLAG = $(empty)
|
76
|
-
|
77
|
-
RUBY_EXTCONF_H =
|
78
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
79
|
-
cxxflags = $(optflags) $(debugflags) $(warnflags)
|
80
|
-
optflags = -O3 -fno-fast-math
|
81
|
-
debugflags = -ggdb3
|
82
|
-
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wno-maybe-uninitialized
|
83
|
-
CCDLFLAGS = -fPIC
|
84
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) $(ARCH_FLAG)
|
85
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
86
|
-
DEFS =
|
87
|
-
CPPFLAGS = -I/home/eugr/.rbenv/versions/2.4.2/include $(DEFS) $(cppflags)
|
88
|
-
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
89
|
-
ldflags = -L. -L/home/eugr/.rbenv/versions/2.4.2/lib -fstack-protector -rdynamic -Wl,-export-dynamic
|
90
|
-
dldflags = -L/home/eugr/.rbenv/versions/2.4.2/lib -Wl,--compress-debug-sections=zlib
|
91
|
-
ARCH_FLAG =
|
92
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
93
|
-
LDSHARED = $(CC) -shared
|
94
|
-
LDSHAREDXX = $(CXX) -shared
|
95
|
-
AR = ar
|
96
|
-
EXEEXT =
|
97
|
-
|
98
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
99
|
-
RUBY_SO_NAME = ruby
|
100
|
-
RUBYW_INSTALL_NAME =
|
101
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
102
|
-
RUBYW_BASE_NAME = rubyw
|
103
|
-
RUBY_BASE_NAME = ruby
|
104
|
-
|
105
|
-
arch = x86_64-linux
|
106
|
-
sitearch = $(arch)
|
107
|
-
ruby_version = 2.4.0
|
108
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
109
|
-
RUBY = $(ruby)
|
110
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
111
|
-
|
112
|
-
RM = rm -f
|
113
|
-
RM_RF = $(RUBY) -run -e rm -- -rf
|
114
|
-
RMDIRS = rmdir --ignore-fail-on-non-empty -p
|
115
|
-
MAKEDIRS = /bin/mkdir -p
|
116
|
-
INSTALL = /usr/bin/install -c
|
117
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
118
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
119
|
-
COPY = cp
|
120
|
-
TOUCH = exit >
|
121
|
-
|
122
|
-
#### End of system configuration section. ####
|
123
|
-
|
124
|
-
preload =
|
125
|
-
libpath = . $(libdir)
|
126
|
-
LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir)
|
127
|
-
DEFFILE =
|
128
|
-
|
129
|
-
CLEANFILES = mkmf.log
|
130
|
-
DISTCLEANFILES =
|
131
|
-
DISTCLEANDIRS =
|
132
|
-
|
133
|
-
extout =
|
134
|
-
extout_prefix =
|
135
|
-
target_prefix =
|
136
|
-
LOCAL_LIBS =
|
137
|
-
LIBS = -lpthread -ldl -lcrypt -lm -lc
|
138
|
-
ORIG_SRCS = encode.c
|
139
|
-
SRCS = $(ORIG_SRCS)
|
140
|
-
OBJS = encode.o
|
141
|
-
HDRS = $(srcdir)/encode.h
|
142
|
-
LOCAL_HDRS =
|
143
|
-
TARGET = encode
|
144
|
-
TARGET_NAME = encode
|
145
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
146
|
-
DLLIB = $(TARGET).so
|
147
|
-
EXTSTATIC =
|
148
|
-
STATIC_LIB =
|
149
|
-
|
150
|
-
TIMESTAMP_DIR = .
|
151
|
-
BINDIR = $(bindir)
|
152
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
153
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
154
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
155
|
-
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
156
|
-
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
157
|
-
TARGET_SO_DIR =
|
158
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
159
|
-
CLEANLIBS = $(TARGET_SO)
|
160
|
-
CLEANOBJS = *.o *.bak
|
161
|
-
|
162
|
-
all: $(DLLIB)
|
163
|
-
static: $(STATIC_LIB)
|
164
|
-
.PHONY: all install static install-so install-rb
|
165
|
-
.PHONY: clean clean-so clean-static clean-rb
|
166
|
-
|
167
|
-
clean-static::
|
168
|
-
clean-rb-default::
|
169
|
-
clean-rb::
|
170
|
-
clean-so::
|
171
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
172
|
-
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
173
|
-
|
174
|
-
distclean-rb-default::
|
175
|
-
distclean-rb::
|
176
|
-
distclean-so::
|
177
|
-
distclean-static::
|
178
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
179
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
180
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
181
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
182
|
-
|
183
|
-
realclean: distclean
|
184
|
-
install: install-so install-rb
|
185
|
-
|
186
|
-
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
|
187
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
188
|
-
clean-static::
|
189
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
190
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
191
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
192
|
-
pre-install-rb: Makefile
|
193
|
-
pre-install-rb-default: Makefile
|
194
|
-
do-install-rb:
|
195
|
-
do-install-rb-default:
|
196
|
-
pre-install-rb-default:
|
197
|
-
@$(NULLCMD)
|
198
|
-
$(TIMESTAMP_DIR)/.sitearchdir.time:
|
199
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
200
|
-
$(Q) $(TOUCH) $@
|
201
|
-
|
202
|
-
site-install: site-install-so site-install-rb
|
203
|
-
site-install-so: install-so
|
204
|
-
site-install-rb: install-rb
|
205
|
-
|
206
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
207
|
-
|
208
|
-
.cc.o:
|
209
|
-
$(ECHO) compiling $(<)
|
210
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
211
|
-
|
212
|
-
.cc.S:
|
213
|
-
$(ECHO) translating $(<)
|
214
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
215
|
-
|
216
|
-
.mm.o:
|
217
|
-
$(ECHO) compiling $(<)
|
218
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
219
|
-
|
220
|
-
.mm.S:
|
221
|
-
$(ECHO) translating $(<)
|
222
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
223
|
-
|
224
|
-
.cxx.o:
|
225
|
-
$(ECHO) compiling $(<)
|
226
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
227
|
-
|
228
|
-
.cxx.S:
|
229
|
-
$(ECHO) translating $(<)
|
230
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
231
|
-
|
232
|
-
.cpp.o:
|
233
|
-
$(ECHO) compiling $(<)
|
234
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
235
|
-
|
236
|
-
.cpp.S:
|
237
|
-
$(ECHO) translating $(<)
|
238
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
239
|
-
|
240
|
-
.c.o:
|
241
|
-
$(ECHO) compiling $(<)
|
242
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
243
|
-
|
244
|
-
.c.S:
|
245
|
-
$(ECHO) translating $(<)
|
246
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
247
|
-
|
248
|
-
.m.o:
|
249
|
-
$(ECHO) compiling $(<)
|
250
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
251
|
-
|
252
|
-
.m.S:
|
253
|
-
$(ECHO) translating $(<)
|
254
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
255
|
-
|
256
|
-
$(TARGET_SO): $(OBJS) Makefile
|
257
|
-
$(ECHO) linking shared-object $(DLLIB)
|
258
|
-
-$(Q)$(RM) $(@)
|
259
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|