From 72738d44554ac9d879ae300aa8c826134a07a46b Mon Sep 17 00:00:00 2001 From: Adam Sharp Date: Sun, 28 Apr 2019 13:39:09 -0400 Subject: [PATCH 1/2] Support installing gitsh from HEAD via Homebrew Supersedes https://github.com/thoughtbot/homebrew-formulae/pull/60. Adds a `head` configuration block to the Homebrew formula to support top-of-tree builds. Additionally adds a VERSION_SUFFIX variable to configure.ac, which is appended to PACKAGE_VERSION on `./configure`. This is used to produce a SemVer-compatible version number such as 0.14-head+5d9484d, in order to differentiate pre-release builds from official releases. --- configure.ac | 3 +++ homebrew/gitsh.rb.in | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/configure.ac b/configure.ac index 9ef4c696..f9746caa 100644 --- a/configure.ac +++ b/configure.ac @@ -5,6 +5,9 @@ AC_PREREQ([2.68]) AC_INIT(gitsh, 0.14, hello@thoughtbot.com) AM_INIT_AUTOMAKE([subdir-objects]) +AC_ARG_VAR([VERSION_SUFFIX]) +AS_IF([test -n "$VERSION_SUFFIX"], [AC_SUBST([PACKAGE_VERSION], ["$PACKAGE_VERSION$VERSION_SUFFIX"])]) + AC_ARG_VAR([RUBY],[The path of the Ruby binary to use]) AC_ARG_VAR( [READLINE_LIB], diff --git a/homebrew/gitsh.rb.in b/homebrew/gitsh.rb.in index fac6316f..98870c2d 100644 --- a/homebrew/gitsh.rb.in +++ b/homebrew/gitsh.rb.in @@ -9,6 +9,12 @@ class Gitsh < Formula url 'https://thoughtbot.github.io/@PACKAGE@/@DIST_ARCHIVES@' sha256 '@DIST_SHA@' + head do + url 'https://github.com/thoughtbot/@PACKAGE@.git' + depends_on 'autoconf' => :build + depends_on 'automake' => :build + end + def self.old_system_ruby? system_ruby_version = `#{SYSTEM_RUBY_PATH} -e "puts RUBY_VERSION"`.chomp system_ruby_version < '2.3.0' @@ -22,6 +28,13 @@ class Gitsh < Formula def install set_ruby_path set_architecture + + if build.head? + system "./autogen.sh" + git_sha = %x(git log -1 --format=%h).chomp + ENV["VERSION_SUFFIX"] = "-head+#{git_sha}" + end + system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", From 579b60211f0a32dc14ddb25ed6cd2698e1b59b2c Mon Sep 17 00:00:00 2001 From: Adam Sharp Date: Sun, 28 Apr 2019 14:09:07 -0400 Subject: [PATCH 2/2] fixup! Support installing gitsh from HEAD via Homebrew --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f9746caa..8fc0dd22 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ AC_PREREQ([2.68]) AC_INIT(gitsh, 0.14, hello@thoughtbot.com) AM_INIT_AUTOMAKE([subdir-objects]) -AC_ARG_VAR([VERSION_SUFFIX]) +AC_ARG_VAR([VERSION_SUFFIX], [Appended to PACKAGE_VERSION when building, e.g., for pre-release builds]) AS_IF([test -n "$VERSION_SUFFIX"], [AC_SUBST([PACKAGE_VERSION], ["$PACKAGE_VERSION$VERSION_SUFFIX"])]) AC_ARG_VAR([RUBY],[The path of the Ruby binary to use])