diff options
author | Charles Strahan <charles.c.strahan@gmail.com> | 2015-01-21 15:20:42 -0500 |
---|---|---|
committer | Charles Strahan <charles.c.strahan@gmail.com> | 2015-01-21 18:23:35 -0500 |
commit | f52c32fcfccbecfc52f68571a3ce866f59e91459 (patch) | |
tree | 8fb05c498ef7cdb95b387fd5e5d2f67e9622bda1 /pkgs/applications/networking/mailreaders | |
parent | 5f1622e95f166cbe4738cef956eb0851d9ea0a00 (diff) | |
download | nixlib-f52c32fcfccbecfc52f68571a3ce866f59e91459.tar nixlib-f52c32fcfccbecfc52f68571a3ce866f59e91459.tar.gz nixlib-f52c32fcfccbecfc52f68571a3ce866f59e91459.tar.bz2 nixlib-f52c32fcfccbecfc52f68571a3ce866f59e91459.tar.lz nixlib-f52c32fcfccbecfc52f68571a3ce866f59e91459.tar.xz nixlib-f52c32fcfccbecfc52f68571a3ce866f59e91459.tar.zst nixlib-f52c32fcfccbecfc52f68571a3ce866f59e91459.zip |
ruby: rewrite `sup` package
Diffstat (limited to 'pkgs/applications/networking/mailreaders')
6 files changed, 215 insertions, 78 deletions
diff --git a/pkgs/applications/networking/mailreaders/sup/Gemfile b/pkgs/applications/networking/mailreaders/sup/Gemfile index f7d13a163268..a57feb5d21f3 100644 --- a/pkgs/applications/networking/mailreaders/sup/Gemfile +++ b/pkgs/applications/networking/mailreaders/sup/Gemfile @@ -1,6 +1,8 @@ source "https://rubygems.org" -#gem "sup", "0.20.0" -#gem 'sup', '~> 0.20.0' -#gem 'gpgme' -gem 'gpgme', '2.0.7' +gem 'sup' +gem 'gpgme' + +# Sup tries to `xapian-ruby` in its extconf instead of listing it as a +# dependency. +gem 'xapian-ruby', "~> 1.2.15" diff --git a/pkgs/applications/networking/mailreaders/sup/Gemfile.lock b/pkgs/applications/networking/mailreaders/sup/Gemfile.lock index 2f56752d9a2f..fe8746b9f724 100644 --- a/pkgs/applications/networking/mailreaders/sup/Gemfile.lock +++ b/pkgs/applications/networking/mailreaders/sup/Gemfile.lock @@ -1,12 +1,34 @@ GEM remote: https://rubygems.org/ specs: + chronic (0.9.1) gpgme (2.0.7) mini_portile (>= 0.5.0, <= 0.6.0) + highline (1.6.21) + locale (2.1.0) + lockfile (2.1.3) + mime-types (1.25.1) mini_portile (0.6.0) + ncursesw (1.4.9) + rmail-sup (1.0.1) + sup (0.20.0) + chronic (~> 0.9.1) + highline + locale (~> 2.0) + lockfile + mime-types (~> 1.0) + ncursesw (~> 1.4.0) + rmail-sup (~> 1.0.1) + trollop (>= 1.12) + unicode (~> 0.4.4) + trollop (2.1.1) + unicode (0.4.4.2) + xapian-ruby (1.2.19.1) PLATFORMS ruby DEPENDENCIES - gpgme (= 2.0.7) + gpgme + sup + xapian-ruby (~> 1.2.15) diff --git a/pkgs/applications/networking/mailreaders/sup/default.nix b/pkgs/applications/networking/mailreaders/sup/default.nix index 3d537d83f430..874d662754f9 100644 --- a/pkgs/applications/networking/mailreaders/sup/default.nix +++ b/pkgs/applications/networking/mailreaders/sup/default.nix @@ -1,79 +1,52 @@ -{ stdenv, fetchurl, ruby, rake, rubygems, makeWrapper, ncursesw_sup -, xapian_ruby, gpgme, libiconvOrEmpty, mime_types, chronic, trollop, lockfile -, gettext, iconv, locale, text, highline, rmail_sup, unicode, gnupg, which -, bundler, git }: +{ stdenv, lib, bundlerEnv, gpgme, ruby, ncurses, writeText, zlib, xapian, pkgconfig, which }: -stdenv.mkDerivation rec { - version = "0.18.0"; - name = "sup-${version}"; +bundlerEnv { + name = "sup-0.20.0"; - meta = { - description = "A curses threads-with-tags style email client"; - homepage = http://supmua.org; - license = stdenv.lib.licenses.gpl2; - maintainers = with stdenv.lib.maintainers; [ lovek323 ]; - platforms = stdenv.lib.platforms.unix; - broken = true; - }; - - dontStrip = true; + inherit ruby; + gemfile = ./Gemfile; + lockfile = ./Gemfile.lock; + gemset = ./gemset.nix; - src = fetchurl { - url = "https://github.com/sup-heliotrope/sup/archive/release-${version}.tar.gz"; - sha256 = "1dhg0i2v0ddhwi32ih5lc56x00kbaikd2wdplgzlshq0nljr9xy0"; + fixes.gpgme = attrs: { + buildInputs = [ gpgme ]; }; - buildInputs = - [ rake ruby rubygems makeWrapper gpgme ncursesw_sup xapian_ruby - libiconvOrEmpty git ]; - - phases = [ "unpackPhase" "buildPhase" "installPhase" ]; - - buildPhase = '' - # the builder uses git to get a listing of the files - export EMAIL="nobody@in.here" - git init >/dev/null - git add . - git commit -m "message" >/dev/null - gem build sup.gemspec - ''; - - installPhase = '' - export HOME=$TMP/home; mkdir -pv "$HOME" - - GEM_PATH="$GEM_PATH:$out/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${chronic}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${gettext}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${gpgme}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${highline}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${iconv}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${locale}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${lockfile}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${mime_types}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${ncursesw_sup}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${rmail_sup}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${text}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${trollop}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${unicode}/${ruby.gemPath}" - GEM_PATH="$GEM_PATH:${xapian_ruby}/${ruby.gemPath}" - - # Don't install some dependencies -- we have already installed - # the dependencies but gem doesn't acknowledge this - gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \ - --bindir "$out/bin" --no-rdoc --no-ri sup-${version}.gem \ - --ignore-dependencies >/dev/null + fixes.ncursesw = attrs: { + buildInputs = [ ncurses ]; + buildArgs = [ + "--with-cflags=-I${ncurses}/include" + "--with-ldflags=-L${ncurses}/lib" + ]; + }; - # specify ruby interpreter explicitly - sed -i '1 s|^.*$|#!${ruby}/bin/ruby|' bin/sup-sync-back-maildir + fixes.xapian-ruby = attrs: { + # use the system xapian + buildInputs = [ xapian pkgconfig zlib ]; + postPatch = '' + cp ${./xapian-Rakefile} Rakefile + ''; + preInstall = '' + export XAPIAN_CONFIG=${xapian}/bin/xapian-config + ''; + }; - cp bin/sup-sync-back-maildir "$out/bin" + fixes.sup = attrs: { + # prevent sup from trying to dynamically install `xapian-ruby`. + postPatch = '' + cp ${./mkrf_conf_xapian.rb} ext/mkrf_conf_xapian.rb - for prog in $out/bin/*; do - wrapProgram "$prog" --prefix GEM_PATH : "$GEM_PATH" --prefix PATH : "${gnupg}/bin:${which}/bin" - done + substituteInPlace lib/sup/crypto.rb \ + --replace 'which gpg2' \ + '${which}/bin/which gpg2' + ''; + }; - for prog in $out/gems/*/bin/*; do - [[ -e "$out/bin/$(basename $prog)" ]] - done - ''; + meta = with lib; { + description = "A curses threads-with-tags style email client"; + homepage = http://supmua.org; + license = with licenses; gpl2; + maintainers = with maintainers; [ cstrahan lovek323 ]; + platforms = platforms.unix; + }; } diff --git a/pkgs/applications/networking/mailreaders/sup/gemset.nix b/pkgs/applications/networking/mailreaders/sup/gemset.nix index de28a5dfeb39..e39da3dac85e 100644 --- a/pkgs/applications/networking/mailreaders/sup/gemset.nix +++ b/pkgs/applications/networking/mailreaders/sup/gemset.nix @@ -1,7 +1,14 @@ { - gpgme = { + "chronic" = { + version = "0.9.1"; + source = { + type = "gem"; + sha256 = "0kspaxpfy7yvyk1lvpx31w852qfj8wb9z04mcj5bzi70ljb9awqk"; + }; + }; + "gpgme" = { version = "2.0.7"; - src = { + source = { type = "gem"; sha256 = "1p84zhiri2ihcld7py9mwc2kg5xs5da8fk11zhndrhmw05yvf5mr"; }; @@ -9,11 +16,92 @@ "mini_portile" ]; }; - mini_portile = { + "highline" = { + version = "1.6.21"; + source = { + type = "gem"; + sha256 = "06bml1fjsnrhd956wqq5k3w8cyd09rv1vixdpa3zzkl6xs72jdn1"; + }; + }; + "locale" = { + version = "2.1.0"; + source = { + type = "gem"; + sha256 = "18bb0g24flq9dr8qv4j7pm7w9i2vmvmqrbmry95ibf1r1c4s60yj"; + }; + }; + "lockfile" = { + version = "2.1.3"; + source = { + type = "gem"; + sha256 = "0dij3ijywylvfgrpi2i0k17f6w0wjhnjjw0k9030f54z56cz7jrr"; + }; + }; + "mime-types" = { + version = "1.25.1"; + source = { + type = "gem"; + sha256 = "0mhzsanmnzdshaba7gmsjwnv168r1yj8y0flzw88frw1cickrvw8"; + }; + }; + "mini_portile" = { version = "0.6.0"; - src = { + source = { type = "gem"; sha256 = "09kcn4g63xrdirgwxgjikqg976rr723bkc9bxfr29pk22cj3wavn"; }; }; + "ncursesw" = { + version = "1.4.9"; + source = { + type = "gem"; + sha256 = "154cls3b237imdbhih7rni5p85nw6mpbpkzdw08jxzvqaml7q093"; + }; + }; + "rmail-sup" = { + version = "1.0.1"; + source = { + type = "gem"; + sha256 = "1xswk101s560lxqaax3plqh8vjx7jjspnggdwb3q80m358f92q9g"; + }; + }; + "sup" = { + version = "0.20.0"; + source = { + type = "gem"; + sha256 = "1lpqgrqkv29xr1h1142qsbmknlshpgys7fc3w1nkyhib8s3ikamg"; + }; + dependencies = [ + "chronic" + "highline" + "locale" + "lockfile" + "mime-types" + "ncursesw" + "rmail-sup" + "trollop" + "unicode" + ]; + }; + "trollop" = { + version = "2.1.1"; + source = { + type = "gem"; + sha256 = "0z5dvh7glwqjprlihsjx67hfzy4whsjfhqj9akyyrby9q5va1i4k"; + }; + }; + "unicode" = { + version = "0.4.4.2"; + source = { + type = "gem"; + sha256 = "15fggljzan8zvmr8h12b5m7pcj1gvskmmnx367xs4p0rrpnpil8g"; + }; + }; + "xapian-ruby" = { + version = "1.2.19.1"; + source = { + type = "gem"; + sha256 = "1crfrmc8kf6qq1xcfcmgf213zg66badpg4d86n7y9x3i1f5lxlbv"; + }; + }; } \ No newline at end of file diff --git a/pkgs/applications/networking/mailreaders/sup/mkrf_conf_xapian.rb b/pkgs/applications/networking/mailreaders/sup/mkrf_conf_xapian.rb new file mode 100644 index 000000000000..e19f06e23ac2 --- /dev/null +++ b/pkgs/applications/networking/mailreaders/sup/mkrf_conf_xapian.rb @@ -0,0 +1,14 @@ +require 'rubygems' +require 'rubygems/command.rb' +require 'rubygems/dependency_installer.rb' +require 'rbconfig' + +begin + Gem::Command.build_args = ARGV +rescue NoMethodError +end + +# create dummy rakefile to indicate success +f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") +f.write("task :default\n") +f.close diff --git a/pkgs/applications/networking/mailreaders/sup/xapian-Rakefile b/pkgs/applications/networking/mailreaders/sup/xapian-Rakefile new file mode 100644 index 000000000000..9f0b8e72f08c --- /dev/null +++ b/pkgs/applications/networking/mailreaders/sup/xapian-Rakefile @@ -0,0 +1,38 @@ +# encoding: utf-8 +# Install the xapian binaries into the lib folder of the gem +require 'rbconfig' + +c = RbConfig::CONFIG + +def system!(cmd) + puts cmd + system(cmd) or raise +end + +source_dir = 'xapian_source' +bindings = Dir["#{source_dir}/xapian-bindings-*"].first +bindings = File.basename(bindings, ".tar.xz") + +task :default do + system! "tar -xJf #{source_dir}/#{bindings}.tar.xz" + + prefix = Dir.pwd + ENV['LDFLAGS'] = "-L#{prefix}/lib" + + system! "mkdir -p lib" + + Dir.chdir bindings do + ENV['RUBY'] ||= "#{c['bindir']}/#{c['RUBY_INSTALL_NAME']}" + system! "./configure --prefix=#{prefix} --exec-prefix=#{prefix} --with-ruby" + system! "make clean all" + end + + system! "cp -r #{bindings}/ruby/.libs/_xapian.* lib" + system! "cp #{bindings}/ruby/xapian.rb lib" + + system! "rm lib/*.la" + system! "rm lib/*.lai" + + system! "rm -R #{bindings}" + system! "rm -R #{source_dir}" +end |