Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73277 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2891 invoked from network); 18 Mar 2014 22:48:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2014 22:48:01 -0000 Authentication-Results: pb1.pair.com header.from=kris.craig@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=kris.craig@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.171 as permitted sender) X-PHP-List-Original-Sender: kris.craig@gmail.com X-Host-Fingerprint: 209.85.128.171 mail-ve0-f171.google.com Received: from [209.85.128.171] ([209.85.128.171:51223] helo=mail-ve0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B6/64-16983-02DC8235 for ; Tue, 18 Mar 2014 17:48:00 -0500 Received: by mail-ve0-f171.google.com with SMTP id cz12so7926345veb.16 for ; Tue, 18 Mar 2014 15:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JaHdJK566kO9Brj7P+m+zn9kGxS00szBNJngtg8wB2g=; b=pnCOshh6ra+tU1YdXFmXh5bzihmr/59SbMIk8mT6JgM1yx2P/T8veukiOW34Irxuy4 WmMPqALhqWyUFxwXiSBn+qT+80EUjRP/5UjdjCVqPNxNZ4xHq2VuGr/OZkPq6+aCr+6P N20tKY3dj/ldLOWWdm3mRd0IB4IeBoLAIyb2Fj/sXoILYnqzX0jbijefoT8PcMzsN0z0 9OmplaBxOMECd5Wvn63dswBH286xhWeOADYgsxPrd/HmgVLp+euX3mi1p1+lFy/EERMT L9FCOdt730MAbXsIOfV5hMAaryVkJd64fRmvYy1Fp4MfC9qvyS19pdNfRelfH7iBpnTC aypA== MIME-Version: 1.0 X-Received: by 10.58.162.168 with SMTP id yb8mr6481562veb.9.1395182877994; Tue, 18 Mar 2014 15:47:57 -0700 (PDT) Received: by 10.58.161.162 with HTTP; Tue, 18 Mar 2014 15:47:57 -0700 (PDT) In-Reply-To: References: Date: Tue, 18 Mar 2014 15:47:57 -0700 Message-ID: To: Kevin Ingwersen Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b671f34d6f62804f4e9533a Subject: Re: [PHP-DEV] PHP could become more embeddable From: kris.craig@gmail.com (Kris Craig) --047d7b671f34d6f62804f4e9533a Content-Type: text/plain; charset=ISO-8859-1 On Mon, Mar 17, 2014 at 2:05 PM, Kevin Ingwersen wrote: > Good evening, internals! > > I have posted about this just a while ago - I am slightly concerned about > the current build system. > > Nothing against autotools and the current "phpize" system - t runs, is > stable, and well concepted. But currently, PHP is a program on its own, and > to me, it is hard to imagine being able to embed it on a system - like > Windows, where you have nothing like apt, yum, zypper, or whatever. I am > writing a package manager for that reason...but it might want to integrate > PHP for a varity of reasons. But at the current state, its hard to > implement PHP into anything, without getting a hang on itself first. > > Setting up the deps folder with the required headers and dll's, or > compiling other stuff on UNIX is okay. But to embed PHP, one needs to be > able to run a proper shell - bash - have make and some headers/libs > installed, making it rather hard to implement. > > I for myself only want to implement parts of PHP. Like the core engine, > the pthreads PECL extension and using PHP-CPP, I will be making my libd0p > and others available to PHP too. But if I want to build on Windows, I am > quite lost. > > The build system I deem to use is a script-like system, and it is by > nature windows compatible. It might not be as direct as make, or not even > Ninja, but things like the following work quite nicely. > > -- > # Builting some librarys and making it into a binary. > > target static_lib("d0p") { > // I could have said "target libd0p.a" - but using a function, I > can make this cross platform. > // So it is either .a or .lib, depending on the os. > rule "static_lib"; > input [files("libd0p/*.cpp")]; > requires [targets("d0p")]; // We can assign tags for easer finding > } > target static_lib("canister") { > rule "static_lib"; > tag "d0p"; > input [files("libcanister/src/*.cpp")]; > CPPFLAGS = CPPFLAGS.define("foo=bar"); # Will automaticaly set -D > or /D and add to the flags > } > target static_lib("bu") { > rule "static_lib"; > tag "d0p"; > input [ > files("libbu/src/stable/*.cpp"), > files("libbu/src/experimental/*.cpp"), > files("libbu/src/unstable/*.cpp") > ]; > CPPFLAGS = CPPFLAGS.include("libbu/"); > } > > target "d0p-tool" { > rule "exe"; > requires [targets("d0p")]; > input "d0p.cpp"; > CPPFLAGS = CPPFLAGS.include("libbu/").include("libcanister/src"); > } > > action "default" { > build: "d0p"; > } > -- > > This build system is currently learning configuration (checking for > headers, functions, libraries, tools), generating and downloading of files. > After this is done, I hope to replicate PHP's main build system int hat way > - so I can then include the file from a main file. But in order to do this, > I need to learn as much as I can about the very basic PHP building. > > But this isnt just useful for me. For anyone who wishes to integrate a > basic PHP engine, this would be some useful knowledge. What to check for, > what to generate - and then, what to build - to just get a basic thing up > and running. > > As much as I have searched for now, PHP generates a tiny bit of files: > > ./ext/date/lib/timelib_config.h > ./main/build-defs.h > ./main/internal_functions.c > ./main/internal_functions_cli.c > ./main/php_config.h > ./TSRM/tsrm_config.h > ./Zend/zend_config.h > > But, can't this process be simplified? For example: > > $ cat TSRM/tsrm_config.h > #include <../main/php_config.h> > > Why do we even need this file, if it is more or less pointless, as it just > includes a file at another location? > > My goal is to achieve a way to make embedding PHP for others simpler - > that will incldue adding PHP-CPP. Because its structured so simple, that it > only comes with a makefile - and you basically could: > > g++ -c src/*.cpp -I. -Iinclude > ar rcs libphpcpp.a *.o > > Voila, built. > > > > So, to sumarize my points that I somehow tried to explain, but I am not > very good with wording myself in english - my main language is german. > > - Autotools is not capable of properly including other projects, > without forcing more configure calls, which check things over and over > again. > - Someone may sumarize how to compile the basic PHP by hand - > like, what files to compile with gcc and which .o's to put together for a > basic libphp5.a? > - Can the build of PHP be made easier, for embedding purpose - by > refactoring some generations and checks? > > I will keep investigating into this topic, as I really want to use PHP - > now even more avter finding out about PHP-CPP, which is like, the best > "addon" to PHP that I have ever, ever seen...thanks again to the person who > posted about that, its an amazing finding! > > Kind regards, Ingwie > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > With regard to Windows, you should take a look at Garret Serack's CoApp project. It's pretty impressive, I think. --Kris --047d7b671f34d6f62804f4e9533a--