-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: sekaiacg <[email protected]>
- Loading branch information
Showing
31 changed files
with
525 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,4 +31,5 @@ stamp-h1 | |
*.bak | ||
CMakeCache.txt | ||
CMakeFiles | ||
cmake_install.cmake | ||
cmake_install.cmake | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
project(erofs-utils) | ||
|
||
set(CMAKE_C_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD 20) | ||
|
||
if(DEFINED EROFS_C_FLAGS) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EROFS_C_FLAGS}") | ||
endif() | ||
|
||
if(DEFINED EROFS_CXX_FLAGS) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EROFS_CXX_FLAGS}") | ||
endif() | ||
|
||
if (DEFINED EROFS_LINKER_FLAGS) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EROFS_LINKER_FLAGS}") | ||
else () | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -static -s") | ||
endif() | ||
|
||
set(MODULES_SRC "${PROJECT_SOURCE_DIR}/../../src") | ||
set(PROJECT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../..") | ||
|
||
# git clone submodule | ||
execute_process(COMMAND git submodule init) | ||
execute_process(COMMAND git submodule update) | ||
|
||
# thrid part library | ||
add_subdirectory("${MODULES_SRC}/lz4/build/cmake" "modules/lz4") | ||
|
||
# header | ||
include_directories( | ||
"${PROJECT_SOURCE_DIR}/lib" | ||
"${PROJECT_SOURCE_DIR}/include" | ||
"${PROJECT_SOURCE_DIR}/src/lz4/lib" | ||
"${MODULES_SRC}/core/libcutils/include" | ||
"${MODULES_SRC}/e2fsprogs/lib" | ||
"${MODULES_SRC}/e2fsprogs/lib/uuid" | ||
"${MODULES_SRC}/selinux/libselinux/include" | ||
"${MODULES_SRC}/logging/liblog/include" | ||
) | ||
|
||
# start building | ||
add_subdirectory(modules) | ||
add_subdirectory(erofs-tools) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set(TARGET dump.erofs) | ||
|
||
file(GLOB DUMP_SRCS "${PROJECT_SOURCE_DIR}/dump/*.c") | ||
|
||
add_executable(${TARGET} ${DUMP_SRCS}) | ||
|
||
target_compile_options(${TARGET} PRIVATE ${EROFS_UTILS_DEFAULTS_CFLAGS}) | ||
|
||
target_link_libraries(${TARGET} erofs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set(TARGET fsck.erofs) | ||
|
||
file(GLOB FSCK_SRCS "${PROJECT_SOURCE_DIR}/fsck/*.c") | ||
|
||
add_executable(${TARGET} ${FSCK_SRCS}) | ||
|
||
target_compile_options(${TARGET} PRIVATE ${EROFS_UTILS_DEFAULTS_CFLAGS}) | ||
|
||
target_link_libraries(${TARGET} erofs) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set(TARGET mkfs.erofs) | ||
|
||
file(GLOB MKFS_SRCS "${PROJECT_SOURCE_DIR}/mkfs/*.c") | ||
|
||
add_executable(${TARGET} ${MKFS_SRCS}) | ||
|
||
target_compile_options(${TARGET} PRIVATE ${EROFS_UTILS_DEFAULTS_CFLAGS}) | ||
|
||
target_link_libraries(${TARGET} erofs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
set(TARGET base) | ||
|
||
set(TARGET_SRC_DIR "${MODULES_SRC}/libbase") | ||
|
||
set(TARGET_CFLAGS | ||
"-Wall" | ||
"-Werror" | ||
"-Wextra" | ||
"-Wexit-time-destructors" | ||
) | ||
|
||
set(LIBBASE_SRCS | ||
"${TARGET_SRC_DIR}/abi_compatibility.cpp" | ||
"${TARGET_SRC_DIR}/chrono_utils.cpp" | ||
"${TARGET_SRC_DIR}/cmsg.cpp" | ||
"${TARGET_SRC_DIR}/file.cpp" | ||
"${TARGET_SRC_DIR}/hex.cpp" | ||
"${TARGET_SRC_DIR}/logging.cpp" | ||
"${TARGET_SRC_DIR}/mapped_file.cpp" | ||
"${TARGET_SRC_DIR}/parsebool.cpp" | ||
"${TARGET_SRC_DIR}/parsenetaddress.cpp" | ||
"${TARGET_SRC_DIR}/posix_strerror_r.cpp" | ||
"${TARGET_SRC_DIR}/process.cpp" | ||
"${TARGET_SRC_DIR}/properties.cpp" | ||
"${TARGET_SRC_DIR}/stringprintf.cpp" | ||
"${TARGET_SRC_DIR}/strings.cpp" | ||
"${TARGET_SRC_DIR}/threads.cpp" | ||
"${TARGET_SRC_DIR}/test_utils.cpp" | ||
) | ||
|
||
if (CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
list(APPEND LIBBASE_SRCS "${TARGET_SRC_DIR}/errors_unix.cpp" ) | ||
elseif (CMAKE_SYSTEM_NAME MATCHES "Android") | ||
list(APPEND TARGET_CFLAGS | ||
"-D_FILE_OFFSET_BITS=64" | ||
) | ||
endif() | ||
|
||
add_library(${TARGET} STATIC ${LIBBASE_SRCS}) | ||
|
||
target_include_directories(${TARGET} PRIVATE | ||
"${TARGET_SRC_DIR}/include" | ||
"${MODULES_SRC}/core/include" | ||
) | ||
|
||
target_compile_options(${TARGET} PRIVATE $<$<COMPILE_LANGUAGE:C>:${TARGET_CFLAGS}> $<$<COMPILE_LANGUAGE:CXX>:${TARGET_CPPFLAGS}>) | ||
|
||
target_link_libraries(${TARGET} log) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
set(TARGET cutils) | ||
|
||
set(TARGET_SRC_DIR "${MODULES_SRC}/core/libcutils") | ||
|
||
set(TARGET_CFLAGS | ||
"-Wno-exit-time-destructors" | ||
"-Wall" | ||
"-Wextra" | ||
) | ||
|
||
set(LIBCUTILS_SRCS | ||
"${TARGET_SRC_DIR}/config_utils.cpp" | ||
"${TARGET_SRC_DIR}/iosched_policy.cpp" | ||
"${TARGET_SRC_DIR}/load_file.cpp" | ||
"${TARGET_SRC_DIR}/native_handle.cpp" | ||
"${TARGET_SRC_DIR}/properties.cpp" | ||
"${TARGET_SRC_DIR}/record_stream.cpp" | ||
"${TARGET_SRC_DIR}/strlcpy.c" | ||
"${TARGET_SRC_DIR}/threads.cpp" | ||
) | ||
set(LIBCUTILS_NONWINDOWS_SRCS | ||
"${TARGET_SRC_DIR}/fs.cpp" | ||
"${TARGET_SRC_DIR}/hashmap.cpp" | ||
"${TARGET_SRC_DIR}/multiuser.cpp" | ||
"${TARGET_SRC_DIR}/str_parms.cpp" | ||
) | ||
|
||
set(LIBCUTILS_SOCKET_SRCS | ||
"${TARGET_SRC_DIR}/sockets.cpp" | ||
) | ||
set(LIBCUTILS_SOCKET_NONWINDOWS_SRCS | ||
"${TARGET_SRC_DIR}/socket_inaddr_any_server_unix.cpp" | ||
"${TARGET_SRC_DIR}/socket_local_client_unix.cpp" | ||
"${TARGET_SRC_DIR}/socket_local_server_unix.cpp" | ||
"${TARGET_SRC_DIR}/socket_network_client_unix.cpp" | ||
"${TARGET_SRC_DIR}/sockets_unix.cpp" | ||
) | ||
|
||
if (CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
list(APPEND LIBCUTILS_SRCS | ||
${LIBCUTILS_SOCKET_SRCS} | ||
${LIBCUTILS_NONWINDOWS_SRCS} | ||
${LIBCUTILS_SOCKET_NONWINDOWS_SRCS} | ||
"${TARGET_SRC_DIR}/ashmem-host.cpp" | ||
"${TARGET_SRC_DIR}/canned_fs_config.cpp" | ||
"${TARGET_SRC_DIR}/fs_config.cpp" | ||
"${TARGET_SRC_DIR}/trace-host.cpp" | ||
) | ||
elseif (CMAKE_SYSTEM_NAME MATCHES "Android") | ||
list(APPEND LIBCUTILS_SOCKET_SRCS | ||
"${TARGET_SRC_DIR}/android_get_control_file.cpp" | ||
"${TARGET_SRC_DIR}/socket_inaddr_any_server_unix.cpp" | ||
"${TARGET_SRC_DIR}/socket_local_client_unix.cpp" | ||
"${TARGET_SRC_DIR}/socket_local_server_unix.cpp" | ||
"${TARGET_SRC_DIR}/socket_network_client_unix.cpp" | ||
"${TARGET_SRC_DIR}/sockets_unix.cpp" | ||
) | ||
list(APPEND LIBCUTILS_SRCS | ||
${LIBCUTILS_SOCKET_SRCS} | ||
${LIBCUTILS_SOCKET_NONWINDOWS_SRCS} | ||
${LIBCUTILS_NONWINDOWS_SRCS} | ||
"${TARGET_SRC_DIR}/android_reboot.cpp" | ||
"${TARGET_SRC_DIR}/ashmem-dev.cpp" | ||
"${TARGET_SRC_DIR}/canned_fs_config.cpp" | ||
"${TARGET_SRC_DIR}/fs_config.cpp" | ||
"${TARGET_SRC_DIR}/klog.cpp" | ||
"${TARGET_SRC_DIR}/partition_utils.cpp" | ||
"${TARGET_SRC_DIR}/qtaguid.cpp" | ||
"${TARGET_SRC_DIR}/trace-dev.cpp" | ||
"${TARGET_SRC_DIR}/uevent.cpp" | ||
) | ||
endif() | ||
|
||
add_library(${TARGET} STATIC ${LIBCUTILS_SRCS}) | ||
|
||
target_include_directories(${TARGET} PRIVATE | ||
"${TARGET_SRC_DIR}/include" | ||
"${MODULES_SRC}/core/libutils/include" | ||
"${MODULES_SRC}/libbase/include" | ||
) | ||
|
||
target_compile_options(${TARGET} PRIVATE ${TARGET_CFLAGS}) | ||
|
||
target_link_libraries(${TARGET} | ||
base | ||
log | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
set(TARGET erofs) | ||
|
||
set(TARGET_SRC_DIR "${PROJECT_SOURCE_DIR}/lib") | ||
|
||
set(EROFS_UTILS_DEFAULTS_CFLAGS | ||
"-Wall" | ||
"-Wno-ignored-qualifiers" | ||
"-Wno-pointer-arith" | ||
"-Wno-unused-parameter" | ||
"-Wno-unused-function" | ||
"-DHAVE_FALLOCATE" | ||
"-DHAVE_LINUX_TYPES_H" | ||
"-DHAVE_LIBSELINUX" | ||
"-DHAVE_LIBUUID" | ||
"-DLZ4_ENABLED" | ||
"-DLZ4HC_ENABLED" | ||
"-DWITH_ANDROID" | ||
"-DHAVE_MEMRCHR" | ||
CACHE INTERNAL "erofs_utils_defaults_cflags" | ||
) | ||
|
||
set(LIBEROFS_SRCS | ||
"${TARGET_SRC_DIR}/config.c" | ||
"${TARGET_SRC_DIR}/io.c" | ||
"${TARGET_SRC_DIR}/cache.c" | ||
"${TARGET_SRC_DIR}/super.c" | ||
"${TARGET_SRC_DIR}/inode.c" | ||
"${TARGET_SRC_DIR}/xattr.c" | ||
"${TARGET_SRC_DIR}/exclude.c" | ||
"${TARGET_SRC_DIR}/namei.c" | ||
"${TARGET_SRC_DIR}/data.c" | ||
"${TARGET_SRC_DIR}/compress.c" | ||
"${TARGET_SRC_DIR}/compressor.c" | ||
"${TARGET_SRC_DIR}/zmap.c" | ||
"${TARGET_SRC_DIR}/decompress.c" | ||
"${TARGET_SRC_DIR}/compress_hints.c" | ||
"${TARGET_SRC_DIR}/hashmap.c" | ||
"${TARGET_SRC_DIR}/sha256.c" | ||
"${TARGET_SRC_DIR}/blobchunk.c" | ||
"${TARGET_SRC_DIR}/dir.c" | ||
"${TARGET_SRC_DIR}/block_list.c" | ||
"${TARGET_SRC_DIR}/compressor_lz4.c" | ||
"${TARGET_SRC_DIR}/compressor_lz4hc.c" | ||
) | ||
|
||
add_library(${TARGET} STATIC ${LIBEROFS_SRCS}) | ||
|
||
target_compile_options(${TARGET} PRIVATE ${EROFS_UTILS_DEFAULTS_CFLAGS}) | ||
|
||
target_link_libraries(${TARGET} | ||
base | ||
cutils | ||
ext2_uuid | ||
log | ||
lz4_static | ||
selinux | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
set(TARGET ext2_uuid) | ||
|
||
set(TARGET_SRC_DIR "${MODULES_SRC}/e2fsprogs/lib/uuid") | ||
|
||
set(TARGET_CFLAGS | ||
"-Wno-unused-function" | ||
"-Wno-unused-parameter" | ||
) | ||
|
||
set(LIBEXT2_UUID_SRCS | ||
"${TARGET_SRC_DIR}/clear.c" | ||
"${TARGET_SRC_DIR}/compare.c" | ||
"${TARGET_SRC_DIR}/copy.c" | ||
"${TARGET_SRC_DIR}/gen_uuid.c" | ||
"${TARGET_SRC_DIR}/isnull.c" | ||
"${TARGET_SRC_DIR}/pack.c" | ||
"${TARGET_SRC_DIR}/parse.c" | ||
"${TARGET_SRC_DIR}/unpack.c" | ||
"${TARGET_SRC_DIR}/unparse.c" | ||
"${TARGET_SRC_DIR}/uuid_time.c" | ||
) | ||
|
||
add_library(${TARGET} STATIC ${LIBEXT2_UUID_SRCS}) | ||
|
||
target_compile_options(${TARGET} PRIVATE $<$<COMPILE_LANGUAGE:C>:${TARGET_CFLAGS}>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
set(TARGET log) | ||
|
||
set(TARGET_SRC_DIR "${MODULES_SRC}/logging/liblog") | ||
|
||
set(TARGET_CFLAGS | ||
"-Wall" | ||
"-Wextra" | ||
"-Wexit-time-destructors" | ||
"-DLIBLOG_LOG_TAG=1006" | ||
"-DSNET_EVENT_LOG_TAG=1397638484" | ||
) | ||
|
||
set(LIBLOG_SRCS | ||
"${TARGET_SRC_DIR}/log_event_list.cpp" | ||
"${TARGET_SRC_DIR}/log_event_write.cpp" | ||
"${TARGET_SRC_DIR}/logger_name.cpp" | ||
"${TARGET_SRC_DIR}/logger_read.cpp" | ||
"${TARGET_SRC_DIR}/logger_write.cpp" | ||
"${TARGET_SRC_DIR}/logprint.cpp" | ||
"${TARGET_SRC_DIR}/properties.cpp" | ||
) | ||
set(LIBLOG_TARGET_SRCS | ||
"${TARGET_SRC_DIR}/event_tag_map.cpp" | ||
"${TARGET_SRC_DIR}/log_time.cpp" | ||
"${TARGET_SRC_DIR}/pmsg_reader.cpp" | ||
"${TARGET_SRC_DIR}/pmsg_writer.cpp" | ||
"${TARGET_SRC_DIR}/logd_reader.cpp" | ||
"${TARGET_SRC_DIR}/logd_writer.cpp" | ||
) | ||
|
||
if (CMAKE_SYSTEM_NAME MATCHES "Android") | ||
list(APPEND LIBLOG_SRCS ${LIBLOG_TARGET_SRCS}) | ||
endif() | ||
|
||
add_library(${TARGET} STATIC ${LIBLOG_SRCS}) | ||
|
||
target_include_directories(${TARGET} PRIVATE | ||
"${TARGET_SRC_DIR}/include" | ||
"${MODULES_SRC}/core/include" | ||
"${MODULES_SRC}/core/libcutils/include" | ||
"${MODULES_SRC}/libbase/include" | ||
) | ||
|
||
target_compile_options(${TARGET} PRIVATE ${TARGET_CFLAGS}) |
Oops, something went wrong.