diff options
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | scripts/Makefile.am | 1 | ||||
-rw-r--r-- | scripts/repo-add.sh.in | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 9f4209b2..20aa1807 100644 --- a/configure.ac +++ b/configure.ac @@ -182,18 +182,24 @@ GCC_VISIBILITY_CC GCC_GNU89_INLINE_CC # Host-dependant definitions +SIZECMD="stat -c %s" case "${host_os}" in + *bsd*) + SIZECMD="stat -f %z" + ;; cygwin*) host_os_cygwin=yes CFLAGS="$CFLAGS -DCYGWIN" ;; darwin*) host_os_darwin=yes + SIZECMD="stat -f %z" ;; esac AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes") AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes") +AC_SUBST(SIZECMD) # Check for architecture, used in default makepkg.conf # (Note single space left after CARCHFLAGS) @@ -365,6 +371,7 @@ ${PACKAGE_NAME}: Architecture : ${CARCH} Architecture flags : ${CARCHFLAGS} Host Type : ${CHOST} + Filesize command : ${SIZECMD} libalpm version : ${LIB_VERSION} libalpm version info : ${LIB_VERSION_INFO} diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 7dccff9d..fd8fab7f 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -37,6 +37,7 @@ edit = sed \ -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \ -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ -e 's|@DBEXT[@]|$(DBEXT)|g' \ + -e 's|@SIZECMD[@]|$(SIZECMD)|g' \ -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g' ## All the scripts depend on Makefile so that they are rebuilt when the diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 538976d7..f3a3a4f4 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -122,7 +122,7 @@ db_write_delta() # get md5sum and size of delta md5sum="$(md5sum "$deltafile" | cut -d ' ' -f 1)" - csize=$(du -kL "$deltafile" | awk '{print $1 * 1024}') + csize=$(@SIZECMD@ "$deltafile") # ensure variables were found if [ -z "$pkgname" -o -z "$fromver" -o -z "$tover" -o -z "$arch" ]; then @@ -170,7 +170,7 @@ db_write_entry() IFS=$OLDIFS # get compressed size of package - csize=$(du -kL "$pkgfile" | awk '{print $1 * 1024}') + csize=$(@SIZECMD@ "$pkgfile") startdir=$(pwd) pushd "$gstmpdir" 2>&1 >/dev/null |