Open alexrp opened 11 years ago
I can help with writing the PKGBUILD and Homebrew formula if you need it.
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).
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?
PKGBUILD committed in 4341449.
@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
.
Added MacPorts to the list.
@novabyte: Can you also take a look at that in addition to Homebrew?
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.
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
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.
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
Note that if you're building Flect for 32-bit, you likely want to pass -m32
to FLECT_CC_ARGS
.
Also, did you intend to say #{prefix}/usr/bin
as opposed to #{prefix}/bin
?
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.
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
?
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.
Homebrew formula committed in 4ce6932b78ec928710d6fbede85e6e4018601adc.
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.