e2fsprogs/util/gen-android-files
Theodore Ts'o beb19fce8a Allow debugfs to be built for use in Android
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-05-25 22:26:20 -04:00

61 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
ANDROID_GENERATED_FILES="lib/ext2fs/ext2_err.c lib/ext2fs/ext2_err.h \
lib/ss/ss_err.c lib/ss/ss_err.h e2fsck/prof_err.c \
e2fsck/prof_err.h misc/prof_err.c misc/prof_err.h \
e2fsck/nls-enable.h e2fsck/plausible.c e2fsck/plausible.h \
lib/blkid/blkid_types.h lib/uuid/uuid_types.h \
lib/ext2fs/ext2_types.h lib/config.h lib/blkid/blkid.h \
lib/uuid/uuid.h lib/ext2fs/crc32c_table.h misc/default_profile.c \
lib/ss/std_rqs.c debugfs/debug_cmds.c debugfs/ro_debug_cmds.c \
debugfs/extent_cmds.c debugfs/e2freefrag.c debugfs/create_inode.c \
debugfs/plausible.c debugfs/recovery.c debugfs/revoke.c"
SS_DIR=$(pwd)/lib/ss
MK_CMDS=/tmp/mk_cmds$$.sh
sed -e "s;@SS_DIR@;$SS_DIR;" < $SS_DIR/mk_cmds.sh.in \
| sed -e "s/@AWK@/awk/" | sed -e "s/@SED@/sed/" > $MK_CMDS
sed -e "s/@E2FSPROGS_VERSION@/$(git describe)/" < lib/ext2fs/ext2_err.et.in > lib/ext2fs/ext2_err.et
for i in lib/ss/ss_err e2fsck/prof_err lib/ext2fs/ext2_err
do
rm -f $i.c $i.h
awk -f lib/et/et_c.awk outfile=$i.c outfn=$(basename $i.c) $i.et
awk -f lib/et/et_h.awk outfile=$i.h outfn=$(basename $i.h) $i.et
done
for i in lib/ss/std_rqs debugfs/debug_cmds debugfs/ro_debug_cmds \
debugfs/extent_cmds
do
/bin/sh $MK_CMDS $i.ct
mv -f $(basename $i).c $i.c
done
rm -f $MK_CMDS
rm -f misc/prof_err.[ch]
cp e2fsck/prof_err.[ch] misc/
cp lib/blkid/blkid.h.in lib/blkid/blkid.h
cp lib/uuid/uuid.h.in lib/uuid/uuid.h
cp util/android_types.h lib/ext2fs/ext2_types.h
cp util/android_types.h lib/blkid/blkid_types.h
cp util/android_types.h lib/uuid/uuid_types.h
cp util/android_config.h lib/config.h
cp misc/plausible.? e2fsck/
cp misc/nls-enable.h e2fsck/
cp misc/e2freefrag.c misc/create_inode.c misc/plausible.c debugfs/
cp e2fsck/recovery.c e2fsck/revoke.c debugfs/
gcc -o gen_crc32ctable lib/ext2fs/gen_crc32ctable.c
./gen_crc32ctable > lib/ext2fs/crc32c_table.h
awk -f misc/profile-to-c.awk < misc/mke2fs.conf.in > misc/default_profile.c
rm -f ./gen_crc32table ./gen_crc32ctable lib/ext2fs/ext2_err.et
git add -f $ANDROID_GENERATED_FILES
git commit -m "Update generated files for Android"