Skip to content

Instantly share code, notes, and snippets.

@skottler
Created March 8, 2014 08:25
Show Gist options
  • Save skottler/bf887642420c411ffee2 to your computer and use it in GitHub Desktop.
Save skottler/bf887642420c411ffee2 to your computer and use it in GitHub Desktop.
commit af15b5923823a186c9deb258020e29fe3aad3fab
Author: Sam Kottler <shk@redhat.com>
Date: Sat Mar 8 14:13:31 2014 +0600
Add bootstrap mode and add necessary conditionals for building rebar with a self-hosted rebar
Rebar is built with rebar, which makes getting the initial bootstrap
completed rather interesting. Additionally, erlang-rebar requires
erlang-getopt, but erlang-rebar can't be built without erlang-getopt
already available in the repo mock is using because of the patch which
removes the vendored version. This commit adds a variable which uses the
bundled getopt in order to bootstrap.
diff --git a/erlang-rebar.spec b/erlang-rebar.spec
index e75bbcf..a9f00ae 100644
--- a/erlang-rebar.spec
+++ b/erlang-rebar.spec
@@ -4,6 +4,13 @@
%global git_tag ebb474b
%global patchnumber 0
+# Set this to true when starting a rebuild of the whole erlang stack. There's
+# a cyclical dependency between erlang-rebar and erlang-getopt so this package
+# (rebar) needs to get built first in bootstrap mode.
+%global need_bootstrap_set 0
+
+%{!?need_bootstrap: %global need_bootstrap %{need_bootstrap_set}}
+
Name: erlang-%{realname}
Version: 2.1.0
@@ -19,8 +26,13 @@ Source1: rebar.escript
Patch1: rebar-0001-Don-t-load-templates-from-the-bundle.patch
# Fedora/EPEL-specific
Patch2: rebar-0002-Remove-bundled-mustache.patch
+
+# The bundled getopt is necessary to do the initial bootstrap since
+# erlang-getopt requires erlang-rebar to build and vice versa.
+%if 0%{?need_bootstrap} < 1
# Fedora/EPEL-specific
Patch3: rebar-0003-Remove-bundled-getopt.patch
+%endif
# Backported from upstream
Patch4: rebar-0004-Be-sure-to-filter-empty-sources-h-t-to-Tuncer-and-Jo.patch
# Will be proposed for inclusion
@@ -35,7 +47,13 @@ Patch8: rebar-0008-Remove-abnfc-compiler-support-n-a-in-Fedora-EPEL.patch
Patch9: rebar-0009-Adjust-app-version.patch
# Backported from upstream
Patch10: rebar-0010-Fix-default-DTL-compilation-when-no-erlydtl_opts-are.patch
+
+%if 0%{?need_bootstrap} < 1
BuildRequires: erlang-rebar
+%else
+BuildRequires: erlang
+%endif
+
# FIXME wip
#Requires: erlang-abnfc%{?_isa}
Requires: erlang-asn1%{?_isa}
@@ -77,7 +95,9 @@ Erlang Build Tools.
%setup -q -n %{upstream}-%{realname}-%{git_tag}
%patch1 -p1 -b .dont_load_templates
%patch2 -p1 -b .remove_bundled_mustache
+%if 0%{?need_bootstrap} < 1
%patch3 -p1 -b .remove_bundled_getopt
+%endif
%patch4 -p1 -b .dont_try_building_so
%patch5 -p1 -b .allow_discarding_ports
%patch6 -p1 -b .use_locally_installed
@@ -88,7 +108,12 @@ Erlang Build Tools.
%build
+%if 0%{?need_bootstrap} < 1
rebar compile -v
+%else
+./bootstrap
+./rebar compile -v
+%endif
%install
commit 0648829759d4f018e1b2809a5038c4daf25dabc5
Author: Sam Kottler <shk@redhat.com>
Date: Sat Mar 8 14:17:19 2014 +0600
Bump the release for the bootstrap mode change
diff --git a/erlang-rebar.spec b/erlang-rebar.spec
index a9f00ae..6811df5 100644
--- a/erlang-rebar.spec
+++ b/erlang-rebar.spec
@@ -14,7 +14,7 @@
Name: erlang-%{realname}
Version: 2.1.0
-Release: 0.6%{?dist}
+Release: 0.7%{?dist}
Summary: Erlang Build Tools
Group: Development/Tools
License: MIT
@@ -137,6 +137,9 @@ cp -a priv %{buildroot}%{_libdir}/erlang/lib/%{realname}-%{version}/
%changelog
+* Sat Mar 8 2014 Sam Kottler <skottler@fedoraproject.org> - 2.1.0-0.7
+- Add bootstrap variable and necessary conditionals for building without external getopt
+
* Sun Sep 01 2013 Peter Lemenkov <lemenkov@gmail.com> - 2.1.0-0.5
- Added missing runtime requirements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment