libports: initial e2fsck port

In contrast to the already available e2fsprogs port, this one does not
depend on Noux.

Issue #2558.
This commit is contained in:
Josef Söntgen 2017-10-26 16:09:09 +02:00 committed by Christian Helmuth
parent 84e0ffe7cb
commit a110fef4d9
8 changed files with 544 additions and 0 deletions

View File

@ -0,0 +1,7 @@
E2FSPROGS_DIR := $(call select_from_ports,e2fsprogs-lib)
INC_DIR += $(E2FSPROGS_DIR)/src/lib/e2fsprogs/lib
INC_DIR += $(E2FSPROGS_DIR)/include/e2fsprogs
INC_DIR += $(REP_DIR)/src/lib/e2fsprogs
INC_DIR += $(REP_DIR)/src/lib/e2fsprogs/lib

View File

@ -0,0 +1,228 @@
E2FSPROGS_DIR := $(call select_from_ports,e2fsprogs-lib)/src/lib/e2fsprogs
INC_DIR += $(call select_from_ports,e2fsprogs-lib)/include/e2fsprogs
LIBS := libc e2fsprogs_host_tools
CC_OPT += -Wno-unused-variable -Wno-unused-function -Wno-maybe-uninitialized
CC_DEF += -DLOCALEDIR=\"/share/locale\"
CC_DEF += -DLIBDIR=\"/lib\"
CC_DEF += -DLOCALE_ALIAS_PATH=\"/share/locale\"
SRC_C_intl := \
intl/bindtextdom.c \
intl/dcgettext.c \
intl/dgettext.c \
intl/gettext.c \
intl/finddomain.c \
intl/loadmsgcat.c \
intl/localealias.c \
intl/textdomain.c \
intl/l10nflist.c \
intl/dcigettext.c \
intl/explodename.c \
intl/dcngettext.c \
intl/dngettext.c \
intl/ngettext.c \
intl/plural.c \
intl/plural-exp.c \
intl/localcharset.c \
intl/relocatable.c \
intl/log.c \
intl/localename.c \
intl/printf.c \
intl/osdep.c \
intl/intl-compat.c
INC_DIR_intl := $(E2FSPROGS_DIR)/intl $(REP_DIR)/src/lib/e2fsprogs/intl
CC_OPT_intl/dcigettext += -DSTATIC=
SRC_C_libblkid := \
lib/blkid/cache.c \
lib/blkid/devname.c \
lib/blkid/dev.c \
lib/blkid/getsize.c \
lib/blkid/devno.c \
lib/blkid/llseek.c \
lib/blkid/probe.c \
lib/blkid/read.c \
lib/blkid/resolve.c \
lib/blkid/save.c \
lib/blkid/tag.c \
lib/blkid/version.c
INC_DIR_libblkid := $(E2FSPROGS_DIR)/lib/blkid $(REP_DIR)/src/lib/e2fsprogs/lib/blkid
SRC_C_libcom_err := \
lib/et/com_err.c \
lib/et/com_right.c \
lib/et/error_message.c \
lib/et/et_name.c \
lib/et/init_et.c
INC_DIR_libcom_err := $(E2FSPROGS_DIR)/lib/et
SRC_C_libe2p := \
lib/e2p/feature.c \
lib/e2p/fgetflags.c \
lib/e2p/fgetversion.c \
lib/e2p/fsetflags.c \
lib/e2p/fsetversion.c \
lib/e2p/getflags.c \
lib/e2p/getversion.c \
lib/e2p/hashstr.c \
lib/e2p/iod.c \
lib/e2p/ls.c \
lib/e2p/mntopts.c \
lib/e2p/ostype.c \
lib/e2p/parse_num.c \
lib/e2p/pe.c \
lib/e2p/percent.c \
lib/e2p/pf.c \
lib/e2p/ps.c \
lib/e2p/setflags.c \
lib/e2p/setversion.c \
lib/e2p/uuid.c
INC_DIR_libe2p := $(E2FSPROGS_DIR)/lib/e2p
SRC_C_libext2fs := \
lib/ext2fs/alloc.c \
lib/ext2fs/alloc_sb.c \
lib/ext2fs/alloc_stats.c \
lib/ext2fs/alloc_tables.c \
lib/ext2fs/badblocks.c \
lib/ext2fs/bb_compat.c \
lib/ext2fs/bb_inode.c \
lib/ext2fs/bitmaps.c \
lib/ext2fs/bitops.c \
lib/ext2fs/blkmap64_ba.c \
lib/ext2fs/blkmap64_rb.c \
lib/ext2fs/blknum.c \
lib/ext2fs/block.c \
lib/ext2fs/bmap.c \
lib/ext2fs/check_desc.c \
lib/ext2fs/closefs.c \
lib/ext2fs/crc16.c \
lib/ext2fs/crc32c.c \
lib/ext2fs/csum.c \
lib/ext2fs/dblist.c \
lib/ext2fs/dblist_dir.c \
lib/ext2fs/dir_iterate.c \
lib/ext2fs/dirblock.c \
lib/ext2fs/dirhash.c \
lib/ext2fs/dupfs.c \
lib/ext2fs/expanddir.c \
lib/ext2fs/ext2_err.c \
lib/ext2fs/ext_attr.c \
lib/ext2fs/extent.c \
lib/ext2fs/fileio.c \
lib/ext2fs/finddev.c \
lib/ext2fs/flushb.c \
lib/ext2fs/freefs.c \
lib/ext2fs/gen_bitmap.c \
lib/ext2fs/gen_bitmap64.c \
lib/ext2fs/get_pathname.c \
lib/ext2fs/getsectsize.c \
lib/ext2fs/getsize.c \
lib/ext2fs/i_block.c \
lib/ext2fs/icount.c \
lib/ext2fs/imager.c \
lib/ext2fs/ind_block.c \
lib/ext2fs/initialize.c \
lib/ext2fs/inline.c \
lib/ext2fs/inode.c \
lib/ext2fs/inode_io.c \
lib/ext2fs/io_manager.c \
lib/ext2fs/ismounted.c \
lib/ext2fs/link.c \
lib/ext2fs/llseek.c \
lib/ext2fs/lookup.c \
lib/ext2fs/mkdir.c \
lib/ext2fs/mkjournal.c \
lib/ext2fs/mmp.c \
lib/ext2fs/namei.c \
lib/ext2fs/native.c \
lib/ext2fs/newdir.c \
lib/ext2fs/openfs.c \
lib/ext2fs/progress.c \
lib/ext2fs/punch.c \
lib/ext2fs/qcow2.c \
lib/ext2fs/rbtree.c \
lib/ext2fs/read_bb.c \
lib/ext2fs/read_bb_file.c \
lib/ext2fs/res_gdt.c \
lib/ext2fs/rw_bitmaps.c \
lib/ext2fs/swapfs.c \
lib/ext2fs/symlink.c \
lib/ext2fs/tdb.c \
lib/ext2fs/test_io.c \
lib/ext2fs/undo_io.c \
lib/ext2fs/unix_io.c \
lib/ext2fs/unlink.c \
lib/ext2fs/valid_blk.c \
lib/ext2fs/version.c \
lib/ext2fs/write_bb_file.c
INC_DIR_libext2fs := $(E2FSPROGS_DIR)/lib/ext2fs $(REP_DIR)/src/lib/e2fsprogs/lib/ext2fs
SRC_C_libquota := \
lib/quota/mkquota.c \
lib/quota/quotaio.c \
lib/quota/quotaio_v2.c \
lib/quota/quotaio_tree.c \
e2fsck/dict.c
INC_DIR_libquota := $(E2FSPROGS_DIR)/lib/quota
SRC_C_libuuid := \
lib/uuid/clear.c \
lib/uuid/compare.c \
lib/uuid/copy.c \
lib/uuid/gen_uuid.c \
lib/uuid/isnull.c \
lib/uuid/pack.c \
lib/uuid/parse.c \
lib/uuid/unpack.c \
lib/uuid/unparse.c \
lib/uuid/uuid_time.c
INC_DIR_libuuid := $(E2FSPROGS_DIR)/lib/uuid
SRC_C := \
$(SRC_C_intl) \
$(SRC_C_libblkid) \
$(SRC_C_libcom_err) \
$(SRC_C_libe2p) \
$(SRC_C_libext2fs) \
$(SRC_C_libquota) \
$(SRC_C_libuuid)
INC_DIR += $(E2FSPROGS_DIR)/lib
INC_DIR += $(REP_DIR)/src/lib/e2fsprogs
INC_DIR += $(REP_DIR)/src/lib/e2fsprogs/lib
INC_DIR += $(INC_DIR_intl)
INC_DIR += $(INC_DIR_libblkid)
INC_DIR += $(INC_DIR_libcom_err)
INC_DIR += $(INC_DIR_libe2p)
INC_DIR += $(INC_DIR_libext2fs)
INC_DIR += $(INC_DIR_libquota)
INC_DIR += $(INC_DIR_libuuid)
CC_DEF += -D__BSD_VISIBLE
CC_DEF += -DHAVE_CONFIG_H
vpath %.c $(E2FSPROGS_DIR)
#
# Generate header files
#
# use top directory so that $(INC_DIR) picks it up
E2FSPROGS_BUILD_DIR := $(BUILD_BASE_DIR)/var/libcache/e2fsprogs
CRC_HEADER := $(E2FSPROGS_BUILD_DIR)/crc32c_table.h
$(SRC_C:.c=.o): \
$(CRC_HEADER)
EXT2FS_GEN_CRC := $(BUILD_BASE_DIR)/tool/e2fsprogs/gen_crc32ctable
$(CRC_HEADER):
$(MSG_CONVERT)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)$(EXT2FS_GEN_CRC) > $@

View File

@ -0,0 +1,20 @@
#
# Compile host tools used to create generated header files
#
EXT2FS_GEN_CRC := $(BUILD_BASE_DIR)/tool/e2fsprogs/gen_crc32ctable
E2FSCK_GEN_CRC := $(BUILD_BASE_DIR)/tool/e2fsprogs/gen_crc32table
HOST_TOOLS += $(EXT2FS_GEN_CRC) $(E2FSCK_GEN_CRC)
E2FSPROGS_DIR := $(call select_from_ports,e2fsprogs-lib)/src/lib/e2fsprogs
$(EXT2FS_GEN_CRC): $(E2FSPROGS_DIR)
$(MSG_BUILD)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)gcc $(E2FSPROGS_DIR)/lib/ext2fs/$(notdir $@).c -o $@
$(E2FSCK_GEN_CRC): $(E2FSPROGS_DIR)
$(MSG_BUILD)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)gcc $(E2FSPROGS_DIR)/e2fsck/$(notdir $@).c -o $@

View File

@ -0,0 +1 @@
7302da4fea6929fd6c2e4b4c70f81b20b9dd7d38

View File

@ -0,0 +1,90 @@
LICENSE := GPLv2
VERSION := 1.42.9
DOWNLOADS := e2fsprogs.git
E2FSPROGS_DIR := src/lib/e2fsprogs
URL(e2fsprogs) := http://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
REV(e2fsprogs) := v$(VERSION)
DIR(e2fsprogs) := $(E2FSPROGS_DIR)
PATCHES := src/lib/e2fsprogs/patches/*.patch
INCLUDE_DIR := include/e2fsprogs
DIRS := $(INCLUDE_DIR)
# arbitrary dummy header to keep the ports tool happy
DIR_CONTENT($(INCLUDE_DIR)) := \
$(addprefix $(E2FSPROGS_DIR)/lib/ext2fs/,ext2fs.h)
#
# Generate header files
#
BLKID_HEADER := $(INCLUDE_DIR)/blkid/blkid.h
EXT2FS_HEADER := $(INCLUDE_DIR)/ext2fs/ext2_types.h
INTL_HEADER := $(INCLUDE_DIR)/libgnuintl.h
UUID_HEADER := $(INCLUDE_DIR)/uuid/uuid.h
_dirs: \
$(BLKID_HEADER) \
$(EXT2FS_HEADER) \
$(INTL_HEADER) \
$(UUID_HEADER)
$(INTL_HEADER):
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)sed -e 's,@''HAVE_POSIX_PRINTF''@,1,g' \
-e 's,@''HAVE_ASPRINTF''@,1,g' \
-e 's,@''HAVE_SNPRINTF''@,1,g' \
-e 's,@''HAVE_WPRINTF''@,0,g' \
< $(E2FSPROGS_DIR)/intl/libgnuintl.h.in > $@
$(VERBOSE)ln -sf $(notdir $@) $(dir $@)/libintl.h
$(BLKID_HEADER):
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cp $(E2FSPROGS_DIR)/lib/blkid/blkid.h.in $@
$(VERBOSE)sed -e 's,@''SIZEOF_INT''@,__SIZEOF_INT__,g' \
-e 's,@''SIZEOF_LONG''@,__SIZEOF_LONG__,g' \
-e 's,@''SIZEOF_LONG_LONG''@,__SIZEOF_LONG_LONG__,g' \
-e 's,@''SIZEOF_SHORT''@,__SIZEOF_SHORT__,g' \
-e 's,@''ASM_TYPES_HEADER''@,,g' \
< $(E2FSPROGS_DIR)/lib/blkid/blkid_types.h.in > $(dir $@)/blkid_types.h
$(UUID_HEADER):
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cp $(E2FSPROGS_DIR)/lib/uuid/uuid.h.in $@
$(VERBOSE)sed -e 's,@''SIZEOF_INT''@,__SIZEOF_INT__,g' \
-e 's,@''SIZEOF_LONG''@,__SIZEOF_LONG__,g' \
-e 's,@''SIZEOF_LONG_LONG''@,__SIZEOF_LONG_LONG__,g' \
-e 's,@''SIZEOF_SHORT''@,__SIZEOF_SHORT__,g' \
< $(E2FSPROGS_DIR)/lib/uuid/uuid_types.h.in > $(dir $@)/uuid_types.h
$(EXT2FS_HEADER):
$(VERBOSE)sed -e 's,@''E2FSPROGS_VERSION''@,$(VERSION),g' \
< $(E2FSPROGS_DIR)/lib/ext2fs/ext2_err.et.in \
> $(E2FSPROGS_DIR)/lib/ext2fs/ext2_err.et && \
for file in lib/ext2fs/ext2_err e2fsck/prof_err; do \
$(MSG_GENERATE)$${file}.h && \
gawk -f $(E2FSPROGS_DIR)/lib/et/et_h.awk \
"outfile=$(E2FSPROGS_DIR)/$${file}.h" \
$(E2FSPROGS_DIR)/$${file}.et && \
$(MSG_GENERATE)$${file}.c && \
gawk -f $(E2FSPROGS_DIR)/lib/et/et_c.awk \
"outfile=$(E2FSPROGS_DIR)/$${file}.c" \
$(E2FSPROGS_DIR)/$${file}.et; \
done
@$(MSG_GENERATE)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)sed -e 's,@''SIZEOF_INT''@,__SIZEOF_INT__,g' \
-e 's,@''SIZEOF_LONG''@,__SIZEOF_LONG__,g' \
-e 's,@''SIZEOF_LONG_LONG''@,__SIZEOF_LONG_LONG__,g' \
-e 's,@''SIZEOF_SHORT''@,__SIZEOF_SHORT__,g' \
-e 's,@''ASM_TYPES_HEADER''@,,g' \
-e 's,@''PUBLIC_CONFIG_HEADER''@,,g' \
< $(E2FSPROGS_DIR)/lib/ext2fs/ext2_types.h.in > $@
@echo '#define HAVE_SYS_TYPES_H 1' >> $@
@echo '#undef WORDS_BIGENDIAN' >> $@

View File

@ -0,0 +1,63 @@
TARGET := e2fsck
LIBS := posix e2fsprogs
E2FSCK_TOP_DIR := $(call select_from_ports,e2fsprogs-lib)
E2FSCK_DIR := $(E2FSCK_TOP_DIR)/src/lib/e2fsprogs/e2fsck
INC_DIR += $(E2FSCK_DIR)/include/e2fsprogs
CC_DEF += -DHAVE_CONFIG_H
CC_DEF += -DROOT_SYSCONFDIR=\"/etc\"
CC_OPT += -Wno-unused-variable -Wno-parentheses
# e2fsck/dict.c
SRC_C := \
badblocks.c \
crc32.c \
dirinfo.c \
dx_dirinfo.c \
e2fsck.c \
ea_refcount.c \
ehandler.c \
journal.c \
logfile.c \
message.c \
pass1.c \
pass1b.c \
pass2.c \
pass3.c \
pass4.c \
pass5.c \
problem.c \
prof_err.c \
profile.c \
quota.c \
recovery.c \
region.c \
rehash.c \
revoke.c \
sigcatcher.c \
super.c \
unix.c \
util.c
INC_DIR += $(PRG_DIR)
vpath %.c $(E2FSCK_DIR)
#
# Generate CRC32 header
#
E2FSCK_GEN_CRC := $(BUILD_BASE_DIR)/tool/e2fsprogs/gen_crc32table
CRC_HEADER := $(BUILD_BASE_DIR)/app/e2fsck/crc32table.h
$(SRC_C:.c=.o): $(CRC_HEADER)
$(CRC_HEADER):
$(MSG_CONVERT)$(notdir $@)
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)$(E2FSCK_GEN_CRC) > $@
INC_DIR += $(BUILD_BASE_DIR)/$(dir $(CRC_HEADER))

View File

@ -0,0 +1,122 @@
#define ENABLE_HTREE 1
#define ENABLE_NLS 1
#define HAVE_ALLOCA 1
#define HAVE_ASPRINTF 1
#define HAVE_DECL_FEOF_UNLOCKED 1
#define HAVE_DECL_FGETS_UNLOCKED 0
#define HAVE_DECL_GETC_UNLOCKED 1
#define HAVE_DECL__SNPRINTF 0
#define HAVE_DECL__SNWPRINTF 0
#define HAVE_DIRENT_H 1
#define HAVE_ERRNO_H 1
#define HAVE_FCHOWN 1
#define HAVE_FWPRINTF 1
#define HAVE_GETCWD 1
#define HAVE_GETDTABLESIZE 1
#define HAVE_GETEGID 1
#define HAVE_GETEUID 1
#define HAVE_GETGID 1
#define HAVE_GETMNTINFO 1
#define HAVE_GETOPT_H 1
#define HAVE_GETPAGESIZE 1
#define HAVE_GETPWUID_R 1
#define HAVE_GETRLIMIT 1
#define HAVE_GETRUSAGE 1
#define HAVE_GETUID 1
#define HAVE_INTMAX_T 1
#define HAVE_INTPTR_T 1
#define HAVE_INTTYPES_H 1
#define HAVE_INTTYPES_H_WITH_UINTMAX 1
#define HAVE_JRAND48 1
#define HAVE_LANGINFO_CODESET 1
#define HAVE_LC_MESSAGES 1
#define HAVE_LIMITS_H 1
#define HAVE_LOCALE_H 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_LONG_LONG 1
#define HAVE_MBSTOWCS 1
#define HAVE_MEMORY_H 1
#define HAVE_MMAP 1
#define HAVE_MNTENT_H 1
#define HAVE_MSYNC 1
#define HAVE_MUNMAP 1
#define HAVE_NANOSLEEP 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NET_IF_DL_H 1
#define HAVE_OPTRESET 1
#define HAVE_PATHCONF 1
#define HAVE_PATHS_H 1
#define HAVE_POSIX_PRINTF 1
#define HAVE_PUTENV 1
#define HAVE_RECLEN_DIRENT 1
#define HAVE_SA_LEN 1
#define HAVE_SEMAPHORE_H 1
#define HAVE_SETENV 1
#define HAVE_SETJMP_H 1
#define HAVE_SETLOCALE 1
#define HAVE_SIGNAL_H 1
#define HAVE_SNPRINTF 1
#define HAVE_SRANDOM 1
#define HAVE_STAT_FLAGS 1
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDINT_H_WITH_UINTMAX 1
#define HAVE_STDLIB_H 1
#define HAVE_STPCPY 1
#define HAVE_STRCASECMP 1
#define HAVE_STRDUP 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRNLEN 1
#define HAVE_STRPTIME 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOULL 1
#define HAVE_SYSCONF 1
#define HAVE_SYS_DISKLABEL_H 1
#define HAVE_SYS_DISK_H 1
#define HAVE_SYS_FILE_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_MOUNT_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_QUEUE_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_SYS_SOCKIO_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_SYSCALL_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_UN_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_TSEARCH 1
#define HAVE_TYPE_SSIZE_T 1
#define HAVE_UINTMAX_T 1
#define HAVE_UNISTD_H 1
#define HAVE_UNSIGNED_LONG_LONG 1
#define HAVE_USLEEP 1
#define HAVE_UTIME 1
#define HAVE_UTIME_H 1
#define HAVE_VPRINTF 1
#define HAVE_WCHAR_T 1
#define HAVE_WCSLEN 1
#define HAVE_WINT_T 1
#define INTDIV0_RAISES_SIGFPE 0
#define PACKAGE "e2fsprogs"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_URL ""
#define PACKAGE_VERSION ""
#define SIZEOF_INT 4
#define SIZEOF_LONG __SIZEOF_LONG__
#define SIZEOF_LONG_LONG 8
#define SIZEOF_OFF_T 8
#define SIZEOF_SHORT 2
#define STDC_HEADERS 1
#define USE_UUIDD 1
#define VERSION "0.14.1"

View File

@ -0,0 +1,13 @@
Remove io->align check because it is not needed in our case
and rather leads to an memory allocation error (we cannot satisfy
the alignment).
+++ src/lib/e2fsprogs/lib/ext2fs/unix_io.c
@@ -558,7 +558,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
}
#endif
-#if defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if 0
/*
* Some operating systems require that the buffers be aligned,
* regardless of O_DIRECT