Skip to content

Commit

Permalink
Update documentation, license, scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Aug 11, 2016
1 parent 671cb5c commit b55646a
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 92 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright Homebrew contributors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 changes: 12 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
# Homebrew Portable
Formulae and tools to build versions of Ruby, Git and Curl that can be installed and run from anywhere on the filesystem.

Portable edition tools.

## How to build?
## How do I install these formulae?
Just `brew install homebrew/portable/<formula>`.

## How do I build packages for these formulae?
### OS X

* It is recommended to build formulae on Leopard VM.
* `brew install ruby`
* Set following environment variables for Tigerbrew:
* `export HOMEBREW_PREFER_64_BIT=1`
* `export HOMEBREW_DEVELOPER=1`
* `export HOMEBREW_RUBY_PATH="$(brew --prefix ruby)/bin/ruby"`
* `brew tap homebrew/portable`
* `brew install portable-<tool>`.
* `brew uninstall $(brew deps --include-build portable-<tool>)`
* `brew test portable-<tool>`.
* Check the linkage using `brew linkage portable-<tool>`.
* `brew portable-package portable-<tool>`.
Run `brew portable-package <formula>` (ideally inside a OS X 10.5 VM so it is compatible with old OS X versions.

### Linux

* Build docker image from `docker/Dockerfile`.
* `brew tap homebrew/portable`
* `brew install portable-<tool>`.
* `brew uninstall $(brew deps --include-build portable-<tool>)`
* `brew test portable-<tool>`.
* Check the linkage using `ldd`.
* `brew portable-package portable-<tool>`.
Run `brew portable-package <formula>`. Ideally this should be run inside the CentOS 5 Docker container with:
```bash
docker build -f docker/Dockerfile -t homebrew-portable:latest .
docker run -t -i homebrew-portable /bin/bash
brew portable-package <formula>
```

## License

MIT License.
Code is under the [BSD 2 Clause (NetBSD) license](https://github.com/Homebrew/homebrew-portable/blob/master/LICENSE.txt).
66 changes: 22 additions & 44 deletions cmd/brew-portable-package.rb
Original file line number Diff line number Diff line change
@@ -1,50 +1,28 @@
require "formula"
require "keg"
require "utils/bottles"
# Build a portable Homebrew utility bottle.
#
# Usage: brew portable-package <formula> [formula...]

include FileUtils
odie "Need to specify at least one portable formula!" if ARGV.empty?

raise FormulaUnspecifiedError if ARGV.named.empty?
f = ARGV.resolved_formulae.first
keg = Keg.new f.prefix
tab = Tab.for_keg(keg)
f.build = tab
filename = Bottle::Filename.create(f, Utils::Bottles.tag, 0)
bottle_path = Pathname.pwd/filename
tar_filename = filename.to_s.sub(/.gz$/, "")
tar_path = Pathname.pwd/tar_filename

ohai "Packaging #{filename}..."
keg.lock do
begin
original_tab = tab.dup
tab.poured_from_bottle = false
tab.HEAD = nil
tab.time = nil
tab.write
if RUBY_VERSION.split(".").first.to_i < 2
safe_system "brew", "install", "ruby"
ENV["HOMEBREW_RUBY_PATH"] = "#{HOMEBREW_PREFIX}/bin/ruby"
end

keg.find do |file|
if file.symlink?
# Ruby does not support `File.lutime` yet.
# Shellout using `touch` to change modified time of symlink itself.
system "/usr/bin/touch", "-h",
"-t", tab.source_modified_time.strftime("%Y%m%d%H%M.%S"), file
else
file.utime(tab.source_modified_time, tab.source_modified_time)
end
end
ENV["HOMEBREW_PREFER_64_BIT"] = "1"
ENV["HOMEBREW_DEVELOPER"] = "1"

cd HOMEBREW_CELLAR do
safe_system "tar", "cf", tar_path, "#{f.name}/#{f.pkg_version}"
tar_path.utime(tab.source_modified_time, tab.source_modified_time)
relocatable_tar_path = "#{f}-bottle.tar"
mv tar_path, relocatable_tar_path
safe_system "gzip", "-f", relocatable_tar_path
mv "#{relocatable_tar_path}.gz", bottle_path
end
ensure
ignore_interrupts do
original_tab.write
end
ARGV.named.each do |name|
name = "portable-#{name}" unless name.start_with? "portable-"
f = Formula[name]
safe_system "brew", "install", "--build-bottle", name
safe_system "brew uninstall --force $(brew deps --include-build #{name})"
safe_system "brew", "test", name
puts "Library linkage:"
if OS.linux?
puts Utils.open_read "ldd", "#{f.bin}/#{arg.gsub(/^portable-/, "")}"
else
puts Utils.popen_read "brew", "linkage", name
end
safe_system "brew", "bottle", "--skip-relocation", name
end
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# We want sufficiently old glibc
# We want a sufficiently old glibc to be backwards compatible.
FROM centos:centos5
MAINTAINER Xu Cheng <xucheng@me.com>
MAINTAINER Homebrew Maintainers <homebrew-discuss@googlegroups.com>

RUN rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
RUN yum groupinstall 'Development Tools' -y
Expand Down

0 comments on commit b55646a

Please sign in to comment.