• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3ANDROID_GENERATED_FILES="lib/ext2fs/ext2_err.c lib/ext2fs/ext2_err.h \
4	lib/ss/ss_err.c lib/ss/ss_err.h lib/support/prof_err.c \
5	lib/support/prof_err.h \
6	lib/blkid/blkid_types.h lib/uuid/uuid_types.h \
7	lib/ext2fs/ext2_types.h lib/config.h lib/blkid/blkid.h \
8	lib/uuid/uuid.h lib/ext2fs/crc32c_table.h misc/default_profile.c \
9	lib/ss/std_rqs.c debugfs/debug_cmds.c debugfs/ro_debug_cmds.c \
10	debugfs/extent_cmds.c debugfs/e2freefrag.c \
11	debugfs/recovery.c debugfs/revoke.c \
12	MODULE_LICENSE_GPL README.version"
13
14SS_DIR=$(pwd)/lib/ss
15MK_CMDS=/tmp/mk_cmds$$.sh
16
17sed -e "s/@AWK@/awk/" < $SS_DIR/mk_cmds.sh.in \
18    | sed -e "s/@SED@/sed/" > $MK_CMDS
19
20sed -e "s/@E2FSPROGS_VERSION@/$(git describe)/" < lib/ext2fs/ext2_err.et.in > lib/ext2fs/ext2_err.et
21
22for i in lib/ss/ss_err lib/support/prof_err lib/ext2fs/ext2_err
23do
24   rm -f $i.c $i.h
25   awk -f lib/et/et_c.awk outfile=$i.c outfn=$(basename $i.c) $i.et
26   awk -f lib/et/et_h.awk outfile=$i.h outfn=$(basename $i.h) $i.et
27done
28
29for i in lib/ss/std_rqs debugfs/debug_cmds debugfs/ro_debug_cmds \
30			debugfs/extent_cmds
31do
32    _SS_DIR_OVERRIDE=lib/ss /bin/sh $MK_CMDS $i.ct
33    mv -f $(basename $i).c $i.c
34done
35
36rm -f $MK_CMDS
37
38cp lib/blkid/blkid.h.in lib/blkid/blkid.h
39cp lib/uuid/uuid.h.in lib/uuid/uuid.h
40
41cp util/android_types.h lib/ext2fs/ext2_types.h
42cp util/android_types.h lib/blkid/blkid_types.h
43cp util/android_types.h lib/uuid/uuid_types.h
44# Copied header files having exactly same content results in debug output
45# differences on RBE. Hence modify the #define's appropriately.
46sed -i 's/#define _LINUX_TYPES_H/#define _BLKID_TYPES_H/g' lib/blkid/blkid_types.h
47sed -i 's/#define _LINUX_TYPES_H/#define _EXT2_TYPES_H/g' lib/ext2fs/ext2_types.h
48sed -i 's/#define _LINUX_TYPES_H/#define _UUID_TYPES_H/g' lib/uuid/uuid_types.h
49
50cp util/android_config.h lib/config.h
51cp misc/e2freefrag.c debugfs/
52cp e2fsck/recovery.c e2fsck/revoke.c debugfs/
53
54gcc -o gen_crc32ctable lib/ext2fs/gen_crc32ctable.c
55./gen_crc32ctable > lib/ext2fs/crc32c_table.h
56
57awk -f misc/profile-to-c.awk < misc/mke2fs.conf.in > misc/default_profile.c
58
59rm -f ./gen_crc32table ./gen_crc32ctable lib/ext2fs/ext2_err.et
60
61touch MODULE_LICENSE_GPL
62
63E2FSPROGS_VERSION=`grep E2FSPROGS_VERSION version.h  \
64	| awk '{print $3}' | tr \" " " | awk '{print $1}'`
65DATE=`grep E2FSPROGS_DATE version.h | awk '{print $3}' \
66	| tr \" " "`
67E2FSPROGS_DAY=$(echo $DATE | awk -F- '{print $1}' | sed -e '/^[1-9]$/s/^/0/')
68MONTH=`echo $DATE | awk -F- '{print $2}'`
69YEAR=`echo $DATE | awk -F- '{print $3}'`
70
71if expr $YEAR ">" 1900 > /dev/null ; then
72	E2FSPROGS_YEAR=$YEAR
73elif expr $YEAR ">" 90 >/dev/null ; then
74	E2FSPROGS_YEAR=19$YEAR
75else
76	E2FSPROGS_YEAR=20$YEAR
77fi
78
79case $MONTH in
80Jan)	MONTH_NUM=01; E2FSPROGS_MONTH="January" ;;
81Feb)	MONTH_NUM=02; E2FSPROGS_MONTH="February" ;;
82Mar)	MONTH_NUM=03; E2FSPROGS_MONTH="March" ;;
83Apr)	MONTH_NUM=04; E2FSPROGS_MONTH="April" ;;
84May)	MONTH_NUM=05; E2FSPROGS_MONTH="May" ;;
85Jun)	MONTH_NUM=06; E2FSPROGS_MONTH="June" ;;
86Jul)	MONTH_NUM=07; E2FSPROGS_MONTH="July" ;;
87Aug)	MONTH_NUM=08; E2FSPROGS_MONTH="August" ;;
88Sep)	MONTH_NUM=09; E2FSPROGS_MONTH="September" ;;
89Oct)	MONTH_NUM=10; E2FSPROGS_MONTH="October" ;;
90Nov)	MONTH_NUM=11; E2FSPROGS_MONTH="November" ;;
91Dec)	MONTH_NUM=12; E2FSPROGS_MONTH="December" ;;
92*)	MONTH_NUM=13; E2FSPROGS_MONTH="UNKNOWN" ;;
93esac
94
95base_ver=`echo $E2FSPROGS_VERSION | \
96	       sed -e 's/-WIP//' -e 's/pre-//' -e 's/-PLUS//'`
97
98date_spec=${E2FSPROGS_YEAR}${MONTH_NUM}${E2FSPROGS_DAY}
99
100case $E2FSPROGS_VERSION in
101*-WIP|pre-*)
102	VER="$base_ver-WIP-$date_spec"
103	FN="$base_ver~WIP.$E2FSPROGS_YEAR.$MONTH_NUM.$E2FSPROGS_DAY"
104	;;
105*)
106	VER="$base_ver"
107	FN="$base_ver"
108	;;
109esac
110
111sed -e "s/@VER@/$VER/g" -e "s/@FN@/$FN/" < util/android-README.version.in > README.version
112
113git add -f $ANDROID_GENERATED_FILES
114if test -f COPYING
115then
116   git mv COPYING NOTICE
117fi
118git commit -m "Update generated files for Android"
119