From owner-svn-doc-head@freebsd.org Mon Sep 5 11:34:08 2016 Return-Path: Delivered-To: svn-doc-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DA95B96A88; Mon, 5 Sep 2016 11:34:08 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E0548F3; Mon, 5 Sep 2016 11:34:08 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u85BY7eP057246; Mon, 5 Sep 2016 11:34:07 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u85BY7ZP057244; Mon, 5 Sep 2016 11:34:07 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201609051134.u85BY7ZP057244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Mon, 5 Sep 2016 11:34:07 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r49366 - in head: en_US.ISO8859-1/books/porters-handbook/makefiles share/xml X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the doc tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2016 11:34:08 -0000 Author: mat Date: Mon Sep 5 11:34:07 2016 New Revision: 49366 URL: https://svnweb.freebsd.org/changeset/doc/49366 Log: Document GH_SUBDIR. While there, add an example on how to do work with git submodules. Reviewed by: wblock Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D7661 Modified: head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml head/share/xml/man-refs.ent Modified: head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml Fri Sep 2 21:40:36 2016 (r49365) +++ head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml Mon Sep 5 11:34:07 2016 (r49366) @@ -1982,15 +1982,29 @@ MASTER_SITE_SUBDIR= stardict/WyabdcRealP + GH_SUBDIR + When the software needs an additional + distribution file to be extracted within + ${WRKSRC}, this variable can be + used. See the examples in + for more information. + (none) + + + GH_TUPLE - GH_TUPLE allows putting all - the GH_ACCOUNT, - GH_PROJECT, and - GH_TAGNAME into one variable. The - format is - account:project:tagname:group. - It is helpful when there is more than one GitHub - project from which to fetch. + GH_TUPLE allows putting + GH_ACCOUNT, + GH_PROJECT, + GH_TAGNAME, and + GH_SUBDIR into a single variable. + The format is + account:project:tagname:group/subdir. + The + /subdir + part is optional. It is helpful when there is more + than one GitHub project from which to fetch. @@ -2132,11 +2146,9 @@ USE_GITHUB= yes 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 +CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib} This will fetch three distribution files from github. The default one comes from @@ -2165,6 +2177,17 @@ post-extract: with the contrib tag is called ${WRKSRC_contrib} and contains ${WRKDIR}/foo-contrib-fa579bc. + + The software's build system expects to find the icons + in a ext/icons subdirectory in its + sources, so GH_SUBDIR is used. + GH_SUBDIR makes sure that + ext exists, but that + ext/icons does not already exist. + Then it does this: + + post-extract: + @${MV} ${WRKSRC_icons} ${WRKSRC}/ext/icons @@ -2180,19 +2203,118 @@ post-extract: 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 +CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib} Grouping was used in the previous example with bar:icons,contrib. Some redundant information is present with GH_TUPLE because grouping is not possible. + + + How to Use <varname>USE_GITHUB</varname> with + <application>Git</application> Submodules? + + Ports with GitHub as an upstream repository sometimes + use submodules. See &man.git-submodule.1; for more + information. + + The problem with submodules is that each is a separate + repository. As such, they each must be fetched + separately. + + Using finance/moneymanagerex as an + example, its GitHub repository is . + It has a .gitmodules + file at the root. This file describes all the submodules + used in this repository, and lists additional repositories + needed. This file will tell what additional repositories + are needed: + + [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 +[...] + + 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: + + &prompt.user; git clone --recurse-submodules https://github.com/moneymanagerex/moneymanagerex.git +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; cd moneymanagerex +&prompt.user; git submodule status + c51d11a247ee4d1e9817dfa2a8da8d9e2f97ae3b 3rd/LuaGlue (heads/master) + cd434eeeb35904ebcd3d718ba29c281a649b192c 3rd/cgitemplate (cd434ee) + 2140e5992ab9a3a9a34ce9a281abf57f00f95cda 3rd/mongoose (6.2-138-g2140e59) + fb66eb230d8aed21dec273b38c7c054dcb7d6b51 lib/wxsqlite3 (v3.4.0) +[...] + + It can also be found on GitHub. Each subdirectory + that is a submodule is shown as + directory @ hash, + for example, + mongoose @ 2140e59. + + + While getting the information from GitHub seems more + straightforward, the information found using + git submodule status will provide + more meaningful information. For example, here, + lib/wxsqlite3's commit hash + fb66eb2 correspond to + v3.4.0. Both can be used + interchangeably, but when a tag is available, use + it. + + + Now that all the required information has been + gathered, the Makefile can be written + (only GitHub-related lines are shown): + + 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 \ + [...] + @@ -4755,6 +4877,10 @@ LIB_DEPENDS+= libb.so:devel/b + GH_SUBDIR + + + GH_TAGNAME Modified: head/share/xml/man-refs.ent ============================================================================== --- head/share/xml/man-refs.ent Fri Sep 2 21:40:36 2016 (r49365) +++ head/share/xml/man-refs.ent Mon Sep 5 11:34:07 2016 (r49366) @@ -257,6 +257,7 @@ getfacl1"> getopt1"> getopts1"> +git-submodule1"> glob1"> gnu-ar1"> gnu-ranlib1">