-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlts-libdrm-rename
executable file
·135 lines (104 loc) · 4.3 KB
/
lts-libdrm-rename
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
set -e
old_binaries="libkms1 2 -intel1 -nouveau2 -omap1 -radeon1"
ltsq=$(grep "^libdrm-intel1" "${rename_mapping_file}" | cut -d- -f3)
if [ -z "${ltsq}" ]; then
echo "Could not get name for ltsq"
exit 1
fi
# debian/control
# the only package not to have conflicts/replaces/provides
${basedir}/dpkg-control \
--source-suffix ${suffix} \
--binary-suffix ${suffix} \
--mapping-file "${rename_mapping_file}" \
--kill-binaries "libdrm2-udeb,libdrm-nouveau1a,libdrm-nouveau1a-dbg" \
> debian/control.new
# .. except in libdrm-dev renamed, which is special
conflicts="Conflicts: libdrm-dev, libdrm-dev-renamed, ${extraconflicts}"
provides="Provides: libdrm-dev, libdrm-dev-renamed, ${extraprovides}"
# add conflicts to libdrm-dev
sed -e "/Package: libdrm-dev-${suffix}\$/s@\$@\n${conflicts}\n${provides}@" -i debian/control.new
# debian/rules fixes
cp debian/rules debian/rules.new
if grep -q libdrm_nouveau1a debian/rules.new; then
#libdrm 2.4.39 had nouveau1a still built, remove it
# what libdrm-nouveau1a?
sed -e "/ libdrm-nouveau1a/d" -i debian/control.new
rm debian/libdrm-nouveau1a.*
sed -e "/libdrm-nouveau1a/d" -i debian/rules.new
# Zap temporary nouveau rules, which were needed for nouveau1a
sed -e "/libdrm_nouveau/d" -i debian/rules.new
# Now fix up the actual libdrm package..
sed -e "/04_libdrm-2.4.37-nouveau-1.diff/d" \
-e "/02_build_libkms_against_in_tree_drm.diff/d" \
-i debian/patches/series
# libdrm is being renamed, so make sure libkms links against it
# 2.4.40 and higher already have this patch
patch -Np1 < debian/patches/02_build_libkms_against_in_tree_drm.diff
fi
mv -v debian/control.new debian/control
# remove libdrm2-udeb from rules too
sed -e "s/--add-udeb=libdrm2-udeb//" -i debian/rules.new
# big mess, since we're special
mv debian/libdrm-dev.install debian/libdrm-dev-${suffix}.install
sed -e "s/^lib.../&-${ltsq}/" -i debian/*.lintian-overrides
for pkg in ${old_binaries}; do
if [ "${pkg}" = "libkms1" ]; then
newpkg="libkms-${ltsq}1"
else
newpkg="libdrm-${ltsq}${pkg}"
pkg="libdrm${pkg}"
fi
echo "- Renaming ${pkg}.* files to ${newpkg}.*"
set +e
files=$(ls debian/${pkg}.*)
err=$?
set -e
if [ $err -ne 0 ]; then
echo "Failed to list in ${old_package} for ${old_package} -> ${new_package}"
continue
fi
for old_file in $files; do
new_file=${old_file/${pkg}/${newpkg}}
mv -v ${old_file} ${new_file}
# TODO: Maybe using 'rename' would be better?
done
# Argh my eyes, so terribly sorry about this
# substitute $(XXV) for ati
# dumb rename for packages install rules
# another dumb rename for doc and bugs
# dh_strip rules
# libdrm has a single -p libkms1, fix it to -plibkms1
# dh_makeshlibs is needed for libdrm
sed -e "s@\$(XXV)@xserver-xorg-video@g" \
-e "s@debian/${pkg}/@debian/${newpkg}/@g" \
-e "s@debian/${pkg}\.@debian/${newpkg}.@g" \
-e "/dh_strip/s/-p /-p/g" \
-e "/dh_strip/s/-p${pkg} /-p${newpkg} /" \
-e "/dh_strip/s/-N${pkg} /-N${newpkg} /" \
-e "/dh_strip/s/${pkg}-dbg/${newpkg}-dbg/" \
-e "/dh_makeshlibs/s/${pkg}\\([ ']\\)/${newpkg}\\1/g" \
-i debian/rules.new
sed -e "s/ ${pkg} / ${newpkg} /" -i "debian/${newpkg}.symbols"
# we're renaming the sonames too, fix those up..
sed -e "s/^libdrm/libdrm_${ltsq}/" -i "debian/${newpkg}.symbols"
sed -e "s/^libkms/libkms_${ltsq}/" -i "debian/${newpkg}.symbols"
# and of course the install stuff
sed -e "s/libdrm/libdrm_${ltsq}/" -i "debian/${newpkg}.install"
sed -e "s/libkms/libkms_${ltsq}/" -i "debian/${newpkg}.install"
done
mv debian/rules.new debian/rules
sed -e "s/-lkms/&_${ltsq}/" -e "s/-ldrm/&_${ltsq}/" -i libdrm.pc.in */*.pc.in
sed -e "s/^libdrm/&_${ltsq}/" -i Makefile.am
sed -e "s/^libkms/&_${ltsq}/g" -i libkms/Makefile.am
sed -e "s/libkms\\.la/libkms_${ltsq}.la/" \
-e "s/libdrm\\.la/libdrm_${ltsq}.la/" \
-i Makefile.am tests/Makefile.am tests/*/Makefile.am libkms/Makefile.am
for n in exynos intel nouveau omap radeon; do
sed -e "s/^libdrm/&_${ltsq}/" \
-e "s/libdrm_${n}\\.la/libdrm_${ltsq}_${n}.la/" \
-e "s/libdrm\\.la/libdrm_${ltsq}.la/" \
-i ${n}/Makefile.am
done
debuild -S -sa ${debuild_args}