Skip to content

Commit

Permalink
optimize disk usage for build php
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerl committed Oct 9, 2022
1 parent 477e66e commit 782fc31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Elkeid_rasp_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:

- name: Build
run: |
curl -fsSL https://lf3-static.bytednsdoc.com/obj/eden-cn/laahweh7uhwbps/php-headers.tar.gz | tar -xz -C /tmp
docker run --rm -v $(pwd):/Elkeid -v /tmp/cache/gradle:/root/.gradle -v /tmp/cache/php:/Elkeid/rasp/php/build -v /tmp/cache/librasp:/Elkeid/rasp/librasp/target -v /tmp/cache/rasp_server:/Elkeid/rasp/rasp_server/target -v /tmp/cache/plugin:/Elkeid/rasp/plugin/target -v /tmp/php-headers:/tmp/php-headers -e MAKEFLAGS="-j$(nproc)" hackerl/rasp-toolchain make -C /Elkeid/rasp build STATIC=TRUE PY_PREBUILT=TRUE CC=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-gcc CXX=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-g++ LD=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-ld CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-ld GNU_CC=/opt/gcc-10.4.0/bin/gcc GNU_CXX=/opt/gcc-10.4.0/bin/g++ PHP_HEADERS=/tmp/php-headers PYTHON2_INCLUDE=/usr/local/include/python2.7 PYTHON3_INCLUDE=/usr/local/include/python3.6m VERSION=${GITHUB_REF#refs/*/rasp-v}
curl -fsSL https://lf3-static.bytednsdoc.com/obj/eden-cn/laahweh7uhwbps/php-headers.tar.gz | tar -xz -C rasp/php
docker run --rm -v $(pwd):/Elkeid -v /tmp/cache/gradle:/root/.gradle -v /tmp/cache/librasp:/Elkeid/rasp/librasp/target -v /tmp/cache/rasp_server:/Elkeid/rasp/rasp_server/target -v /tmp/cache/plugin:/Elkeid/rasp/plugin/target -e MAKEFLAGS="-j$(nproc)" hackerl/rasp-toolchain make -C /Elkeid/rasp build STATIC=TRUE PY_PREBUILT=TRUE CC=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-gcc CXX=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-g++ LD=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-ld CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=/opt/x86_64-linux-musl-1.2.2/bin/x86_64-linux-musl-ld GNU_CC=/opt/gcc-10.4.0/bin/gcc GNU_CXX=/opt/gcc-10.4.0/bin/g++ PHP_HEADERS=/Elkeid/rasp/php/php-headers PYTHON2_INCLUDE=/usr/local/include/python2.7 PYTHON3_INCLUDE=/usr/local/include/python3.6m VERSION=${GITHUB_REF#refs/*/rasp-v}
- name: Release
uses: softprops/action-gh-release@v1
Expand Down
6 changes: 2 additions & 4 deletions rasp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ php_probe: ## build php probe
@echo "build PHP probe"
mkdir -p output/lib/php
ifeq ($(STATIC), TRUE)
cd php && mkdir -p output build; for header in ${PHP_HEADERS}/*; do version=$$(basename $$header); mkdir -p build/$$version; CC=$(GNU_CC) CXX=$(GNU_CXX) cmake -B build/$$version -DSTATIC_BUILD=ON -DPHP_EXTENSIONS_INCLUDE_DIR=$$header && cmake --build build/$$version -j$$(nproc) && cp lib/libphp_probe.so output/libphp_probe-$$version.so; done
cd php && mkdir -p output build; for header in ${PHP_HEADERS}/*; do [ -d include ] && rm -rf include; cp -r $$header include; CC=$(GNU_CC) CXX=$(GNU_CXX) cmake -B build -DSTATIC_BUILD=ON -DPHP_EXTENSIONS_INCLUDE_DIR=$$(pwd)/include && cmake --build build -j$$(nproc) && cp lib/libphp_probe.so output/libphp_probe-$$(basename $$header).so; done
else
cd php && mkdir -p output build; for header in ${PHP_HEADERS}/*; do version=$$(basename $$header); mkdir -p build/$$version; cmake -B build/$$version -DSTATIC_BUILD=ON -DPHP_EXTENSIONS_INCLUDE_DIR=$$header && cmake --build build/$$version -j$$(nproc) && cp lib/libphp_probe.so output/libphp_probe-$$version.so; done
cd php && mkdir -p output build; for header in ${PHP_HEADERS}/*; do [ -d include ] && rm -rf include; cp -r $$header include; cmake -B build -DSTATIC_BUILD=ON -DPHP_EXTENSIONS_INCLUDE_DIR=$$(pwd)/include && cmake --build build -j$$(nproc) && cp lib/libphp_probe.so output/libphp_probe-$$(basename $$header).so; done
endif
cp php/output/* output/lib/php

Expand Down Expand Up @@ -195,8 +195,6 @@ build: update_version agent_plugin nsenter mounts process_injector java python g
$(call split_debug, output/lib/golang/go_loader)
$(call split_debug, output/lib/golang/go_probe)
$(call split_debug, output/lib/python/python_loader)
$(call split_debug, output/lib/python/rasp/probe.so)
$(call split_debug, output/lib/python/rasp/probe.abi3.so)
$(foreach file, $(wildcard output/lib/php/*), $(call split_debug, $(file));)

tar -czvf debug.tar.gz debug
Expand Down

0 comments on commit 782fc31

Please sign in to comment.