Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73231 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55667 invoked from network); 17 Mar 2014 21:05:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2014 21:05:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=ingwie2000@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ingwie2000@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.83.41 as permitted sender) X-PHP-List-Original-Sender: ingwie2000@googlemail.com X-Host-Fingerprint: 74.125.83.41 mail-ee0-f41.google.com Received: from [74.125.83.41] ([74.125.83.41:50756] helo=mail-ee0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/1E-17561-58367235 for ; Mon, 17 Mar 2014 16:05:10 -0500 Received: by mail-ee0-f41.google.com with SMTP id t10so4649745eei.0 for ; Mon, 17 Mar 2014 14:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=35XxCbwTbRoqOs9BBduHeb4tdWO1JlGm21R8uKF989I=; b=w/IUkL6b5ck013hBrz+dlJTrZkWSiy1S8VjwZAhnfqiUdfDEbeocr5eHkO54caeQq4 +IxDskbLoi48//89hb/qetxveyuY2dfsiNG/j1x4GIj+KBGEaegiMObJsnNZMc9Oloih W5rfAcwejW7GbLnEm9Co5A9hTXCdYE3WQa0MxhA/08ocTIU0QK1s+oyoM2R21pEmIKyT 6LOFWCPneJTPMmYwmasq0jOS3HH9xFSdRGo1zK6z+j3zCtqFrVUnpuxBcCtcd3WVu35w 4S3Zo4/JuzpBo710579nCS/Yo6jUApZAQhVVkExlkENX72kUqk4PwFvzp4NlVFVUbGJx kebw== X-Received: by 10.15.65.68 with SMTP id p44mr10193187eex.63.1395090307107; Mon, 17 Mar 2014 14:05:07 -0700 (PDT) Received: from [192.168.200.19] (dslb-094-219-079-065.pools.arcor-ip.net. [94.219.79.65]) by mx.google.com with ESMTPSA id o5sm42100443eeg.8.2014.03.17.14.05.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Mar 2014 14:05:05 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Message-ID: Date: Mon, 17 Mar 2014 22:05:03 +0100 To: PHP internals Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) X-Mailer: Apple Mail (2.1822) Subject: PHP could become more embeddable From: ingwie2000@googlemail.com (Kevin Ingwersen) 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 =84phpize=93 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=85but 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.=20 Setting up the deps folder with the required headers and dll=92s, 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. =97 # 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 =3D CPPFLAGS.define("foo=3Dbar"); # 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 =3D CPPFLAGS.include("libbu/"); } target "d0p-tool" { rule "exe"; requires [targets("d0p")]; input "d0p.cpp"; CPPFLAGS =3D = CPPFLAGS.include("libbu/").include("libcanister/src"); } action "default" { build: "d0p"; } =97 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=92s 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=92t this process be simplified? For example: $ cat TSRM/tsrm_config.h=20 #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=92s 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 = =84addon=93 to PHP that I have ever, ever seen=85thanks again to the = person who posted about that, its an amazing finding! Kind regards, Ingwie=