|
| 1 | +#!/bin/bash -ex |
| 2 | +# |
| 3 | +# Copyright 2017, Intel Corporation |
| 4 | +# |
| 5 | +# Redistribution and use in source and binary forms, with or without |
| 6 | +# modification, are permitted provided that the following conditions |
| 7 | +# are met: |
| 8 | +# |
| 9 | +# * Redistributions of source code must retain the above copyright |
| 10 | +# notice, this list of conditions and the following disclaimer. |
| 11 | +# |
| 12 | +# * Redistributions in binary form must reproduce the above copyright |
| 13 | +# notice, this list of conditions and the following disclaimer in |
| 14 | +# the documentation and/or other materials provided with the |
| 15 | +# distribution. |
| 16 | +# |
| 17 | +# * Neither the name of the copyright holder nor the names of its |
| 18 | +# contributors may be used to endorse or promote products derived |
| 19 | +# from this software without specific prior written permission. |
| 20 | +# |
| 21 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 22 | +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 23 | +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 24 | +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 25 | +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 26 | +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 27 | +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 28 | +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 29 | +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 30 | +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 31 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | + |
| 33 | +# |
| 34 | +# build-pmemfile.sh - builds libpmemfile |
| 35 | +# |
| 36 | + |
| 37 | +# libpmemfile needs syscall_intercept to build, so create a mock library |
| 38 | +# that looks like libsyscall_intercept (as long as it is used for linking |
| 39 | +# with, not for executing). |
| 40 | +mkdir -p ~/mock_syscall_intercept |
| 41 | +cp libsyscall_intercept_hook_point.h ~/mock_syscall_intercept/. |
| 42 | + |
| 43 | +cd |
| 44 | +cd mock_syscall_intercept |
| 45 | + |
| 46 | +echo int intercept_hook_point\; > mock_syscall_intercept.c |
| 47 | +echo int intercept_hook_point_clone_child\; >> mock_syscall_intercept.c |
| 48 | +echo int syscall_no_intercept\(void\) \{return 0\;\} >> mock_syscall_intercept.c |
| 49 | +echo int syscall_hook_in_process_allowed\(void\) \{return 0\;\} >> mock_syscall_intercept.c |
| 50 | + |
| 51 | +gcc -xc -nostdlib -shared mock_syscall_intercept.c -o libsyscall_intercept.so |
| 52 | + |
| 53 | +echo Name: libsyscall_intercept > libsyscall_intercept.pc |
| 54 | +echo Version: mock >> libsyscall_intercept.pc |
| 55 | +echo Description: Mock libsyscall_intercept >> libsyscall_intercept.pc |
| 56 | +echo includedir=$PWD >> libsyscall_intercept.pc |
| 57 | +echo Libs: -L$PWD -lsyscall_intercept >> libsyscall_intercept.pc |
| 58 | +echo Cflags: -I$PWD >> libsyscall_intercept.pc |
| 59 | + |
| 60 | +# Set some environment variables, allowing cmake to find the mock library |
| 61 | +export LD_LIBRARY_PATH=$PWD |
| 62 | +export PKG_CONFIG_PATH=$PWD |
| 63 | + |
| 64 | +cd |
| 65 | + |
| 66 | +# Build pmemfile. |
| 67 | +# The tests from pmemfile repo are going to be used, so there is no point |
| 68 | +# in calling `make install`. |
| 69 | +# Trying to make a minimal build here, not needing libpmemfile-posix tests, |
| 70 | +# antool tests. |
| 71 | +git clone https://github.com/pmem/pmemfile.git |
| 72 | +cd pmemfile |
| 73 | +git checkout a7f1d347bfdbabec3b0e0b1dca50542ec6c267e3 |
| 74 | +mkdir build |
| 75 | +cd build |
| 76 | +cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 77 | + -DBUILD_LIBPMEMFILE=ON \ |
| 78 | + -DAUTO_GENERATE_SOURCES=OFF \ |
| 79 | + -DTESTS_USE_FORCED_PMEM=ON \ |
| 80 | + -DDEVELOPER_MODE=OFF \ |
| 81 | + -DFAULT_INJECTION=OFF \ |
| 82 | + -DLONG_TESTS=OFF \ |
| 83 | + -DTRACE_TESTS=ON \ |
| 84 | + -DUSE_ASAN=OFF \ |
| 85 | + -DUSE_UBSAN=OFF \ |
| 86 | + -DANTOOL_TESTS=SKIP \ |
| 87 | + -DBUILD_LIBPMEMFILE_POSIX_TESTS=OFF \ |
| 88 | + -DBUILD_LIBPMEMFILE_TESTS=ON \ |
| 89 | + .. |
| 90 | +make |
| 91 | +cd |
| 92 | +rm -rf mock_syscall_intercept |
0 commit comments