Updated syntax.txt (was: looking for syntax wor...)

atark at thepipeline.net atark at thepipeline.net
Tue Jan 9 19:28:07 PST 2001


Here is an updated syntax.txt.  As soon as I get CVS access I'll commit
it.  Also let me know what you think.  I'm sure it's not 100% complete
or accurate (moving target you know) but it's closer.

A couple of comments.  

1. Is it really necessary to have both tag and notag scenerious in
ALFS?  Seems a bit confusing and not consistent in a few places.  Seems
like either one or the other makes more sense depending on which tag.

2. This document should be converted to SGML, HTML, or something, I
would (and maybe will) volunteer for this but I'm not sure if I can put
in the time learn the SGML/Docbook stuff.



--Andy


Bryan Dumm wrote:
> 
> Howdy,
> 
> We need someone to checkout from cvs the syntax.txt document,
> the profiles(chap4, chap5) and the backend code, and _update_
> the syntax.txt document.
> 
> You can use cvs from the command line, or find it on the web @
> 
> http://cvs.linuxfromscratch.org
> 
> under the ALFS section. :)
> 
> Plus you can email/sign up to alfs-backend if you get lost/confused
> by anything while writing things up....
> 
> Please email me, if you are willing to do it, as I didn't want to get
> a bunch of people doing the same work....
> 
> thx,
> Bryan
> 
> 
> 
> --
> Unsubscribe: send email to alfs-discuss-request at linuxfromscratch.org
> and put unsubscribe in the subject header of the message
-------------- next part --------------
Authors:    Jesse Tie Ten Quee (highos at highos dot com)
            Gerard Beekmans (gerard at linuxfromscratch dot com)
            Bryan Dumm (bdumm at bobby dot bcpub dot com)
            (And of course, everyone on alfs-profile at linuxfromscratch.org)
Version:    0.0.3
Subject:    Profile Syntax


Getting started:
================

The ALFS Profile is based heavily on XML, this descriptes the basic syntax 
we plan on using (and writting a DTD)

Single and double quotes are allowed, we've only used double here.




Calling external commands:
--------------------------

Used for executing external system commands (make, patch, configure, etc)

Tag name:  system_command
Tag value: command to execute

Allowed attributes:
	dir		- working directory
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter

Example:

<system_command dir="&LFS;&builddir;" param1="-N" param2="-p" param3="-i"
	param4="file.patch">patch</system_command>


No tag scenario:
	dir		- working directory
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter
	command		- command to execute

Example:

<system_command dir="&LFS;&builddir;" param=1"-N" param2="-p" param3="-i"
	param4="file.patch" command="patch" />



Search and Replace:
-------------------

If you want to replace a certain string in a file, this is what you could use.

Tag name:  search_replace
Tag value: file to operate on

Allowed attributes:
	dir		- working directory
	find		- string to look for
	replace		- string to replace the 'find' string with

Example:

<search_replace dir="&LFS;&builddir;" find="termcap" 
	replace="ncurses">Makefile</search_replace>


No tag scenario:
	dir		- working directory
	find		- string to look for
	replace		- string to replace the 'find' string with
	file		- file to operate on

Example:

<search_replace dir="&LFS;&builddir;" find="termcap" 
	replace="ncurses" file="Makefile" />


Mounting a Partition:
---------------------

Tag name:  mount
Tag value: mount point

Allowed attributes:
	device		- device to mount
	type		- filesystem type

Example:

<mount device="/dev/hda1" type="ext2">/mnt/lfs</mount>

A no tag value scenario:

	device		- device to mount
	type		- filesytem type
	mpoint		- mount point

Example:

<mount device="/dev/hda1" type="ext2" point="/mnt/lfs />



Creating file system: 
---------------------

FIXME: NOT YET IMPLEMENTED!

Tag name:  makefs
Tag value: block device or special file (loop) to create an fs on

Allowed attributes:
	type:		type of file system to create

Example:
	<makefs type="ext2">/dev/hda1</makefs>

No tag value scenario:
	type
	target: 	block device or file to create the file system on

Example:
	<makefs target="/dev/hda1" type="ext2" />



Making directories:
-------------------

Tag name:  mkdir
Tag value: directory/directories to make

Allowed attributes:
	dir		- working directory
	permissions	- permission value (alphanumeric or octal)

Example:

<mkdir dir="/mnt/lfs">bin</mkdir>
<mkdir dir="/mnt/lfs">bin boot etc sbin usr</mkdir>
<mkdir dir="/mnt/lfs" permissions="1777">tmp</mkdir>

No tag scenario:
	dir		- working directory
	permissions	- permission value (alphanumeric or octal)
	dirs		- directory/directories to create

Examples:

<mkdir dirs="/mnt/lfs/bin />
<mkdir dirs=" bin boot etc sbin usr />



Creating Links:
---------------

Used for creating hard or soft links.

Tag name:  link
Tag value: link name

Allowed attributes:
	dir		- working directory
	source		- source to link from
	type		- type of link


Example:

<link dir="/mnt/lfs/usr" source="share/man" type="symbolic">man</link>
<link dir="/mnt/lfs/usr" source="share/info" type="hard">info</link>

No tag scenario:
	dir		- working directory
	source		- source to link from
	type		- type of link
	link		- link to create

<link source="share/info" link="info" type="symbolic" />



Setting Permissions:
--------------------

FIXME: NOTE YET IMPLEMENTED!

Used for setting permissions:

Tag name:  permissions
Tag value: file(s) or directory(ies) to set permissions on

Allowed attributes:

	set		- permission value: either alphanumeric or octal values

Example:

	<permissions set="go+r">/root</permissions>
	<permissions set="1777">/usr/tmp /var/tmp</permissions

No tag value scenario:

	set
	target	- file(s) or directory(ies) to set permissions on

	<permissions set="1777" target="/tmp" />




Moving files/directories around:
--------------------------------

Tag name:  move
Tag value: target directory

Allowed attributes:
	dir		- working directory	
	source		- file(s) to move
	
Example:

<move dir="/mnt/lfsusr/bin" source="bash bashbug">/mnt/lfs/bin</move>

No tag scenario:
	dir		- working directory	
	source		- file(s) to move
	destination 	- destination to move source to

<move source="/mnt/lfs/usr/bin/bash" destination"/mnt/lfs/bin" />



Copying files:
--------------

Tag name:  copy
Tag value: target to copy

Allowed attributes:
	dir		- working directory
	source		- source to copy

Example:

<copy source="&LFS;/usr/bin/gunzip">&LFS;/bin</copy>

No tag scenario:
	dir		- working diretory
	source		- source to copy
	destination	- destination to copy to

Example:

<copy source="&LFS;/usr/bin/gunzip" destination="&LFS;/bin" />



Removing files:
---------------

Tag name:  remove
Tag value: target to remove

Allowed attributes:
	none

Example:
	<remove>&LFS;/usr/bin/gunzip</remove>

No tag scenario:
	target 		- file to remove

Example:
	<remove target="&LFS;/usr/bin/gunzip" />




Set environment variable:
-------------------------

FIXME: NET YET IMPLEMENTED!

Tag name:  setenv
Tag value: environment variable's name

Allowed attributes:
	value: 	the value the variable should have

Example:
	<setenv value="-Dre_max_failures=re_max_failures2">CPPFLAGS</setenv>

A no tag value scenario:
	value
	name: the name of the variable

Example:
	<setenv name="CPPFLAGS" value="-Dre_max_failures=re_max_failures2" />



Unset environment variable:
----------------------------

FIXME: NET YET IMPLEMENTED!

Tag name:  unsetenv
Tag value: environment variable to unset

Allowed attributes:
	None

Example:
	<unsetenv>CPPFLAGS</unsetenv>

No tag value scenario:
	name: environment variable to unset

Example:
	<unsetenv name="CPPFLAGS" />



Unpacking archives:
-------------------

Unpacking source archives and other files.

Tag name:  unpack
Tag value: destination directory

Allowed attributes:
	archive		- archive to unpack

Example:

<unpack archive="&packages_dir;/bash-2.04.tar.bz2">&LFS;&builddir;</unpack>

No tag scenario:
	archive		- archive to unpack
	destination	- directory to unpack in

Example:

<unpack archive="&packages_dir;/bash-2.04.tar.bz2" 
	destination="&LFS;&builddir;" />




Text file dump:
---------------

Dumping information to a text file on the system.

Tag name:  textdump
Tag value: content to dump

Allowed attributes:
	file		- where to dump the output to

Example:

<textdump file="configparms">
slibdir=/lib
sysconfdir=/etc
</textdump>


Patch package:
--------------

Apply a patch to a file or source package

Tag name:  patch

Allowed attributes:
	dir		- working directory
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter 

Example:

<patch dir="&LFS;&builddir;/tar-1.13/src" param1="-i" 
	param2="&LFS;&builddir;/gnutarpatch.txt"/> 



Configure package:
------------------

Configure a package prior to compiling if applicable, usually "configure"

Tag name:  config
Tag value: alternate configure command (!= "./configure")

Allowed attributes:
	dir		- build directory (root package directory)
	nodir		- alternate build directory (ie. gcc, glibc)
	pre		- parameters before configure command
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter 
	
Example:

<config nodir="&builddir;/perl-5.6.0" param1="-Dprefix=/usr" param2="-d" 
	param3="-e" >./Configure</config>

No tag scenario:
	dir		- build directory (root package directory)
	nodir		- alternate build directory (ie. gcc, glibc)
	pre		- parameters before command
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter 
	?????		- alternate command (ie. perl -- "./Configure")

Example:

<config param1="-default" dir="&builddir;/man-1.5h1" />



Compiling a package:
--------------------

Command used to compile package, usually "make"

Tag name:  make

Allowed attributes:
	dir		- build directory (root package directory)
	nodir		- alternate build directory (ie. gcc, glibc)
	pre		- parameters before command
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter 

Example:


No tag scenario:
	dir		- build directory (root package directory)
	nodir		- alternate build directory (ie. gcc, glibc)
	pre		- parameters before command
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter 

Example:

<make dir="&builddir;/bash-2.04" />
<make nodir="&builddir;/gcc-build" param1="bootstrap"/>



Installing a package:
---------------------

Command used to install package, usually "make install"

Tag name:  make_install

Allowed attributes:
	dir		- build directory (root package directory)
	nodir		- alternate build directory (ie. gcc, glibc)
	pre		- parameters before command
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter 

Example:



No tag scenario:
	dir		- build directory (root package directory)
	nodir		- alternate build directory (ie. gcc, glibc)
	pre		- parameters before command
	param1		- first paramter
	param2		- second parameter
	param3		- third parameter
	paramx		- xth paramter 

Example:

<make_install dir="&builddir;/bison-1.28" />
<make_install nodir="&builddir;/gcc-build"/>
<make_install param1="-e" param2="tooldir=/usr" param3="" i
	dir="&builddir;/binutils-2.10" />

	
Chroot:
-------

Enter chroot environment process commands between tags

Tag name:  chroot

Allowed attributes:
	dir		- target directory

Example:

<chroot dir="&LFS;">
	<configure>...</configure>
	<build>...</build>
	<install>...</install>
</chroot>




Package Installation:
---------------------

Tag name:  package
Tag value: subtags that make up the installation of a package

Allowed attributes:
	name		- package name
	version		- package version

Allowed subtags:

	preconfigure	- used to do things before you run configure script
	configure	- run configure script
	prebuild	- used to do things before you build the package
	build		- build the package (run make)
	preinstall	- used to do things before you install a package
	install		- install the package (make install)
	postinstall	- used to do things after you install a package


We tried to cover all possibilities of when we would need these tags, you 
will problably not use all of them, just at least half.


Example:

    Simple package;

<package name="ed" version="0.2">
    <configure>
        <system_command param1="--prefix=/usr">configure</system_command>
    </configure>

    <build>
        <system_command>make</system_command>
    </build>

    <install>
        <system_command param1="install">make</system_command>
    </install>

    <postinstall>
        <move source="/usr/bin/ed">/bin</move>
        <move source="/usr/bin/red">/bin</move>
    </postinstall>
</package>

    Average package;

<package name="glibc" version="2.1.3">
    <preconfigure>
        <textdump file="configparms">
        slibdir=/lib
        sysconfdir=/etc
        </textdump>

        <system_command param1="-Np1" param2=" -i" 
            param3="../glibc-2.1.3.patch">patch</system_command>
    </preconfigure>

    <configure>
        <system_command param1="--prefix=/usr" param2="--enable-add-ons" 
            param3="--with-header=/mnt/lfs/usr/include">configure</system_command>
    </configure>

    <build>
        <system_command>make</system_command>
    </build>

    <install>
        <system_command param1="install_root=/mnt/lfs" 
            param2="install">make</system_command>
        <system_command param1="install_root=/mnt/lfs" 
            param2="localedata/install-locales">make</system_command>
    </install>
</package>

    Custom (HIghoS) package;
    (note: <collection_system_files> is a custom function/element)

<package name="ed" version="0.2">
    <configure>
            <system_command param1="--prefix=/usr">./configure</system_command>
    </configure>

    <build>
        <system_command>make</system_command>
    </build>

    <preinstall>
        <collect_system_files file="sys.files" />
    </preinstall>

    <install>
        <system_command val1="install">make</sustem_command>
    </install>

    <postinstall>
        <collect_system_files file="sys.files~" />
        <system_command param1="sys.files*" redirect="ouput" 
            param2="ed.files">diff</system_command>
    </postinstall>
</package>



More information about the alfs-discuss mailing list