Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Apr 12, 2022
1 parent 54a21df commit 62059bd
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 38 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/main.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: main
name: build

on:
push:
branches: [ main ]
paths-ignore:
- '*.adoc'
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -57,15 +59,13 @@ jobs:
platform: x86_64-darwin
ruby-version: '2.7'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

# https://github.com/microsoft/vcpkg/issues/15931
# no good solution :(
- name: Workaround for vcpkg
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand Down Expand Up @@ -130,8 +130,6 @@ jobs:
name: pkg
path: pkg

# https://github.com/microsoft/vcpkg/issues/15931
# no good solution :(
- name: Workaround for vcpkg
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand Down Expand Up @@ -162,7 +160,7 @@ jobs:
platform: arm64-darwin
ruby-version: '2.7'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install packages
if: matrix.os == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
platform: x86_64-darwin
ruby-version: '2.7'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
Expand All @@ -46,7 +46,7 @@ jobs:
- run: bundle exec rake gem:native:${{ matrix.platform }}

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: pkg
path: pkg/*.gem
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ inherit_from:
- 'https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml'

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6
SuggestExtensions: false

Gemspec/RequireMFA:
Expand Down
48 changes: 28 additions & 20 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
= emf2svg
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"]
image:https://badge.fury.io/rb/emf2svg.svg["Gem Version", link="https://badge.fury.io/rb/emf2svg"]


== Purpose
= emf2svg

Provides Ruby access to https://github.com/kakwa/libemf2svg (temporarily using
== Overview
emf2svg-ruby provides Ruby front-end to emf to svg converter https://github.com/kakwa/libemf2svg (temporarily using
the https://github.com/metanorma/libemf2svg[Metanorma fork] until upstreaming
is complete).

== Installation
== Requirements:
Ruby >= 2.6

== Installation
Install the gem directly:

[source,sh]
Expand All @@ -22,19 +27,28 @@ Or add it to your `Gemfile`:
gem 'emf2svg'
----

=== Dependencies
=== Packaging
We distribute pre-compiled libraries for a set of machine architecture. On supported platforms, this removes the need
for compiling the C extension and installation of system dependencies. This results in much faster and more reliable installation.

==== Native extensions
* x86_64-linux (GNU and musl flavors)
* aarch64-linux (GNU and musl flavors)
* x86_64-darwin
* arm64-darwin
* x64-mingw32
* x64-mingw-ucrt

* libiconv
* libpng
* libfontconfig
* libfreetype
=== Building GEM from source
emf2svg build script maintaince and installs all required libraries and other dependencies using vcpkg package manager
You still need to install appropriate build system (like gcc, clang or Visual Studio) and cmake
On Debian systems there is vcpkg bug [https://github.com/microsoft/vcpkg/issues/15931] that needs to be addressed by installing gperf package:

==== Windows

On Windows all necessary libraries are precompiled but you'll need Visual
Studio 2019 with C++ Build Tools, which can be downloaded
https://visualstudio.microsoft.com/downloads/[here], or installed with
Chocolatey:
https://visualstudio.microsoft.com/downloads/[here], or installed with Chocolatey:

[source,sh]
----
Expand All @@ -55,22 +69,16 @@ brew install cmake
[source,sh]
----
# compiler
apt-get install gcc g++
apt-get install gcc g++ gperf cmake pkg-config
# or
apt-get install clang
# build deps
apt-get install cmake pkg-config
# library deps with their headers
apt-get install libpng-dev libc6-dev libfontconfig1-dev libfreetype6-dev zlib1g-dev
apt-get install clang gperf cmake pkg-config
----

===== Fedora

[source,sh]
----
yum install cmake libpng-devel freetype-devel fontconfig-devel gcc-c++ gcc
yum install cmake gcc-c++ gcc
----

== Usage
Expand Down
2 changes: 1 addition & 1 deletion emf2svg.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
spec.summary = "Ruby interface to libemf2svg."
spec.homepage = "https://github.com/metanorma/emf2svg-ruby"
spec.license = "BSD-2-Clause"
spec.required_ruby_version = ">= 2.5.0"
spec.required_ruby_version = ">= 2.6.0"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/metanorma/emf2svg-ruby"
Expand Down
16 changes: 9 additions & 7 deletions lib/emf2svg/recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ def host_platform
case @host
when /\Ax86_64.*mingw32/
"x64-mingw32"
when /\Ai[3-6]86.*mingw32/
"x86-mingw32"
when /\Ax86_64.*linux/
"x86_64-linux"
when /\A(arm64|aarch64).*linux/
"arm64-linux"
when /\Ai[3-6]86.*linux/
"x86-linux"
when /\Ax86_64.*(darwin|macos|osx)/
"x86_64-darwin"
when /\A(arm64|aarch64).*(darwin|macos|osx)/
Expand Down Expand Up @@ -79,13 +75,19 @@ def target_triplet
"x64-linux"
when /\Ax64-mingw(32|-ucrt)/
"x64-mingw-static"
else
nil
end
end
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/MethodLength

def windows_native?
MiniPortile.windows? && target_triplet.eql?("x64-mingw-static")
end

def drop_target_triplet?
windows_native? || host_platform.eql?(target_platform)
end

def checkpoint
File.join(@target, "#{name}-#{version}-#{target_platform}.installed")
end
Expand All @@ -96,7 +98,7 @@ def configure_defaults
opts << "-DCMAKE_BUILD_TYPE=Release"
opts << "-DLONLY=ON"

unless target_triplet.nil? "unknown" or host_platform.eql? target_platform
unless target_triplet.nil? || drop_target_triplet?
opts << " -DVCPKG_TARGET_TRIPLET=#{target_triplet}"
end

Expand Down

0 comments on commit 62059bd

Please sign in to comment.