librelist archives

« back to archive

Variants

Variants

From:
Douglas Creager
Date:
2010-02-05 @ 21:11
Is there a correct way to do MacPorts-style variants in a formula?  For 
instance, the top of the Emacs formula has this:

  if ARGV.include? "--cocoa"
    # 98643 is the same bzr rev as the old git sha db44e1e
    # but both bzr@98643 and bzr@trunk fail with 'digest-doc' not found
    head 'bzr://http://bzr.savannah.gnu.org/r/emacs/trunk', :tag => '98643'
  else
    url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.1.tar.bz2'
    head 'bzr://http://bzr.savannah.gnu.org/r/emacs/trunk'
    md5 '17f7f0ba68a0432d58fa69d05a2225be'
  end

That lets me run “brew install emacs --cocoa” and it'll grab the latest 
Emacs from Bazaar, and compile a Cocoa-native version.  It'll get placed 
into Cellar/emacs/HEAD.  If I leave off the --cocoa option, it downloads 
the 23.1 release, and compiles a console version of Emacs.

Problem is this information isn't persisted.  I'm working on a new formula
that has emacs as a dependency.  I have to give the same “--cocoa” command
line option when installing my new formula; otherwise, when Homebrew reads
in the Emacs formula when it walks dependencies, it falls into the else 
case above, and expects emacs to be installed into Cellar/emacs/23.1.

Is there a better way to do this?

Thanks
–doug

—
Douglas Creager
http://dcreager.net/

Re: [homebrew] Variants

From:
Max Howell
Date:
2010-02-06 @ 13:46
If it's an emacs plugin add it to the emacs formula.

Otherwise wait for the variants system which will be built eventually.

The former is still preferred. Although currently you can't add
metadata to formula so that people using brew search will find said
feature. Although this isn't always a problem, it depends on the
feature in question.

> Is there a correct way to do MacPorts-style variants in a formula?  For 
instance, the top of the Emacs formula has this:
>
>  if ARGV.include? "--cocoa"
>    # 98643 is the same bzr rev as the old git sha db44e1e
>    # but both bzr@98643 and bzr@trunk fail with 'digest-doc' not found
>    head 'bzr://http://bzr.savannah.gnu.org/r/emacs/trunk', :tag => '98643'
>  else
>    url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.1.tar.bz2'
>    head 'bzr://http://bzr.savannah.gnu.org/r/emacs/trunk'
>    md5 '17f7f0ba68a0432d58fa69d05a2225be'
>  end
>
> That lets me run “brew install emacs --cocoa” and it'll grab the latest 
Emacs from Bazaar, and compile a Cocoa-native version.  It'll get placed 
into Cellar/emacs/HEAD.  If I leave off the --cocoa option, it downloads 
the 23.1 release, and compiles a console version of Emacs.
>
> Problem is this information isn't persisted.  I'm working on a new 
formula that has emacs as a dependency.  I have to give the same “--cocoa”
command line option when installing my new formula; otherwise, when 
Homebrew reads in the Emacs formula when it walks dependencies, it falls 
into the else case above, and expects emacs to be installed into 
Cellar/emacs/23.1.
>
> Is there a better way to do this?

Re: [homebrew] Variants

From:
Douglas Creager
Date:
2010-02-08 @ 16:02
> If it's an emacs plugin add it to the emacs formula.

In this case it's not a tiny single elisp file, it's Auctex, which is a 
pretty big package with its own download and installation instructions.  
And it installs stuff for both Emacs and Tex, so even if we didn't want it
to have its own package, it's not clear where exactly it would go.

> Otherwise wait for the variants system which will be built eventually.

Awesome.  Is there a design doc or email archive anywhere that describes 
how this would work to the user or formula writer?

In the meantime I'm just going to put a caveat into the formula that says 
you need to install it with the same command-line options that were used 
to install Emacs.

Thanks for the help!

–doug