-
Notifications
You must be signed in to change notification settings - Fork 0
/
Recipe
executable file
·150 lines (114 loc) · 4.57 KB
/
Recipe
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
########################################################################
# Package the baries built on Travis-CI as an AppImage
# By Simon Peter 2016
# For more information, see http://appimage.org/
########################################################################
export ARCH="$(uname -m)"
LOC="$PWD"
APP=gvim
LOWERAPP=${APP,,}
apt-get update
apt-get install -y wget curl gzip perl python python3 ruby lua5.2
apt-get build-dep -y vim-gtk
URLS=$(apt-get -y install --print-uris --reinstall libncurses5 | cut -d "'" -f 2 | grep -e "^http")
VIM_VERSION=$(wget -cq https://github.com/vim/vim/releases -O - | grep ".tar.gz" | head -n 1 | cut -d '"' -f 2 | cut -d '/' -f 5 | sed 's|.tar.gz||g' | sed 's|v||g')
printf "VERSION is $VIM_VERSION\n"
wget -cqO- https://github.com/vim/vim/archive/v$VIM_VERSION.tar.gz | tar xz --transform="s/vim-${VIM_VERSION}/vim/"
if [[ -d /AppDir ]]; then
rm -rf /AppDir
fi
mkdir -p /AppDir/usr
cd vim
./configure \
--enable-perlinterp \
--enable-pythoninterp \
--enable-python3interp \
--enable-rubyinterp \
--enable-luainterp \
--prefix=/usr
make
make install DESTDIR=/AppDir
cd /AppDir
wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
chmod +x ./functions.sh
. ./functions.sh
rm functions.sh
# Also needs grep for gvim.wrapper
cp /bin/grep ./usr/bin
# install additional dependencies for python
#URL=$(apt-get install -qq --yes --no-download --reinstall --print-uris libpython2.7 libpython3.2 libperl5.14 liblua5.1-0 libruby1.9.1| cut -d' ' -f1 | tr -d "'")
#URL=$(apt-get install -qq --yes --no-download --reinstall --print-uris libpython3.2 | cut -d' ' -f1 | tr -d "'")
#wget -c $URL
#for package in *.deb; do
# dpkg -x $package .
#done
#rm -f *.deb
########################################################################
# Copy desktop and icon file to AppDir for AppRun to pick them up
########################################################################
get_apprun
get_desktop
find "${SOURCE_DIR}" -name "vim48x48.png" -exec cp {} "${LOWERAPP}.png" \;
mkdir -p ./usr/lib/x86_64-linux-gnu
# copy dynamically needed dlls
#find /usr/lib -maxdepth 2 -type f -name "libpython[23]*.so*" -exec cp {} ./usr/lib/x86_64-linux-gnu/ \;
# copy dependencies
copy_deps
# Move the libraries to usr/bin
move_lib
########################################################################
# Delete stuff that should not go into the AppImage
########################################################################
# if those libraries are present, there will be a pango problem
find . -name "libpango*" -delete
find . -name "libfreetype*" -delete
find . -name "libX*" -delete
# Delete dangerous libraries; see
# https://github.com/probonopd/AppImages/blob/master/excludelist
delete_blacklisted
########################################################################
# desktopintegration asks the user on first run to install a menu item
########################################################################
get_desktopintegration "$LOWERAPP"
########################################################################
# Patch away absolute paths; it would be nice if they were relative
########################################################################
sed -i -e "s|/usr/share/|././/share/|g" usr/bin/vim
sed -i -e "s|/usr/lib/|././/lib/|g" usr/bin/vim
sed -i -e "s|/usr/share/doc/vim/|././/share/doc/vim/|g" usr/bin/vim
# Possibly need to patch additional hardcoded paths away, replace
# "/usr" with "././" which means "usr/ in the AppDir"
# remove unneeded stuff
rmdir ./usr/lib64 || true
rm -rf ./usr/bin/*tutor* || true
rm -rf ./usr/share/doc || true
#rm -rf ./usr/bin/vim || true
# remove unneded links
find ./usr/bin -type l \! -name "gvim" -delete || true
cp ./usr/share/icons/hicolor/48x48/apps/gvim.png .
cd ..
for URL in $URLS ; do
if [ ! -f $(basename "$URL") ] ; then
wget -c $URL
fi
done
cd -
find ../*.deb -exec dpkg -x {} . \; || true
cd -
# Package as AppImage
GLIBC_NEEDED=$(find . -type f -executable -exec strings {} \; | grep ^GLIBC_2 | sed s/GLIBC_//g | sort --version-sort | uniq | tail -n 1)
VERSION=${VIM_VERSION}.glibc$GLIBC_NEEDED
echo "VERSION is $VERSION"
ARCH=$(uname -m)
if [[ "$ARCH" = "x86_64" ]] ; then
APPIMAGE=$APP"-"$VERSION"-x86_64.AppImage"
fi
if [[ "$ARCH" = "i686" ]] ; then
APPIMAGE=$APP"-"$VERSION"-i386.AppImage"
fi
mkdir -p /out
rm -f /out/*.AppImage || true
curl -sL "https://github.com/probonopd/AppImageKit/releases/download/6/AppImageAssistant_6-x86_64.AppImage" > AppImageAssistant
chmod a+x AppImageAssistant
./AppImageAssistant ./AppDir/ /out/$APP"-"$VERSION"-"$ARCH".AppImage"