Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136670052
D7661.id19722.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
9 KB
Referenced Files
None
Subscribers
None
D7661.id19722.diff
View Options
Index: en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml
===================================================================
--- en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml
+++ en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml
@@ -1982,13 +1982,28 @@
</row>
<row>
+ <entry><varname>GH_SUBDIR</varname></entry>
+ <entry>When the software needs an additional
+ distribution file to be extracted within
+ <varname>${WRKSRC}</varname>, this variable can be
+ used. See the examples in <xref
+ linkend="makefile-master_sites-github-multiple"/>
+ for more information.</entry>
+ <entry>(none)</entry>
+ </row>
+
+ <row>
<entry><varname>GH_TUPLE</varname></entry>
<entry><varname>GH_TUPLE</varname> allows putting all
the <varname>GH_ACCOUNT</varname>,
- <varname>GH_PROJECT</varname>, and
- <varname>GH_TAGNAME</varname> into one variable. The
+ <varname>GH_PROJECT</varname>,
+ <varname>GH_TAGNAME</varname>, and
+ <varname>GH_SUBDIR</varname> into one variable. The
format is
- <replaceable>account</replaceable><literal>:</literal><replaceable>project</replaceable><literal>:</literal><replaceable>tagname</replaceable><literal>:</literal><replaceable>group</replaceable>.
+ <replaceable>account</replaceable><literal>:</literal><replaceable>project</replaceable><literal>:</literal><replaceable>tagname</replaceable><literal>:</literal><replaceable>group</replaceable><literal>/</literal><replaceable>subdir</replaceable>.
+ The
+ <literal>/</literal><replaceable>subdir</replaceable>
+ part is optional.
It is helpful when there is more than one GitHub
project from which to fetch.</entry>
</row>
@@ -2132,11 +2147,9 @@
GH_ACCOUNT= bar:icons,contrib
GH_PROJECT= foo-icons:icons foo-contrib:contrib
GH_TAGNAME= 1.0:icons fa579bc:contrib
+GH_SUBDIR= ext/icons:icons
-CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}
-
-post-extract:
- @${MV} ${WRKSRC_icons} ${WRKSRC}/icons</programlisting>
+CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}</programlisting>
<para>This will fetch three distribution files from
github. The default one comes from
@@ -2165,6 +2178,16 @@
with the <literal>contrib</literal> tag is called
<varname>${WRKSRC_contrib}</varname> and contains
<literal>${WRKDIR}/foo-contrib-fa579bc</literal>.</para>
+
+ <para>The software's build system expects to find the icons
+ in an <literal>ext/icons</literal> subdirectory in its
+ sources, so <varname>GH_SUBDIR</varname> is used. What it
+ basically does, after making sure
+ <literal>ext/icons</literal> does not exist, and that
+ <literal>ext</literal> exists, is this:</para>
+
+ <programlisting>post-extract:
+ @${MV} ${WRKSRC_icons} ${WRKSRC}/ext/icons</programlisting>
</example>
<example xml:id="makefile-master_sites-github-multi2">
@@ -2180,19 +2203,118 @@
PORTVERSION= 1.0.2
USE_GITHUB= yes
-GH_TUPLE= bar:foo-icons:1.0:icons \
+GH_TUPLE= bar:foo-icons:1.0:icons/ext/icons \
bar:foo-contrib:fa579bc:contrib
-CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}
-
-post-extract:
- @${MV} ${WRKSRC_icons} ${WRKSRC}/icons</programlisting>
+CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}</programlisting>
<para>Grouping was used in the previous example with
<literal>bar:icons,contrib</literal>. Some redundant
information is present with <varname>GH_TUPLE</varname>
because grouping is not possible.</para>
</example>
+
+ <example xml:id="makefile-master_sites-github-submodules">
+ <title>How to Use <varname>USE_GITHUB</varname> with
+ <application>Git</application> Submodules?</title>
+
+ <para>When dealing with GitHub as an upstream, it sometimes
+ happens that the repository uses submodules. See
+ &man.git-submodule.1; for more information on what
+ submodules are.</para>
+
+ <para>The problem with submodules is that each is a separate
+ repository. As such, they each need to be fetched
+ separately.</para>
+
+ <para>Using <package
+ role="port">finance/moneymanagerex</package> as an
+ example, its GitHub repository is <link
+ xlink:href="https://github.com/moneymanagerex/moneymanagerex"/>.
+ It has a <link
+ xlink:href="https://github.com/moneymanagerex/moneymanagerex/blob/master/.gitmodules"><filename>.gitmodules</filename></link>
+ file at the root of it, it is the file describing all the
+ submodules used in this repository. This file will tell
+ what additional repositories are needed:</para>
+
+ <programlisting>[submodule "lib/wxsqlite3"]
+ path = lib/wxsqlite3
+ url = https://github.com/utelle/wxsqlite3.git
+[submodule "3rd/mongoose"]
+ path = 3rd/mongoose
+ url = https://github.com/cesanta/mongoose.git
+[submodule "3rd/LuaGlue"]
+ path = 3rd/LuaGlue
+ url = https://github.com/moneymanagerex/LuaGlue.git
+[submodule "3rd/cgitemplate"]
+ path = 3rd/cgitemplate
+ url = https://github.com/moneymanagerex/html-template.git
+[...]</programlisting>
+
+ <para>The only information missing from that file is the
+ commit hash or tag to use as a version. This information
+ is found after cloning the repository:</para>
+
+ <screen>&prompt.user; <userinput>git clone --recurse-submodules https://github.com/moneymanagerex/moneymanagerex.git</userinput>
+Cloning into 'moneymanagerex'...
+remote: Counting objects: 32387, done.
+[...]
+Submodule '3rd/LuaGlue' (https://github.com/moneymanagerex/LuaGlue.git) registered for path '3rd/LuaGlue'
+Submodule '3rd/cgitemplate' (https://github.com/moneymanagerex/html-template.git) registered for path '3rd/cgitemplate'
+Submodule '3rd/mongoose' (https://github.com/cesanta/mongoose.git) registered for path '3rd/mongoose'
+Submodule 'lib/wxsqlite3' (https://github.com/utelle/wxsqlite3.git) registered for path 'lib/wxsqlite3'
+[...]
+Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/3rd/LuaGlue'...
+Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/3rd/cgitemplate'...
+Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/3rd/mongoose'...
+Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/lib/wxsqlite3'...
+[...]
+Submodule path '3rd/LuaGlue': checked out 'c51d11a247ee4d1e9817dfa2a8da8d9e2f97ae3b'
+Submodule path '3rd/cgitemplate': checked out 'cd434eeeb35904ebcd3d718ba29c281a649b192c'
+Submodule path '3rd/mongoose': checked out '2140e5992ab9a3a9a34ce9a281abf57f00f95cda'
+Submodule path 'lib/wxsqlite3': checked out 'fb66eb230d8aed21dec273b38c7c054dcb7d6b51'
+[...]
+&prompt.user; <userinput>cd moneymanagerex</userinput>
+&prompt.user; <userinput>git submodule status</userinput>
+ c51d11a247ee4d1e9817dfa2a8da8d9e2f97ae3b 3rd/LuaGlue (heads/master)
+ cd434eeeb35904ebcd3d718ba29c281a649b192c 3rd/cgitemplate (cd434ee)
+ 2140e5992ab9a3a9a34ce9a281abf57f00f95cda 3rd/mongoose (6.2-138-g2140e59)
+ fb66eb230d8aed21dec273b38c7c054dcb7d6b51 lib/wxsqlite3 (v3.4.0)
+[...]</screen>
+
+ <para>It can also be found on GitHub, each subdirectory that
+ is in fact a submodule is shown as
+ <replaceable>directory</replaceable><literal> @ </literal><replaceable>hash</replaceable>,
+ for example,
+ <literal>mongoose @ 2140e59</literal>.</para>
+
+ <note>
+ <para>While getting the information from GitHub seems more
+ straightforward, the information found using
+ <command>git submodule status</command> will get more
+ meaningful information, for example, here,
+ <literal>lib/wxsqlite3</literal>'s commit hash
+ <literal>fb66eb2</literal> correspond to
+ <literal>v3.4.0</literal>. Both can be used
+ interchangeably, but when a tag is available, it is
+ always better to use it.</para>
+ </note>
+
+ <para>Now that all the required information have been
+ gathered, the <filename>Makefile</filename> can be written
+ (only showing the GitHub related lines):</para>
+
+ <programlisting>PORTNAME= moneymanagerex
+PORTVERSION= 1.3.0
+DISTVERSIONPREFIX= v
+
+USE_GITHUB= yes
+GH_TUPLE= utelle:wxsqlite3:v3.4.0:wxsqlite3/lib/wxsqlite3 \
+ moneymanagerex:LuaGlue:c51d11a:lua_glue/3rd/LuaGlue \
+ moneymanagerex:html-template:cd434ee:html_template/3rd/cgitemplate \
+ cesanta:mongoose:2140e59:mongoose/3rd/mongoose \
+ [...]</programlisting>
+ </example>
</sect3>
</sect2>
Index: share/xml/man-refs.ent
===================================================================
--- share/xml/man-refs.ent
+++ share/xml/man-refs.ent
@@ -257,6 +257,7 @@
<!ENTITY man.getfacl.1 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>getfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY man.getopt.1 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>getopt</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY man.getopts.1 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>getopts</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
+<!ENTITY man.git-submodule.1 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>git-submodule</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY man.glob.1 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>glob</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY man.gnu-ar.1 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>gnu-ar</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
<!ENTITY man.gnu-ranlib.1 "<citerefentry xmlns='http://docbook.org/ns/docbook'><refentrytitle>gnu-ranlib</refentrytitle><manvolnum>1</manvolnum></citerefentry>">
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 19, 8:09 PM (17 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25671897
Default Alt Text
D7661.id19722.diff (9 KB)
Attached To
Mode
D7661: Document GH_SUBDIR.
Attached
Detach File
Event Timeline
Log In to Comment