forked from libyal/libvshadow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
synclibs.sh
executable file
·155 lines (128 loc) · 3.35 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
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
#!/bin/sh
# Script that synchronizes the local library dependencies
#
# Version: 20160912
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
continue
fi
rm -rf ${LOCAL_LIB};
mkdir ${LOCAL_LIB};
if ! test -d ${LOCAL_LIB};
then
continue
fi
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/'`;
LOCAL_LIB_MAKEFILE_AM="${LOCAL_LIB}/Makefile.am";
cp ${LOCAL_LIB}-$$/${LOCAL_LIB}/*.[chly] ${LOCAL_LIB};
cp ${LOCAL_LIB}-$$/${LOCAL_LIB_MAKEFILE_AM} ${LOCAL_LIB_MAKEFILE_AM};
# Make the necessary changes to libyal/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};
if test ${LOCAL_LIB} = "libodraw";
then
# TODO: make this more generic to strip the last \\
sed -i'~' 's/libodraw_cue_scanner.c \\/libodraw_cue_scanner.c/' ${LOCAL_LIB_MAKEFILE_AM};
else
sed -i'~' '/EXTRA_DIST = /,/^$/d' ${LOCAL_LIB_MAKEFILE_AM};
fi
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;
# Make the necessary changes to libcfile/Makefile.am
if test ${LOCAL_LIB} = "libcfile";
then
if ! test -f "m4/libuna.m4";
then
sed -i'~' 's?@LIBUNA_CPPFLAGS@?-I$(top_srcdir)/libuna?' ${LOCAL_LIB_MAKEFILE_AM};
fi
fi
# Make the necessary changes to libcsystem/Makefile.am
if test ${LOCAL_LIB} = "libcsystem";
then
if ! test -f "m4/libuna.m4";
then
sed -i'~' 's?@LIBUNA_CPPFLAGS@?-I$(top_srcdir)/libuna?' ${LOCAL_LIB_MAKEFILE_AM};
fi
fi
# Make the necessary changes to libfvalue/Makefile.am
if test ${LOCAL_LIB} = "libfvalue";
then
if ! test -f "m4/libfdatetime.m4";
then
sed -i'~' '/@LIBFDATETIME_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM};
fi
if ! test -f "m4/libfguid.m4";
then
sed -i'~' '/@LIBFGUID_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM};
fi
if ! test -f "m4/libfwnt.m4";
then
sed -i'~' '/@LIBFWNT_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM};
fi
if ! test -f "m4/libuna.m4";
then
sed -i'~' '/@LIBUNA_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM};
fi
fi
# Remove libyal/libyal.c
rm -f ${LOCAL_LIB}/${LOCAL_LIB}.c;
# Make the necessary changes to libyal/libyal_defitions.h
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;
rm -rf ${LOCAL_LIB}-$$;
done
IFS=$OLDIFS;