Linux build fixes.
This commit is contained in:
parent
bf5e30c2c7
commit
87913326a5
9
platform-independent/c/core/Dockerfile.x86
Normal file
9
platform-independent/c/core/Dockerfile.x86
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM i386/debian:stable-slim
|
||||||
|
ENTRYPOINT ["linux32", "--"]
|
||||||
|
|
||||||
|
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
|
||||||
|
RUN mkdir -p /usr/share/man/man1
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y default-jdk-headless git-core bash libtool automake autoconf make g++
|
||||||
|
RUN git clone --depth=3 $(: --shallow-submodules) --recurse-submodules --branch rewrite https://gitlab.com/MasterPassword/MasterPassword.git /mpw
|
||||||
|
RUN cd /mpw && git log -1 && ./gradlew -i clean build
|
@ -1,12 +1,8 @@
|
|||||||
FROM debian:stable-slim
|
FROM debian:stable-slim
|
||||||
|
|
||||||
# For i386
|
|
||||||
#FROM i386/debian:stable-slim
|
|
||||||
#ENTRYPOINT ["linux32", "--"]
|
|
||||||
|
|
||||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
|
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199
|
||||||
RUN mkdir -p /usr/share/man/man1
|
RUN mkdir -p /usr/share/man/man1
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y default-jdk-headless git-core bash libtool automake autoconf make g++
|
RUN apt-get update && apt-get install -y default-jdk-headless git-core bash libtool automake autoconf make g++
|
||||||
RUN git clone --depth=3 $(: --shallow-submodules) --recurse-submodules https://gitlab.com/MasterPassword/MasterPassword.git /mpw
|
RUN git clone --depth=3 $(: --shallow-submodules) --recurse-submodules --branch rewrite https://gitlab.com/MasterPassword/MasterPassword.git /mpw
|
||||||
RUN cd /mpw/gradle && ./gradlew -i clean build
|
RUN cd /mpw && git log -1 && ./gradlew -i clean build
|
@ -25,37 +25,36 @@ artifacts {
|
|||||||
library {
|
library {
|
||||||
baseName.set( 'mpw' )
|
baseName.set( 'mpw' )
|
||||||
linkage.set( [Linkage.SHARED] )
|
linkage.set( [Linkage.SHARED] )
|
||||||
source.from fileTree( 'src' )
|
source.from files( 'src' )
|
||||||
|
|
||||||
// Reconfigure the toolchain from C++ to C.
|
// JDK for JNI support.
|
||||||
toolChains {
|
privateHeaders.from files( new File( Jvm.current().javaHome, 'include' ) ) { first().eachDir { from it } }
|
||||||
withType( VisualCpp ) {
|
|
||||||
eachPlatform {
|
|
||||||
cppCompiler.withArguments { addAll( ['/TC', '/MT', '/Ox', '/DMPW_SODIUM=1', '/DSODIUM_STATIC', '/DSODIUM_EXPORT=', '/DMPW_LOG=mpw_log_app'] ) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
withType( GccCompatibleToolChain ) {
|
|
||||||
eachPlatform {
|
|
||||||
cppCompiler.withArguments { addAll( ['-x', 'c', '-O3', '-Werror', '-DMPW_SODIUM=1', '-DMPW_LOG=mpw_log_app'] ) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cross-compile for these host platforms.
|
// Cross-compile for these target platforms.
|
||||||
// TODO: Cross-compiling, blocked by: https://github.com/gradle/gradle-native/issues/169 - CppLibraryPlugin.java:163
|
// TODO: Cross-compiling, blocked by: https://github.com/gradle/gradle-native/issues/1031
|
||||||
// operatingSystems.set( [objects.named( OperatingSystemFamily, OperatingSystemFamily.LINUX ),
|
|
||||||
// objects.named( OperatingSystemFamily, OperatingSystemFamily.MAC_OS ),
|
|
||||||
// objects.named( OperatingSystemFamily, OperatingSystemFamily.WINDOWS )] )
|
|
||||||
targetMachines.set( [
|
targetMachines.set( [
|
||||||
machines.linux.x86_64,
|
machines.linux.x86, machines.linux.x86_64,
|
||||||
machines.windows.x86, machines.windows.x86_64,
|
machines.windows.x86, machines.windows.x86_64,
|
||||||
machines.macOS.x86_64
|
machines.macOS.x86_64
|
||||||
] )
|
] )
|
||||||
|
|
||||||
components.withType( CppComponent ) {
|
tasks.withType(CppCompile).configureEach {
|
||||||
// JDK for JNI support.
|
// Define a preprocessor macro for every binary
|
||||||
privateHeaders.from files( new File( Jvm.current().javaHome, 'include' ) ) { first().eachDir { from it } }
|
macros.put("MPW_SODIUM", "1")
|
||||||
|
macros.put("MPW_LOG", "mpw_log_app")
|
||||||
|
|
||||||
|
// Reconfigure the toolchain from C++ to C.
|
||||||
|
compilerArgs.addAll toolChain.map { toolChain ->
|
||||||
|
if (toolChain in GccCompatibleToolChain) {
|
||||||
|
return ['-x', 'c', '-O3', '-Werror']
|
||||||
|
} else if (toolChain in VisualCpp) {
|
||||||
|
return ['/TC', '/MT', '/Ox', '/DSODIUM_STATIC', '/DSODIUM_EXPORT=']
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
components.withType( CppComponent ) {
|
||||||
binaries.whenElementFinalized {
|
binaries.whenElementFinalized {
|
||||||
project.dependencies {
|
project.dependencies {
|
||||||
def system = targetMachine.getOperatingSystemFamily().getName()
|
def system = targetMachine.getOperatingSystemFamily().getName()
|
||||||
|
@ -29,10 +29,11 @@ void mpw_log_app(LogLevel level, const char *format, ...) {
|
|||||||
else if (level <= LogLevelError)
|
else if (level <= LogLevelError)
|
||||||
method = (*env)->GetMethodID( env, class, "error", "(Ljava/lang/String;)V" );
|
method = (*env)->GetMethodID( env, class, "error", "(Ljava/lang/String;)V" );
|
||||||
|
|
||||||
char *message = NULL;
|
int length = vsnprintf( NULL, 0, format, args );
|
||||||
int length = vasprintf( &message, format, args );
|
if (length > 0) {
|
||||||
if (message) {
|
char *message = malloc( length + 1 );
|
||||||
(*env)->CallVoidMethod( env, logger, method, (*env)->NewStringUTF( env, message ) );
|
if (message && (length = vsnprintf( message, length, format, args )) > 0);
|
||||||
|
(*env)->CallVoidMethod( env, logger, method, (*env)->NewStringUTF( env, message ) );
|
||||||
mpw_free( &message, (size_t)max( 0, length ) );
|
mpw_free( &message, (size_t)max( 0, length ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user