Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge Installation Footprint #188

Closed
ksylvest opened this issue Jun 19, 2024 · 4 comments
Closed

Huge Installation Footprint #188

ksylvest opened this issue Jun 19, 2024 · 4 comments

Comments

@ksylvest
Copy link

ksylvest commented Jun 19, 2024

The install size for gpgme-2.0.24 is ~45 MB. This seems pretty huge! A quick spot check:

gem install gpgme
cd $(bundle show gpgme)
du -hs * | sort -h
 24K	examples
 92K	test
800K	lib
7.1M	ports
 38M	ext
du -hs ext/gpgme/* | sort -h
8.0K	ext/gpgme/extconf.rb
 12K	ext/gpgme/Makefile
104K	ext/gpgme/gpgme_n.c
 38M	ext/gpgme/tmp

A few questions / thoughts:

  1. Do the test / examples need to be included in the gemspec files?
  2. The ext/gpgme/tmp folder is part of the bundle and fairly huge (38M) - is it required or just build artifacts?
  3. What is the purpose of the ports exactly (can they also be excluded from the finalized version)?

If this does seem like an issue happy to help opening a PR to address.

@kernelsmith
Copy link

@stanhu you might be able to weigh in here. I would think that anything other than maybe a .gitkeep could be gitignored in /tmp?

@stanhu
Copy link
Collaborator

stanhu commented Aug 27, 2024

@kernelsmith I think that tmp directory can be removed, but I don't think a .gitkeep would do anything here because that temporary directory is created by the Rakefile:

ruby-gpgme/Rakefile

Lines 11 to 16 in bae97e2

mkdir 'tmp'
Dir.chdir('tmp') do
system "ruby #{File.dirname(__FILE__)}/ext/gpgme/extconf.rb"
system "make"
end

Do the test / examples need to be included in the gemspec files?

I think they can be excluded, though sometimes it's useful to have the tests to verify the C extension built and installed correctly.

What is the purpose of the ports exactly (can they also be excluded from the finalized version)?

I believe that directory is used to download and build gpgme, libassuan, etc. I believe they can be removed.

I spent a long time working on building precompiled gems and ensuring the gems had a minimal footprint in https://github.com/mudge/re2. We can probably borrow the same ideas from there.

@kernelsmith
Copy link

We could make the tmp directory ahead of time and stick a .gitkeep in there and then gitignore the rest of the contents. When rake runs, I assume it won't fail if the dir already exists (depends how mkdir is defined obviously). However, in this case we can just gitignore the entire /tmp so let's just do that ;)

@stanhu
Copy link
Collaborator

stanhu commented Aug 27, 2024

gpgme v2.0.23 had an issue with cleanup, but I believe this has been fixed in v2.0.24 via #178 and #179:

gem install gpgme -v 2.0.24
cd `dirname $(gem which gpgme)`
cd ..
du -h
 28K	./test/support
 12K	./test/files
 96K	./test
124K	./ext/gpgme
124K	./ext
 24K	./examples
108K	./lib/gpgme
876K	./lib
1.1M	.

@ueno I think we can close this issue?

I raised rubygems/rubygems#6956 to discuss how to standardize cleanup, but for now the roundabout way does the job:

-$(Q)$(RUBY) $(srcdir)/extconf.rb --clean

@stanhu stanhu closed this as completed Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants