Commit bd21b1b

mo khan <mo@mokhan.ca>
2021-03-09 06:00:03
install spandx gem
1 parent ab45b47
config/software/preparation.rb
@@ -5,12 +5,14 @@ default_version "1.0.0"
 license :project_license
 skip_transitive_dependency_licensing true
 
-dependency "ruby"
+dependency "spandx-ruby"
 
 build do
   block do
-    touch "#{install_dir}/embedded/lib/.gitkeep"
-    touch "#{install_dir}/embedded/bin/.gitkeep"
-    touch "#{install_dir}/bin/.gitkeep"
+    touch "#{install_dir}/embedded/lib/.keep"
+    touch "#{install_dir}/embedded/bin/.keep"
+    touch "#{install_dir}/bin/.keep"
+
+    gem "install spandx --no-document"
   end
 end
config/software/spandx-ruby.rb
@@ -0,0 +1,71 @@
+# frozen_string_literal: true
+
+name "ruby"
+
+license "BSD-2-Clause"
+license_file "BSDL"
+license_file "COPYING"
+license_file "LEGAL"
+
+default_version "3.0.0"
+
+dependency "libffi"
+dependency "liblzma"
+dependency "libxml2"
+dependency "libyaml"
+dependency "openssl"
+dependency "zlib"
+
+source \
+  url: "https://cache.ruby-lang.org/pub/ruby/#{version.match(/^(\d+\.\d+)/)[0]}/ruby-#{version}.tar.gz",
+  sha256: "a13ed141a1c18eb967aac1e33f4d6ad5f21be1ac543c344e0d6feeee54af8e28"
+
+relative_path "ruby-#{version}"
+embedded_dir = "#{install_dir}/embedded"
+
+build do
+  env = with_standard_compiler_flags(with_embedded_path)
+  configure_command = [
+    "--disable-debug-env",
+    "--disable-dtrace",
+    "--disable-install-capi",
+    "--disable-install-doc",
+    "--disable-install-rdoc",
+    "--disable-jit-support",
+    "--enable-shared",
+    "--prefix=#{embedded_dir}",
+    "--with-out-ext=dbm,readline,rdoc,win32,win32ole,sdbm",
+    "--without-gdbm",
+    "--without-gmp",
+    "--without-jemalloc",
+    "--without-tk",
+    "--without-valgrind"
+  ]
+  configure(*configure_command, env: env)
+  make "-j #{workers}", env: env
+  make "-j #{workers} install", env: env
+end
+
+build do
+  %w[benchmark pstore rss test-unit webrick minitest].each do |gem_name|
+    delete "#{embedded_dir}/lib/ruby/gems/**/gems/#{gem_name}*"
+    delete "#{embedded_dir}/lib/ruby/**/#{gem_name}*"
+  end
+
+  delete "#{embedded_dir}/bin/*rac*"
+  delete "#{embedded_dir}/bin/erb"
+  delete "#{embedded_dir}/bin/irb"
+  delete "#{embedded_dir}/bin/rake"
+  delete "#{embedded_dir}/bin/rdoc"
+  delete "#{embedded_dir}/bin/ri"
+  delete "#{embedded_dir}/bin/thor"
+  delete "#{embedded_dir}/lib/ruby/gems/**/cache"
+  delete "#{embedded_dir}/lib/ruby/gems/**/doc"
+  delete "#{embedded_dir}/lib/ruby/gems/**/gems/**/.github"
+  delete "#{embedded_dir}/lib/ruby/gems/**/gems/**/.gitignore"
+  delete "#{embedded_dir}/lib/ruby/gems/**/gems/**/.travis.yml"
+  delete "#{embedded_dir}/lib/ruby/gems/**/gems/**/bundler/man"
+  delete "#{embedded_dir}/lib/ruby/gems/**/gems/**/man"
+  delete "#{embedded_dir}/lib/ruby/gems/**/gems/**/test"
+  delete "#{embedded_dir}/share"
+end
config/software/spandx-zlib.rb
@@ -1,55 +0,0 @@
-#
-# Copyright 2021 YOUR NAME
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# These options are required for all software definitions
-name "spandx-zlib"
-default_version "1.2.6"
-
-# A software can specify more than one version that is available for install
-version("1.2.6") { source md5: "618e944d7c7cd6521551e30b32322f4a" }
-version("1.2.8") { source md5: "44d667c142d7cda120332623eab69f40" }
-
-# Sources may be URLs, git locations, or path locations
-source url: "http://downloads.sourceforge.net/project/libpng/zlib/#{version}/zlib-#{version}.tar.gz"
-
-# This is the path, inside the tarball, where the source resides
-relative_path "zlib-#{version}"
-
-build do
-  # Setup a default environment from Omnibus - you should use this Omnibus
-  # helper everywhere. It will become the default in the future.
-  env = with_standard_compiler_flags(with_embedded_path)
-
-  # Manipulate any configure flags you wish:
-  #   For some reason zlib needs this flag on solaris
-  env["CFLAGS"] << " -DNO_VIZ" if solaris?
-
-  # "command" is part of the build DSL. There are a number of handy options
-  # available, such as "copy", "sync", "ruby", etc. For a complete list, please
-  # consult the Omnibus gem documentation.
-  #
-  # "install_dir" is exposed and refers to the top-level projects +install_dir+
-  command "./configure" \
-          " --prefix=#{install_dir}/embedded", env: env
-
-  # You can have multiple steps - they are executed in the order in which they
-  # are read.
-  #
-  # "workers" is a DSL method that returns the most suitable number of
-  # builders for the currently running system.
-  command "make -j #{workers}", env: env
-  command "make -j #{workers} install", env: env
-end
omnibus.rb
@@ -6,7 +6,7 @@ build_dir     './tmp/omnibus/build'
 package_dir   './tmp/omnibus/pkg'
 package_tmp   './tmp/omnibus/pkg-tmp'
 
-use_git_caching false
+use_git_caching true
 
 # build_retries 5
 # fetcher_read_timeout 120