-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
58 lines (48 loc) · 1.25 KB
/
Rakefile
File metadata and controls
58 lines (48 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
require "etc" # make -j #{Etc.nprocessors}
# Test
task default: :test
Rake::TestTask.new do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
# Release gem
# Prevent releasing the gem including htslib shared library.
task :check_shared_library_exist do
unless Dir.glob("vendor/*.{so,dylib,dll}").empty?
magenta = "\e[35m"
clear = "\e[0m"
abort "#{magenta}Shared library exists in the vendor directory.#{clear}"
end
end
Rake::Task["release:guard_clean"].enhance(["check_shared_library_exist"])
# Build htslib
namespace :htslib do
desc "Building HTSlib"
task :build do
Dir.chdir("htslib") do
unless File.exist? "htscodecs/README.md"
puts "Missing git submodules"
puts "Use `git submodule update --init --recursive`"
exit 1
end
sh "autoreconf -i"
sh "./configure"
sh "make -j #{Etc.nprocessors}"
FileUtils.mkdir_p("../vendor")
require "ffi"
FileUtils.move(
"libhts.#{FFI::Platform::LIBSUFFIX}",
"../vendor/libhts.#{FFI::Platform::LIBSUFFIX}"
)
end
end
desc "make clean"
task :clean do
Dir.chdir("htslib") do
sh "make clean"
end
end
end