Kompiluje se
[mirrors/Programs.git] / bash / debian-ports / debiarch.sh
CommitLineData
21c4e167
H
1#!/bin/bash
2dscurl='http://ftp.de.debian.org/debian/pool/main/s/sash/sash_3.7-8.dsc';
3pkgurl=$(dirname "$dscurl");
4
5#init
6tmpdir="/tmp/debiarch-pid$$";
7rm -rf "$tmpdir";
8mkdir "$tmpdir"
9
10dscfile="${tmpdir}/desc.dsc";
11wget "$dscurl" -O "$dscfile" > /dev/null 2>&1 || exit 1;
12
13echo '# Contributor: Your Name youremail at domain dot com'
14echo '# This PKGBUILD was automatically generated and it will probably need few manual fixes'
15echo
16
17pkgname=$(cat "$dscfile" | grep '^Binary: ' | cut -d ' ' -f 2 | head -n 1)
18echo "pkgname=$pkgname"
19pkgver=$(cat "$dscfile" | grep '^Version: ' | cut -d ' ' -f 2 | head -n 1)
20echo "pkgver=$pkgver"
21stdver=$(cat "$dscfile" | grep '^Standards-Version: ' | cut -d ' ' -f 2 | head -n 1)
22
23#misc
24echo 'pkgrel=1'
25echo "pkgdesc='Port of Debian package $pkgname to ArchLinux'"
26echo "arch=('i686' 'x86_64')"
27echo "url='$dscurl'"
28echo "license=('GPL')"
29
30echo '#ArchLinux packages will probably have different names to Debian packages:'
31echo '#depends=() #check ${srcdir}/${pkgname}-${pkgver}/control for info about depends'
32echo '#makedepends=(' $(cat "$dscfile" | grep '^Build-Depends\(\|-Indep\): ' | cut -d ' ' -f 2- ) ')'
33echo '#install=debian.install #uncomment if needed'
34
35echo 'source=('
36 cat "$dscfile" | grep '^ ' | cut -d ' ' -f 4 | sort -u | while read line; do echo -ne '\t'; echo "${pkgurl}/$line"; done;
37echo ')'
38
39echo 'md5sums=('
40echo -e '\t#Make your own using md5sum *'
41echo ')'
42
43
44echo '
45build() {
46 srcsubdir=$(ls -1 --group-directories-first "$srcdir" | head -n 1) #guess it... ;)
47
48 echo -e "\n-------------------------------------------"
49 echo "==> Note you can check ${srcdir}/${srcsubdir}/debian/control for more info and run-time dependencies"
50 echo "==> and ${srcdir}/${srcsubdir}/debian/README.debian for even more info"
51 echo "==> Short version follows:"
52 cat "${srcdir}/${srcsubdir}/debian/control" | grep -i "^\(Depends\|Conflicts\|Suggests\|Description\):" | sort -u
53 echo -e "-------------------------------------------\n"
54
55 cd "${srcdir}"
56
57 #Apply debian patch (which contains more patches lol)
58 #patch -p0 < ${pkgname}_${pkgver}.diff
59 patch -p0 < ${pkgname}*.diff #another ugly asterisk hack muhwahwa...
60
61 #cd ${srcdir}/${pkgname}-${pkgver}/
62 cd "${srcdir}/${srcsubdir}/"
63
64 #Apply Debian patches (if any ;o)
65 for i in $(cat ./debian/patches/00list); do
66 bash "./debian/patches/$i.dpatch" -patch
67 done;
68
69 #Debian install script (if any...)
70 cp ./debian/postinst "${startdir}/debian.install"
71
72 #real build() work here (you will probably need to edit this):
73 cd "${srcdir}/${srcsubdir}" || return 1
74 ./configure --prefix=/usr
75 make || return 1
76 make DESTDIR=$pkgdir install || return 1
77}
78'
79
80#cleanup
81rm -rf "$tmpdir";
This page took 0.171951 seconds and 4 git commands to generate.