* updated x264 (4121277 -> 4613ac3c)
[t2sde.git] / scripts / Create-Pkg
blob4af60b03f24046164a15f82b05f454c7b7588de0
1 #!/bin/bash
3 #--- T2-COPYRIGHT-NOTE-BEGIN ---
4 #T2 SDE: scripts/Create-Pkg
5 #Copyright (C) 2004 - 2024 The T2 SDE Project
6 #Copyright (C) 1998 - 2003 ROCK Linux Project
8 #This Copyright note is generated by scripts/Create-CopyPatch,
9 #more information can be found in the files COPYING and README.
11 #This program is free software; you can redistribute it and/or modify
12 #it under the terms of the GNU General Public License version 2.
13 # --- T2-COPYRIGHT-NOTE-END ---
16 usage() {
17 cat <<-EOT
18 Usage:
19 $0 [ package/repository/packagename ] url < url-2 ... >
21 EOT
22 exit 1
25 [ $# -lt 1 ] && usage
27 info= text= url= author= category= license=GPL status=Beta code=
28 maintainer='The T2 Project <t2@t2-project.org>'
30 dir=
31 if [ $# -gt 1 ]; then
32 dir=${1#package/}; shift
33 else
34 case "$1" in
35 -h|*-help)
36 usage
38 *kde.org*)
39 dir=kde category=extra/desktop/kde author="KDE Project"
40 code=". \$base/package/*/*/kde-conf.in"
42 *gnome.org*)
43 dir=gnome category=extra/desktop/gnome author="GNOME Project"
44 code=". \$base/package/*/*/gnome-conf.in"
46 *github.com*)
47 curl ${1/github.com/api.github.com/repos} > repotmpfile
48 curl ${1/github.com/api.github.com/repos}/releases > releasetmpfile
50 dir=contrib
51 ver=$(jq -r '.[0].tag_name' releasetmpfile)
52 info=$(jq -r .description repotmpfile)
53 author=$(jq -r .owner.login repotmpfile)
54 license=$(jq -r .license.spdx_id repotmpfile)
56 [[ "$ver" != 0* ]] && status=Stable
58 url=$1
59 set -- "${url}/archive/${ver}/${url##*/}-${ver/v/}.tar.gz"
60 rm -f repotmpfile releasetmpfile
62 *) dir=contrib
64 esac
66 dir="$dir/${1##*/}"
67 dir="${dir%-[0-9]*}"
70 ver="${1%.tar.*}"
71 ver="${ver##*-}"
73 pkg=${dir##*/}
74 if [ "$pkg" = "$dir" ]; then
75 echo "failed"
76 echo " $dir must be <rep>/<pkg>!"
77 exit 1
80 rep="$(echo package/*/$pkg | cut -d'/' -f 2)"
81 if [ "$rep" != "*" ]; then
82 echo "failed"
83 echo " package $pkg belongs to $rep!"
84 exit 1
87 rep=${dir/\/$pkg/}
88 confdir="package/$dir"
90 echo -n "Creating $confdir ... "
91 if [ -e $confdir ]; then
92 echo "failed"
93 echo " $confdir already exists!"
94 exit
96 if ! mkdir -p $confdir; then
97 echo "failed"
98 exit 1
101 echo -n "Creating $pkg.desc ... "
102 cat >$confdir/$pkg.desc <<EOT
103 [I] ${info}
105 [T] ${text}
107 [U] ${url}
109 [A] ${author}
110 [M] ${maintainer}
112 [C] ${category}
113 [F] CROSS
115 [L] ${license}
116 [S] ${status}
117 [V] ${ver}
118 [P] X -----5---9 400.000
122 [ "$code" ] &&
123 echo "[O] $code
124 " >> $confdir/$pkg.desc
126 for dl; do
127 echo "[D] 0 ${dl##*/} ${dl%/*}/" >> $confdir/$pkg.desc
128 done
130 touch $confdir/$pkg.cache
131 svn add $confdir/
133 echo "Remember to fill in the TODO's:"
134 grep '^\[.\] $' $confdir/$pkg.desc
136 scripts/Create-CopyPatch $confdir/$pkg.desc | patch -p1
138 scripts/Config -oldconfig
139 scripts/Emerge-Pkg $pkg