Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Write package scripts for a number of OSs/package managers #15

Open
2 of 6 tasks
alexrp opened this issue Feb 25, 2013 · 17 comments
Open
2 of 6 tasks

Write package scripts for a number of OSs/package managers #15

alexrp opened this issue Feb 25, 2013 · 17 comments

Comments

@alexrp
Copy link
Member

alexrp commented Feb 25, 2013

Namely:

Feel free to reply with more package managers/OSs that I should add to the list if you're interested in putting effort into writing a script for that target.

@ghost ghost assigned alexrp Feb 25, 2013
@novabyte
Copy link
Contributor

I can help with writing the PKGBUILD and Homebrew formula if you need it.

@alexrp
Copy link
Member Author

alexrp commented Feb 25, 2013

I'm already hacking together a PKGBUILD, but it would be great if you could put together a Homebrew formula (I'd have to dust off my iMac to write that).

@novabyte
Copy link
Contributor

Sure, I can write the homebrew formula. The only problem is that it'd depend on the Elixir version which is:

elixir: stable 0.8.1, HEAD
http://elixir-lang.org/
/usr/local/Cellar/elixir/0.8.1 (246 files, 3.1M) *
https://github.com/mxcl/homebrew/commits/master/Library/Formula/elixir.rb

As far as I'm aware we still need 0.9.0 with Flect?

@alexrp
Copy link
Member Author

alexrp commented Feb 25, 2013

PKGBUILD committed in 4341449.

@alexrp
Copy link
Member Author

alexrp commented Feb 25, 2013

@novabyte regarding your IRC question: Just use whatever seems to be the convention for the package manager. So if foo-lang is more common than just foo, just go with flect-lang.

@alexrp
Copy link
Member Author

alexrp commented Mar 3, 2013

Added MacPorts to the list.

@novabyte: Can you also take a look at that in addition to Homebrew?

@novabyte
Copy link
Contributor

novabyte commented Mar 3, 2013

Sure, I can :).

I've not forgotten about the Homebrew Formula, I've got a halfway complete script that I'm fleshing out and debugging.

I wasn't sure anyone really used MacPorts still, but I'll have a look at creating a Portfile.

@novabyte
Copy link
Contributor

hey @alexrp

Here's a Work-In-Progress for the Homebrew formula. There's a couple of remaining TODOs. :/

require 'formula'

class Flect < Formula
  homepage 'https://github.com/lycus/flect'
  head 'https://github.com/lycus/flect.git', :revision => 'HEAD'

  depends_on 'git'    => :build
  depends_on 'elixir' => :build
  depends_on 'erlang'

  def install
    pwd   = Pathname.new('.')
    # TODO: detect arch and adjust
    abi   = ''
    fpabi = ''

    ohai 'Configuring the build...'
    (pwd+'config.mak').write <<-EOF.undent
      export FLECT_ARCH       ?= x86
      export FLECT_OS         ?= linux
      export FLECT_ABI        ?= #{abi}
      export FLECT_FPABI      ?= #{fpabi}
      export FLECT_CROSS      ?= false

      export FLECT_CC         ?= clang
      export FLECT_CC_TYPE    ?= gcc
      export FLECT_CC_ARGS    ?=
      export FLECT_LD         ?= ld
      export FLECT_LD_TYPE    ?= ld
      export FLECT_LD_ARGS    ?=

      export FLECT_PREFIX     ?= #{prefix}/usr
      export FLECT_BIN_DIR    ?= #{prefix}/usr/bin
      export FLECT_LIB_DIR    ?= #{prefix}/usr/lib/flect
      export FLECT_ST_LIB_DIR ?= #{prefix}/usr/lib/flect/static
      export FLECT_SH_LIB_DIR ?= #{prefix}/usr/lib/flect/shared
    EOF

    ohai 'Building and installing...'
    system 'make install'

    # TODO: link the keg
  end

  test do
    ohai 'Running test suite...'
    system 'make test -j 1'
  end
end

@alexrp
Copy link
Member Author

alexrp commented May 23, 2013

I think it's safe to just say:

export FLECT_ARCH ?= x86
export FLECT_OS ?= darwin
export FLECT_ABI ?= x86-sysv64
export FLECT_FPABI ?= x86-sse

People rarely want to build 32-bit stuff on Mac anymore.

@novabyte
Copy link
Contributor

I believe this will work.

I cannot test it right now because the Elixir guys have just updated their Homebrew formula for their 0.9.0 release. The problem is that they've introduced a dependency on Erlang R16+ which hasn't been updated on Homebrew yet. :/

require 'formula'

class Flect < Formula
  homepage 'https://github.com/lycus/flect'
  head 'https://github.com/lycus/flect.git', :revision => 'HEAD'

  depends_on 'elixir' => :build
  depends_on 'erlang'

  def install
    pwd   = Pathname.new('.')
    abi   = 'x86-sysv32'
    fpabi = 'x86-x87'

    if MacOS.prefer_64_bit?
      abi   = 'x86-sysv64'
      fpabi = 'x86-sse'
    end

    ohai 'Configuring the build...'
    (pwd+'config.mak').write <<-EOF.undent
      export FLECT_ARCH       ?= x86
      export FLECT_OS         ?= darwin
      export FLECT_ABI        ?= #{abi}
      export FLECT_FPABI      ?= #{fpabi}
      export FLECT_CROSS      ?= false

      export FLECT_CC         ?= clang
      export FLECT_CC_TYPE    ?= gcc
      export FLECT_CC_ARGS    ?=
      export FLECT_LD         ?= ld
      export FLECT_LD_TYPE    ?= ld
      export FLECT_LD_ARGS    ?=

      export FLECT_PREFIX     ?= #{prefix}/usr
      export FLECT_BIN_DIR    ?= #{prefix}/usr/bin
      export FLECT_LIB_DIR    ?= #{prefix}/usr/lib/flect
      export FLECT_ST_LIB_DIR ?= #{prefix}/usr/lib/flect/static
      export FLECT_SH_LIB_DIR ?= #{prefix}/usr/lib/flect/shared
    EOF

    ohai 'Building and installing...'
    system "make", "install"
  end

  test do
    ohai 'Running test suite...'
    system "make", "test", "-j", "1"
  end
end

@alexrp
Copy link
Member Author

alexrp commented May 23, 2013

Note that if you're building Flect for 32-bit, you likely want to pass -m32 to FLECT_CC_ARGS.

@alexrp
Copy link
Member Author

alexrp commented May 23, 2013

Also, did you intend to say #{prefix}/usr/bin as opposed to #{prefix}/bin?

@novabyte
Copy link
Contributor

You're right I'll make those changes in the morning, I've been staring at the script for too long and missing things now. I'll wait to test the formula then submit a pull request.

I'll have a look into creating a Portfile for MacPorts users after that.

@novabyte
Copy link
Contributor

Ok. It seems that it's necessary to do the following to install Elixir via Homebrew:

$> brew uninstall erlang
$> brew tap homebrew/versions
$> brew install erlang-r16
$> brew update
$> brew install elixir

The only problem with the above is that anyone wanting to casually install flect via Hombrew (i.e. those people that won't read the README) will see the dependency failure without installing the specific version of the Erlang runtime for Elixir...

Shall I configure the Flect Homebrew Formula to depend on erlang-r16?

@novabyte
Copy link
Contributor

What are your thoughts about speaking with the Elixir team and seeing if they're open to bundling the required version of the Erlang VM with their build process?

In the same way as the Basho team does with Riak.

@novabyte
Copy link
Contributor

Homebrew formula committed in 4ce6932.

@novabyte
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants