Skip to content

Commit

Permalink
configure option for encryption
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2197
  • Loading branch information
adeas31 authored and OpenModelica-Hudson committed Feb 15, 2018
1 parent 081af3b commit 06cea20
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Compiler/Script/CevalScriptBackend.mo
Expand Up @@ -3471,7 +3471,7 @@ algorithm
pd := System.pathDelimiter();
str1 := if System.os() == "Windows_NT" then ".exe" else "";
// create the path till packagetool
str2 := stringAppendList({omhome,pd,"bin",pd,"packagetool",str1});
str2 := stringAppendList({omhome,pd,"lib",pd,"omc",pd,"SEMLA",pd,"packagetool",str1});
if System.regularFileExists(str2) then
// create the list of arguments for packagetool
str3 := "-librarypath \"" + System.dirname(fileName) + "\" -version \"1.0\" -language \"3.2\" -encrypt \"true\"";
Expand All @@ -3492,7 +3492,7 @@ algorithm
commandOutput := System.readFile(logFile);
end if;
else
Error.addMessage(Error.FILE_NOT_FOUND_ERROR, {str2});
Error.addMessage(Error.ENCRYPTION_NOT_SUPPORTED, {str2});
commandOutput := "";
success := false;
end if;
Expand Down
2 changes: 2 additions & 0 deletions Compiler/Util/Error.mo
Expand Up @@ -1066,6 +1066,8 @@ public constant Message DEPRECATED_API_CALL = MESSAGE(7016, SCRIPTING(), WARNING
Util.gettext("'%1' is deprecated. It is recommended to use '%2' instead."));
public constant Message CONFLICTING_ALIAS_SET = MESSAGE(7017, SYMBOLIC(), WARNING(),
Util.gettext("The model contains alias variables with conflicting start and/or nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts."));
public constant Message ENCRYPTION_NOT_SUPPORTED = MESSAGE(7018, SCRIPTING(), ERROR(),
Util.gettext("File not Found: %s. Compile OpenModelica with Encryption support."));

protected import ErrorExt;

Expand Down
16 changes: 10 additions & 6 deletions Makefile.common
Expand Up @@ -27,19 +27,23 @@ INSTALL_LOCALEDIR = ${DESTDIR}${datadir}/locale

.PHONY : interactive omc release all mkbuilddirs fmi test install-dirs susan susan_all susgen sustst install-openturns runtimeCPPinstall CMinpack metis Cdaskr boehm-gc libzmq $(MINGW_EXTRA_LIBS)

ifeq ($(OMENCRYPTION),ON)
.PHONY : semla
ifeq ($(OMENCRYPTION),yes)
.PHONY : semla semla-clean
CPPFLAGS=-DOMENCRYPTION

semla: mkbuilddirs
mkdir -p ../SEMLA/build
(cd ../SEMLA/build && test -f Makefile || $(CMAKE) -DCMAKE_COLOR_MAKEFILE:Bool=OFF -DCMAKE_INSTALL_PREFIX:String=../install ../src -G $(CMAKE_TARGET))
(cd ../SEMLA/build && $(CMAKE) --build .)
(cd ../SEMLA/build && $(CMAKE) --build . --target install)
cp -pPR ../SEMLA/install/bin/* $(builddir_bin)
cp -pPR ../SEMLA/install/lib/* $(builddir_lib_omc)
mkdir -p $(builddir_bin)/LVE
mv $(builddir_bin)/lve.exe $(builddir_bin)/LVE/lve_win64.exe
mkdir -p $(builddir_lib)/omc/SEMLA/LVE
cp -pPR ../SEMLA/install/bin/* $(builddir_lib)/omc/SEMLA
cp -pPR ../SEMLA/install/lib/* $(builddir_lib)/omc/SEMLA
mv $(builddir_lib)/omc/SEMLA/lve$(EXE) $(builddir_lib)/omc/SEMLA/LVE/lve_$(LVE_EXE_SUFFIX)$(EXE)

semla-clean:
#rm -rf ../SEMLA/build
#rm -rf ../SEMLA/install
endif # end of OMENCRYPTION

mkbuilddirs:
Expand Down
6 changes: 6 additions & 0 deletions Makefile.in
Expand Up @@ -66,6 +66,8 @@ LIBMODELICASTANDARDTABLES=@OMBUILDDIR@/lib/@host_short@/omc/libModelicaStandardT
LIBMODELICAZLIB=@OMBUILDDIR@/lib/@host_short@/omc/libzlib@SHREXT@
LIBMODELICAIO=@OMBUILDDIR@/lib/@host_short@/omc/libModelicaIO@SHREXT@
LIBMODELICAMATIO=@OMBUILDDIR@/lib/@host_short@/omc/libModelicaMatIO@SHREXT@
OMENCRYPTION=@OMENCRYPTION@
LVE_EXE_SUFFIX=@MODELICA_SPEC_PLATFORM@

SUITESPARSE_LIBS = -DKLU_LIBRARY="libklu$(SHREXT)" -DAMD_LIBRARY="libamd$(SHREXT)" -DCOLAMD_LIBRARY="libcolamd$(SHREXT)" -DBTF_LIBRARY="libbtf$(SHREXT)"

Expand All @@ -75,7 +77,11 @@ include Makefile.common
.testvariables:
settings:

ifeq ($(OMENCRYPTION),yes)
omc: omc-bootstrapped semla
else
omc: omc-bootstrapped
endif

boehm-gc-lib: @LIBGC@
$(OMBUILDDIR)/$(LIB_OMC)/libomcgc.so: 3rdParty/gc/.libs/libomcgc.so
Expand Down
12 changes: 12 additions & 0 deletions configure.ac
Expand Up @@ -94,6 +94,7 @@ AC_SUBST(LIBDL)
AC_SUBST(BOOST_INCLUDE)
AC_SUBST(LDFLAGS_LIBSTDCXX)
AC_SUBST(CPP_RUNTIME_ARGS)
AC_SUBST(OMENCRYPTION)

FINAL_MESSAGES="\nConfigured OpenModelica successfully using the following options:"

Expand Down Expand Up @@ -780,6 +781,17 @@ AC_ARG_WITH(PATOH, [ --with-PATOH=DIR Compile with PATOH hyperg
USE_PATOH=0;
])

AC_ARG_WITH(ENCRYPTION, [ --with-ENCRYPTION Compile SEMLA and link omc to it],
[
if test "$withval" = "yes"; then
OMENCRYPTION=yes
else
OMENCRYPTION=no
fi
], [
OMENCRYPTION=no
])

m4_include([common/m4/semver.m4])

SOURCE_REVISION="$SOURCE_REVISION$NON_FREE_VERSION"
Expand Down

0 comments on commit 06cea20

Please sign in to comment.