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