[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:misc:anatomy_of_a_slackbuild [2019/12/18 19:34 (UTC)] – [Anatomy Of a Slackbuild] captain_sensiblehowtos:misc:anatomy_of_a_slackbuild [2020/01/05 16:49 (UTC)] (current) – [Anatomy Of a Slackbuild] captain_sensible
Line 21: Line 21:
 The other thing to mention is that the **context** of this page, when you read it, regarding a  latex2html script is that a whole "slackbuild"   from slackbuilds.org has been downloaded, is somewhere convenient (say on my desktop) that it  is unpacked and into the unpacked directory called "latex2html"  the software source called latex2html-2019.2.tar.gz has been placed. The other thing to mention is that the **context** of this page, when you read it, regarding a  latex2html script is that a whole "slackbuild"   from slackbuilds.org has been downloaded, is somewhere convenient (say on my desktop) that it  is unpacked and into the unpacked directory called "latex2html"  the software source called latex2html-2019.2.tar.gz has been placed.
  
 +Also that you have kick started the script :
 +
 +<code>
 +bash-5.0# chmod a+x latex2html.SlackBuild 
 +bash-5.0# ./latex2html.SlackBuild 
 +
 +</code>
  
 == Bash == == Bash ==
Line 147: Line 154:
 </code> </code>
  
-Before we go into this let me have a look in my slackware file  system and see whats there at /tmp/SBo.Taking a quick look at the image will give you a clue that the slackbuild works, by using the /tmp/SBo/ directory and creates a directory with the syntax package-packagename.So if we now have a look at the code above. CWD (current working directory)  is a  variable and is set to the value of pwd. If you run that in a terminal window, it will tell you where you in a bash context where you are working from.{{howtos:misc:tmp_Sbo.gif}}+Before we go into this let me have a look in my slackware file  system and see whats there at /tmp/SBo.Taking a quick look at the image will give you a clue that the slackbuild works, by using the /tmp/SBo/ directory and creates a directory with the syntax package-packagename.So if we now have a look at the code above. CWD (current working directory)  is a  variable and is set to the value of pwd. If you run that in a terminal window, it will tell you where you in a bash context where you are working from.{{ howtos:misc:tmp_Sbo.gif }}
  
 TMP is going to be set to /tmp/SBo. TMP is going to be set to /tmp/SBo.
Line 226: Line 233:
 rm -rf $PRGNAM-$VERSION will get rid of any previous directory entries(maybe failed)  for latex2html-2019.2  \\ rm -rf $PRGNAM-$VERSION will get rid of any previous directory entries(maybe failed)  for latex2html-2019.2  \\
  
-tar xvf $CWD/$PRGNAM-$VERSION.tar.gz : This equated to unpacking of  latex2html-2019.2, which would be inside the unpacked slackbuild from slackbuilds.org namely "latex2html".+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz : This equated to unpacking of  latex2html-2019.2.tar.gz , which would be inside the unpacked slackbuild from slackbuilds.org namely "latex2html".\\ 
 + 
 +cd $PRGNAM-$VERSION : This  is a "change directory" command. The bash shell will now be working from the context that is located inside the unpacked  source, which is located $CWD. i.e We are back to the unpacked slackbuild but, inside the unpacked source. 
 + 
 +chown -R root:root . : Notice the dot , with a space at the end of the line; this means all in current directory. -R is permission recursive. So here we are giving ownership to root and group root. 
 +<code> 
 + find -L . \ 
 + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ 
 +  -o -perm 511 \) -exec chmod 755 {} \; -o \ 
 + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ 
 +  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; 
 +</code> 
 + 
 +If i understand the above block of code correctly its using the "find" on the basis of permissions and following symbolic links using the "-L flag". If i understand this correctly its basically setting directories to 755 in order to enable a "cd" into them and files so that root can read write. If this is true I might  have expected 
 +<code> 
 +-type d -exec chmod 775 {}  
 +</code>  
 + 
 +For directories  and  
 +<code> 
 +-type f -exec chmod 644 {} 
 + 
 +</code> 
 +For files. 
 +Next block of code:  
 +<code> 
 +CFLAGS="$SLKCFLAGS"
 +CXXFLAGS="$SLKCFLAGS"
 +./configure \ 
 +  --prefix=/usr \ 
 +  --libdir=/usr/lib${LIBDIRSUFFIX} \ 
 +  --sysconfdir=/etc \ 
 +  --localstatedir=/var \ 
 +   --with-perl=/usr/bin/perl \ 
 +  --enable-eps \ 
 +  --enable-gif \ 
 +  --enable-png \ 
 +  --build=$ARCH-slackware-linux \ 
 +  --host=$ARCH-slackware-linux 
 + 
 +make 
 +make install DESTDIR=$PKG 
 +</code> 
 + 
 +A couple of things to say here , the use of "\" is a way of using a long command over several lines. We have already mentioned CFLAGS and CXXFLAGS. We also previously mentioned the variable SLKFLAGS and here we use it to set the value of CFLAGS and CXXFLAGS.  
 + 
 +In this latex2html slackbuild script we also utilize a three step process of configure, make, make install. 
 +But what about the likes of  --enable-eps , where does that come from ? 
 + 
 +Well if you take the source code  [[https://github.com/latex2html/latex2html/archive/v2019.2/latex2html-2019.2.tar.gz | latex2html source]]unpack it ( a quick way is right click , open with Ark) cd into it and run : 
 + 
 + 
 +<code> 
 +./configure --help 
 +</code> 
 + 
 +Then you will get some useful information from the developers. It tells you the option and how you can enable some of them.  
 + 
 +<code> 
 +make 
 +make install DESTDIR=$PKG 
 +</code> 
 + 
 +Here, make, make install are carried out.Note DESTDIR is a flag to say where the package will go. \\
    
 +$PKG equates to /tmp/SBo/package-latex2html
 +
 +Next Block of code:\\
 +
 +<code>
 +
 +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
 +  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
 +
 +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
 +cp -a \
 + FAQ INSTALL LICENSE MANIFEST README.md TODO  \
 +  $PKG/usr/doc/$PRGNAM-$VERSION
 +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
 +cp $CWD/manual.pdf  $PKG/usr/doc/$PRGNAM-$VERSION
 +
 +mkdir -p $PKG/install
 +cat $CWD/slack-desc > $PKG/install/slack-desc 
 +
 +cd $PKG
 +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
 +
 +</code>
 +
 +The first two lines of this block are a bit of a mouth-full:
 +<code>
 +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
 +  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
 +</code>
 +
 +We can however pick out key words that are commands and that can help to make some sense of it.
 +ind" located at /usr/bin/find is a powerful utility  that has around 50 options. It basically does what it says on the can.With the -print0 option it separates what it finds with "\000"  - in a word NULL. 
 +
 +The "|" or pipe is used to pass the results of a command to another;in this case xargs which has a flag -0. This option  is for xargs to accept input that has /000 between them. ELF is is Executable & Linkable Format.
 +
 +To give a succinct answer the two lines are removing debugging symbols and other unnecessary stuff to make the binaries smaller, faster and take up less memory.
 +
 +<code>
 +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
 +</code>
 +
 +Here we are preparing a directory which will be called "latex2html-2019.2" located at  /usr/doc. This is so we an put relevant documentation into a directory relevantly called, so that a user can access documentation on the package.
 +The next lines put files such as  README.md into the /usr/doc/latex2html-2019.2 directory.
 +
 +<code>
 +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
 +</code>
 +
 +That line goes back to the original directory that Latex2html.SlackBuild was run from ( i previously quoted Desktop) opens up the SlackBuild with "cat"  command and copies it to the documentation directory. 
 +Now before I submitted latex2html to slackbuilds obviously I did some testing and found that when the package was installed it had a fairly comprehensive output of what it could do just using: 
 +
 +<code>
 +$ latex2html --help
 +</code> 
 +
 +Also I had access to a comprehensive manual in pdf format; so in my case I did not write code for man pages. Instead I simply put a copy of "manual.pdf" into the /usr/doc/latex2html-2019.2 directory.
 +
 +
 + --- //[[wiki:user:captain_sensible|andy brookes]] 2020/01/05 16:29 (UTC)//
 +
 +//If you teach maths it doesn't stop you  embedding a little English.//  
 +
  
-\\ +Blank slackbuild templates can be obtained from : [[https://slackbuilds.org/templates/]]
- --- //[[wiki:user:captain_sensible|andy brookes]] 2019/12/12 20:43 (UTC)//and iu embedding a little English.  +
  
 ====== Sources ====== ====== Sources ======
Line 236: Line 367:
 <!-- * Original source: [[http://some.website.org/some/page.html]] --> <!-- * Original source: [[http://some.website.org/some/page.html]] -->
  
-I am using a SlackBuild script that i submitted to slackbuilds.org: [[https://slackbuilds.org/repository/14.2/academic/latex2html/?search=latex2html]]+I am using a SlackBuild script that i submitted to slackbuilds.org: [[https://slackbuilds.org/repository/14.2/academic/latex2html/?search=latex2html | latex2html slackbuild]]
 <!-- Authors are allowed to give credit to themselves! --> <!-- Authors are allowed to give credit to themselves! -->
 * Originally written by [[wiki:user:captain_sensible|andy brookes]] * Originally written by [[wiki:user:captain_sensible|andy brookes]]
 howtos:misc:anatomy_of_a_slackbuild ()