Reorganize core source and add Docker support to CLI.
This commit is contained in:
parent
8e41cba7ac
commit
c2aafd8602
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -17,7 +17,7 @@
|
||||
path = platform-darwin/External/jrswizzle
|
||||
url = git://github.com/jonmarimba/jrswizzle.git
|
||||
[submodule "MasterPassword/Web/js/mpw-js"]
|
||||
path = platform-independent/web-js/js/mpw-js
|
||||
path = platform-independent/web/js/mpw-js
|
||||
url = https://github.com/tmthrgd/mpw-js.git
|
||||
[submodule "lib/libsodium"]
|
||||
path = lib/libsodium
|
||||
|
@ -1 +0,0 @@
|
||||
../../../../../mpw_tests.xml
|
@ -7,16 +7,16 @@ try {
|
||||
}
|
||||
|
||||
include 'masterpassword-core'
|
||||
project(':masterpassword-core').projectDir = new File( '../core/c' )
|
||||
project(':masterpassword-core').projectDir = new File( '../platform-independent/c/core' )
|
||||
|
||||
include 'masterpassword-algorithm'
|
||||
project(':masterpassword-algorithm').projectDir = new File( '../core/java/algorithm' )
|
||||
project(':masterpassword-algorithm').projectDir = new File( '../platform-independent/java/core' )
|
||||
|
||||
include 'masterpassword-model'
|
||||
project(':masterpassword-model').projectDir = new File( '../core/java/model' )
|
||||
project(':masterpassword-model').projectDir = new File( '../platform-independent/java/model' )
|
||||
|
||||
include 'masterpassword-tests'
|
||||
project(':masterpassword-tests').projectDir = new File( '../core/java/tests' )
|
||||
project(':masterpassword-tests').projectDir = new File( '../platform-independent/java/tests' )
|
||||
|
||||
include 'masterpassword-gui'
|
||||
project(':masterpassword-gui').projectDir = new File( '../platform-independent/gui-java' )
|
||||
|
@ -1,9 +1,13 @@
|
||||
# Native CLI
|
||||
|
||||
This is a command-line terminal interface to the Master Password standard implementation.
|
||||
The CLI is a command-line terminal interface to the Master Password standard implementation.
|
||||
|
||||
To use the app, you'll first need to build it, then install it into your system's PATH.
|
||||
|
||||
Start by changing into the CLI application directory:
|
||||
|
||||
cd cli
|
||||
|
||||
|
||||
## Building
|
||||
|
||||
@ -15,6 +19,13 @@ Note that the build depends on your system having certain dependencies already i
|
||||
By default, you'll need to have at least `libsodium`, `libjson-c` and `libncurses` installed.
|
||||
|
||||
|
||||
## Building with docker
|
||||
|
||||
To install mpw into a Docker container, make sure you have Docker installed on your system, then run something like:
|
||||
|
||||
docker build -f cli/Dockerfile .
|
||||
|
||||
|
||||
## Building with cmake
|
||||
|
||||
There is also a cmake configuration you can use to build instead of using the `./build` script. While `./build` depends on Bash and is geared toward POSIX systems, cmake is platform-independent. You should use your platform's cmake tools to continue. On POSIX systems, you can do this:
|
@ -123,9 +123,11 @@ endfunction()
|
||||
### TARGET: MPW
|
||||
if( BUILD_MPW )
|
||||
# target
|
||||
add_executable( mpw "core/base64.c" "core/aes.c" "core/mpw-algorithm.c" "core/mpw-types.c" "core/mpw-util.c" "core/mpw-marshal-util.c" "core/mpw-marshal.c"
|
||||
"cli/mpw-cli-util.c" "cli/mpw-cli.c" )
|
||||
target_include_directories( mpw PUBLIC core cli )
|
||||
add_executable( mpw "../core/src/base64.c" "../core/src/aes.c" "../core/src/mpw-algorithm.c" "../core/src/mpw-types.c" "../core/src/mpw-util.c"
|
||||
"../core/src/mpw-marshal-util.c" "../core/src/mpw-marshal.c"
|
||||
"src/mpw-cli-util.c" "src/mpw-cli.c" )
|
||||
target_include_directories( mpw PUBLIC ../core/src src )
|
||||
install( TARGETS mpw RUNTIME DESTINATION bin )
|
||||
|
||||
# dependencies
|
||||
use_mpw_sodium( mpw required )
|
||||
@ -137,23 +139,25 @@ endif()
|
||||
### TARGET: MPW-BENCH
|
||||
if( BUILD_MPW_BENCH )
|
||||
# target
|
||||
add_executable( mpw_bench "core/base64.c" "core/aes.c" "core/mpw-algorithm.c" "core/mpw-types.c" "core/mpw-util.c"
|
||||
"cli/mpw-bench.c" )
|
||||
target_include_directories( mpw_bench PUBLIC core cli )
|
||||
add_executable( mpw-bench "../core/src/base64.c" "../core/src/aes.c" "../core/src/mpw-algorithm.c" "../core/src/mpw-types.c" "../core/src/mpw-util.c"
|
||||
"src/mpw-bench.c" )
|
||||
target_include_directories( mpw-bench PUBLIC ../core/src src )
|
||||
install( TARGETS mpw-bench RUNTIME DESTINATION bin )
|
||||
|
||||
# dependencies
|
||||
use_mpw_sodium( mpw_bench required )
|
||||
use_mpw_sodium( mpw-bench required )
|
||||
endif()
|
||||
|
||||
|
||||
### TARGET: MPW-TESTS
|
||||
if( BUILD_MPW_TESTS )
|
||||
# target
|
||||
add_executable( mpw_tests "core/base64.c" "core/aes.c" "core/mpw-algorithm.c" "core/mpw-types.c" "core/mpw-util.c"
|
||||
"cli/mpw-tests-util.c" "cli/mpw-tests.c" )
|
||||
target_include_directories( mpw_tests PUBLIC core cli )
|
||||
add_executable( mpw-tests "../core/src/base64.c" "../core/src/aes.c" "../core/src/mpw-algorithm.c" "../core/src/mpw-types.c" "../core/src/mpw-util.c"
|
||||
"src/mpw-tests-util.c" "src/mpw-tests.c" )
|
||||
target_include_directories( mpw-tests PUBLIC ../core/src src )
|
||||
install( TARGETS mpw-tests RUNTIME DESTINATION bin )
|
||||
|
||||
# dependencies
|
||||
use_mpw_sodium( mpw_tests required )
|
||||
use_mpw_xml( mpw_tests required )
|
||||
use_mpw_sodium( mpw-tests required )
|
||||
use_mpw_xml( mpw-tests required )
|
||||
endif()
|
9
platform-independent/c/cli/Dockerfile
Normal file
9
platform-independent/c/cli/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM ubuntu
|
||||
WORKDIR /mpw/cli
|
||||
ADD . /mpw
|
||||
|
||||
RUN apt-get update && apt -y install cmake libsodium-dev libjson-c-dev libncurses-dev libxml2-dev
|
||||
RUN cmake -DBUILD_MPW_TESTS=ON . && make install
|
||||
RUN mpw-tests
|
||||
|
||||
CMD mpw
|
@ -63,18 +63,18 @@ mpw() {
|
||||
cflags=(
|
||||
"${cflags[@]}"
|
||||
|
||||
# library paths
|
||||
-I"lib/include"
|
||||
# mpw paths
|
||||
-I"core" -I"cli"
|
||||
-I"../core/src" -I"src"
|
||||
)
|
||||
ldflags=(
|
||||
"${ldflags[@]}"
|
||||
)
|
||||
|
||||
# build
|
||||
cc "${cflags[@]}" "$@" "core/base64.c" "core/aes.c" "core/mpw-algorithm.c" "core/mpw-types.c" "core/mpw-util.c" "core/mpw-marshal-util.c" "core/mpw-marshal.c" "cli/mpw-cli-util.c" \
|
||||
"${ldflags[@]}" "cli/mpw-cli.c" -o "mpw"
|
||||
cc "${cflags[@]}" "$@" \
|
||||
"../core/src/base64.c" "../core/src/aes.c" "../core/src/mpw-algorithm.c" "../core/src/mpw-types.c" "../core/src/mpw-util.c" \
|
||||
"../core/src/mpw-marshal-util.c" "../core/src/mpw-marshal.c" "src/mpw-cli-util.c" \
|
||||
"${ldflags[@]}" "src/mpw-cli.c" -o "mpw"
|
||||
echo "done! You can now run ./mpw-cli-tests, ./install or use ./$_"
|
||||
}
|
||||
|
||||
@ -88,18 +88,17 @@ mpw-bench() {
|
||||
cflags=(
|
||||
"${cflags[@]}"
|
||||
|
||||
# library paths
|
||||
-I"lib/include"
|
||||
# mpw paths
|
||||
-I"core" -I"cli"
|
||||
-I"../core/src" -I"src"
|
||||
)
|
||||
ldflags=(
|
||||
"${ldflags[@]}"
|
||||
)
|
||||
|
||||
# build
|
||||
cc "${cflags[@]}" "$@" "core/base64.c" "core/aes.c" "core/mpw-algorithm.c" "core/mpw-types.c" "core/mpw-util.c" \
|
||||
"${ldflags[@]}" "cli/mpw-bench.c" -o "mpw-bench"
|
||||
cc "${cflags[@]}" "$@" \
|
||||
"../core/src/base64.c" "../core/src/aes.c" "../core/src/mpw-algorithm.c" "../core/src/mpw-types.c" "../core/src/mpw-util.c" \
|
||||
"${ldflags[@]}" "src/mpw-bench.c" -o "mpw-bench"
|
||||
echo "done! You can now use ./$_"
|
||||
}
|
||||
|
||||
@ -114,18 +113,17 @@ mpw-tests() {
|
||||
cflags=(
|
||||
"${cflags[@]}"
|
||||
|
||||
# library paths
|
||||
-I"lib/include"
|
||||
# mpw paths
|
||||
-I"core" -I"cli"
|
||||
-I"../core/src" -I"src"
|
||||
)
|
||||
ldflags=(
|
||||
"${ldflags[@]}"
|
||||
)
|
||||
|
||||
# build
|
||||
cc "${cflags[@]}" "$@" "core/base64.c" "core/aes.c" "core/mpw-algorithm.c" "core/mpw-types.c" "core/mpw-util.c" "cli/mpw-tests-util.c" \
|
||||
"${ldflags[@]}" "cli/mpw-tests.c" -o "mpw-tests"
|
||||
cc "${cflags[@]}" "$@" \
|
||||
"../core/src/base64.c" "../core/src/aes.c" "../core/src/mpw-algorithm.c" "../core/src/mpw-types.c" "../core/src/mpw-util.c" "src/mpw-tests-util.c" \
|
||||
"${ldflags[@]}" "src/mpw-tests.c" -o "mpw-tests"
|
||||
echo "done! You can now use ./$_"
|
||||
}
|
||||
|
7
platform-independent/c/cli/clean
Executable file
7
platform-independent/c/cli/clean
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Clean all generated build files.
|
||||
set -e
|
||||
cd "${BASH_SOURCE%/*}"
|
||||
|
||||
rm -vfr mpw mpw-bench mpw-tests
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
cd "${BASH_SOURCE%/*}"
|
||||
cd "${BASH_SOURCE%/*}/.."
|
||||
tag=$(git describe --exact-match --match '*-cli*') || { echo >&2 "Tree is not at a release tag."; exit 1; }
|
||||
version=$(git describe --match '*-cli*' --long --dirty --broken)
|
||||
[[ $version != *-dirty ]] || { echo >&2 "Tree is dirty, first commit any changes."; exit 1; }
|
||||
@ -11,7 +11,7 @@ mpwArchive=mpw-$version.tar.gz
|
||||
read -n1 -p "Will prepare and release $mpwArchive. Press a key to continue or ^C to abort."
|
||||
|
||||
echo "Cleaning .."
|
||||
( git clean -ffdx . && cd core && git clean -ffdx . )
|
||||
git clean -ffdx .
|
||||
|
||||
echo "Creating archive $mpwArchive .."
|
||||
echo "$version" > VERSION
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Clean all generated build files.
|
||||
set -e
|
||||
cd "${BASH_SOURCE%/*}"
|
||||
|
||||
rm -vfr lib/*/{.unpacked,.patched,src} lib/include
|
||||
rm -vfr {core,cli,.}/{*.o,*.dSYM} mpw mpw-bench mpw-tests
|
@ -1 +0,0 @@
|
||||
../../core/c/src
|
@ -1 +0,0 @@
|
||||
core/lib
|
@ -1 +0,0 @@
|
||||
../../core/mpw_tests.xml
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user