emf2svg 1.3.0-x86_64-linux → 1.4.1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +201 -0
- data/.github/workflows/release.yml +67 -62
- data/.rubocop.yml +1 -1
- data/README.adoc +124 -47
- data/Rakefile +0 -8
- data/emf2svg.gemspec +1 -1
- data/lib/emf2svg/libemf2svg.so +0 -0
- data/lib/emf2svg/recipe.rb +23 -22
- data/lib/emf2svg/version.rb +1 -1
- metadata +4 -4
- data/.github/workflows/main.yml +0 -167
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da3b471f051656dd1be3fc81413e748e01b33abb436285b1128412c0bed1f19a
|
4
|
+
data.tar.gz: d56a6b7b629c0da26e21bc419be2dd7692143dec4a0c55e05ffd7c2327509703
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d6c8a9d8a000b26551704099637136de0fbe1323ec526aa4783c00b46367801b3e93effa985945fbd0861dfc25ba934efde893a59d822f7f641930a0d057e8d
|
7
|
+
data.tar.gz: f946faacc7234282f455b6a038e9ef836835835da81c0fc620fcda91f2fe3abb34bb8380198765c5751a6f5ab3097c192b834084a0c99a83fcf699b91c863112
|
@@ -0,0 +1,201 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
paths-ignore:
|
7
|
+
- '*.adoc'
|
8
|
+
pull_request:
|
9
|
+
workflow_dispatch:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
test:
|
13
|
+
runs-on: ${{ matrix.os }}
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
|
18
|
+
ruby-version: [ '2.7' ]
|
19
|
+
include:
|
20
|
+
- os: windows-latest
|
21
|
+
ruby-version: '3.1'
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v3
|
24
|
+
|
25
|
+
- uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
bundler-cache: true
|
28
|
+
ruby-version: ${{ matrix.ruby-version }}
|
29
|
+
|
30
|
+
# https://github.com/microsoft/vcpkg/issues/15931
|
31
|
+
# no good solution :(
|
32
|
+
- name: Workaround for vcpkg
|
33
|
+
if: startsWith(matrix.os, 'ubuntu')
|
34
|
+
run: |
|
35
|
+
sudo apt-get update
|
36
|
+
sudo apt-get install gperf
|
37
|
+
|
38
|
+
- run: bundle exec rake
|
39
|
+
|
40
|
+
build:
|
41
|
+
name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
|
42
|
+
runs-on: ${{ matrix.os }}
|
43
|
+
strategy:
|
44
|
+
fail-fast: false
|
45
|
+
matrix:
|
46
|
+
include:
|
47
|
+
- os: ubuntu-18.04
|
48
|
+
platform: any
|
49
|
+
ruby-version: '2.7'
|
50
|
+
file: 'skip'
|
51
|
+
- os: ubuntu-18.04
|
52
|
+
platform: x86_64-linux
|
53
|
+
ruby-version: '2.7'
|
54
|
+
file: 'ELF 64-bit LSB shared object, x86-64'
|
55
|
+
- os: windows-latest
|
56
|
+
platform: x64-mingw32
|
57
|
+
ruby-version: '2.7'
|
58
|
+
file: 'skip'
|
59
|
+
- os: windows-latest
|
60
|
+
platform: x64-mingw-ucrt
|
61
|
+
ruby-version: '3.1'
|
62
|
+
file: 'skip'
|
63
|
+
- os: macos-latest
|
64
|
+
platform: x86_64-darwin
|
65
|
+
ruby-version: '2.7'
|
66
|
+
file: 'Mach-O 64-bit dynamically linked shared library x86_64'
|
67
|
+
steps:
|
68
|
+
- uses: actions/checkout@v3
|
69
|
+
|
70
|
+
- uses: ruby/setup-ruby@v1
|
71
|
+
with:
|
72
|
+
ruby-version: ${{ matrix.ruby-version }}
|
73
|
+
bundler-cache: true
|
74
|
+
|
75
|
+
- name: Workaround for vcpkg
|
76
|
+
if: startsWith(matrix.os, 'ubuntu')
|
77
|
+
run: |
|
78
|
+
sudo apt-get update
|
79
|
+
sudo apt-get install gperf
|
80
|
+
|
81
|
+
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
82
|
+
|
83
|
+
- uses: actions/upload-artifact@v2
|
84
|
+
with:
|
85
|
+
name: pkg
|
86
|
+
path: pkg/*.gem
|
87
|
+
|
88
|
+
- name: Install gem
|
89
|
+
run: gem install -b pkg/emf2svg-*.gem
|
90
|
+
|
91
|
+
- name: Test conversion
|
92
|
+
run: |
|
93
|
+
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
94
|
+
|
95
|
+
- name: Check file format
|
96
|
+
if: matrix.file != 'skip'
|
97
|
+
run: file $(ls pkg/*/lib/emf2svg/libemf2svg.*) | grep "${{ matrix.file }}"
|
98
|
+
|
99
|
+
test-build:
|
100
|
+
needs: build
|
101
|
+
runs-on: ${{ matrix.os }}
|
102
|
+
strategy:
|
103
|
+
fail-fast: false
|
104
|
+
matrix:
|
105
|
+
include:
|
106
|
+
- os: ubuntu-latest
|
107
|
+
platform: any
|
108
|
+
ruby-version: '2.7'
|
109
|
+
- os: windows-latest
|
110
|
+
platform: any
|
111
|
+
ruby-version: '2.7'
|
112
|
+
- os: macos-latest
|
113
|
+
platform: any
|
114
|
+
ruby-version: '2.7'
|
115
|
+
- os: ubuntu-18.04
|
116
|
+
platform: x86_64-linux
|
117
|
+
ruby-version: '2.7'
|
118
|
+
- os: ubuntu-latest
|
119
|
+
platform: x86_64-linux
|
120
|
+
ruby-version: '2.7'
|
121
|
+
- os: windows-latest
|
122
|
+
platform: x64-mingw32
|
123
|
+
ruby-version: '2.7'
|
124
|
+
- os: windows-latest
|
125
|
+
platform: x64-mingw-ucrt
|
126
|
+
ruby-version: '3.1'
|
127
|
+
- os: macos-latest
|
128
|
+
platform: x86_64-darwin
|
129
|
+
ruby-version: '2.7'
|
130
|
+
|
131
|
+
steps:
|
132
|
+
- uses: actions/checkout@v2
|
133
|
+
|
134
|
+
- uses: ruby/setup-ruby@v1
|
135
|
+
with:
|
136
|
+
ruby-version: ${{ matrix.ruby-version }}
|
137
|
+
|
138
|
+
- uses: actions/download-artifact@v2
|
139
|
+
with:
|
140
|
+
name: pkg
|
141
|
+
path: pkg
|
142
|
+
|
143
|
+
- name: Workaround for vcpkg
|
144
|
+
if: startsWith(matrix.os, 'ubuntu')
|
145
|
+
run: |
|
146
|
+
sudo apt-get update
|
147
|
+
sudo apt-get install gperf
|
148
|
+
|
149
|
+
- name: Install native gem
|
150
|
+
if: matrix.platform == 'any'
|
151
|
+
run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem
|
152
|
+
|
153
|
+
- name: Install binary gem
|
154
|
+
if: matrix.platform != 'any'
|
155
|
+
run: gem install -b pkg/emf2svg-*-${{ matrix.platform }}.gem
|
156
|
+
|
157
|
+
- name: Test conversion
|
158
|
+
run: |
|
159
|
+
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
160
|
+
|
161
|
+
cross:
|
162
|
+
name: build ${{ matrix.os }}, ${{ matrix.ruby-version }}, ${{ matrix.platform }}
|
163
|
+
runs-on: ${{ matrix.os }}
|
164
|
+
strategy:
|
165
|
+
fail-fast: false
|
166
|
+
matrix:
|
167
|
+
include:
|
168
|
+
- os: ubuntu-latest
|
169
|
+
platform: aarch64-linux
|
170
|
+
ruby-version: '2.7'
|
171
|
+
file: 'ELF 64-bit LSB shared object, ARM aarch64'
|
172
|
+
- os: macos-latest
|
173
|
+
platform: arm64-darwin
|
174
|
+
ruby-version: '2.7'
|
175
|
+
file: 'Mach-O 64-bit dynamically linked shared library arm64'
|
176
|
+
steps:
|
177
|
+
- uses: actions/checkout@v3
|
178
|
+
|
179
|
+
- name: Install packages
|
180
|
+
if: matrix.os == 'ubuntu-latest'
|
181
|
+
run: |
|
182
|
+
sudo apt-get update
|
183
|
+
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
184
|
+
|
185
|
+
- uses: ruby/setup-ruby@v1
|
186
|
+
with:
|
187
|
+
ruby-version: ${{ matrix.ruby-version }}
|
188
|
+
bundler-cache: true
|
189
|
+
|
190
|
+
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
191
|
+
|
192
|
+
- uses: actions/upload-artifact@v2
|
193
|
+
with:
|
194
|
+
name: pkg
|
195
|
+
path: pkg/*.gem
|
196
|
+
|
197
|
+
- name: Install gem
|
198
|
+
run: gem install -b pkg/emf2svg-*.gem
|
199
|
+
|
200
|
+
- name: Check file format
|
201
|
+
run: file $(ls pkg/*/lib/emf2svg/libemf2svg.*) | grep "${{ matrix.file }}"
|
@@ -9,7 +9,6 @@ jobs:
|
|
9
9
|
build:
|
10
10
|
runs-on: ${{ matrix.os }}
|
11
11
|
strategy:
|
12
|
-
max-parallel: 3
|
13
12
|
fail-fast: false
|
14
13
|
matrix:
|
15
14
|
include:
|
@@ -29,91 +28,97 @@ jobs:
|
|
29
28
|
platform: x86_64-darwin
|
30
29
|
ruby-version: '2.7'
|
31
30
|
steps:
|
32
|
-
|
31
|
+
- uses: actions/checkout@v3
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
- uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby-version }}
|
36
|
+
bundler-cache: true
|
38
37
|
|
39
|
-
|
38
|
+
# https://github.com/microsoft/vcpkg/issues/15931
|
39
|
+
# no good solution :(
|
40
|
+
- name: Workaround for vcpkg
|
41
|
+
if: startsWith(matrix.os, 'ubuntu')
|
42
|
+
run: |
|
43
|
+
sudo apt-get update
|
44
|
+
sudo apt-get install gperf
|
40
45
|
|
41
|
-
|
42
|
-
with:
|
43
|
-
name: pkg
|
44
|
-
path: pkg/*.gem
|
46
|
+
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
+
- uses: actions/upload-artifact@v3
|
49
|
+
with:
|
50
|
+
name: pkg
|
51
|
+
path: pkg/*.gem
|
48
52
|
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
- name: Install gem
|
54
|
+
run: gem install -b pkg/emf2svg-*.gem
|
55
|
+
|
56
|
+
- name: Test conversion
|
57
|
+
run: |
|
58
|
+
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
52
59
|
|
53
60
|
cross:
|
54
61
|
runs-on: ${{ matrix.os }}
|
55
62
|
strategy:
|
56
|
-
max-parallel: 3
|
57
63
|
fail-fast: false
|
58
64
|
matrix:
|
59
65
|
include:
|
60
66
|
- os: ubuntu-latest
|
61
|
-
platform:
|
67
|
+
platform: aarch64-linux
|
62
68
|
ruby-version: '2.7'
|
63
69
|
- os: macos-latest
|
64
70
|
platform: arm64-darwin
|
65
71
|
ruby-version: '2.7'
|
66
72
|
steps:
|
67
|
-
|
73
|
+
- uses: actions/checkout@v2
|
74
|
+
|
75
|
+
- name: Install packages
|
76
|
+
if: matrix.os == 'ubuntu-latest'
|
77
|
+
run: |
|
78
|
+
sudo apt-get update
|
79
|
+
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
68
80
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
74
|
-
|
75
|
-
- uses: ruby/setup-ruby@v1
|
76
|
-
with:
|
77
|
-
ruby-version: ${{ matrix.ruby-version }}
|
78
|
-
bundler-cache: true
|
81
|
+
- uses: ruby/setup-ruby@v1
|
82
|
+
with:
|
83
|
+
ruby-version: ${{ matrix.ruby-version }}
|
84
|
+
bundler-cache: true
|
79
85
|
|
80
|
-
|
86
|
+
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
81
87
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
88
|
+
- uses: actions/upload-artifact@v2
|
89
|
+
with:
|
90
|
+
name: pkg
|
91
|
+
path: pkg/*.gem
|
86
92
|
|
87
|
-
|
88
|
-
|
93
|
+
- name: Install gem
|
94
|
+
run: gem install -b pkg/emf2svg-*.gem
|
89
95
|
|
90
96
|
publish:
|
91
97
|
needs: [ build, cross ]
|
92
98
|
runs-on: ubuntu-latest
|
93
99
|
steps:
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
for gem in pkg/*.gem; do gem push -V $gem; done
|
100
|
+
- uses: actions/checkout@v2
|
101
|
+
|
102
|
+
- uses: ruby/setup-ruby@v1
|
103
|
+
with:
|
104
|
+
ruby-version: '2.7'
|
105
|
+
bundler-cache: true
|
106
|
+
|
107
|
+
- uses: actions/download-artifact@v2
|
108
|
+
with:
|
109
|
+
name: pkg
|
110
|
+
path: pkg
|
111
|
+
|
112
|
+
- name: Publish to rubygems.org
|
113
|
+
env:
|
114
|
+
RUBYGEMS_API_KEY: ${{secrets.METANORMA_CI_RUBYGEMS_API_KEY}}
|
115
|
+
run: |
|
116
|
+
mkdir -p ~/.gem
|
117
|
+
touch ~/.gem/credentials
|
118
|
+
cat > ~/.gem/credentials << EOF
|
119
|
+
---
|
120
|
+
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
121
|
+
EOF
|
122
|
+
chmod 0600 ~/.gem/credentials
|
123
|
+
gem signin
|
124
|
+
for gem in pkg/*.gem; do gem push -V $gem; done
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -1,12 +1,22 @@
|
|
1
|
-
= emf2svg
|
1
|
+
= emf2svg Ruby gem for EMF to SVG conversion
|
2
|
+
|
3
|
+
image:https://github.com/metanorma/emf2svg-ruby/actions/workflows/build.yml/badge.svg["Build", link="https://github.com/metanorma/emf2svg-ruby/actions/workflows/build.yml"]
|
4
|
+
image:https://badge.fury.io/rb/emf2svg.svg["Gem Version", link="https://badge.fury.io/rb/emf2svg"]
|
2
5
|
|
3
6
|
== Purpose
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
The `emf2svg` Ruby gem provides a Ruby interface to the
|
9
|
+
https://github.com/kakwa/libemf2svg[libemf2svg] EMF-to-SVG conversion library.
|
10
|
+
|
11
|
+
NOTE: This gem currently uses the
|
12
|
+
https://github.com/metanorma/libemf2svg[Metanorma fork of libemf2svg]
|
13
|
+
until feature up-streaming is complete.
|
14
|
+
|
15
|
+
== Prerequisites
|
8
16
|
|
9
|
-
|
17
|
+
* Ruby version >= 2.6
|
18
|
+
|
19
|
+
== Install
|
10
20
|
|
11
21
|
Install the gem directly:
|
12
22
|
|
@@ -22,17 +32,98 @@ Or add it to your `Gemfile`:
|
|
22
32
|
gem 'emf2svg'
|
23
33
|
----
|
24
34
|
|
25
|
-
|
35
|
+
NOTE: For more information on how to install by compiling from source, see
|
36
|
+
<<install-from-source>>.
|
37
|
+
|
38
|
+
|
39
|
+
== Usage
|
40
|
+
|
41
|
+
This gem provides an interface to `libemf2svg`, allowing your Ruby code to
|
42
|
+
directly utilize EMF to SVG conversion facilities.
|
43
|
+
|
44
|
+
There are two ways to provide EMF data to `emf2svg`.
|
45
|
+
|
46
|
+
=== Loading from file
|
47
|
+
|
48
|
+
`Emf2svg.from_file`:: Loads an EMF file directly from the filesystem.
|
49
|
+
|
50
|
+
[example]
|
51
|
+
.Example of using `Emf2svg.from_file` and exporting an SVG file
|
52
|
+
====
|
53
|
+
[source,ruby]
|
54
|
+
----
|
55
|
+
require "emf2svg"
|
56
|
+
|
57
|
+
data = Emf2svg.from_file("example.emf")
|
58
|
+
File.write("output.svg", data, mode: "wb")
|
59
|
+
----
|
60
|
+
====
|
61
|
+
|
62
|
+
=== Loading binary data
|
63
|
+
|
64
|
+
`Emf2svg.from_binary_string`:: Loads EMF content from binary form.
|
65
|
+
|
66
|
+
[example]
|
67
|
+
.Example of using `Emf2svg.from_binary_string` and exporting an SVG file
|
68
|
+
====
|
69
|
+
[source,ruby]
|
70
|
+
----
|
71
|
+
require "emf2svg"
|
72
|
+
|
73
|
+
emf_content = File.read("example.emf", mode: "rb")
|
74
|
+
svg_data = Emf2svg.from_binary_string(emf_content)
|
75
|
+
File.write("output.svg", svg_data, mode: "wb")
|
76
|
+
----
|
77
|
+
====
|
78
|
+
|
79
|
+
|
80
|
+
[[packaging]]
|
81
|
+
== Packaging
|
82
|
+
|
83
|
+
=== Pre-compiled extensions or building from source
|
84
|
+
|
85
|
+
This gem is distributed with pre-compiled native extensions for a set of
|
86
|
+
supported machine architectures.
|
87
|
+
|
88
|
+
On supported platforms, this removes the need for compiling the C extension and
|
89
|
+
the installation of system dependencies. This results in much faster and a more
|
90
|
+
reliable installation step.
|
91
|
+
|
92
|
+
The pre-compiled platforms are:
|
26
93
|
|
27
|
-
*
|
28
|
-
*
|
29
|
-
*
|
30
|
-
*
|
94
|
+
* `x86_64-linux` (GNU and `musl` flavors)
|
95
|
+
* `aarch64-linux` (GNU and `musl` flavors)
|
96
|
+
* `x86_64-darwin`
|
97
|
+
* `arm64-darwin`
|
98
|
+
* `x64-mingw32`
|
99
|
+
* `x64-mingw-ucrt`
|
100
|
+
|
101
|
+
When installing the gem, Ruby will automatically select a pre-compiled version
|
102
|
+
suitable for your platform, or opt to install from source if the platform
|
103
|
+
is not supported.
|
104
|
+
|
105
|
+
[[install-from-source]]
|
106
|
+
=== Installing from source
|
107
|
+
|
108
|
+
==== General
|
109
|
+
|
110
|
+
For platforms that require compilation, the `emf2svg` build script will
|
111
|
+
automatically compile the native extension locally.
|
112
|
+
|
113
|
+
The `emf2svg` build script maintains and installs all required libraries and
|
114
|
+
other dependencies using the `vcpkg` package manager.
|
115
|
+
|
116
|
+
Prior to installation, the system must already have install the appropriate
|
117
|
+
build system (such as `gcc`, `clang` or Visual Studio), and CMake.
|
118
|
+
|
119
|
+
==== Build prerequisites by platform
|
31
120
|
|
32
121
|
==== Windows
|
33
122
|
|
34
|
-
On Windows all necessary libraries are
|
35
|
-
Studio 2019 with C++ Build Tools
|
123
|
+
On Windows, while all necessary libraries are already pre-compiled, Visual
|
124
|
+
Studio 2019 with C++ Build Tools still need to be installed.
|
125
|
+
|
126
|
+
They can be downloaded
|
36
127
|
https://visualstudio.microsoft.com/downloads/[here], or installed with
|
37
128
|
Chocolatey:
|
38
129
|
|
@@ -43,62 +134,45 @@ choco install visualstudio2019buildtools -y --no-progress --package-parameters "
|
|
43
134
|
|
44
135
|
==== macOS
|
45
136
|
|
137
|
+
On macOS, CMake needs to be installed.
|
138
|
+
|
46
139
|
[source,sh]
|
47
140
|
----
|
48
141
|
brew install cmake
|
49
142
|
----
|
50
143
|
|
51
|
-
==== Linux
|
144
|
+
==== Linux: Debian
|
52
145
|
|
53
|
-
|
146
|
+
On Debian, the following build tools need to be installed.
|
54
147
|
|
55
148
|
[source,sh]
|
56
149
|
----
|
57
|
-
# compiler
|
58
|
-
|
150
|
+
# Choose your preferred compiler
|
151
|
+
# GCC
|
152
|
+
apt-get install gcc g++ gperf cmake pkg-config
|
59
153
|
# or
|
60
|
-
|
61
|
-
|
62
|
-
# build deps
|
63
|
-
apt-get install cmake pkg-config
|
64
|
-
|
65
|
-
# library deps with their headers
|
66
|
-
apt-get install libpng-dev libc6-dev libfontconfig1-dev libfreetype6-dev zlib1g-dev
|
154
|
+
# clang
|
155
|
+
apt-get install clang gperf cmake pkg-config
|
67
156
|
----
|
68
157
|
|
69
|
-
|
158
|
+
NOTE: On Debian systems, there exists a
|
159
|
+
https://github.com/microsoft/vcpkg/issues/15931[vcpkg bug] that needs to be
|
160
|
+
addressed by installing the `gperf` package in addition to other build tools.
|
70
161
|
|
71
|
-
|
72
|
-
----
|
73
|
-
yum install cmake libpng-devel freetype-devel fontconfig-devel gcc-c++ gcc
|
74
|
-
----
|
162
|
+
==== Linux: Fedora
|
75
163
|
|
76
|
-
|
77
|
-
|
78
|
-
This gem embeds libemf2svg, allowing your Ruby code to utilize EMF to SVG
|
79
|
-
conversion facilities.
|
164
|
+
On Fedora, the following build tools need to be installed.
|
80
165
|
|
81
|
-
[source,
|
82
|
-
----
|
83
|
-
require "emf2svg"
|
84
|
-
|
85
|
-
data = Emf2svg.from_file("example.emf")
|
86
|
-
File.write("output.svg", data, mode: "wb")
|
166
|
+
[source,sh]
|
87
167
|
----
|
88
|
-
|
89
|
-
It also can use content of emf as an input:
|
90
|
-
|
91
|
-
[source,ruby]
|
168
|
+
yum install cmake gcc-c++ gcc
|
92
169
|
----
|
93
|
-
require "emf2svg"
|
94
170
|
|
95
|
-
emf_content = File.read("example.emf", mode: "rb")
|
96
|
-
svg_data = Emf2svg.from_binary_string(emf_content)
|
97
|
-
File.write("output.svg", svg_data, mode: "wb")
|
98
|
-
----
|
99
171
|
|
100
172
|
== Development
|
101
173
|
|
174
|
+
=== Basic steps
|
175
|
+
|
102
176
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
103
177
|
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
104
178
|
prompt that will allow you to experiment.
|
@@ -109,6 +183,7 @@ release a new version, update the version number in `version.rb`, and then run
|
|
109
183
|
git commits and the created tag, and push the `.gem` file to
|
110
184
|
https://rubygems.org[rubygems.org].
|
111
185
|
|
186
|
+
|
112
187
|
=== Releasing
|
113
188
|
|
114
189
|
Releasing is done automatically with GitHub Actions. Just bump and tag with
|
@@ -128,6 +203,7 @@ For a minor release (0.x.0) use:
|
|
128
203
|
gem bump --version minor --tag --push
|
129
204
|
----
|
130
205
|
|
206
|
+
|
131
207
|
== Contributing
|
132
208
|
|
133
209
|
Bug reports and pull requests are welcome on GitHub at
|
@@ -136,6 +212,7 @@ safe, welcoming space for collaboration, and contributors are expected to adhere
|
|
136
212
|
to the
|
137
213
|
https://github.com/metanorma/emf2svg-ruby/blob/master/CODE_OF_CONDUCT.md[code of conduct].
|
138
214
|
|
215
|
+
|
139
216
|
== Code of Conduct
|
140
217
|
|
141
218
|
Everyone interacting in the emf2svg project's codebases, issue trackers, chat
|
data/Rakefile
CHANGED
@@ -34,17 +34,9 @@ platforms = [
|
|
34
34
|
"x64-mingw32",
|
35
35
|
"x64-mingw-ucrt",
|
36
36
|
"x86_64-linux",
|
37
|
-
"arm64-linux",
|
38
37
|
"aarch64-linux",
|
39
38
|
"x86_64-darwin",
|
40
39
|
"arm64-darwin",
|
41
|
-
"aarch64-darwin",
|
42
|
-
"x86_64-macos",
|
43
|
-
"arm64-macos",
|
44
|
-
"aarch64-macos",
|
45
|
-
"x86_64-osx",
|
46
|
-
"arm64-osx",
|
47
|
-
"aarch64-osx",
|
48
40
|
]
|
49
41
|
|
50
42
|
platforms.each do |platform|
|
data/emf2svg.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = "Ruby interface to libemf2svg."
|
12
12
|
spec.homepage = "https://github.com/metanorma/emf2svg-ruby"
|
13
13
|
spec.license = "BSD-2-Clause"
|
14
|
-
spec.required_ruby_version = ">= 2.
|
14
|
+
spec.required_ruby_version = ">= 2.6.0"
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/metanorma/emf2svg-ruby"
|
data/lib/emf2svg/libemf2svg.so
CHANGED
Binary file
|
data/lib/emf2svg/recipe.rb
CHANGED
@@ -8,11 +8,11 @@ module Emf2svg
|
|
8
8
|
ROOT = Pathname.new(File.expand_path("../..", __dir__))
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
super("libemf2svg", "1.
|
11
|
+
super("libemf2svg", "1.7.0")
|
12
12
|
|
13
13
|
@files << {
|
14
|
-
url: "https://github.com/metanorma/libemf2svg/releases/download/v1.
|
15
|
-
sha256: "
|
14
|
+
url: "https://github.com/metanorma/libemf2svg/releases/download/v1.7.0/libemf2svg.tar.gz",
|
15
|
+
sha256: "a87a02510f87ed4510a3426fa8636b340e26d96f25edf63c3ba465e7e9d7e2eb", # rubocop:disable Layout/LineLength
|
16
16
|
}
|
17
17
|
|
18
18
|
@target = ROOT.join(@target).to_s
|
@@ -25,7 +25,6 @@ module Emf2svg
|
|
25
25
|
|
26
26
|
def cook
|
27
27
|
super
|
28
|
-
|
29
28
|
FileUtils.touch(checkpoint)
|
30
29
|
end
|
31
30
|
|
@@ -36,14 +35,10 @@ module Emf2svg
|
|
36
35
|
case @host
|
37
36
|
when /\Ax86_64.*mingw32/
|
38
37
|
"x64-mingw32"
|
39
|
-
when /\Ai[3-6]86.*mingw32/
|
40
|
-
"x86-mingw32"
|
41
38
|
when /\Ax86_64.*linux/
|
42
39
|
"x86_64-linux"
|
43
40
|
when /\A(arm64|aarch64).*linux/
|
44
41
|
"arm64-linux"
|
45
|
-
when /\Ai[3-6]86.*linux/
|
46
|
-
"x86-linux"
|
47
42
|
when /\Ax86_64.*(darwin|macos|osx)/
|
48
43
|
"x86_64-darwin"
|
49
44
|
when /\A(arm64|aarch64).*(darwin|macos|osx)/
|
@@ -58,10 +53,10 @@ module Emf2svg
|
|
58
53
|
case ENV["target_platform"]
|
59
54
|
when /\A(arm64|aarch64).*(darwin|macos|osx)/
|
60
55
|
"arm64-darwin"
|
61
|
-
when /\
|
56
|
+
when /\Ax86_64.*(darwin|macos|osx)/
|
62
57
|
"x86_64-darwin"
|
63
58
|
when /\A(arm64|aarch64).*linux/
|
64
|
-
"
|
59
|
+
"aarch64-linux"
|
65
60
|
else
|
66
61
|
ENV["target_platform"] || host_platform
|
67
62
|
end
|
@@ -73,17 +68,24 @@ module Emf2svg
|
|
73
68
|
when "arm64-darwin"
|
74
69
|
"arm64-osx"
|
75
70
|
when "x86_64-darwin"
|
76
|
-
"
|
77
|
-
|
78
|
-
|
71
|
+
"x64-osx"
|
72
|
+
when "aarch64-linux"
|
73
|
+
"arm64-linux"
|
74
|
+
when "x86_64-linux"
|
75
|
+
"x64-linux"
|
76
|
+
when /\Ax64-mingw(32|-ucrt)/
|
77
|
+
"x64-mingw-static"
|
79
78
|
end
|
80
79
|
end
|
81
|
-
|
82
80
|
# rubocop:enable Metrics/CyclomaticComplexity
|
83
81
|
# rubocop:enable Metrics/MethodLength
|
84
82
|
|
85
|
-
def
|
86
|
-
|
83
|
+
def windows_native?
|
84
|
+
MiniPortile.windows? && target_triplet.eql?("x64-mingw-static")
|
85
|
+
end
|
86
|
+
|
87
|
+
def drop_target_triplet?
|
88
|
+
windows_native? || host_platform.eql?(target_platform)
|
87
89
|
end
|
88
90
|
|
89
91
|
def checkpoint
|
@@ -94,16 +96,14 @@ module Emf2svg
|
|
94
96
|
opts = []
|
95
97
|
|
96
98
|
opts << "-DCMAKE_BUILD_TYPE=Release"
|
99
|
+
opts << "-DLONLY=ON"
|
97
100
|
|
98
|
-
|
99
|
-
opts << "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
|
100
|
-
end
|
101
|
-
|
102
|
-
if cross_compiling? && (not MiniPortile.windows?)
|
103
|
-
message("Cross-compiling on #{host_platform} for #{target_platform}\n")
|
101
|
+
unless target_triplet.nil? || drop_target_triplet?
|
104
102
|
opts << "-DVCPKG_TARGET_TRIPLET=#{target_triplet}"
|
105
103
|
end
|
106
104
|
|
105
|
+
opts << "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake"
|
106
|
+
|
107
107
|
opts
|
108
108
|
end
|
109
109
|
|
@@ -116,6 +116,7 @@ module Emf2svg
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def install
|
119
|
+
message("Called install\n")
|
119
120
|
libs = if MiniPortile.windows?
|
120
121
|
Dir.glob(File.join(work_path, "Release", "*.dll"))
|
121
122
|
else
|
data/lib/emf2svg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emf2svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: x86_64-linux
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -74,7 +74,7 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- ".github/workflows/
|
77
|
+
- ".github/workflows/build.yml"
|
78
78
|
- ".github/workflows/release.yml"
|
79
79
|
- ".gitignore"
|
80
80
|
- ".rspec"
|
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
requirements:
|
110
110
|
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 2.
|
112
|
+
version: 2.6.0
|
113
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
data/.github/workflows/main.yml
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
name: main
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ main ]
|
6
|
-
pull_request:
|
7
|
-
workflow_dispatch:
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
test:
|
11
|
-
runs-on: ${{ matrix.os }}
|
12
|
-
strategy:
|
13
|
-
max-parallel: 4
|
14
|
-
fail-fast: false
|
15
|
-
matrix:
|
16
|
-
os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ]
|
17
|
-
ruby-version: [ '2.7' ]
|
18
|
-
include:
|
19
|
-
- os: windows-latest
|
20
|
-
ruby-version: '3.1'
|
21
|
-
steps:
|
22
|
-
- uses: actions/checkout@v2
|
23
|
-
|
24
|
-
- uses: ruby/setup-ruby@v1
|
25
|
-
with:
|
26
|
-
bundler-cache: true
|
27
|
-
ruby-version: ${{ matrix.ruby-version }}
|
28
|
-
|
29
|
-
- run: bundle exec rake
|
30
|
-
|
31
|
-
build:
|
32
|
-
runs-on: ${{ matrix.os }}
|
33
|
-
strategy:
|
34
|
-
max-parallel: 4
|
35
|
-
fail-fast: false
|
36
|
-
matrix:
|
37
|
-
include:
|
38
|
-
- os: ubuntu-18.04
|
39
|
-
platform: any
|
40
|
-
ruby-version: '2.7'
|
41
|
-
- os: ubuntu-18.04
|
42
|
-
platform: x86_64-linux
|
43
|
-
ruby-version: '2.7'
|
44
|
-
- os: windows-latest
|
45
|
-
platform: x64-mingw32
|
46
|
-
ruby-version: '2.7'
|
47
|
-
- os: windows-latest
|
48
|
-
platform: x64-mingw-ucrt
|
49
|
-
ruby-version: '3.1'
|
50
|
-
- os: macos-latest
|
51
|
-
platform: x86_64-darwin
|
52
|
-
ruby-version: '2.7'
|
53
|
-
steps:
|
54
|
-
- uses: actions/checkout@v2
|
55
|
-
|
56
|
-
- uses: ruby/setup-ruby@v1
|
57
|
-
with:
|
58
|
-
ruby-version: ${{ matrix.ruby-version }}
|
59
|
-
bundler-cache: true
|
60
|
-
|
61
|
-
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
62
|
-
|
63
|
-
- uses: actions/upload-artifact@v2
|
64
|
-
with:
|
65
|
-
name: pkg
|
66
|
-
path: pkg/*.gem
|
67
|
-
|
68
|
-
- name: Install gem
|
69
|
-
run: gem install -b pkg/emf2svg-*.gem
|
70
|
-
|
71
|
-
- name: Test conversion
|
72
|
-
run: |
|
73
|
-
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
74
|
-
|
75
|
-
test-build:
|
76
|
-
needs: build
|
77
|
-
runs-on: ${{ matrix.os }}
|
78
|
-
strategy:
|
79
|
-
max-parallel: 4
|
80
|
-
fail-fast: false
|
81
|
-
matrix:
|
82
|
-
include:
|
83
|
-
- os: ubuntu-latest
|
84
|
-
platform: any
|
85
|
-
ruby-version: '2.7'
|
86
|
-
- os: windows-latest
|
87
|
-
platform: any
|
88
|
-
ruby-version: '2.7'
|
89
|
-
- os: macos-latest
|
90
|
-
platform: any
|
91
|
-
ruby-version: '2.7'
|
92
|
-
- os: ubuntu-18.04
|
93
|
-
platform: x86_64-linux
|
94
|
-
ruby-version: '2.7'
|
95
|
-
- os: ubuntu-latest
|
96
|
-
platform: x86_64-linux
|
97
|
-
ruby-version: '2.7'
|
98
|
-
- os: windows-latest
|
99
|
-
platform: x64-mingw32
|
100
|
-
ruby-version: '2.7'
|
101
|
-
- os: windows-latest
|
102
|
-
platform: x64-mingw-ucrt
|
103
|
-
ruby-version: '3.1'
|
104
|
-
- os: macos-latest
|
105
|
-
platform: x86_64-darwin
|
106
|
-
ruby-version: '2.7'
|
107
|
-
|
108
|
-
steps:
|
109
|
-
- uses: actions/checkout@v2
|
110
|
-
|
111
|
-
- uses: ruby/setup-ruby@v1
|
112
|
-
with:
|
113
|
-
ruby-version: ${{ matrix.ruby-version }}
|
114
|
-
|
115
|
-
- uses: actions/download-artifact@v2
|
116
|
-
with:
|
117
|
-
name: pkg
|
118
|
-
path: pkg
|
119
|
-
|
120
|
-
- name: Install native gem
|
121
|
-
if: matrix.platform == 'any'
|
122
|
-
run: gem install -b pkg/emf2svg-$(ruby -I lib -r emf2svg/version -e "puts Emf2svg::VERSION").gem
|
123
|
-
|
124
|
-
- name: Install binary gem
|
125
|
-
if: matrix.platform != 'any'
|
126
|
-
run: gem install -b pkg/emf2svg-*-${{ matrix.platform }}.gem
|
127
|
-
|
128
|
-
- name: Test conversion
|
129
|
-
run: |
|
130
|
-
ruby -remf2svg -e "puts File.write('output.svg', Emf2svg.from_file('spec/examples/image1.emf'), mode: 'wb')"
|
131
|
-
|
132
|
-
cross:
|
133
|
-
runs-on: ${{ matrix.os }}
|
134
|
-
strategy:
|
135
|
-
max-parallel: 4
|
136
|
-
fail-fast: false
|
137
|
-
matrix:
|
138
|
-
include:
|
139
|
-
- os: ubuntu-latest
|
140
|
-
platform: arm64-linux
|
141
|
-
ruby-version: '2.7'
|
142
|
-
- os: macos-latest
|
143
|
-
platform: arm64-darwin
|
144
|
-
ruby-version: '2.7'
|
145
|
-
steps:
|
146
|
-
- uses: actions/checkout@v2
|
147
|
-
|
148
|
-
- name: Install packages
|
149
|
-
if: matrix.os == 'ubuntu-latest'
|
150
|
-
run: |
|
151
|
-
sudo apt-get update
|
152
|
-
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
|
153
|
-
|
154
|
-
- uses: ruby/setup-ruby@v1
|
155
|
-
with:
|
156
|
-
ruby-version: ${{ matrix.ruby-version }}
|
157
|
-
bundler-cache: true
|
158
|
-
|
159
|
-
- run: bundle exec rake gem:native:${{ matrix.platform }}
|
160
|
-
|
161
|
-
- uses: actions/upload-artifact@v2
|
162
|
-
with:
|
163
|
-
name: pkg
|
164
|
-
path: pkg/*.gem
|
165
|
-
|
166
|
-
- name: Install gem
|
167
|
-
run: gem install -b pkg/emf2svg-*.gem
|