-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include msco/cybozu lib for cryptography
- Loading branch information
Showing
103 changed files
with
22,772 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -23,3 +23,4 @@ cran-comments.md | |
^inst/img$ | ||
^tests/testthat/_snaps$ | ||
^tests/testthat/testfiles$ | ||
*.o |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.RData | ||
.DS_Store | ||
.vscode/* | ||
*.o | ||
src/*.o | ||
src/*.so | ||
src/*.dll | ||
|
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
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,105 @@ | ||
# Anticonf (tm) script by Jeroen Ooms (2020) | ||
# This script will query 'pkg-config' for the required cflags and ldflags. | ||
# If pkg-config is unavailable or does not find the library, try setting | ||
# INCLUDE_DIR and LIB_DIR manually via e.g: | ||
# R CMD INSTALL --configure-vars='INCLUDE_DIR=/.../include LIB_DIR=/.../lib' | ||
|
||
# Library settings | ||
PKG_CONFIG_NAME="openssl" | ||
PKG_DEB_NAME="libssl-dev" | ||
PKG_RPM_NAME="openssl-devel" | ||
PKG_CSW_NAME="libssl_dev" | ||
PKG_BREW_NAME="openssl" | ||
PKG_TEST_FILE="tools/version.c" | ||
PKG_LIBS="-lssl -lcrypto" | ||
PKG_CFLAGS="" | ||
|
||
# Build against a specific openssl version | ||
# export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig" | ||
|
||
# Use pkg-config if available | ||
pkg-config ${PKG_CONFIG_NAME} --atleast-version=1.0 2>/dev/null | ||
if [ $? -eq 0 ]; then | ||
PKGCONFIG_CFLAGS=`pkg-config --cflags ${PKG_CONFIG_NAME}` | ||
PKGCONFIG_LIBS=`pkg-config --libs ${PKG_CONFIG_NAME}` | ||
fi | ||
|
||
# Note that cflags may be empty in case of success | ||
if [ "$INCLUDE_DIR" ] || [ "$LIB_DIR" ]; then | ||
echo "Found INCLUDE_DIR and/or LIB_DIR!" | ||
PKG_CFLAGS="-I$INCLUDE_DIR $PKG_CFLAGS" | ||
PKG_LIBS="-L$LIB_DIR $PKG_LIBS" | ||
elif [ "$PKGCONFIG_CFLAGS" ] || [ "$PKGCONFIG_LIBS" ]; then | ||
echo "Found pkg-config cflags and libs!" | ||
PKG_CFLAGS=${PKGCONFIG_CFLAGS} | ||
PKG_LIBS=${PKGCONFIG_LIBS} | ||
elif [ `uname` = "Darwin" ]; then | ||
test ! "$CI" && brew --version 2>/dev/null | ||
if [ $? -eq 0 ]; then | ||
BREWDIR=`brew --prefix` | ||
PKG_CFLAGS="-I$BREWDIR/opt/openssl/include -I$BREWDIR/opt/openssl@1.1/include" | ||
PKG_LIBS="-L$BREWDIR/opt/openssl/lib -L$BREWDIR/opt/openssl@1.1/lib $PKG_LIBS" | ||
else | ||
curl -sfL "https://autobrew.github.io/scripts/$PKG_BREW_NAME" > autobrew | ||
. ./autobrew | ||
fi | ||
fi | ||
|
||
# Find compiler | ||
CC=`${R_HOME}/bin/R CMD config CC` | ||
CFLAGS=`${R_HOME}/bin/R CMD config CFLAGS` | ||
CPPFLAGS=`${R_HOME}/bin/R CMD config CPPFLAGS` | ||
|
||
# For debugging | ||
echo "Using PKG_CFLAGS=$PKG_CFLAGS" | ||
|
||
# Test configuration | ||
${CC} ${CPPFLAGS} ${PKG_CFLAGS} ${CFLAGS} -E ${PKG_TEST_FILE} >/dev/null 2>configure.log | ||
|
||
# Customize the error | ||
if [ $? -ne 0 ]; then | ||
echo "--------------------------- [ANTICONF] --------------------------------" | ||
echo "Configuration failed because $PKG_CONFIG_NAME was not found. Try installing:" | ||
echo " * deb: $PKG_DEB_NAME (Debian, Ubuntu, etc)" | ||
echo " * rpm: $PKG_RPM_NAME (Fedora, CentOS, RHEL)" | ||
echo " * csw: $PKG_CSW_NAME (Solaris)" | ||
echo " * brew: $PKG_BREW_NAME (Mac OSX)" | ||
echo "If $PKG_CONFIG_NAME is already installed, check that 'pkg-config' is in your" | ||
echo "PATH and PKG_CONFIG_PATH contains a $PKG_CONFIG_NAME.pc file. If pkg-config" | ||
echo "is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:" | ||
echo "R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'" | ||
echo "-------------------------- [ERROR MESSAGE] ---------------------------" | ||
cat configure.log | ||
echo "--------------------------------------------------------------------" | ||
exit 1 | ||
fi | ||
|
||
# Try to link against the correct OpenSSL version | ||
if [ -z "$AUTOBREW" ]; then | ||
SONAME=`${CC} -E ${PKG_CFLAGS} src/tests/soname.h | sh | xargs` | ||
if [ "$SONAME" ]; then | ||
if [ `uname` = "Darwin" ]; then | ||
PKG_LIBS_VERSIONED=`echo "${PKG_LIBS}" | sed "s/-lssl/-lssl.${SONAME}/" | sed "s/-lcrypto/-lcrypto.${SONAME}/"` | ||
else | ||
PKG_LIBS_VERSIONED=`echo "${PKG_LIBS}" | sed "s/-lssl/-l:libssl.so.${SONAME}/" | sed "s/-lcrypto/-l:libcrypto.so.${SONAME}/"` | ||
fi | ||
|
||
# Test if versioned linking works | ||
${CC} ${PKG_CFLAGS} src/tests/main.c ${PKG_LIBS_VERSIONED} -o src/main.exe 2>/dev/null | ||
if [ $? -eq 0 ]; then PKG_LIBS="${PKG_LIBS_VERSIONED}"; fi | ||
|
||
# Suppress opensslv3 warnings for now | ||
if [ "$SONAME" = "3" ]; then | ||
PKG_CFLAGS="$PKG_CFLAGS -DOPENSSL_SUPPRESS_DEPRECATED" | ||
fi | ||
|
||
fi #SONAME | ||
fi #AUTOBREW | ||
|
||
echo "Using PKG_LIBS=$PKG_LIBS" | ||
|
||
# Write to Makevars | ||
sed -e "s|@cflags@|$PKG_CFLAGS|" -e "s|@libs@|$PKG_LIBS|" src/Makevars.in > src/Makevars | ||
|
||
# Success | ||
exit 0 |
Empty file.
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,17 @@ | ||
PKG_CPPFLAGS = @cflags@ -I. -I../inst/include/pugixml -Icryptography -Icryptography/msoc/include | ||
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` @libs@ | ||
|
||
OBJECTS = cryptography/msoc/msocdll.o \ | ||
helper_functions.o \ | ||
load_workbook.o \ | ||
msoc.o \ | ||
pugi.o \ | ||
strings_xml.o \ | ||
styles_xml.o \ | ||
write_file.o \ | ||
RcppExports.o | ||
|
||
all: clean | ||
|
||
clean: | ||
rm -f $(OBJECTS) $(SHLIB) |
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,2 @@ | ||
CRT=-ucrt | ||
include Makevars.win |
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,21 @@ | ||
VERSION=1.1.1k | ||
PKG_CPPFLAGS= -I../windows/openssl-$(VERSION)/include -I. -I../inst/include/pugixml -Icryptography -Icryptography/msoc/include | ||
PKG_LIBS = -L../windows/openssl-$(VERSION)/lib${R_ARCH}${CRT} -lcrypto -lws2_32 -lcrypt32 -fPIC | ||
|
||
OBJECTS = cryptography/msoc/msocdll.o \ | ||
helper_functions.o \ | ||
load_workbook.o \ | ||
msoc.o \ | ||
pugi.o \ | ||
strings_xml.o \ | ||
styles_xml.o \ | ||
write_file.o \ | ||
RcppExports.o | ||
|
||
all: clean winlibs | ||
|
||
clean: | ||
rm -f $(SHLIB) $(OBJECTS) | ||
|
||
winlibs: | ||
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION) |
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,27 @@ | ||
|
||
Copyright (c) 2007-2012 Cybozu Labs, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
Neither the name of the Cybozu Labs, Inc. nor the names of its contributors may | ||
be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
THE POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.