Unpacking the tarballs from inside the build scripts.
This commit is contained in:
parent
8533c2604d
commit
570c9f3863
1 changed files with 69 additions and 11 deletions
80
LFS/lfs.xsl
80
LFS/lfs.xsl
|
@ -54,13 +54,14 @@
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Hock for user envars or extra commands before cd into the sources dir -->
|
<!-- Hock for user envars or extra commands after unpacking the tarball
|
||||||
|
but before cd into the sources dir -->
|
||||||
<xsl:template name="user_pre_commands">
|
<xsl:template name="user_pre_commands">
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Hock for user footer additions -->
|
<!-- Hock for user footer additions before remove sources dir -->
|
||||||
<xsl:template name="user_footer">
|
<xsl:template name="user_footer">
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -71,15 +72,14 @@
|
||||||
<!-- Inherited values -->
|
<!-- Inherited values -->
|
||||||
<xsl:param name="reference" select="foo"/>
|
<xsl:param name="reference" select="foo"/>
|
||||||
<xsl:param name="order" select="foo"/>
|
<xsl:param name="order" select="foo"/>
|
||||||
<!-- Add a string to be sure that this scripts are run
|
<!-- Added a string to be sure that this scripts are run
|
||||||
before the selected one -->
|
before the selected one -->
|
||||||
<xsl:variable name="insert_order" select="concat($order,'_0')"/>
|
<xsl:variable name="insert_order" select="concat($order,'_0')"/>
|
||||||
<!-- Add an xsl:if block for each referenced sect1 you want
|
<!-- Add an xsl:if block for each referenced sect1 you want
|
||||||
to insert scripts before -->
|
to insert scripts before -->
|
||||||
<xsl:if test="$reference = 'ID_of_selected_sect1'">
|
<xsl:if test="$reference = 'ID_of_selected_sect1'">
|
||||||
<!-- Add an exsl:document block for each script to be inserted
|
<!-- Add an exsl:document block for each script to be inserted
|
||||||
at this point of the build. This one is only a dummy example.
|
at this point of the build. This one is only a dummy example. -->
|
||||||
You must replace "dummy" by the script name and increase "01" -->
|
|
||||||
<exsl:document href="{$insert_order}01-dummy" method="text">
|
<exsl:document href="{$insert_order}01-dummy" method="text">
|
||||||
<xsl:call-template name="header"/>
|
<xsl:call-template name="header"/>
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
|
@ -87,13 +87,16 @@ PKG_PHASE=dummy
|
||||||
PACKAGE=dummy
|
PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:call-template name="unpack"/>
|
||||||
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
@ -105,7 +108,7 @@ make install
|
||||||
<!-- Inherited values -->
|
<!-- Inherited values -->
|
||||||
<xsl:param name="reference" select="foo"/>
|
<xsl:param name="reference" select="foo"/>
|
||||||
<xsl:param name="order" select="foo"/>
|
<xsl:param name="order" select="foo"/>
|
||||||
<!-- Add a string to be sure that this scripts are run
|
<!-- Added a string to be sure that this scripts are run
|
||||||
after the selected one -->
|
after the selected one -->
|
||||||
<xsl:variable name="insert_order" select="concat($order,'_z')"/>
|
<xsl:variable name="insert_order" select="concat($order,'_z')"/>
|
||||||
<!-- Add an xsl:if block for each referenced sect1 you want
|
<!-- Add an xsl:if block for each referenced sect1 you want
|
||||||
|
@ -120,13 +123,16 @@ PKG_PHASE=dummy
|
||||||
PACKAGE=dummy
|
PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:call-template name="unpack"/>
|
||||||
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
@ -148,13 +154,16 @@ PKG_PHASE=dummy
|
||||||
PACKAGE=dummy
|
PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:call-template name="unpack"/>
|
||||||
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -207,13 +216,36 @@ make install
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Enter to the sources dir, clean it, and unpack the tarball -->
|
||||||
|
<xsl:template name="unpack">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||||
|
<xsl:text>cd $SRCDIR</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>cd /sources</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>
|
||||||
|
PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
|
||||||
|
if [ -d $PKGDIR ]; then
|
||||||
|
rm -rf $PKGDIR
|
||||||
|
fi
|
||||||
|
if [ -d ${PKGDIR%-*}-build ]; then
|
||||||
|
rm -rf ${PKGDIR%-*}-build
|
||||||
|
fi
|
||||||
|
tar -xf $TARBALL
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Extra previous commands needed by the book but not inside screen tags -->
|
<!-- Extra previous commands needed by the book but not inside screen tags -->
|
||||||
<xsl:template name="pre_commands">
|
<xsl:template name="pre_commands">
|
||||||
<xsl:if test="sect2[@role='installation']">
|
<xsl:if test="sect2[@role='installation']">
|
||||||
<xsl:text>cd $PKGDIR
</xsl:text>
|
<xsl:text>cd $PKGDIR
</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
<xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
||||||
<xsl:text>tar -xvf ../$TARBALL_1 --strip-components=1
</xsl:text>
|
<xsl:text>tar -xf ../$TARBALL_1 --strip-components=1
</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
@ -229,6 +261,23 @@ make install
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Remove sources and build dirs -->
|
||||||
|
<xsl:template name="clean_sources">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||||
|
<xsl:text>cd $SRCDIR</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>cd /sources</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>
|
||||||
|
rm -rf $PKGDIR
|
||||||
|
rm -rf ${PKGDIR%-*}-build
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Script footer -->
|
<!-- Script footer -->
|
||||||
<xsl:template name="footer">
|
<xsl:template name="footer">
|
||||||
<!-- Dump the build time -->
|
<!-- Dump the build time -->
|
||||||
|
@ -299,13 +348,16 @@ PKG_PHASE=dummy
|
||||||
PACKAGE=dummy
|
PACKAGE=dummy
|
||||||
VERSION=0.0.0
|
VERSION=0.0.0
|
||||||
TARBALL=dummy-0.0.0.tar.bz2
|
TARBALL=dummy-0.0.0.tar.bz2
|
||||||
|
</xsl:text>
|
||||||
|
<xsl:call-template name="unpack"/>
|
||||||
|
<xsl:text>
|
||||||
cd $PKGDIR
|
cd $PKGDIR
|
||||||
./configure --prefix=/usr
|
./configure --prefix=/usr
|
||||||
make
|
make
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
|
<xsl:call-template name="clean_sources"/>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -401,11 +453,17 @@ make install
|
||||||
<xsl:apply-templates select="sect1info[@condition='script']">
|
<xsl:apply-templates select="sect1info[@condition='script']">
|
||||||
<xsl:with-param name="phase" select="$filename"/>
|
<xsl:with-param name="phase" select="$filename"/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
|
<xsl:if test="sect2[@role='installation']">
|
||||||
|
<xsl:call-template name="unpack"/>
|
||||||
|
</xsl:if>
|
||||||
<xsl:call-template name="user_pre_commands"/>
|
<xsl:call-template name="user_pre_commands"/>
|
||||||
<xsl:call-template name="pre_commands"/>
|
<xsl:call-template name="pre_commands"/>
|
||||||
<xsl:apply-templates select=".//screen"/>
|
<xsl:apply-templates select=".//screen"/>
|
||||||
<xsl:call-template name="post_commands"/>
|
<xsl:call-template name="post_commands"/>
|
||||||
<xsl:call-template name="user_footer"/>
|
<xsl:call-template name="user_footer"/>
|
||||||
|
<xsl:if test="sect2[@role='installation']">
|
||||||
|
<xsl:call-template name="clean_sources"/>
|
||||||
|
</xsl:if>
|
||||||
<xsl:call-template name="footer"/>
|
<xsl:call-template name="footer"/>
|
||||||
</exsl:document>
|
</exsl:document>
|
||||||
<!-- Hock to insert scripts after the current one -->
|
<!-- Hock to insert scripts after the current one -->
|
||||||
|
|
Reference in a new issue