forked from libyal/libvshadow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
synclibs.sh
executable file
·99 lines (80 loc) · 1.99 KB
/
synclibs.sh
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
#!/bin/sh
# Script that synchronizes the local library dependencies
#
# Version: 20141004
GIT_URL_PREFIX="https://github.com/libyal";
LOCAL_LIBS="libbfio libcdata libcerror libcfile libclocale libcnotify libcpath libcsplit libcstring libcsystem libcthreads libfdatetime libfguid libuna";
OLDIFS=$IFS;
IFS=" ";
for LOCAL_LIB in ${LOCAL_LIBS};
do
git clone ${GIT_URL_PREFIX}/${LOCAL_LIB}.git ${LOCAL_LIB}-$$;
if test -d ${LOCAL_LIB}-$$;
then
LOCAL_LIB_UPPER=`echo "${LOCAL_LIB}" | tr "[a-z]" "[A-Z]"`;
LOCAL_LIB_VERSION=`grep -A 2 AC_INIT ${LOCAL_LIB}-$$/configure.ac | tail -n 1 | sed 's/^\s*\[\([0-9]*\)\],\s*$/\1/'`;
rm -rf ${LOCAL_LIB};
mkdir ${LOCAL_LIB};
if test -d ${LOCAL_LIB};
then
cp ${LOCAL_LIB}-$$/${LOCAL_LIB}/*.[ch] ${LOCAL_LIB};
cp ${LOCAL_LIB}-$$/${LOCAL_LIB}/Makefile.am ${LOCAL_LIB}/Makefile.am;
SED_SCRIPT="/AM_CPPFLAGS = / {
i\\
if HAVE_LOCAL_${LOCAL_LIB_UPPER}
}
/lib_LTLIBRARIES/ {
s/lib_LTLIBRARIES/noinst_LTLIBRARIES/
}
/${LOCAL_LIB}\.c/ {
d
}
/${LOCAL_LIB}_la_LIBADD/ {
:loop1
/${LOCAL_LIB}_la_LDFLAGS/ {
N
i\\
endif
d
}
/${LOCAL_LIB}_la_LDFLAGS/ !{
N
b loop1
}
}
/${LOCAL_LIB}_la_LDFLAGS/ {
N
i\\
endif
d
}
/distclean: clean/ {
n
N
d
}";
echo "${SED_SCRIPT}" >> ${LOCAL_LIB}-$$.sed;
sed -i'~' -f ${LOCAL_LIB}-$$.sed ${LOCAL_LIB}/Makefile.am;
rm -f ${LOCAL_LIB}-$$.sed;
sed -i'~' "/${LOCAL_LIB}_definitions.h.in/d" ${LOCAL_LIB}/Makefile.am;
sed -i'~' "/${LOCAL_LIB}.rc/d" ${LOCAL_LIB}/Makefile.am;
sed -i'~' '/EXTRA_DIST = /d' ${LOCAL_LIB}/Makefile.am;
SED_SCRIPT="/^$/ {
x
N
/endif$/ {
a\\
D
}
}";
echo "${SED_SCRIPT}" >> ${LOCAL_LIB}-$$.sed;
sed -i'~' -f ${LOCAL_LIB}-$$.sed ${LOCAL_LIB}/Makefile.am;
rm -f ${LOCAL_LIB}-$$.sed;
rm -f ${LOCAL_LIB}/${LOCAL_LIB}.c;
cp ${LOCAL_LIB}-$$/${LOCAL_LIB}/${LOCAL_LIB}_definitions.h.in ${LOCAL_LIB}/${LOCAL_LIB}_definitions.h;
sed -i'~' 's/@VERSION@/${LOCAL_LIB_VERSION}/' ${LOCAL_LIB}/${LOCAL_LIB}_definitions.h;
fi
rm -rf ${LOCAL_LIB}-$$;
fi
done
IFS=$OLDIFS;