Add parted dependency (does not build yet)

This commit is contained in:
Davide Depau 2018-08-18 01:00:49 +02:00
parent 7a95328bbd
commit db9f81ea6a
Signed by: depau
GPG key ID: C7D999B6A55EFE86
7 changed files with 75 additions and 2 deletions

3
.gitmodules vendored
View file

@ -10,3 +10,6 @@
[submodule "app/src/c/libressl"]
path = dmg2img/src/c/libressl
url = https://github.com/libressl-portable/portable.git
[submodule "parted/src/c/parted"]
path = parted/src/c/parted
url = https://github.com/Depau/parted.git

View file

@ -37,7 +37,7 @@ dependencies {
// implementation 'com.github.mjdev:libaums:0.5.5'
implementation project(':libaums')
implementation project(':dmg2img')
implementation project(':parted')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'

43
parted/CMakeLists.txt Normal file
View file

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.4)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
include(ExternalProject)
ExternalProject_Add(parted_build
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/c/parted"
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/src/c/parted/configure --prefix=<INSTALL_DIR> --sbindir=${CMAKE_CURRENT_SOURCE_DIR}/src/main/assets/bin/${ANDROID_ABI}/ --bindir=${CMAKE_CURRENT_SOURCE_DIR}/src/main/assets/bin/${ANDROID_ABI}/ --libdir=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
BUILD_COMMAND ${MAKE})
ExternalProject_Add_Step(parted_build bootstrap
DEPENDERS configure
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/c/parted
COMMAND ./bootstrap)
add_library(libparted-fs-resize SHARED IMPORTED)
add_dependencies(libparted-fs-resize parted_build)
set_target_properties(libparted-fs-resize PROPERTIES IMPORTED_LOCATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libparted-fs-resize.so.0.0.1)
add_library(libparted SHARED IMPORTED)
add_dependencies(libparted parted_build)
set_target_properties(libparted PROPERTIES IMPORTED_LOCATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libparted.so.2.0.1)
add_executable(parted IMPORTED)
add_dependencies(parted parted_build)
set_target_properties(parted PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/assets/bin/${ANDROID_ABI}/parted)
add_executable(partprobe IMPORTED)
add_dependencies(partprobe parted_build)
set_target_properties(partprobe PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/assets/bin/${ANDROID_ABI}/partprobe)
#ExternalProject_Add_Step(parted mkbindir
# DEPENDEES build
# COMMAND mkdir -p "${CMAKE_CURRENT_SOURCE_DIR}/src/main/assets/bin/${ANDROID_ABI}/")
#ExternalProject_Add_Step(parted copybin
# DEPENDEES mkbindir
# COMMAND cp <INSTALL_DIR>/sbin/parted <INSTALL_DIR>/sbin/partprobe "${CMAKE_CURRENT_SOURCE_DIR}/src/main/assets/bin/${ANDROID_ABI}/")

23
parted/build.gradle Normal file
View file

@ -0,0 +1,23 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
externalNativeBuild {
cmake {
targets "libparted", "libparted-fs-resize", "parted", "partprobe"
arguments "-DANDROID_PIE=ON"
}
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets']
}
}
}

1
parted/src/c/parted Submodule

@ -0,0 +1 @@
Subproject commit 395f8aabfecb28820006d37ec37e9ffe1d2eb1e3

View file

@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.gnu.parted" >
</manifest>

View file

@ -1,2 +1,2 @@
include ':app', ':libaums', ':dmg2img'
include ':app', ':libaums', ':dmg2img', ':parted'
project(':libaums').projectDir = new File('libaums/libaums')