aaaaand released digest-crc 0.6.1 because of course I forgot that bundler requires rake be listed as a dependency, even though it's bundled with ruby. Now digest-crc will successfully install/compile under bundler.
FYI digest-crc 0.6.0 is out. 40x performance improvement for CRuby! If you use ruby-kafka (which uses digest-crc) run `bundle update digest-crc` to take advantage of the performance boost.
https://github.com/postmodern/digest-crc/blob/master/ChangeLog.md#060--2020-07-01
TIL snap's snapcraft.yml format is similar to my gemspec.yml format. A win for package metadata simplicity!
https://github.com/aleandros/tdiff/blob/master/snap/snapcraft.yaml
Kind of wish that Enumerable#filter_map was aliased as #map_compact, because that's what it basically does.
FYI digest-crc 0.6.0.rc1 is out! Optional C extensions yielding 40x performance boost on CRuby! Please test installing it on various rubies/platforms.
`gem install digest-crc -v 0.6.0.rc1`
https://github.com/postmodern/digest-crc/blob/0.6.0/ChangeLog.md#060--2020-06-16
Working on my Open Source backlog. Released #bundler-audit 0.7.0 that fixes a few outstanding bugs and adds a few things. Now to finish writing specs for 0.8.0...
https://github.com/rubysec/bundler-audit/blob/master/ChangeLog.md#070--2020-06-12
Playing with #crystal-lang reminds me of my Java days. Constant back-and-fourth between annoying compiler errors and editing. Definitely appreciate how Ruby let's you hit the ground running with irb.
Well this is a first. Trying to resurrect some old Ruby repos but Travis CI is flagging my pushes as Abuse.
https://travis-ci.org/ronin-ruby/ronin-support/requests
https://travis-ci.org/postmodern/digest-crc/jobs/658819856?utm_medium=notification&utm_source=github_status
oh figures. Ruby 2.5 lacks USHORT2NUM macro, but the C compiler treats undefined macros as undefined symbols. Ruby's C macros are the cruftiest part of the API.
https://github.com/postmodern/digest-crc/issues/13#issuecomment-595118118 recent benchmarks of pure Ruby CRC algorithms vs. the optional C extensions. Looks like a +90% performance improvement across the board 😮
Starting to regret avoiding C extensions for all these years 😕 (although they are still a PITA to write and C is not a safe or secure programming language...)
TIL mkmf's `create_makefile` cannot be called multiple times to generate multiple separate Makefiles, because it's a dumpster fire of global variables...
https://github.com/ruby/ruby/blob/e4a9e926f0fe0acf2fbe61da6e075a95d34be066/lib/mkmf.rb#L55-L64
nm, prototyping my own. Trying to duplicate the make/installation part of the extconf building.
https://github.com/ruby/ruby/blob/87f6154bb4c67ca77ee353bb1fe25a922036c0e5/lib/rubygems/ext/ext_conf_builder.rb#L63-L82
I'm really curious if there's an example out there of building Ruby C Extensions using a Rakefile (ie `gemspec.extensions = ["ext/foo/Rakefile"]`) instead of the standard `extconf.rb` method? This might allow me to optionally build C extensions, and fail gracefully if there's no C compiler, no headers, no libruby, etc.
https://github.com/ruby/ruby/blob/16415fefc14e1419d5587288fb6a69fe5ccf94ba/lib/rubygems/ext/builder.rb#L123
Ah yes I remember now. The bulk of the C extension building logic is in RubyGems itself. RubyGems will execute extconf.rb, then try to run the resulting Makefile, or error if none was generated.
Fun fact: RubyGems supports `./configure`, `Rakefiles`, and even `CMakeLists.txt` files in `gemspec.extensions`:
https://github.com/ruby/ruby/blob/14dd377e51408ef07e03c27f95ff6b0e186df022/lib/rubygems/ext/builder.rb#L117-L131
https://github.com/ruby/ruby/blob/master/lib/mkmf.rb trying to understand how try_compile causes the extconf.rb file to exit -1 if it fails. mkmf.rb is a tire fire, but amazingly works on any common *nix platform.
WIP https://github.com/postmodern/digest-crc/tree/c_exts
Still need to figure out how to make extconf.rb fail gracefully when it cannot build C extensions (ie: no C compiler, ruby-dev/ruby-devel not installed) and print some "Skipping ..." message.
also need to figure out how to optionally build C exts. Say a user installs my library, but doesn't have gcc installed. I'm sure there's a way to make extconf.rb fail silently. Then you'd just have to put `begin/rescue LoadError` around where you load the C exts.