Giter VIP home page Giter VIP logo

Comments (19)

jingjingxyk avatar jingjingxyk commented on May 17, 2024

可以自己添加

静态编译 libmcrypt 库

wget https://github.com/winlibs/libmcrypt/archive/refs/tags/libmcrypt-2.5.8-3.4.tar.gz
mkdir -p libmcrypt
tar --strip-components=1 -C /work/thirdparty/libmcrypt  -xf /work/pool/lib/libmcrypt-2.5.8-3.4.tar.gz

# 静态编译
chmod a+x ./install-sh
sh ./configure --prefix=/usr/libmcrypt \
--enable-static=yes \
--enable-shared=no

make -j  `nproc`

make install 

micro 构建配置脚本:
build-config-php-8-micro.sh
build-make-php-8-micro.sh

今天编译时临时加上了 mcrypt 扩展

micro.sfx.linux.zip

from static-php-cli.

jingjingxyk avatar jingjingxyk commented on May 17, 2024

安装libmcrypt依赖库参考: https://github.com/jingjingxyk/swoole-cli/blob/1ffb277dd93b70385f12022f1862fa3ac65c5003/library_install_builder_test.php#L1615

from static-php-cli.

y1713375484 avatar y1713375484 commented on May 17, 2024

安装libmcrypt依赖库参考: https://github.com/jingjingxyk/swoole-cli/blob/1ffb277dd93b70385f12022f1862fa3ac65c5003/library_install_builder_test.php#L1615

好的,我研究下

from static-php-cli.

jingjingxyk avatar jingjingxyk commented on May 17, 2024

进入容器就可以开始静态编译PHP了,依赖库已经提前准备好了 提前构建依赖库的 Dockerfile 文件

#!/bin/env sh 

__DIR__=$(
  cd "$(dirname "$0")"
  pwd
)

default_image=registry.cn-beijing.aliyuncs.com/jingjingxyk-public/app:build-swoole-cli-build-dependencies-alpine-edge-20230226T074232Z

 image=$default_image

docker run --rm --name  swoole-cli-build-dev-all-dependencies-container -d -v ${__DIR__}:/work -w /work $image tail -f /dev/null

进入容器就可以开始构建PHP了

from static-php-cli.

jingjingxyk avatar jingjingxyk commented on May 17, 2024

容器里准备了这些依赖库

COPY --from=builder-all-library /usr/openssl/ /usr/openssl/
COPY --from=builder-all-library /usr/libiconv /usr/libiconv
COPY --from=builder-all-library /usr/libxml2/ /usr/libxml2/
COPY --from=builder-all-library /usr/libxslt/ /usr/libxslt/


COPY --from=builder-all-library  /usr/brotli/ /usr/brotli/
COPY --from=builder-all-library  /usr/zlib /usr/zlib
COPY --from=builder-all-library  /usr/bzip2 /usr/bzip2
COPY --from=builder-all-library  /usr/liblz4 /usr/liblz4
COPY --from=builder-all-library  /usr/liblzma /usr/liblzma
COPY --from=builder-all-library  /usr/libzstd /usr/libzstd
COPY --from=builder-all-library  /usr/libzip /usr/libzip

COPY --from=builder-all-library  /usr/libgif /usr/libgif
COPY --from=builder-all-library  /usr/libpng /usr/libpng
COPY --from=builder-all-library  /usr/libjpeg /usr/libjpeg
COPY --from=builder-all-library  /usr/freetype /usr/freetype
COPY --from=builder-all-library  /usr/libwebp /usr/libwebp
COPY --from=builder-all-library  /usr/imagemagick /usr/imagemagick



COPY --from=builder-all-library /usr/libidn2 /usr/libidn2
COPY --from=builder-all-library  /usr/cares /usr/cares
COPY --from=builder-all-library  /usr/curl/ /usr/curl/



COPY --from=builder-all-library  /usr/icu/ /usr/icu/
COPY --from=builder-all-library  /usr/ncurses /usr/ncurses
COPY --from=builder-all-library  /usr/readline /usr/readline


COPY --from=builder-all-library  /usr/mimalloc/ /usr/mimalloc/

COPY --from=builder-all-library  /usr/pgsql/ /usr/pgsql/
COPY --from=builder-all-library  /usr/libffi /usr/libffi

COPY --from=builder-all-library  /usr/gmp/ /usr/gmp/
COPY --from=builder-all-library  /usr/sqlite3/ /usr/sqlite3/
COPY --from=builder-all-library  /usr/oniguruma/ /usr/oniguruma/
COPY --from=builder-all-library  /usr/libsodium/ /usr/libsodium/
COPY --from=builder-all-library  /usr/libyaml /usr/libyaml

from static-php-cli.

y1713375484 avatar y1713375484 commented on May 17, 2024

我不会用docker,只想要在基础扩展中多添加一个mcrypt扩展的静态php可执行文件,能帮我编译一份吗

from static-php-cli.

jingjingxyk avatar jingjingxyk commented on May 17, 2024

@y1713375484
已经上传到这里了呀
#27 (comment)

image

https://github.com/crazywhalecc/static-php-cli/files/10834490/micro.sfx.linux.zip

from static-php-cli.

y1713375484 avatar y1713375484 commented on May 17, 2024

@y1713375484 已经上传到这里了呀 #27 (comment)

image

https://github.com/crazywhalecc/static-php-cli/files/10834490/micro.sfx.linux.zip

77b7bc0e0a736f13d04f905de92f225
我想用这种,您上传的这种.sfx文件怎样使用呢?

from static-php-cli.

y1713375484 avatar y1713375484 commented on May 17, 2024

image
会用了,用.sfx文件和phar编译成了可执行文件了,但还是想要一个单独的php的静态执行文件

from static-php-cli.

jingjingxyk avatar jingjingxyk commented on May 17, 2024

自己编译呀,现在简单多了,因为其他(swoole-cli) 项目,已经提前把依赖库解决了 swoole/swoole-cli#41

提前解决了依赖库,你就直接开始构建编译就行了

进入容器,你就可以开始编译静态PHP了 (扩展的依赖库依靠容器技术已经提前解决了)

from static-php-cli.

jingjingxyk avatar jingjingxyk commented on May 17, 2024

需要的脚本都放这里了:linux x86-64版本
php7静态编译 : https://github.com/jingjingxyk/swoole-cli/tree/new_dev_build/build-tools/php-7
php8静态编译: https://github.com/jingjingxyk/swoole-cli/tree/new_dev_build/build-tools/php-8

from static-php-cli.

crazywhalecc avatar crazywhalecc commented on May 17, 2024

(禁止偷家(bushi

from static-php-cli.

ikilobyte avatar ikilobyte commented on May 17, 2024

需要的脚本都放这里了:linux x86-64版本 php7静态编译 : https://github.com/jingjingxyk/swoole-cli/tree/new_dev_build/build-tools/php-7 php8静态编译: https://github.com/jingjingxyk/swoole-cli/tree/new_dev_build/build-tools/php-8

@jingjingxyk php静态编译?这个仓库就是啊,你这个是把代码转成二进制?

from static-php-cli.

crazywhalecc avatar crazywhalecc commented on May 17, 2024

需要的脚本都放这里了:linux x86-64版本 php7静态编译 : https://github.com/jingjingxyk/swoole-cli/tree/new_dev_build/build-tools/php-7 php8静态编译: https://github.com/jingjingxyk/swoole-cli/tree/new_dev_build/build-tools/php-8

@jingjingxyk php静态编译?这个仓库就是啊,你这个是把代码转成二进制?

他的意思是 swoole-cli 这个项目有你需要的构建需求了,这个项目和本项目的功能类似,各有不同特点。

from static-php-cli.

jingjingxyk avatar jingjingxyk commented on May 17, 2024

(禁止偷家(bushi

着实没看懂呀?

构建扩展的依赖库,不就3种方式:
1、源码编译;
2、借助系统源已经构建好依赖库
3、上面两种混合使用

我目前只不过是参与了,源码编译扩展依赖库 。其它都是连带测试一下能不能用

目的: 提前构建好扩展的依赖库,至于扩展是否要启用,由使用人决定

本项目:是一个很好的参考项目,我参考以后,我把我的成果发了出来了而已,我可没啥其他意思

编译的静态库:可不止PHP 需要,我编译 ffmpeg opencv ovn socat aria2 都是需要的,也就是这个文件里的这些: https://github.com/jingjingxyk/swoole-cli/blob/new_dev/library_builder.php

from static-php-cli.

ikilobyte avatar ikilobyte commented on May 17, 2024

@crazywhalecc 我发现这个项目的时候star才几十个,我是第42个star,加油

from static-php-cli.

crazywhalecc avatar crazywhalecc commented on May 17, 2024

(禁止偷家(bushi

着实没看懂呀?

构建扩展的依赖库,不就3种方式: 1、源码编译; 2、借助系统源已经构建好依赖库 3、上面两种混合使用

我目前只不过是参与了,源码编译扩展依赖库 。其它都是连带测试一下能不能用

目的: 提前构建好扩展的依赖库,至于扩展是否要启用,由使用人决定

本项目:是一个很好的参考项目,我参考以后,我把我的成果发了出来了而已,我可没啥其他意思

编译的静态库:可不止PHP 需要,我编译 ffmpeg opencv ovn socat aria2 都是需要的,也就是这个文件里的这些: https://github.com/jingjingxyk/swoole-cli/blob/new_dev/library_builder.php

我没其他意思,就是说你们在这个项目上 Issue 讨论了好久,我都鸽了很久了,感觉都快变成不是我的项目了,摊手调侃一下。(笑哭)我等最近忙完会发布重构的版本。

from static-php-cli.

crazywhalecc avatar crazywhalecc commented on May 17, 2024

mcrypt 只适用于 Linux,重构版本完成 Linux builder 后可支持。

from static-php-cli.

avriltank avatar avriltank commented on May 17, 2024

这项目确实方便,静态编译部署比docker什么的强多了

from static-php-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.