-
Notifications
You must be signed in to change notification settings - Fork 0
/
7z.build
executable file
·172 lines (135 loc) · 3.96 KB
/
7z.build
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/bash
#
. build_funcs
TARNAME=7z
TARNAMEEXTRA=
TARSEP=""
TARDIR=~/Source/7
#TAR_EXT=.tar.gz
VERSION=2408
VERSIONEXTRA=-src
BUILD=1
WEBPAGE="https://www.7-zip.org/"
#TAR_PROG=
#TAR_OPTS=
#PKGNAME=
#PKGVERSION=
#BUILD_SUFFIX=
#ARCH=noarch
FULL_TARNAME=${TARDIR}/${TARNAME}${TARNAMEEXTRA}${TARSEP}${VERSION}${VERSIONEXTRA}${TAR_EXT}
pre_unpack
PKG=/tmp/package-${PKGNAME}
if [ ! -f ${FULL_TARNAME} ]
then
echo Can\'t find ${FULL_TARNAME}
exit
fi
if [ ! -d ${TARNAME}-${VERSION} ]
then
mkdir ${TARNAME}-${VERSION}
cd ${TARNAME}-${VERSION}
${TAR_PROG} ${TAR_OPTS} ${FULL_TARNAME}
#mv ${TARNAME}-${VERSION} ${TARNAME}-${VERSION}
cd ..
if [ ! -d ${TARNAME}-${VERSION} ]
then
echo "${TARNAME}-${VERSION} directory not found"
exit
fi
(cd ${TARNAME}-${VERSION}
chmod -R +w *
chmod -x DOC/*
patch -p1 < ${CWD}/7z-0002-Use-getcwd-3-POSIX-extension-to-avoid-PATH_MAX-macro.patch
patch -p1 < ${CWD}/7z-0003-Disable-local-echo-display-when-in-input-passwords-C.patch
patch -p1 < ${CWD}/7z-0004-Use-system-locale-to-select-codepage-for-legacy-zip-.patch
)
fi
pre_configure
cd ${TARNAME}-${VERSION}
fix_perms
PKGCFLAGS="-O2 -march=i686 ${CPUOPT}=i686"
if [ ${DO_CONFIGURE} == "yes" ]
then
if [ -f ../configure ]
then
CFLAGS="${SLKCFLAGS}" \
CXXFLAGS="${SLKCFLAGS}" \
../configure --prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var/lib \
--mandir=/usr/man
elif [ -f ../CMakeLists.txt ]
then
cmake -DCMAKE_C_FLAGS:STRING="${SLKCFLAGS}" \
-DCMAKE_CXX_FLAGS:STRING="${SLKCFLAGS}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DMAN_INSTALL_DIR=/usr/man \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
-DSYSCONF_INSTALL_DIR=/etc \
..
elif [ -f ../meson.build ]
then
meson --prefix=/usr . ..
fi
fi
if [ ${DO_MAKE} == "yes" ]
then
if [ -f ../meson.build ]
then
ninja || exit
else
make ${NUM_JOBS} -C CPP/7zip/Bundles/Alone2 -f ../../cmpl_gcc.mak || exit
make ${NUM_JOBS} -C CPP/7zip/Bundles/Format7zF -f ../../cmpl_gcc.mak || exit
make ${NUM_JOBS} -C CPP/7zip/UI/Console -f ../../cmpl_gcc.mak || exit
make ${NUM_JOBS} -C CPP/7zip/Bundles/SFXCon -f ../../cmpl_gcc.mak || exit
make ${NUM_JOBS} -C CPP/7zip/Bundles/Alone -f ../../cmpl_gcc.mak || exit
make ${NUM_JOBS} -C CPP/7zip/Bundles/Alone7z -f ../../cmpl_gcc.mak || exit
# make ${NUM_JOBS} || exit
fi
fi
if [ ${DO_INSTALL} != "yes" ]
then
exit
fi
if [ -f ../meson.build ]
then
DESTDIR=${PKG} ninja install
else
mkdir -p ${PKG}/usr/{bin,lib${LIBDIRSUFFIX},man/man1}
install -Dm755 CPP/7zip/Bundles/Alone2/b/g/7zz ${PKG}/usr/bin
install -Dm755 CPP/7zip/Bundles/Alone/b/g/7za ${PKG}/usr/bin
install -Dm755 CPP/7zip/Bundles/Alone7z/b/g/7zr ${PKG}/usr/bin
install -Dm755 CPP/7zip/Bundles/Format7zF/b/g/7z.so ${PKG}/usr/lib${LIBDIRSUFFIX}
install -Dm755 CPP/7zip/UI/Console/b/g/7z ${PKG}/usr/bin
install -Dm755 CPP/7zip/Bundles/SFXCon/b/g/7zCon ${PKG}/usr/bin
cp ${CWD}/7z{,a,r,z}.1 ${PKG}/usr/man/man1
# make install DESTDIR=${PKG}
fi
strip_binaries
fix_links
compress_manpages
compress_info
cp -a \
DOC/* \
AUTHORS COPYING* INSTALL NEWS PLANS README* TODO \
${PKG}/usr/doc/${TARNAME}-${VERSION}
fix_docs
#-----handy-ruler-for-slack-desc-width-------------------------------|
make_slack_desc << EOF "Compression method of 7z format in 7-Zip program"
LZMA is a compression algorithm, based on the famous Lempel Ziv
compression method.
The main characteristics of the algorithm are very good compression,
fast decompression, use of lot of RAM for compression and low usage
of RAM for decompression.
LZMA provides high compression ratio and very fast decompression, so
it is very suitable for embedded applications. For example, it can be
used for ROM (firmware) compression.
EOF
post_install
cd ${PKG}
su -c "chown -R root:root ${PKG}; \
find . -type d -exec chmod 755 {} \; ; \
makepkg -l y -c n ${PKGDIR}${PKGNAME}-${PKGVERSION}-${ARCH}-${BUILD}${BUILD_SUFFIX}.tgz; \
chown -R ${USERNAME}:${GROUP} ${PKG}"