You are not logged in.
Pages: 1
I am trying to create a SQLTeX package myself by following this topic, and very useful Arch Wiki pages:
Arch packaging standards: https://wiki.archlinux.org/index.php/Ar … _standards
Creating packages: https://wiki.archlinux.org/index.php/Creating_packages
This is the PKGBUILD that I've been able to create:
# Maintainer: Žiga Lausegger <ziga.lausegger@gmail.com>
pkgname=sqltex
pkgver=1.5
pkgrel=1
pkgdesc="Preprocessor to enable the use of SQL statements in LaTeX."
arch=('any')
url="https://github.com/oveas/sqltex"
license=('LaTeX Project Public License (LPPL)')
groups=()
depends=('perl' 'perl-dbi' 'perl-dbd-mysql')
makedepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=(ftp://ftp.oveas.com/pub/SQLTeX/SQLTeX.$pkgver.tar.gz)
noextract=()
md5sums=('f761644e6abb8d4dac1a7ba633a31590')
build() {
cd "SQLTeX.$pkgver"
chmod +x install
./install
#./configure --prefix=/usr
make
}
package() {
cd "SQLTeX.$pkgver"
make DESTDIR="$pkgdir/" install
}
and console output if I run this PKGBUILD using makepkg -si is:
[ziga@ziga-laptop sqltex]$ makepkg -si
==> Making package: sqltex 1.5-1 (Thu Aug 17 15:41:27 CEST 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Downloading SQLTeX.1.5.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 120k 100 120k 0 0 152k 0 --:--:-- --:--:-- --:--:-- 152k
==> Validating source files with md5sums...
SQLTeX.1.5.tar.gz ... Passed
==> Extracting sources...
-> Extracting SQLTeX.1.5.tar.gz with bsdtar
==> Starting build()...
Where should SQLTeX be installed [/home/ziga/Downloads/sqltex/src/SQLTeX.1.5] ?
It all runs fine untill script asks me where to install the package. Now in the SQLTeX documentation
it is said that install script will prompt us to pass the install directory and that default is the current
directory. So If I press enter I get:
Replace file already exists---not overwritten
Installation complete---type SQLTeX -h for help
make: *** No targets specified and no makefile found. Stop.
==> ERROR: A failure occurred in build().
Aborting...
Does this mean that package is installed and I can simply remove function package() from the
PKGBUILD? Why do we even have multiple functions in MAKEPKG prototype?
C, ARM, ARM assembly, HTML, CSS, JS, Linux
Offline
You may want to ask a mod to put this in "Creating and Modifying Packages" instead, this belongs in there probably.
I don't know much about SQLTex packages, but I would be expecting to find a "build" or "make" command in your build() phase, not an install per-se. Typically, a "make install" purpose is for installing libraries and executables, not to build those libraries and executables.
Offline
Why do we even have multiple functions in MAKEPKG prototype?
The purpose of each function is explained on this page you linked on your post.
Each package is built differently, so you may not always need all of the functions. As mentioned on that page, only package() function is required, while others can be left out if they are unnecessary.
When you start building a package, you should first take a look on how to build and install the program by hand. In this case, you're obviously not supposed to use "make" in any point of the install. Hence, there's no Makefile, and the "make" command in build() fails, therefore failing the whole makepkg process.
When there's a single build/install script privided by upstream, the best practice is to open the script in text editor and look what it does. Then instead of executing the install script, you adapt what it does to the PKGBUILD.
Especially when the install script is an interactive one, like it is here, you shouldn't use the script, but adopt it's function to the PKGBUILD, since the build with makepkg shouldn't be interactive at any point.
Offline
When there's a single build/install script privided by upstream, the best practice is to open the script in text editor and look what it does. Then instead of executing the install script, you adapt what it does to the PKGBUILD.
Ok. This is really helpfull! The script looks like this...
#!/bin/sh
SRCF="SQLTeX.pl"
TMPF="SQLTeX.tmp"
SQLT="SQLTeX"
RFIL="SQLTeX_r.dat"
TAB="\011"
PI=`which perl` || PI=""
## Is Perl installed ?
if test -z "$PI"
then
echo "Perl is either not installed on this system, or not included in your path"
echo "Please check and correct this error - you need Perl to use SQLTeX"
exit
fi
## Does the source file exist ?
if ! test -f $SRCF
then
echo "Error - the file $SRCF does not exist in the current directory"
exit
fi
## Where should SQLTeX be installed ?
CUSR=`whoami`
if test $CUSR = "root"
then
DDIR="/usr/local/bin"
else
DDIR=`pwd`
fi
while test -z "$IDIR"
do
echo -n "Where should SQLTeX be installed [$DDIR] ? "
read IDIR
if test -z "$IDIR"
then
IDIR="$DDIR"
fi
if ! test -d $IDIR
then
echo "$IDIR does not exist or is not a directory"
IDIR=""
fi
done
echo "#!$PI -w" > $TMPF
echo "" >> $TMPF
cat $SRCF >> $TMPF
chmod +x $TMPF
mv $TMPF $IDIR/$SQLT
Write_r_File () {
echo -E -n "$1" >> $IDIR/$RFIL
echo -e -n $TAB >> $IDIR/$RFIL
echo -E "$2" >> $IDIR/$RFIL
}
## Create the replacement file if it does not yet exist
if ! test -e $IDIR/$RFIL
then
touch $IDIR/$RFIL
echo -e "; This file contains all characters or character sequences that" >> $IDIR/$RFIL
echo -e "; will be be replaced by SQLTeX when the occur in the response" >> $IDIR/$RFIL
echo -e "; of an SQL query." >> $IDIR/$RFIL
echo -e "; It is mainly used for escaping the (La)TeX special characters," >> $IDIR/$RFIL
echo -e "; but any value can be added here." >> $IDIR/$RFIL
echo -e "; The first column is the character (sequence) that will be replaced." >> $IDIR/$RFIL
echo -e "; The second column is the value to replace col 1 with." >> $IDIR/$RFIL
echo -e "; Columns are sepated with one or more tab- characters." >> $IDIR/$RFIL
echo -e ";" >> $IDIR/$RFIL
echo -e "; Note all values are case sensitive; if you add the line:" >> $IDIR/$RFIL
echo -e "; LaTeX \LaTeX\ " >> $IDIR/$RFIL
echo -E "; the word \"latex\" will be untouched, but \"LaTeX\" will be replaced." >> $IDIR/$RFIL
echo -e ";" >> $IDIR/$RFIL
Write_r_File "$" '\$'
Write_r_File "_" "\_"
Write_r_File "%" "\%"
Write_r_File "&" "\&"
Write_r_File "<" "\texttt{<}"
Write_r_File ">" "\texttt{>}"
Write_r_File "{" "\{"
Write_r_File "}" "\}"
Write_r_File "#" "\#"
Write_r_File '~' "\~{}"
Write_r_File '\' "\ensuremath{\backslash}"
else
echo "Replace file already exists---not overwritten"
fi
echo "Installation complete---type $SQLT -h for help"
Should I put part of this code in build() function and part in package()?
C, ARM, ARM assembly, HTML, CSS, JS, Linux
Offline
You definitely shouldn't just copy/paste anything you don't fully understand from the script, Instead, the goal should be to create a PKGBUILD that does the same as the script in "PKGBUILD-way".
For example, at the beginning, the install script checks that perl is installed with 'which'. In pkgbuild that should be done with depends= or makedepends=. There's also stuff that make no sense in PKGBUILDs: i.e. the user-id- and install-directory-checking. Also, the default install directory (when istalled with root) is wrong for arch packages (should be /usr/ instead of /usr/local/).
Usually install scripts essentially just copy bunch of files to an appropriate system/user directory. IIUC, this one seems to use "echo", to write some stuff I don't fully understand, on a single file. That is the part that should be performed in the PKGBUILD somehow.
Again, see the link on my last post for explanation of what should be done in different PKGBUILD functions. There are cases where it's perfectly fine to run everything in package(), and this could be one of those cases.
Frankly, this is far from the easiest PKGBUILD to create for beginner. If you simply want to get the package installed for yourself, I think you could just run the install script in package(), and enter the correct install directory by hand when asked. However that won't meet any packaging standards, and shouldn't be added in AUR.
Offline
Frankly, this is far from the easiest PKGBUILD to create for beginner. If you simply want to get the package installed for yourself, I think you could just run the install script in package(), and enter the correct install directory by hand when asked. However that won't meet any packaging standards, and shouldn't be added in AUR.
I want to larn how to do it the right way. OK I will now take a look at the link you posted and will report back if I have any further questions.
C, ARM, ARM assembly, HTML, CSS, JS, Linux
Offline
Pages: 1