-
Notifications
You must be signed in to change notification settings - Fork 35
Installation
The toolkit has no path hardcoded. As such, the prefix does not really matter at compilation time. This variable is adjusted below when invoking configure, in order to allow building the tooklit without requiring root privileges.
The pattern used is --prefix=$PWD
, that will install the binaries into a bin subdir, where the source code is deployed.
if that option is omitted, the default is to deploy in /usr/local
, when invoking make install
. In which case, you might need to use su
or sudo
when invoking make install
.
Currently, only OpenSSL 1.0 is supported.
$ ./configure --prefix=$PWD
$ make
$ make install
In case you need to deploy the tooklit on target environments, where openssl is not necessarily installed, you have the option to statically link the openssl library functions into the binaries. This results, obviously, into larger executables, but you get portable binaries that do not depend upon external libraries to run.
-
download openssl from http://www.openssl.org.
-
configure openssl the following way, then compile
$ ./configure zlib no-shared --prefix=$HOME/openssl linux-x86_64 $ make install
this will install openssl lib and include in $HOME/openssl.
-
proceed to
pkcs11-tools
directory, and configure to build against freshly compiled library$ CFLAGS=-I$HOME/openssl/include LDFLAGS=-L$HOME/openssl/lib LIBS="-lz -ldl" ./configure --prefix=$PWD $ make install
(replace [OPENSSL_TARGET_DIR] below with the actual target directory)
- for openssl installation:
$ PATH=/usr/vac/bin:$PATH $ ./configure no-hw no-zlib no-shared --prefix=[OPENSSL_TARGET_DIR] aix64-cc $ make $ make install
- For the toolkit installation:
$ PATH=/usr/vac/bin:$PATH $ AR='ar -X64' CFLAGS='-q64 -qlanglvl=extc99 -I[OPENSSL_TARGET_DIR]/include' LDFLAGS=-L[OPENSSL_TARGET_DIR]/lib ./configure --prefix=$PWD -C $ make $ make install
You need to have GCC deployed on your computer. You can obtain and deploy GCC on your solaris plarform from OpenCSW.
- Build a static openssl library. Please follow the same steps as for Linux or AIX (adapt target accordingly)
- To buill 32 bits binaries:
To build sparcv9 64 bits binaries:
$ CFLAGS='-I$HOME/openssl/include' LDFLAGS=-L$HOME/openssl ./configure
$ CFLAGS='-m64 -mcpu=ultrasparc3 -I$HOME/openssl/include' LDFLAGS=-L$HOME/openssl ./configure --prefix=$PWD
- Compile and deploy
$ make install
Alternatively, you could use the openssl library from OpenCSW. This will result in dynamically linked executables; they are shorter in size, but they rely upon the shared libraries to execute on your target system.
When building with OpenCSW, you may have to prefix all the commands with MAKE=gmake AR=gar
and use gmake instead of make in the examples above, or to change your path to point to /opt/csw/gnu
:
$ export PATH=/opt/csw/gnu:$PATH
Same instructions as for Solaris Sparc, 32 bits.
Cross-compilation works with mingw32-gcc under linux. Debian distros are offering off-the-shelf cross-compilers, so the examples below are assuming Debian as the build platform.
- install cross-compiler (Debian package:
gcc-mingw-w64-i686
) - install wine on your linux host (Debian package:
wine
) Note: if your build platform is 64 bits,wine
will instruct you at first launch to install a few more packages as well as adding an architecture. - have an installation of OpenSSL-Win32 under wine ( see this link referenced by OpenSSL): download the installer and execute with
wine Win32OpenSSL-1_0_XX.exe
(wherexx
represent the version.) - in the project root directory, create a symbolic link to the OpenSSL-Win32 directory (assuming that the DLLs are found in
$HOME/.wine/drive_c/OpenSSL-Win32 openssl-win32
):
$ ln -s $HOME/.wine/drive_c/OpenSSL-Win32 openssl-win32
$ CFLAGS="-I$(pwd)/openssl-win32/include" LDFLAGS="-L$(pwd)/openssl-win32" ./configure --host=i686-w64-mingw32 --prefix=$PWD
$ make install
- install cross-compiler (debian package:
gcc-mingw-w64-x86_64
) - install wine on your linux host (debian package:
wine64
) - have an installation of OpenSSL-Win64 under wine ( see this link referenced by OpenSSL): download the installer and execute with
wine Win64OpenSSL-1_0_XX.exe
(wherexx
represent the version.) - in the project root directory, create a symbolic link to the OpenSSL-Win64 directory: (assuming that the DLLs are found in
$HOME/.wine/drive_c/OpenSSL-Win64 openssl-win64
)
$ ln -s $HOME/.wine/drive_c/OpenSSL-Win64 openssl-win64
$ CFLAGS="-I$(pwd)/openssl-win64/include" LDFLAGS=-L$(pwd)/openssl-win32 ./configure --host=x86_64-w64-mingw32 --prefix=$PWD
$ make install
This expects that brew is installed on MacOS. checkout https://brew.sh/ for more information.
$ eval $(brew shellenv)
$ CFLAGS=-I$HOMEBREW_PREFIX/opt/openssl/include LDFLAGS=-L$HOMEBREW_PREFIX/opt/openssl/lib ./configure [...]
To build a generic binary distribution tarball (all platforms):
$ ./configure [...] --prefix=$PWD
$ make dist-bin
To build solaris package:
$ ./configure [...] --prefix=$PWD
$ make dist-solaris
To build an RPM package:
(this assumes that rpmbuild
is installed and properly configured for the user)
$ ./configure [...] --prefix=$PWD
$ make dist
$ cp dist/redhat/pkcs11-tools.spec $HOME/rpmbuild/SPECS
$ cp pkcs11-tools-[VERSION].tar.gz $HOME/rpmbuild/SRPMS
$ rpmbuild -ba $HOME/rpmbuild/SPECS/pkcs11-tools.spec
RPMs and SRPMs are found in $HOME/rpmbuild/RPMS
and $HOME/rpmbuild/SRPMS
, respectively.