kerTeX for Porteus/Slackware

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#16 by Tonio » 15 Apr 2012, 23:55

@folks,

I am currently working in creating new versions of packages for porteus based on lastest kertex and all packages available.
For i486 testing version(s) of porteus
http://www.mediafire.com/file/yyg8udhwk ... -1_ast.xzm
The module grows to 104 MB. But it includes fonts and all packages available for kertex added by tlaronde, and Mark Van Atten:
2012-04-14 : kertex_T 0.9999.6.1.

"BIG" flavors increased in order to be able to install some LaTeX packages with the default kerTeX installation. More paths searched in the path searching routine. A lot of packages contributed by Mark van Atten (Thanks Mark!)
See kertex homepage for details
http://www.kergis.com/en/kertex.html

As always, input is appreciated and I don't know how much space mediafire gives free users, but if anyone knows of another hosting place, I would appreciate it as well. I am afraid that adding all the packages will make the xzm kertex modules bigger and I may not have enough space.

EDIT:
x86-64 bit module for Porteus here:
http://www.mediafire.com/file/w061y5y0o ... -1_ast.xzm
NOTE: 105 MB big but all packages available are added :) Thanks to Mediafire for letting me put both modules. I have free account and I don't know how much space is allotted for free users :(

To compile book on top, now only fancybox.sty is needed!
Kertex is getting bigger and better. There are still some style files and other things missing, but it is being complemented very well by Mark Van Atten and a continued great effort by T. Laronde maintainer of KerTeX.

Please share experiences with the modules whether positive(+) or negative(-). I will appreciate any kind of feedback since this is what I had been wanting to do for a long time. Now I can see that not too many people share my views about having a portable latex system for linux/unix based systems as an alternative to miktex portable which works very well and to texlive which is big but also very good. Can't complain now as I have achieved what I wanted to do for several years and thanks to all developers of porteus, slax, slackware and to KerTeX users and contributors.

Happy \TeX{}ing and \LaTeX{}ing!!!

Antonio

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#17 by Tonio » 12 Jul 2012, 00:00

@folks,

On poll about linux distros, I got output for kertex module by kaz.

========================
kaz wrote:
Tonio wrote:@kaz would you mind testing KerTeX module(s) for porteus?
Tonio, thank you for your suggestion. I have installed KerTeX for porteus. It works almost perfectly on my TeX document, but, as I expected, Japanese characters cannot be shown in the output. As far as I know, Japanese TeX documents can be handled only by TeX systems specially localized for Japanese. I look forward KerTex supporting UTF-8.
Thank you kaz for your report. I can forward a request to tlaronde as for supporting UTF-8 on next builds of kerTeX. I had heard of vine linux a few years ago on distrowatch. Now, it seems that Berry Linux based on Fedora is a specialized distro for Japanese users, I don't know of others at this time. UTF-8 support only? will copy this message to kerTeX thread to keep it going.

Glad that Voting here is not the same as the big elections coming in November. If I could vote for one person that can be POTUS, I would vote for Ahau :)
Since brokenman and fanthom don't qualify as per the US Constitution :(. Sorry for big Off topic Drift!
========================

I was hoping to update the modules for new releases of Porteus, but have not had time and now I have limited bandwidth :(
As soon as new kerTeX version comes available hopefully when I get back to work, I can update the modules.

Thank you for your support.

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: kerTeX for Porteus/Slackware

Post#18 by Rava » 05 Feb 2013, 23:20

Tonio, will you create a kerTeX version for Porteus 2.0?
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: kerTeX for Porteus/Slackware

Post#19 by Rava » 05 Feb 2013, 23:22

Hopefully this kerTeX version be okay for Porteus 2.0 as well?

Another question... What do I have to install on some Windoze 7 machines if I want to use these printing text I made with Linux kerTex?
Cheers!
Yours Rava

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#20 by Tonio » 06 Feb 2013, 13:14

Rava wrote:Tonio, will you create a kerTeX version for Porteus 2.0?
I am looking at the option of submitting a script that creates the kerTeX Module to fanthom/brokenman/... so that the module is part of Porteus package manager(PPM), but had some errors in my script, working on it to submit it. The pkgs(amstex.sh, latex.sh, graphics.sh, ...) others are optional, but greatly enhance kerTeX. Size can be small if only small parts are used. I don't know what most users want :( and forcing some packages(enhancements *.sh that are addons to kertex might not be the best case? )

What do other users think about this?

I have been silent waiting on some input here. I shall built it on Porteus 2.0 rc 2 and check the buildscript(script which creates slack-desk, doinst.sh, add-kertex-path.sh, and executes a SlackBuild, then become root to install plain kerTeX[installpkg kertex-0.9999.7.5*], run install script. generate fonts, then add packages, ..., then rebuild the txz and finally convert it to xzm ) for mistakes and then we'll see how it goes.
Rava wrote: Hopefully this kerTeX version be okay for Porteus 2.0 as well?

Another question... What do I have to install on some Windoze 7 machines if I want to use these printing text I made with Linux kerTex?
It could still work, but I believe it is best to create new one to match running system as it would work best.

to use printing text with Linux kerTeX on Windows 7 should be no problem, as long as you have ghostscript, GSView, and/or acrobat reader or other pdf viewer you can view the files created. 8)


Thanks Rava for the input :) :Yahoo!:

User avatar
Rava
Contributor
Contributor
Posts: 1319
Joined: 11 Jan 2011, 02:46
Distribution: Porteus 3.1.0 x86-64 XFCe
Location: Germany

Re: kerTeX for Porteus/Slackware

Post#21 by Rava » 06 Feb 2013, 21:59

Tonio wrote:to use printing text with Linux kerTeX on Windows 7 should be no problem, as long as you have ghostscript, GSView, and/or acrobat reader or other pdf viewer you can view the files created. 8)
Win7 sure has Adobe installed... so, exporting TeX to PDF will not kill the quality, then, prior printing?
Cheers!
Yours Rava

makifer
Ronin
Ronin
Posts: 3
Joined: 07 Feb 2013, 09:55
Distribution: Proteus 1.1
Location: Turkey

Re: kerTeX for Porteus/Slackware

Post#22 by makifer » 07 Feb 2013, 10:05

Dear,

This will be a newby question. Sorry for any inconvenience.

I am trying to run KerTeX on Porteus 1.1 Live USB.

What I did is, first to burn Porteus 1.1 iso file into USB stick using Linux Live CD USB Creator under Windows.

Then I downloaded kertex-0.9999.6.1-i486-1_ast.xzm file and copied it to porteus/modules directory.

Then I booted my PC from the USB stick. Now, I cannot see KerTeX in the menu. When I try to run it from terminal using "tex inputfile.tex" command, it runs, but it does not even recognise "/documentclass" package.

I guess I should still do something. Can anybody help me?

Best regards

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#23 by Tonio » 07 Feb 2013, 13:07

Rava wrote:
Tonio wrote:to use printing text with Linux kerTeX on Windows 7 should be no problem, as long as you have ghostscript, GSView, and/or acrobat reader or other pdf viewer you can view the files created. 8)
Win7 sure has Adobe installed... so, exporting TeX to PDF will not kill the quality, then, prior printing?
The source file [La]TeX file will be processed by dvips then use gs(ghostscript) to convert to pdf. KerTeX does not have pdftex or pdflatex.
The printing will be the same. This should not be a concern :)
makifer wrote: Then I booted my PC from the USB stick. Now, I cannot see KerTeX in the menu. When I try to run it from terminal using "tex inputfile.tex" command, it runs, but it does not even recognise "/documentclass" package.

I guess I should still do something. Can anybody help me?

Best regards
Makifer, welcome onboard. There will be no KerTeX menu :( kerTeX is a tex engine that is inspired by Donald E. Knuth's work. One creates a source file in text format and saved in *.tex extension, then one processes the file via command line prompt and types tex filename.tex or latex filename.tex. To view the output, one needs to have ghostscript installed(gs), first the dvi file is converted to ps(postscript) then converted to pdf with ps2pdf. The pdf file should become viewable with okular, xpdf, or other pdf viewer :) Hope this helps in some way!

Also /documentclass package should be \documentclass{article} or similar, the forward slash is incorrect, it needs to be a "\" in this case.
If it has a \documentclass{}, it needs to be processed by latex filename.tex, then use dvips -t papertype filename.dvi > filename.ps, if you have ghostscript installed, run ps2pdf filename.ps to create a pdf of the file.

Best Regards,

Antonio

makifer
Ronin
Ronin
Posts: 3
Joined: 07 Feb 2013, 09:55
Distribution: Proteus 1.1
Location: Turkey

Re: kerTeX for Porteus/Slackware

Post#24 by makifer » 07 Feb 2013, 14:55

Thank you Antonio for the fast response,
I still get errors. My tex file is very simple

Code: Select all

\documentclass{article}

\begin{document}

sdfj

\end{document}

and it works with kile under ubuntu 11.04. When I try it with Porteus, this is what I get

Code: Select all

guest@porteus:~$ tex deneme.tex
This is TeX, kerTeX C Version 3.1415926
(deneme.tex
! Undefined control sequence.
l.1 \documentclass
                  {article}
?
! Undefined control sequence.
l.3 \begin
          {document}
?
[1] )
Output written on deneme.dvi (1 page, 248 bytes).
Transcript written on deneme.log.
guest@porteus:~$

To me, it is as if kerTeX doesn't know where the packages are. Do you have any idea? Is the way I created the Porteus Live USB correct? (explained in my previous post)

Best regards,

-Akif

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#25 by Tonio » 07 Feb 2013, 15:32

Process it with latex :)

Try

Code: Select all

$latex  deneme.tex
and if it does not work please post again. I am working on newer version of kerTeX and may just post buildscript or submit it to fanthom/brokenman/ahau so that the module becomes official :) Of course at their discretion! :Yahoo!:

makifer
Ronin
Ronin
Posts: 3
Joined: 07 Feb 2013, 09:55
Distribution: Proteus 1.1
Location: Turkey

Re: kerTeX for Porteus/Slackware

Post#26 by makifer » 08 Feb 2013, 07:12

Great!

latex deneme.tex works...
And I could also convert it to ps using dvips.

Now I am working on converting it to pdf.

Thanks,

-Akif

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#27 by Tonio » 08 Feb 2013, 16:10

makifer wrote:Great!

latex deneme.tex works...
And I could also convert it to ps using dvips.

Now I am working on converting it to pdf.

Thanks,

-Akif
Excellent! If you can make sure you have ghostscript and ghostscript-fonts xzm modules and if you can also get gv at your own discretion you can have a small portable tex/latex porteus based solution :)

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#28 by Tonio » 12 Feb 2013, 19:54

Here's an xzm from withing porteus for rc2 x86_64 :

Code: Select all

guest@porteus:~$ which_kertex

# WARNING!!! WARNING!!! WARNING!!!
#
# 1) The path separator is now, everywhere, semicolon ';' and not
# colon ':'.
# 2) The pkg stuff is now in /usr/share/kertex/pkg/. Run instead of pkg_core:
# /bin/sh /usr/share/kertex/pkg/kertex.sh install
#

KERTEX_VERSION=0.9999.7.6
KERTEX_HOST=linux-x86_64-3.7.5-porteus
KERTEX_SHELL=/bin/sh
KERTEX_BINDIR=/usr/bin/kertex
KERTEX_LIBDIR=/usr/share/kertex
KERTEX_MANDIR=/usr/share/kertex/man
KERTEX_USER0=root
KERTEX_GROUP0=wheel

guest@porteus:~$ uname -a
Linux porteus 3.7.5-porteus #1 SMP PREEMPT Mon Jan 28 10:58:19 UTC 2013 x86_64 Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz GenuineIntel GNU/Linux
guest@porteus:~$ uname -r
3.7.5-porteus
http://www.mediafire.com/?vctxt0tgqae9g0r

I may need a bit more time to build the 32 bit version one as I did not download it :( and I have a soccer match tonight :) and another one in three days.
Please report any errors/wishes/comments here.

Antonio

User avatar
Hamza
Warlord
Warlord
Posts: 1847
Joined: 28 Dec 2010, 07:41
Distribution: Porteus
Location: France

Re: kerTeX for Porteus/Slackware

Post#29 by Hamza » 12 Feb 2013, 21:27

Please use CODE tag.
NjVFQzY2Rg==

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: kerTeX for Porteus/Slackware

Post#30 by Tonio » 15 Feb 2013, 23:21

@Hamza
sorry for not placing CODE tag, I apologize.

Some modules that are needed to build the kerTeX module on your own if desired are the following:

Code: Select all

guest@porteus:~$ ls /mnt/sdb1/porteus/modules/ -l 
total 183576
-rwxrwxrwx 1 root root    503808 Feb 14 07:48 bison-2.7-i486-1.xzm*
-rwxrwxrwx 1 root root     53248 Feb 14 07:49 ed-1.6-i486-1.xzm*
-rwxrwxrwx 1 root root    798720 Feb 14 07:50 flex-2.5.37-i486-1.xzm*
-rwxrwxrwx 1 root root    815104 Feb 14 07:59 lftp-4.3.8-i486-1.xzm*
-rwxrwxrwx 1 root root    196608 Feb 14 07:52 m4-1.4.16-i486-1.xzm*
-rwxrwxrwx 1 root root    331776 Feb 14 07:57 readline-5.2-i486-4.xzm*
readline is actually not needed, but I used it so I could build lftp on porteus itself using SlackBuild. The following are encouraged to have on your system(s) when using kerTeX since a dvi viewer is not present:

Code: Select all

-rwxrwxrwx 1 root root  11636736 Feb 14 08:11 ghostscript-9.05-i486-3.xzm*
-rwxrwxrwx 1 root root   3629056 Feb 14 10:46 ghostscript-fonts-std-8.11.xzm*
A new module has been built:

Code: Select all

guest@porteus:~/Downloads$ ls -l /tmp/*.xzm
-rw-r--r-- 1 root root 170016768 Feb 15 17:51 /tmp/kertex-0.9999.7.6-i486-1_ast.xzm
http://www.mediafire.com/?okyegugl9xolnqy

To create a module for kerTeX :

I am posting commands used to create new i486 module for kertex built in razor i486 rc 2:

Code: Select all

#!/bin/sh

create_slackdesc()
{
cat > slack-desc << EOF
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

   |-----handy-ruler------------------------------------------------------|
kerTeX: kerTeX (kerTeX Tex Distribution)
kerTeX:
kerTeX: This is a TeX kernel system providing what everything is based
kerTeX: upon: Donald E. Knuth's Digital Typography system; with some
kerTeX: useful additions.  This system includes, of course, METAFONT
kerTeX: and TeX; but auxiliaries are also included.  All the programs
kerTeX: (latest published version) are included here.  In addition, other
kerTeX: programs linked to Tomas Rokicki's dvi to PostScript driver
kerTeX: (dvips(1)) are added. Oren Patashnik's BibTeX (0.99d) is here
kerTeX: too! John Hobby's MetaPost is included! The NTS team e-TeX
kerTeX: is here! And D.E. Knuth and Silvio Levy' CWEB are here too!
EOF
}

create_doinstsh()
{
cat > doinst.sh <<- _EOF_
#!/bin/sh
#\$Id: doinst.sh,v 1.1 2012/03/09 19:15:09 tlaronde Exp \$
# C) 2012 Thierry Laronde <tlaronde AT polynum.com>
#
# A SlackBuild post-install script just to advertise what has to be
# done.
#

# For the moment, we just display the basic "what's next".
#
cat <<"EOT" >&2

==================================================================

                       You're done!
               Thank you for using KerTeX

You must now, as an _unprivileged_ user build the fonts and compile
the dump.

Just run:

       which_kertex

to see where stuff is installed. And then run:

       \$KERTEX_BINDIR/adm/kertex.sh install

Note that the man pages are put in kerTeX realm. So you will have to
add the paths (man.config(5)). This is so in order for you to test
different TeX distribution without one stepping on the others toes.

The path is displayed by which_kertex(1).

You should probably also edit dvips config to be found here:

\$KERTEX_LIBDIR/dvips/dvips.cnf

to match the resolution and memory of your printer device, and to use
or not T1 version of Donald E. Knuth's Computer Modern Fonts.

==================================================================

EOT

exit 0


_EOF_
}

create_addkertexpath()
{
cat > add-kertex-path.sh << EOT
#!/bin/sh

PATH=\$PATH:/usr/bin/kertex/
MANPATH=\$MANPATH:/usr/share/kertex/man

EOT
}

pause()
{
echo "Press ENTER key to continue . . . "
read key
}

create_slackdesc
pause
# check if slack-desc is created
cat slack-desc
pause
# create add-kertex-path.sh to create path
create_addkertexpath
pause
cat add-kertex-path.sh
pause 

# create doinstall.sh file
create_doinstsh
pause
# show the file doinst.sh and check that it works
cat doinst.sh
pause

# get all of the *.sh add on packages for kerTeX
wget http://downloads.kergis.com/kertex/amstex.sh
wget http://downloads.kergis.com/kertex/latex.sh
wget http://downloads.kergis.com/kertex/graphics@latex.sh
wget http://downloads.kergis.com/kertex/babel@latex.sh
wget http://downloads.kergis.com/kertex/cyrillic@latex.sh
wget http://downloads.kergis.com/kertex/ams@latex.sh
wget http://downloads.kergis.com/kertex/lm@latex.sh
wget http://downloads.kergis.com/kertex/ec@latex.sh
wget http://downloads.kergis.com/kertex/cracs@latex.sh
wget http://downloads.kergis.com/kertex/biblatex@latex.sh
wget http://downloads.kergis.com/kertex/comment@latex.sh
wget http://downloads.kergis.com/kertex/csquotes@latex.sh
wget http://downloads.kergis.com/kertex/etoolbox@latex.sh
wget http://downloads.kergis.com/kertex/logreq@latex.sh
wget http://downloads.kergis.com/kertex/memoir@latex.sh
wget http://downloads.kergis.com/kertex/oberdiek@latex.sh
wget http://downloads.kergis.com/kertex/reqtools@latex.sh
wget http://downloads.kergis.com/kertex/url@latex.sh
wget http://downloads.kergis.com/kertex/cm-super@latex.sh
wget http://downloads.kergis.com/kertex/cite@latex.sh
wget http://downloads.kergis.com/kertex/ellipsis@latex.sh
wget http://downloads.kergis.com/kertex/filecontents@latex.sh
wget http://downloads.kergis.com/kertex/float@latex.sh
wget http://downloads.kergis.com/kertex/footmisc@latex.sh
wget http://downloads.kergis.com/kertex/geometry@latex.sh
wget http://downloads.kergis.com/kertex/lh@latex.sh
wget http://downloads.kergis.com/kertex/natbib@latex.sh
wget http://downloads.kergis.com/kertex/ruhyphen@latex.sh
wget http://downloads.kergis.com/kertex/todo@latex.sh
wget http://downloads.kergis.com/kertex/harvard@latex.sh
http://downloads.kergis.com/kertex/ncctools@latex.sh
pause
# make all *.sh files executable
chmod +x *.sh
# make kertex.SlackBuild executable
chmod +x kertex.SlackBuild
# get the main program or build using SlackBuild
PATH=$PATH:/usr/bin/kertex/

# build the package 

./kertex.SlackBuild

# the package is building 
pause
# become root, su -, then run
# installpkg kertex-0.999*
#Then kerTeX is installed but not fully/correctly, as regular user we run
cd /usr/share/kertex/adm/
sh kertex.sh install
#this will install kertex and ask for root password, now officially it is installed
#we proceed to install the add on packages to enhance the tex/latex experience:

# install latex.sh first
sh latex.sh install
pause 
sh graphics.sh install 
pause 

# install all packages one by one
for i in *.sh ; do sh $i install ; done ; 

# or install one by one comment below if you like to do above command only 
# if using FAT32 filesystem use sh instead of ./ because executable files don't work well in this filesystem :(  
pause
./latex.sh install
pause
./graphics\@latex.sh install
pause
./babel\@latex.sh install
pause
./cyrillic\@latex.sh install
pause
./cracs\@latex.sh install
pause
./ams\@latex.sh install
pause
./lm\@latex.sh install
pause
./ec\@latex.sh install
pause
./biblatex\@latex.sh install
pause
./comment\@latex.sh install
pause
./csquotes\@latex.sh install
pause
./etoolbox\@latex.sh install
pause
./logreq\@latex.sh install
pause
./memoir\@latex.sh install
pause
./oberdiek\@latex.sh install
pause
./reqtools\@latex.sh install
pause
./url\@latex.sh install
pause
./cm-super\@latex.sh install
pause
./cite\@latex.sh install
pause
./ellipsis\@latex.sh install
pause
./filecontents\@latex.sh install
pause
./float\@latex.sh install
pause
./footmisc\@latex.sh install
pause
./geometry\@latex.sh install
pause
./lh\@latex.sh install
pause
./natbib\@latex.sh install
pause
./ruhyphen\@latex.sh install
pause
./todo\@latex.sh install
pause
./harvard\@latex.sh install 
pause
./ncctools@latex.sh install
pause


# try to build big kertex tgz with all packages installed
# remember to copy /tmp/*.tar.gz to /tmp/pkg to call
mkdir -p /tmp/pkg
cp /tmp/*.tar.gz /tmp/pkg
pause
# 
# use the following command to build a slackware package
KERTEX_PKG_DIR=/tmp/pkg ./kertex.SlackBuild
# a txz package will be created in /tmp/ 

guest@porteus:~/Downloads$ 
kertex.SlackBuild is as follows:

Code: Select all

#!/bin/sh
#$Id: kertex.SlackBuild,v 1.9 2012/03/22 17:01:18 tlaronde Exp $
# Template generated by Alien's SlackBuild Toolkit: http://slackware.com/~alien/AST
# Copyright 2009, 2010, 2011, 2012  Eric Hameleers, Eindhoven, Netherlands
# Copyright 2012  olivares14031@gmail.com
# Copyright 2012  tlaronde AT polynum.com
# All rights reserved.
#
#   Permission to use, copy, modify, and distribute this software for
#   any purpose with or without fee is hereby granted, provided that
#   the above copyright notice and this permission notice appear in all
#   copies.
#
#   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
#   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
#   IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# -----------------------------------------------------------------------------
#
# Slackware SlackBuild script
# ===========================
# By:          tlaronde@polynum.com suggested by olivares14031@gmail.com
# For:         kerTeX
# Descr:       kerTeX Tex Distribution
# URL:         http://www.kergis.com/en/kertex.html
# Needs:
# Changelog:
# 0.9999.3.0-1: 08/Mar/2012 by tlaronde@polynum.com
#              * Sketching how R.I.S.K. has to be used by the package
#                framework.
# 0.9995-1:     06/Mar/2012 by olivares14031@gmail.com
#              * Initial build.
#
# Run 'sh kerTeX.SlackBuild' to build a Slackware package.
# The package (.tgz) and .txt file as well as build logs are created in /tmp .
# Install it using 'installpkg'.
#
# -----------------------------------------------------------------------------
# [TL] Note that the official name is: kerTeX with a small leading 'k'
# to emphasize that TeX is the important part. There is no LaTeX is there
# is no TeX...
# 
# [TL] A supplementary tip: if KERTEX_PKG_DIR is set in the environment
# at packaging time, the _kerTeX_ packages put in this dir will be
# added to the package. These are _kerTeX_ packages built from a running
# kerTeX. There are (if bin fmt, base etc.) binary dependent but hier
# independent. This is the crux.

# [TL] Actually, packaging kerTeX for whatever packaging framework is a
# simple 4 steps process:
# 
# 1) Create a R.I.S.K. configuration file to take into account custom
# values given by the packager when calling this script, and 
# configuring the kerTeX installed hierarchy conforming to the host 
# filesystem hierarchy.
# 
# 2) Let R.I.S.K. build everything (removing all that is 
# automake/autoconf specific, since R.I.S.K. is a framework on is own).
# 
# 3) Let R.I.S.K. install everything according to the filesystem 
# hierarchy configured in a subdirectory.
# 
# 4) Let the host packaging system gather this result. But since
# R.I.S.K. refuses to process if root, we will indeed install in a 
# subdir and package while R.I.S.K. has switched to root for its own
# installation! So 4) is embedded in 3).
#
# As long as the version is concerned, this script could be always
# cutting edge: if there is saved in SRCDIR a tarball with the
# SlackBuild expected name, we use it. If not we download the latest
# version and set the version accordingly. This means that updating
# should be removing the saved tarball...
#
# For R.I.S.K. it refuses to process if being root, and switches only
# when needed. Period.
#
if test $(id -u) -eq 0; then
  echo "Don't run me as root _now_!" >&2
  echo "I will switch to root only when needed." >&2
  exit 1
fi

#========== STEP 1
#
# [TL] We respect the packaging framework protocol: the names, and will
# be configuring R.I.S.K. after these.

# Set initial variables:

PRGNAM=kertex
VERSION=0.9999.4.0	# to be set with the version of a _saved_ tarball
BUILD=${BUILD:-1}

# The TAG is a unique identifier for all your Slackware packages.
# Use your initials as the value for TAG for instance.
TAG=${TAG:-_ast}

# Where do we look for sources?
# [TL] The bundle can be already here (for packaging various flavors)
# renamed with the Slackbuild convention. If not, we will download
# from kergis.com, using the name of the bundle there.
#
SRCDIR=$(cd $(dirname $0); pwd)
SOURCE="$SRCDIR/${PRGNAM}-${VERSION}.tar.gz"
SRCURL=http://downloads.kergis.com/kertex/kertex_bundle.tar

# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
# We will remove this TMP. So create an unlikely name (if someone 
# defines TMP as '/'...), for concurrent builds, and don't fiddle with 
# it once set! The risk suffix will be verified.
#
TMP=${TMP:-/tmp/}/_$$-$PRGNAM-risk
readonly TMP

# PKG will be installed "chrooted" here for packaging. Root created,
# root deleted.
#
PKG=$TMP/package-$PRGNAM

# The result. So not deleted... and not created either: must exist!
#
OUTPUT=${OUTPUT:-/tmp}

# [TL] R.I.S.K. has its own way (does cross-compilation). And needs
# explicit configuration. This script is a generic one. So we will
# only build package for this matrix arch, except that for Intel based
# we build for i486.
#
ARCH=$(uname -m)
case $ARCH in
  i?86) ARCH=i486; XCFLAGS="-march=i486 -mtune=i686 -O2";
	;;
  arm*) ARCH=arm;
	;;
esac

# Exit the script on errors:
set -e
trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PRGNAM}.log' ERR

# Catch unitialized variables:
set -u
P1=${1:-1}

# Save old umask and set to 0022:
_UMASK_=$(umask)
umask 0022

# Create working directories:
OBJDIRPREFIX=$TMP/build # R.I.S.K.
rm -fr $TMP
mkdir -p $OBJDIRPREFIX
TMPDIR=$OBJDIRPREFIX
export OBJDIRPREFIX TMPDIR

#========== STEP 2
#
# [TL] R.I.S.K. processing. This is simply the get_mk_install.sh
# customized.
#

# We need a writable directory and not SRCDIR.
#
cd $TMP

if ! [ -f ${SOURCE} ]; then
  wget -nv -T 20 -O "kertex_bundle.tar" "${SRCURL}" || true
  if [ $? -ne 0 -o ! -s kertex_bundle.tar ]; then
    echo "Downloading 'kertex_bundle.tar' failed... aborting the build."
    exit 1
  fi
  tar xf kertex_bundle.tar
else
  tar xzf $SOURCE
fi

for src in knuth etex bibtex ams adobe kertex_M kertex_T risk_comp; do
	tar xzf ${src}_*.tar.gz
	rm ${src}_*.tar.gz
done

# And then updating the version. If this is the saved bundle: it should
# be unchanged. Downloaded: at least equal or newer.
#
VERSION=$(sed -n 's/^VERSION: *\([^ 	][^ 	]*\) *$/\1/p' kertex_T/CID)

# This is a fake configuration for kertex_M, just in order that the
# name is the default one for the dir with the tools.
# This is for illustration purpose. Since kertex_M is on matrix
# (not installed) we do not set anything.
#
cat >$OBJDIRPREFIX/slackbuild <<EOT
EOT

# Start compiling kertex_M.
#
( 
	cd kertex_M;
	cd `../risk_comp/sys/posix/sh/rkconfig $OBJDIRPREFIX/slackbuild`;
	make SAVE_SPACE=YES;
)

# Then compile kertex_T.

# Real configuration, with chrooting for the installation (the map).
# And customization for url retrievers (kerTeX packaging system for
# Slackware.
#
cat >$OBJDIRPREFIX/slackbuild <<EOT
SYS_FTPC=lftp
SYS_HTTPC=lftp
CFLAGS="\$CFLAGS ${XCFLAGS:- }"
TARGETCHROOT=$PKG
TARGETBINDIR=/usr/bin
TARGETLIBDIR=/usr/share
CLIB=\$(rk_which_lib_of NULL stdio.h)
EOT

cd kertex_T
cd `../risk_comp/sys/posix/sh/rkconfig $OBJDIRPREFIX/slackbuild`
make SAVE_SPACE=YES

#===== embedding 4) in 3)...
#
# [TL] R.I.S.K. switches to root only when strictly needed. We are hence
# going to build the package during R.I.S.K. install procedure. So
# we add the custom Slackbuild stuff.
#
# This is the real chunk of commands to build the package.
# Replace the variables.
#
cat >.rkcomp/$$.slackbuild <<EOT
PRGNAM=$PRGNAM
VERSION=$VERSION
BUILD=$BUILD
TAG=$TAG
PKG=$PKG
SRCDIR=$SRCDIR
TMP=$TMP
OUTPUT=$OUTPUT
THIS=$(basename $0)
ARCH=$ARCH
MANDIR=/usr/share/kertex/man
KERTEX_PKG_DIR=${KERTEX_PKG_DIR:-}
EOT

# Then add chunk verbatim.
#
cat >>.rkcomp/$$.slackbuild <<"EOT"
set -u # we are root, don't write randomly...

# If there are kerTeX packages to apply do it now.
if test "x$KERTEX_PKG_DIR" != x; then
  (
  cd $TMP
  mkdir _kxpkg
  cd _kxpkg
  for pkg in $KERTEX_PKG_DIR/*.tar.gz; do
      tar xzf $pkg
  done
  # Apply bin
  cd $PKG/usr/bin/kertex
  for pkg in $TMP/_kxpkg/*-bin.tar; do
    tar xf $pkg
  done
  # Apply lib
  cd $PKG/usr/share/kertex
  for pkg in $TMP/_kxpkg/*-lib.tar; do
    tar xf $pkg
  done
  # Set KXPATHS
  cd $PKG/usr/share/kertex
  for kxpath in $TMP/_kxpkg/*.kxpath; do
   while read rootdir addpath; do
 	if test -s $rootdir/KXPATH; then
 	  ed $rootdir/KXPATH <<ENDEDSCRIPT
1s|\$|;$addpath;|
w
q
ENDEDSCRIPT
     else
 	  echo ";$addpath;" >$rootdir/KXPATH
 	fi
   done <$kxpath
  done
  )
  rm -fr $TMP/_kxpkg
fi

# Put stuff where SlackBuilt expect them to be (and to be cleaned).
#
rm -rf $OUTPUT/{configure,make,install,error,makepkg}-$PRGNAM.log
                         # remove old log files
# Add documentation:
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $SRCDIR/$THIS > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
find $PKG/usr/doc -type f -exec chmod 644 {} \;

# Compress the man page(s):
if [ -d $PKG$MANDIR ]; then
 find $PKG$MANDIR -type f -exec gzip -9f {} \;
fi

# Strip binaries (if any):
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
 | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# Add a package description:
mkdir -p $PKG/install
cat $SRCDIR/slack-desc > $PKG/install/slack-desc

# Add a SlackBuild post-install if there is:
if [ -f $SRCDIR/doinst.sh ]; then
  cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh
fi

# add paths for kertex
if [ -f $SRCDIR/add-kertex-path.sh ]; then
  mkdir -p $PKG/etc/profile.d
  cat $SRCDIR/add-kertex-path.sh >> $PKG/etc/profile.d/add-kertex-path.sh
  chmod 755 $PKG/etc/profile.d/add-kertex-path.sh 
fi 

# Build the package:
cd $PKG
makepkg --linkadd y --chown n\
  $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz}  2>&1\
  | tee $OUTPUT/makepkg-${PRGNAM}.log
cd $OUTPUT
md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz}\
  > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE:-txz}.md5
cd -
cat $PKG/install/slack-desc | grep "^${PRGNAM}"\
  > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txt

# Done with the temporary install. Root created, root deleted.
# Just for catching blunders, test name.
#
test "${PKG%$PRGNAM}" != "$PKG" && rm -fr $PKG
EOT

# We simply add this to our own post-install.
#
ed -s .rkcomp/install_bin/post-install <<EOT
?exit 0?-r .rkcomp/$$.slackbuild
w
q
EOT

# Creating a whole install in the $PKG subdir, and creating the package
# by the way.
#
make local_install SAVE_SPACE=YES

# Cleaning our own risk stuff. Check name
#
test "${TMP%risk}" != "$TMP" && rm -fr $TMP

running

Code: Select all

$which_kertex 
would return

Code: Select all

guest@porteus:~$ which_kertex

#              WARNING!!!  WARNING!!!  WARNING!!!
#
# 1) The path separator is now, everywhere, semicolon ';' and not
#	colon ':'.
# 2) The pkg stuff is now in /usr/share/kertex/pkg/. Run instead of pkg_core:
# 	/bin/sh /usr/share/kertex/pkg/kertex.sh install
#

KERTEX_VERSION=0.9999.7.6
KERTEX_HOST=linux-i686-3.7.5-porteus
KERTEX_SHELL=/bin/sh
KERTEX_BINDIR=/usr/bin/kertex
KERTEX_LIBDIR=/usr/share/kertex
KERTEX_MANDIR=/usr/share/kertex/man
KERTEX_USER0=root
KERTEX_GROUP0=wheel

If anyone has further questions, comments or observations please let me know. I will be offline for weekends have no internet :(, but will hopefully get back on Mondays to answer questions if possible. Thanks to all users for reporting errors, bugs, and suggestions. :wall: :good:

Best Regards,


Antonio

Post Reply