Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: PingPing on September 03, 2018, 05:46:23 AM
-
I'm in the process of building Nginx on my Raspberry Pi Zero W and, when finished, I would like to submit it as an extension.
However, before I do that, I have a number of questions that I am hoping I can get answers to:
1. Static or Dynamically-linked libraries?
Nginx depends on 'pcre' and 'openssl'. It can be built without these, but the result is much reduced functionality. I intend to include these in the build. Do I have to dynamically link these libraries when I build or can I build them into the nginx binary itself, ie. static? Also, if the latter, can I use more recent versions of them (the tcz repos have pcre-8.39 and openssl-1.0.2j while the latest versions are 8.42 and 1.1.0i, respectively)? pcre2-10.31 also exists. Should I build with that instead of pcre?
2. Compiler Flags
What are the recommended compiler flags for the Raspberry Pi Zero W? I have come across these for the Raspberry Pi 2 but, I'm not sure if they're appropriate:
export CFLAGS="-Os -pipe"
export CXXFLAGS="-Os -pipe -fno-exceptions -fno-rtti"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
Could someone please advise?
3. Directory locations
I recall reading somewhere that extensions should go in /usr/local/<packagename>, eg. configure --prefix=/usr/local/nginx
Is this correct? If so, are there any other limitations on where I can place the built objects:
- binary files - eg. /usr/local/nginx/sbin/ or /usr/local/sbin/ ?
- library files - eg. /usr/local/nginx/lib/ or /usr/local/lib/ ?
- config files - eg. /usr/local/nginx/etc/ or /usr/local/etc/ ?
- log files - eg. /usr/local/nginx/var/log/ or /usr/local/var/log/ ?
- pid files - eg. /usr/local/nginx/var/run/ or /usr/local/var/run/ ?
I would like to comply fully with TC standards so any advice is appreciated.
4. Other help
I've found these resources to help me:
- Wiki Page: Creating an Extension (http://wiki.tinycorelinux.net/wiki:creating_extensions)
- Forum Thread: Guidelines for extension submission (http://forum.tinycorelinux.net/index.php?topic=330.0)
Are there any others?
Cheers
PingPing
-
1. Please use dynamic unless you need specific functionality that would only work with static newer versions.
3. System paths, --prefix=/usr/local.
4. The book also contains basic info on creating extensions.
-
2. [Optional] CFLAGS/CXXFLAGS to ensure the binaries would work on old RPI.
"-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp"
-
As the maintainer of the 32 and 64-bit nginx extensions, I configure with these options:
./configure \
--prefix=/usr/local \
--sbin-path=/usr/local/sbin/nginx \
--modules-path=/usr/local/lib/nginx/modules \
--conf-path=/usr/local/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/tmp/nginx/lock \
--user=nobody \
--group=nogroup \
--with-threads \
--with-file-aio \
--with-compat \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_xslt_module=dynamic \
--with-http_image_filter_module=dynamic \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--http-log-path=/var/log/nginx \
--http-client-body-temp-path=/tmp/nginx/client \
--http-proxy-temp-path=/tmp/nginx/proxy \
--http-fastcgi-temp-path=/tmp/nginx/fastcgi \
--http-uwsgi-temp-path=/tmp/nginx/uwsgi \
--http-scgi-temp-path=/tmp/nginx/scgi \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_ssl_preread_module
You can always look at the "files" file of nginx for x86_64 TC to see what you should wind up with:
/usr/local/tce.installed/nginx
/usr/local/etc/nginx/original/fastcgi_params.default
/usr/local/etc/nginx/original/nginx.conf.default
/usr/local/etc/nginx/original/uwsgi_params.default
/usr/local/etc/nginx/original/fastcgi.conf.default
/usr/local/etc/nginx/original/mime.types.default
/usr/local/etc/nginx/original/scgi_params.default
/usr/local/etc/nginx/koi-win
/usr/local/etc/nginx/win-utf
/usr/local/etc/nginx/koi-utf
/usr/local/etc/init.d/nginx
/usr/local/lib/nginx/html/index.html
/usr/local/lib/nginx/html/50x.html
/usr/local/lib/nginx/modules/ngx_http_xslt_filter_module.so
/usr/local/lib/nginx/modules/ngx_http_image_filter_module.so
/usr/local/lib/nginx/modules/ngx_mail_module.so
/usr/local/lib/nginx/modules/ngx_stream_module.so
/usr/local/sbin/nginx
I haven't tested all of these modules, as I mostly use it with PHP FPM. You may use the existing nginx startup script from the 64-bit extension or come up with a better one. I'm not so proud to assume the one I have is best, just at least good enough for now. If you know of a good nginx test suite I'd like to give it a try.
-
Hi PingPing
You may want to unpack an existing nginx extension and grab the following files:
/usr/local/tce.installed/nginx
This script performs any initial setup required when nginx gets installed. If no setup is required the file should be omitted.
/usr/local/etc/init.d/nginx
This is the script used to start/stop/restart nginx.
There is a version in an older RPi repo you could get those files from:
http://tinycorelinux.net/5.x/armv6/tcz/nginx.tcz
Or maybe you want to download one of andyjs newer extensions in case those scripts have been updated.
-
And here you have some old build script
http://tinycorelinux.net/5.x/armv6/tcz/src/nginx/nginx.build
-
Thank you all for your advice. It's been really helpful.
I'm using the build script linked to by patrikg and amending it to follow andyj's configure parameters, however, the parameter:
- --with-http_image_filter_module=dynamic
is asking for the GD Library (libgd-dev.tcz). I can see v2.2.5 in the x86 and x86_64 repos but there's nothing at all in the armv6 (RPi) repo. How can I get this ported to the RPi repo, or do I have to compile it myself?
-
You may need to build it yourself. To keep the dependencies down, I compile the version in the x86 repository without requirements for X:
./configure \
--without-x \
--without-xpm