From: RISCi_ATOM Date: Sat, 17 Dec 2016 22:41:05 +0000 (-0500) Subject: First Commit X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=704ce7f78e87d05afcfd1444361a36ce43b6158e;p=librecmc%2Fpackage-feed.git First Commit --- 704ce7f78e87d05afcfd1444361a36ce43b6158e diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..29ba5db --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,114 @@ +# Contributing Guidelines +(See for overall format and construction) + + +### Basic guidelines + +All packages you commit or submit by pull-request should follow these simple guidelines: +* Package a version which is still maintained by the upstream author. +* Will be updated regularly to maintained and supported versions. +* Have no dependencies outside the OpenWrt core packages or this repository feed. +* Have been tested to compile with the correct includes and dependencies. Please also test with "Compile with full language support" found under "General Build Settings" set if language support is relevant to your package. +* Do NOT use a rolling source file (e.g. foo-latest.tar.gz) or the head of a branch as source for the package since that would create unpredictable builds which change over time. +* Best of all -- it works as expected! + +#### Makefile contents should contain: + +* An up-to-date copyright notice. Use OpenWrt if no other present or supply your own. +* A (PKG_)MAINTAINER definition listing either yourself or another person in the field. + (E.g.: PKG_MAINTAINER:= Joe D. Hacker `) +* A PKG_LICENSE tag declaring the main license of the package. + (E.g.: PKG_LICENSE:=GPL-2.0+) Please use SPDX identifiers if possible (see list at the bottom). +* An optional PKG_LICENSE_FILES tag including the filenames of the license-files in the source-package. + (E.g.: PKG_LICENSE_FILES:=COPYING) +* PKG_RELEASE should be initially set to 1 or reset to 1 if the software version is changed. You should increment it if the package itself has changed. For example, modifying a support script, changing configure options like --disable* or --enable* switches, or if you changed something in the package which causes the resulting binaries to be different. Changes like correcting md5sums, changing mirror URLs, adding a maintainer field or updating a comment or copyright year in a Makefile do not require a change to PKG_RELEASE. + +#### Commits in your pull-requests should: + +* Have a useful description prefixed with the package name + (E.g.: "foopkg: Add libzot dependency") +* Include Signed-off-by in the comment + (See ) + +### Advice on pull requests: + +Pull requests are the easiest way to contribute changes to git repos at Github. They are the preferred contribution method, as they offer a nice way for commenting and amending the proposed changes. + +* You need a local "fork" of the Github repo. +* Use a "feature branch" for your changes. That separates the changes in the pull request from your other changes and makes it easy to edit/amend commits in the pull request. Workflow using "feature_x" as the example: + - Update your local git fork to the tip (of the master, usually) + - Create the feature branch with `git checkout -b feature_x` + - Edit changes and commit them locally + - Push them to your Github fork by `git push -u origin feature_x`. That creates the "feature_x" branch at your Github fork and sets it as the remote of this branch + - When you now visit Github, you should see a proposal to create a pull request + +* If you later need to add new commits to the pull request, you can simply commit the changes to the local branch and then use `git push` to automatically update the pull request. + +* If you need to change something in the existing pull request (e.g. to add a missing signed-off-by line to the commit message), you can use `git push -f` to overwrite the original commits. That is easy and safe when using a feature branch. Example workflow: + - Checkout the feature branch by `git checkout feature_x` + - Edit changes and commit them locally. If you are just updating the commit message in the last commit, you can use `git commit --amend` to do that + - If you added several new commits or made other changes that require cleaning up, you can use `git rebase -i HEAD~X` (X = number of commits to edit) to possibly squash some commits + - Push the changed commits to Github with `git push -f` to overwrite the original commits in the "feature_x" branch with the new ones. The pull request gets automatically updated + +### If you have commit access: + +* Do NOT use git push --force. +* Do NOT commit to other maintainer's packages without their consent. +* Use Pull Requests if you are unsure and to suggest changes to other maintainers. + +#### Gaining commit access: + +* We will gladly grant commit access to responsible contributors who have made + useful pull requests and / or feedback or patches to this repository or + OpenWrt in general. Please include your request for commit access in your + next pull request or ticket. + +### Release Branches: + +* Branches named "for-XX.YY" (e.g. for-14.07) are release branches. +* These branches are built with the respective OpenWrt release and are created + during the release stabilisation phase. +* Please ONLY cherry-pick or commit security and bug-fixes to these branches. +* Do NOT add new packages and do NOT do major upgrades of packages here. +* If you are unsure if your change is suitable, please use a pull request. + +### Common LICENSE tags (short list) +(Complete list can be found at: ) + +| Full Name | Identifier | +|---|:---| +|Apache License 1.0|Apache-1.0| +|Apache License 1.1|Apache-1.1| +|Apache License 2.0|Apache-2.0| +|Artistic License 1.0|Artistic-1.0| +|Artistic License 1.0 (Perl)|Artistic-1.0-Perl| +|Artistic License 1.0 w/clause 8|Artistic-1.0-cl8| +|Artistic License 2.0|Artistic-2.0| +|BSD 2-clause "Simplified" License|BSD-2-Clause| +|BSD 2-clause FreeBSD License|BSD-2-Clause-FreeBSD| +|BSD 2-clause NetBSD License|BSD-2-Clause-NetBSD| +|BSD 3-clause "New" or "Revised" License|BSD-3-Clause| +|BSD 3-clause Clear License|BSD-3-Clause-Clear| +|BSD 4-clause "Original" or "Old" License|BSD-4-Clause| +|BSD Protection License|BSD-Protection| +|BSD with attribution|BSD-3-Clause-Attribution| +|BSD-4-Clause (University of California-Specific)|BSD-4-Clause-UC| +|GNU General Public License v1.0 only|GPL-1.0| +|GNU General Public License v1.0 or later|GPL-1.0+| +|GNU General Public License v2.0 only|GPL-2.0| +|GNU General Public License v2.0 or later|GPL-2.0+| +|GNU General Public License v3.0 only|GPL-3.0| +|GNU General Public License v3.0 or later|GPL-3.0+| +|GNU Lesser General Public License v2.1 only|LGPL-2.1| +|GNU Lesser General Public License v2.1 or later|LGPL-2.1+| +|GNU Lesser General Public License v3.0 only|LGPL-3.0| +|GNU Lesser General Public License v3.0 or later|LGPL-3.0+| +|GNU Library General Public License v2 only|LGPL-2.0| +|GNU Library General Public License v2 or later|LGPL-2.0+| +|Fair License|Fair| +|ISC License|ISC| +|MIT License|MIT| +|No Limit Public License|NLPL| +|OpenSSL License|OpenSSL| +|X11 License|X11| +|zlib License|Zlib| diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d908a86 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# OpenWrt packages feed + +## Description + +This is the OpenWrt "packages"-feed containing community-maintained build scripts, options and patches for applications, modules and libraries used within OpenWrt. + +Installation of pre-built packages is handled directly by the **opkg** utility within your running OpenWrt system or by using the [OpenWrt SDK](http://wiki.openwrt.org/doc/howto/obtain.firmware.sdk) on a build system. + +## Usage + +This repository is intended to be layered on-top of an OpenWrt buildroot. If you do not have an OpenWrt buildroot installed, see the documentation at: [OpenWrt Buildroot – Installation](http://wiki.openwrt.org/doc/howto/buildroot.exigence) on the OpenWrt support site. + +This feed is enabled by default. To install all its package definitions, run: +``` +./scripts/feeds update packages +./scripts/feeds install -a -p packages +``` + +## License + +See [LICENSE](LICENSE) file. + +## Package Guidelines + +See [CONTRIBUTING.md](CONTRIBUTING.md) file. + diff --git a/admin/debootstrap/Makefile b/admin/debootstrap/Makefile new file mode 100644 index 0000000..a7d45c2 --- /dev/null +++ b/admin/debootstrap/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2010 Gianluigi Tiesi +# Copyright (C) 2011-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=debootstrap +PKG_VERSION:=1.0.83 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Daniel Golle + +PKG_SOURCE:=$(PKG_NAME)-udeb_$(PKG_VERSION)_all.udeb +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/d/debootstrap +PKG_MD5SUM:=877fe5281a0e424bd6c71d121cbb725b8f56694e66558cd47c20c3aa87ceff72 +PKG_LICENSE:=Unique +PKG_LICENSE_FILES:=debian/copyright + +UNPACK_CMD=ar -p "$(DL_DIR)/$(PKG_SOURCE)" data.tar.xz | xzcat | tar -C $(1) -xf - + +include $(INCLUDE_DIR)/package.mk + +define Package/debootstrap + SECTION:=admin + CATEGORY:=Administration + TITLE:=Bootstrap a basic Debian system + URL:=http://wiki.debian.org/Debootstrap + DEPENDS:= +coreutils +coreutils-chroot +coreutils-sha1sum +ar +xz +endef + +define Package/debootstrap/description + debootstrap is used to create a Debian base system from scratch, without + requiring the availability of dpkg or apt. It does this by downloading .deb + files from a mirror site, and carefully unpacking them into a directory which + can eventually be chrooted into. +endef + +define Build/Compile +# file pkgdetails.c was imported from debian package base-installer version 1.130 + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) ./files/pkgdetails.c -o $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails +endef + +define Package/debootstrap/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/share/debootstrap + $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails $(1)/usr/share/debootstrap + $(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/functions $(1)/usr/share/debootstrap + $(INSTALL_DIR) $(1)/usr/share/debootstrap/scripts + $(CP) $(PKG_BUILD_DIR)/usr/share/debootstrap/scripts/* $(1)/usr/share/debootstrap/scripts +endef + +$(eval $(call BuildPackage,debootstrap)) diff --git a/admin/debootstrap/files/pkgdetails.c b/admin/debootstrap/files/pkgdetails.c new file mode 100644 index 0000000..99ee190 --- /dev/null +++ b/admin/debootstrap/files/pkgdetails.c @@ -0,0 +1,347 @@ +#include +#include +#include +#include +#include +#include + +#define MAX_LINE 1000 +#define MAX_PKGS 100 + +char *checksum_field=NULL; + +static void oom_die(void) +{ + fputs("Out of memory!\n", stderr); + exit(1); +} + +static char *xvasprintf(const char *fmt, va_list ap) { + char *ret; + + if (vasprintf (&ret, fmt, ap) < 0) { + if (errno == ENOMEM) + oom_die(); + return NULL; + } + return ret; +} + +static char *xasprintf(const char *fmt, ...) { + va_list ap; + char *ret; + + va_start(ap, fmt); + ret = xvasprintf(fmt, ap); + va_end(ap); + return ret; +} + +static char *fieldcpy(char *dst, char *fld) { + while (*fld && *fld != ':') + fld++; + if (!*(fld++)) + return NULL; + while (isspace(*fld)) fld++; + return strcpy(dst, fld); +} + +static void outputdeps(char *deps) { + char *pch = deps; + + while (1) { + while (isspace(*pch)) pch++; + if (!*pch) break; + + while (*pch && *pch != '(' && *pch != '|' && *pch != ',' + && !isspace(*pch)) + { + fputc(*pch++, stdout); + } + fputc('\n', stdout); + while (*pch && *pch++ != ',') (void)NULL; + } +} + +static void dogetdeps(char *pkgsfile, char **in_pkgs, int pkgc) { + char buf[MAX_LINE]; + char cur_pkg[MAX_LINE]; + char cur_deps[MAX_LINE]; + char cur_predeps[MAX_LINE]; + char prev_pkg[MAX_LINE]; + char *pkgs[MAX_PKGS]; + int i; + int skip; + FILE *f; + int output_pkg = -1; + + cur_pkg[0] = cur_deps[0] = cur_predeps[0] = prev_pkg[0] = '\0'; + + for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + exit(1); + } + + skip = 1; + while (fgets(buf, sizeof(buf), f)) { + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, "Package:", 8) == 0) { + int any = 0; + skip = 1; + fieldcpy(cur_pkg, buf); + if (strcmp(cur_pkg, prev_pkg) != 0) { + if (output_pkg != -1) + pkgs[output_pkg] = NULL; + if (cur_deps[0]) + outputdeps(cur_deps); + if (cur_predeps[0]) + outputdeps(cur_predeps); + strcpy(prev_pkg, cur_pkg); + } + cur_deps[0] = cur_predeps[0] = '\0'; + output_pkg = -1; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + any = 1; + if (strcmp(cur_pkg, pkgs[i]) == 0) { + skip = 0; + output_pkg = i; + break; + } + } + if (!any) break; + } else if (!skip && strncasecmp(buf, "Depends:", 8) == 0) + fieldcpy(cur_deps, buf); + else if (!skip && strncasecmp(buf, "Pre-Depends:", 12) == 0) + fieldcpy(cur_predeps, buf); + } + if (cur_deps[0]) + outputdeps(cur_deps); + if (cur_predeps[0]) + outputdeps(cur_predeps); + fclose(f); +} + +static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile, + char *fieldname, char **in_pkgs, int pkgc) +{ + char buf[MAX_LINE]; + char cur_field[MAX_LINE]; + char cur_pkg[MAX_LINE]; + char cur_ver[MAX_LINE]; + char cur_arch[MAX_LINE]; + char cur_size[MAX_LINE]; + char cur_checksum[MAX_LINE]; + char cur_filename[MAX_LINE]; + char prev_pkg[MAX_LINE]; + char *pkgs[MAX_PKGS]; + int i; + FILE *f; + char *output = NULL; + int output_pkg = -1; + + cur_field[0] = cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = prev_pkg[0] = '\0'; + + for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + exit(1); + } + while (fgets(buf, sizeof(buf), f)) { + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, fieldname, strlen(fieldname)) == 0) { + fieldcpy(cur_field, buf); + } + if (strncasecmp(buf, "Package:", 8) == 0) { + fieldcpy(cur_pkg, buf); + if (strcmp(cur_pkg, prev_pkg) != 0) { + if (output) + fputs(output, stdout); + if (uniq && output_pkg != -1) + pkgs[output_pkg] = NULL; + strcpy(prev_pkg, cur_pkg); + } + free(output); + output = NULL; + output_pkg = -1; + } else if (strncasecmp(buf, "Version:", 8) == 0) { + fieldcpy(cur_ver, buf); + } else if (strncasecmp(buf, "Architecture:", 13) == 0) { + fieldcpy(cur_arch, buf); + } else if (strncasecmp(buf, "Size:", 5) == 0) { + fieldcpy(cur_size, buf); + } else if (strncasecmp(buf, checksum_field, strlen(checksum_field)) == 0 + && buf[strlen(checksum_field)] == ':') { + fieldcpy(cur_checksum, buf); + } else if (strncasecmp(buf, "Filename:", 9) == 0) { + fieldcpy(cur_filename, buf); + } else if (!*buf) { + int any = 0; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + any = 1; + if (strcmp(cur_field, pkgs[i]) == 0) { + free(output); + output = xasprintf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_checksum, cur_size); + output_pkg = i; + break; + } + } + if (!any) break; + cur_field[0] = '\0'; + } + } + if (output) + fputs(output, stdout); + if (uniq && output_pkg != -1) + pkgs[output_pkg] = NULL; + fclose(f); + + /* any that weren't found are returned as "pkg -" */ + if (uniq) { + for (i = 0; i < pkgc; i++) { + if (pkgs[i]) { + printf("%s -\n", pkgs[i]); + } + } + } +} + +static void dopkgstanzas(char *pkgsfile, char **pkgs, int pkgc) +{ + char buf[MAX_LINE]; + char *accum; + size_t accum_size = 0, accum_alloc = MAX_LINE * 2; + char cur_pkg[MAX_LINE]; + FILE *f; + + accum = malloc(accum_alloc); + if (!accum) + oom_die(); + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + free(accum); + exit(1); + } + while (fgets(buf, sizeof(buf), f)) { + if (*buf) { + size_t len = strlen(buf); + if (accum_size + len + 1 > accum_alloc) { + accum_alloc = (accum_size + len + 1) * 2; + accum = realloc(accum, accum_alloc); + if (!accum) + oom_die(); + } + strcpy(accum + accum_size, buf); + accum_size += len; + } + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, "Package:", 8) == 0) { + fieldcpy(cur_pkg, buf); + } else if (!*buf) { + int i; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + if (strcmp(cur_pkg, pkgs[i]) == 0) { + fputs(accum, stdout); + if (accum[accum_size - 1] != '\n') + fputs("\n\n", stdout); + else if (accum[accum_size - 2] != '\n') + fputc('\n', stdout); + break; + } + } + *accum = '\0'; + accum_size = 0; + } + } + fclose(f); + + free(accum); +} + +static int dotranslatewgetpercent(int low, int high, int end, char *str) { + int ch; + int val, lastval; + + /* print out anything that looks like a % on its own line, appropriately + * scaled */ + + lastval = val = 0; + while ( (ch = getchar()) != EOF ) { + if (isdigit(ch)) { + val *= 10; val += ch - '0'; + } else if (ch == '%') { + float f = (float) val / 100.0 * (high - low) + low; + if (str) { + printf("P: %d %d %s\n", (int) f, end, str); + } else { + printf("P: %d %d\n", (int) f, end); + } + lastval = val; + } else { + val = 0; + } + } + return lastval == 100; +} + +int main(int argc, char *argv[]) { + checksum_field=getenv("DEBOOTSTRAP_CHECKSUM_FIELD"); + if (checksum_field == NULL) { + checksum_field="MD5sum"; + } + + if ((argc == 6 || argc == 5) && strcmp(argv[1], "WGET%") == 0) { + if (dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]), + atoi(argv[4]), argc == 6 ? argv[5] : NULL)) + { + exit(0); + } else { + exit(1); + } + } else if (argc >= 4 && strcmp(argv[1], "GETDEPS") == 0) { + int i; + for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) { + dogetdeps(argv[2], argv+i, MAX_PKGS); + } + dogetdeps(argv[2], argv+i, argc-i); + exit(0); + } else if (argc >= 5 && strcmp(argv[1], "PKGS") == 0) { + int i; + for (i = 4; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, MAX_PKGS); + } + dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, argc-i); + exit(0); + } else if (argc >= 6 && strcmp(argv[1], "FIELD") == 0) { + int i; + for (i = 5; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, MAX_PKGS); + } + dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, argc-i); + exit(0); + } else if (argc >= 4 && strcmp(argv[1], "STANZAS") == 0) { + int i; + for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgstanzas(argv[2], argv+i, MAX_PKGS); + } + dopkgstanzas(argv[2], argv+i, argc-i); + exit(0); + } else { + fprintf(stderr, "usage: %s PKGS mirror packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s FIELD field mirror packagesfile pkgs..\n", + argv[0]); + fprintf(stderr, " or: %s GETDEPS packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s STANZAS packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s WGET%% low high end reason\n", argv[0]); + exit(1); + } +} diff --git a/admin/debootstrap/patches/100-busybox_fix.patch b/admin/debootstrap/patches/100-busybox_fix.patch new file mode 100644 index 0000000..5e8db05 --- /dev/null +++ b/admin/debootstrap/patches/100-busybox_fix.patch @@ -0,0 +1,11 @@ +--- a/usr/share/debootstrap/functions ++++ b/usr/share/debootstrap/functions +@@ -859,8 +859,6 @@ choose_extractor () { + + if [ -n "$EXTRACTOR_OVERRIDE" ]; then + extractor="$EXTRACTOR_OVERRIDE" +- elif type dpkg-deb >/dev/null 2>&1; then +- extractor="dpkg-deb" + else + extractor="ar" + fi diff --git a/admin/htop/Makefile b/admin/htop/Makefile new file mode 100644 index 0000000..010f36d --- /dev/null +++ b/admin/htop/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=htop +PKG_VERSION:=2.0.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://hisham.hm/htop/releases/$(PKG_VERSION)/ +PKG_MD5SUM:=7d354d904bad591a931ad57e99fea84a + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/htop + SECTION:=admin + CATEGORY:=Administration + TITLE:=Interactive processes viewer + DEPENDS:=+libncurses + URL:=http://htop.sourceforge.net/ + MAINTAINER:=Etienne CHAMPETIER +endef + +define Package/htop/description + Htop is an ncursed-based process viewer similar to top, but + it allows to scroll the list vertically and horizontally to + see all processes and their full command lines. +endef + +CONFIGURE_ARGS += \ + --disable-unicode \ + --disable-hwloc + +CONFIGURE_VARS += \ + ac_cv_file__proc_stat=yes \ + ac_cv_file__proc_meminfo=yes + +define Package/htop/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,htop)) diff --git a/admin/htop/patches/100-fix-libtool-version-check.patch b/admin/htop/patches/100-fix-libtool-version-check.patch new file mode 100644 index 0000000..c786213 --- /dev/null +++ b/admin/htop/patches/100-fix-libtool-version-check.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -2,7 +2,7 @@ + # Process this file with autoconf to produce a configure script. + + AC_PREREQ(2.65) +-LT_PREREQ([2.4.2]) ++LT_PREREQ([2.4.0]) + AC_INIT([htop],[2.0.2],[hisham@gobolinux.org]) + + SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" diff --git a/admin/monit/Makefile b/admin/monit/Makefile new file mode 100644 index 0000000..4f8c14a --- /dev/null +++ b/admin/monit/Makefile @@ -0,0 +1,95 @@ +# +# Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=monit +PKG_VERSION:=5.18 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://mmonit.com/monit/dist +PKG_MD5SUM:=a1bfac0fbb83439435f8616200d2364d + +PKG_LICENSE:=AGPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/monit/Default + SECTION:=admin + CATEGORY:=Administration + DEPENDS:= +libpthread + TITLE:=System services monitoring utility + URL:=http://mmonit.com/monit/ + MAINTAINER:=Etienne CHAMPETIER +endef + +define Package/monit/Default/description + An utility for monitoring services on a Unix system +endef + +define Package/monit +$(call Package/monit/Default) + DEPENDS+= +libopenssl + TITLE+= (with SSL support) + VARIANT:=ssl +endef + +define Package/monit/description +$(call Package/monit/Default/description) + This package is built with SSL support. +endef + +define Package/monit-nossl +$(call Package/monit/Default) + TITLE+= (without SSL support) + VARIANT:=nossl +endef + +define Package/monit-nossl/description +$(call Package/monit/Default/description) + This package is built without SSL support. +endef + +CONFIGURE_ARGS += \ + --without-pam \ + libmonit_cv_setjmp_available=yes \ + libmonit_cv_vsnprintf_c99_conformant=yes + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-ssl \ + --with-ssl-dir="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --without-ssl +endif + +define Package/monit/conffiles +/etc/monitrc +endef + +define Package/monit/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/monitrc $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/monit.init $(1)/etc/init.d/monit + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/monit $(1)/usr/bin/ +endef + +Package/monit-nossl/conffiles = $(Package/monit/conffiles) +Package/monit-nossl/install = $(Package/monit/install) + +$(eval $(call BuildPackage,monit)) +$(eval $(call BuildPackage,monit-nossl)) diff --git a/admin/monit/files/monit.init b/admin/monit/files/monit.init new file mode 100644 index 0000000..2bb3609 --- /dev/null +++ b/admin/monit/files/monit.init @@ -0,0 +1,15 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=60 +USE_PROCD=1 +PROG=/usr/bin/monit + +start_service() { + [ -f /etc/monitrc ] || { echo "monit: /etc/monitrc is missing"; return 1; } + chmod 0600 /etc/monitrc + procd_open_instance + # -I runs in foreground, as procd requires + procd_set_param command "$PROG" -I + procd_close_instance +} diff --git a/admin/monit/patches/001-fix-default-piddir.patch b/admin/monit/patches/001-fix-default-piddir.patch new file mode 100644 index 0000000..7af871f --- /dev/null +++ b/admin/monit/patches/001-fix-default-piddir.patch @@ -0,0 +1,18 @@ +--- a/configure ++++ b/configure +@@ -13849,14 +13849,7 @@ fi + # Find the right directory to put the root-mode PID file in + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pid file location" >&5 + $as_echo_n "checking pid file location... " >&6; } +-if test -d "/run" +-then +- piddir="/run" +-elif test -d "/var/run"; then +- piddir="/var/run" +-elif test -d "/etc"; then +- piddir="/etc" +-fi ++piddir="/var/run" + + + cat >>confdefs.h <<_ACEOF diff --git a/admin/muninlite/Makefile b/admin/muninlite/Makefile new file mode 100644 index 0000000..ef7e11d --- /dev/null +++ b/admin/muninlite/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=muninlite +PKG_VERSION:=1.0.4 +PKG_RELEASE:=8 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=a8cc86f0cc536a6c22dc298f4ed55339 +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/muninlite + SECTION:=admin + CATEGORY:=Administration + DEPENDS:=+xinetd + TITLE:=Munin node implemented in shell + URL:=http://sourceforge.net/projects/muninlite/ + PKG_MAINTAINER:=Jonathan McCrohan +endef + +define Package/muninlite/Default/description + Munin node implemented in shell. + Munin is a monitoring system for Unix networks. +endef + +define Package/muninlite/install + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/munin-node $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/xinetd.d + $(INSTALL_DATA) ./files/etc/xinetd.d/munin $(1)/etc/xinetd.d/ +endef + +define Package/muninlite/conffiles +/etc/xinetd.d/munin +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) +endef + +$(eval $(call BuildPackage,muninlite)) diff --git a/admin/muninlite/files/etc/xinetd.d/munin b/admin/muninlite/files/etc/xinetd.d/munin new file mode 100644 index 0000000..012d71b --- /dev/null +++ b/admin/muninlite/files/etc/xinetd.d/munin @@ -0,0 +1,10 @@ +service munin +{ + socket_type = stream + protocol = tcp + wait = no + user = root + group = root + server = /usr/sbin/munin-node + disable = no +} diff --git a/admin/muninlite/patches/001-fix_disks.patch b/admin/muninlite/patches/001-fix_disks.patch new file mode 100644 index 0000000..a2264a8 --- /dev/null +++ b/admin/muninlite/patches/001-fix_disks.patch @@ -0,0 +1,10 @@ +--- a/plugins/df ++++ b/plugins/df +@@ -19,6 +19,6 @@ fetch_df() { + do + PINFO=$(df -P $PART | tail -1); + PNAME=$(echo $PINFO | cut -d\ -f1 | sed 's/[\/.-]/_/g') +- echo "$PNAME.value" $(echo $PINFO | cut -f5 -d\ | sed -e 's/\%//g') ++ echo "$PNAME.value" $(echo $PINFO | sed -e 's/\%//g' -e 's/ */ /g' | cut -f5 -d' ') + done + } diff --git a/admin/muninlite/patches/002-hostname.patch b/admin/muninlite/patches/002-hostname.patch new file mode 100644 index 0000000..5d87168 --- /dev/null +++ b/admin/muninlite/patches/002-hostname.patch @@ -0,0 +1,11 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -113,7 +113,7 @@ PLUGINS=$RES + + # ===== MAIN LOOP ===== + FUNCTIONS="list nodes config fetch version quit" +-HOSTNAME=$(hostname -f 2>/dev/null || hostname) ++HOSTNAME=$(/sbin/uci get "system.@system[0].hostname" 2>/dev/null || cat /proc/sys/kernel/hostname) + echo "# munin node at $HOSTNAME" + while read arg0 arg1 + do diff --git a/admin/muninlite/patches/100-fix-no-ethtool.patch b/admin/muninlite/patches/100-fix-no-ethtool.patch new file mode 100644 index 0000000..88f7e30 --- /dev/null +++ b/admin/muninlite/patches/100-fix-no-ethtool.patch @@ -0,0 +1,21 @@ +--- a/plugins/if_ ++++ b/plugins/if_ +@@ -15,10 +15,14 @@ config_if() { + echo "up.min 0" + echo "up.negative down" + echo "up.cdef up,8,*" +- if ethtool $1 | grep -q Speed; then +- MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000)) +- echo "up.max $MAX" +- echo "down.max $MAX" ++ if [ -n "$(which ethtool)" ]; then ++ if [ -x "$(which ethtool)" ]; then ++ if ethtool $1 | grep -q Speed; then ++ MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000)) ++ echo "up.max $MAX" ++ echo "down.max $MAX" ++ fi ++ fi + fi + } + fetch_if() { diff --git a/admin/muninlite/patches/110-fix-uptime-days.patch b/admin/muninlite/patches/110-fix-uptime-days.patch new file mode 100644 index 0000000..d9aa43f --- /dev/null +++ b/admin/muninlite/patches/110-fix-uptime-days.patch @@ -0,0 +1,12 @@ +--- a/plugins/uptime ++++ b/plugins/uptime +@@ -4,8 +4,7 @@ config_uptime() { + echo "graph_vlabel uptime in days" + echo "uptime.label uptime" + echo "uptime.draw AREA" +- echo "uptime.cdef uptime,86400,/" + } + fetch_uptime() { +- echo "uptime.value" $(cut -d\ -f1 /proc/uptime) ++ awk '{printf "uptime.value %.2f",$1/86400; print ""}' /proc/uptime + } diff --git a/admin/muninlite/patches/200-add-tap-dev.patch b/admin/muninlite/patches/200-add-tap-dev.patch new file mode 100644 index 0000000..fa46ce6 --- /dev/null +++ b/admin/muninlite/patches/200-add-tap-dev.patch @@ -0,0 +1,20 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -72,7 +72,7 @@ RES="" + for PLUG in $PLUGINS + do + if [ "$PLUG" = "if_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed 's/\./VLAN/') + RES="$RES if_$INTERRES" +@@ -80,7 +80,7 @@ do + eval "config_if_${INTERRES}() { config_if $INTER $@; };" + done + elif [ "$PLUG" = "if_err_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed 's/\./VLAN/') + RES="$RES if_err_$INTERRES" diff --git a/admin/muninlite/patches/210-add-bridge-devs.patch b/admin/muninlite/patches/210-add-bridge-devs.patch new file mode 100644 index 0000000..1a76e97 --- /dev/null +++ b/admin/muninlite/patches/210-add-bridge-devs.patch @@ -0,0 +1,24 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -72,17 +72,17 @@ RES="" + for PLUG in $PLUGINS + do + if [ "$PLUG" = "if_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do +- INTERRES=$(echo $INTER | sed 's/\./VLAN/') ++ INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_$INTERRES" + eval "fetch_if_${INTERRES}() { fetch_if $INTER $@; };" + eval "config_if_${INTERRES}() { config_if $INTER $@; };" + done + elif [ "$PLUG" = "if_err_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do +- INTERRES=$(echo $INTER | sed 's/\./VLAN/') ++ INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_err_$INTERRES" + eval "fetch_if_err_${INTERRES}() { fetch_if_err $INTER $@; };" + eval "config_if_err_${INTERRES}() { config_if_err $INTER $@; };" diff --git a/admin/muninlite/patches/220-modify-ifname-parser.patch b/admin/muninlite/patches/220-modify-ifname-parser.patch new file mode 100644 index 0000000..6a2ba23 --- /dev/null +++ b/admin/muninlite/patches/220-modify-ifname-parser.patch @@ -0,0 +1,22 @@ +--- a/plugins/if_ ++++ b/plugins/if_ +@@ -26,7 +26,7 @@ config_if() { + fi + } + fetch_if() { +- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g') ++ IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//') + echo "down.value" $(echo $IINFO | cut -d\ -f1) + echo "up.value" $(echo $IINFO | cut -d\ -f9) + } +--- a/plugins/if_err_ ++++ b/plugins/if_err_ +@@ -15,7 +15,7 @@ config_if_err() { + echo "trans.warning 1" + } + fetch_if_err() { +- IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g') ++ IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ */ /g' -e 's/^[ \t]*//') + echo "rcvd.value" $(echo $IINFO | cut -d\ -f3) + echo "trans.value" $(echo $IINFO | cut -d\ -f11) + } diff --git a/admin/muninlite/patches/230-fix-available-interface-parsing.patch b/admin/muninlite/patches/230-fix-available-interface-parsing.patch new file mode 100644 index 0000000..2f227e5 --- /dev/null +++ b/admin/muninlite/patches/230-fix-available-interface-parsing.patch @@ -0,0 +1,20 @@ +--- a/munin-node.in ++++ b/munin-node.in +@@ -72,7 +72,7 @@ RES="" + for PLUG in $PLUGINS + do + if [ "$PLUG" = "if_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep -E '^ *(ppp|eth|wlan|ath|ra|ipsec|tap|br-)[^:]{1,}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_$INTERRES" +@@ -80,7 +80,7 @@ do + eval "config_if_${INTERRES}() { config_if $INTER $@; };" + done + elif [ "$PLUG" = "if_err_" ]; then +- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); ++ for INTER in $(grep -E '^ *(ppp|eth|wlan|ath|ra|ipsec|tap|br-)[^:]{1,}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); + do + INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') + RES="$RES if_err_$INTERRES" diff --git a/admin/netdata/Makefile b/admin/netdata/Makefile new file mode 100644 index 0000000..022ef8b --- /dev/null +++ b/admin/netdata/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2008-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=netdata +PKG_VERSION:=1.4.0 +PKG_RELEASE:=3 +PKG_MAINTAINER:=Daniel Engberg +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://firehol.org/download/netdata/releases/v$(PKG_VERSION) +PKG_SOURCE_VERSION:=3028b87ee19e8550df6b9decc49733d595e0bd6e + +PKG_INSTALL:=1 +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/netdata + SECTION:=admin + CATEGORY:=Administration + DEPENDS:=+zlib +libuuid + TITLE:=Real-time performance monitoring tool + URL:=http://netdata.firehol.org/ +endef + +define Package/netdata/description + netdata is a highly optimized Linux daemon providing real-time performance + monitoring for Linux systems, applications and SNMP devices over the web. +endef + +define Package/netdata/conffiles +/etc/netdata/ +endef + +define Package/netdata/install + mkdir -p $(1)/etc/netdata + $(CP) $(PKG_INSTALL_DIR)/etc/netdata $(1)/etc + $(CP) ./files/netdata.conf $(1)/etc/netdata + mkdir -p $(1)/usr/share/netdata + $(CP) $(PKG_INSTALL_DIR)/usr/share/netdata $(1)/usr/share + rm $(1)/usr/share/netdata/web/images/animated.gif + rm -rf $(1)/usr/share/netdata/web/old + rm $(1)/usr/share/netdata/web/demo*html + rm $(1)/usr/share/netdata/web/fonts/*.svg + rm $(1)/usr/share/netdata/web/fonts/*.ttf + rm $(1)/usr/share/netdata/web/fonts/*.woff + rm $(1)/usr/share/netdata/web/fonts/*.otf + mkdir -p $(1)/usr/lib/netdata + $(CP) $(PKG_INSTALL_DIR)/usr/lib/netdata $(1)/usr/lib + rm $(1)/usr/lib/netdata/python.d/python-modules-installer.sh + rm -rf $(1)/usr/lib/netdata/python.d/python_modules/pyyaml2 + rm -rf $(1)/usr/lib/netdata/python.d/python_modules/pyyaml3 + chmod 4755 $(1)/usr/lib/netdata/plugins.d/apps.plugin + mkdir -p $(1)/etc/init.d + $(INSTALL_BIN) ./files/netdata.init $(1)/etc/init.d/netdata + mkdir -p $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/netdata $(1)/usr/sbin +endef + +$(eval $(call BuildPackage,netdata)) diff --git a/admin/netdata/files/netdata.conf b/admin/netdata/files/netdata.conf new file mode 100644 index 0000000..8c5c56b --- /dev/null +++ b/admin/netdata/files/netdata.conf @@ -0,0 +1,43 @@ +### NetData Configuration + +### Notes about plugins +### +### charts.d - REQUIRES Bash, enable here and edit charts.d.conf +### apps - none atm +### node.d - REQUIRES node.js +### tc - QoS stats (if wanted) +### cgcroups - No support in OpenWRT/LEDE by default +### health - Disabled by default +### KSM - No support in OpenWRT/LEDE by default +### python.d - REQUIRES python and PyYAML, edit python.d.conf to enable + +[global] + run as user = nobody + web files owner = root + web files group = root + update every = 2 + history = 1800 + access log = none + debug log = syslog + error log = syslog + memory mode = ram + +[plugins] + charts.d = no + apps = no + node.d = no + tc = no + cgroups = no + +[health] + enabled = no + +[plugin:proc] + /proc/net/softnet_stat = no + /proc/net/snmp = no + /sys/kernel/mm/ksm = no + /proc/net/netstat = no + /proc/net/ip_vs_stats = no + /proc/net/stat/synproxy = no + /proc/net/rpc/nfsd = no + /proc/net/rpc/nfs = no diff --git a/admin/netdata/files/netdata.init b/admin/netdata/files/netdata.init new file mode 100644 index 0000000..d4be0a7 --- /dev/null +++ b/admin/netdata/files/netdata.init @@ -0,0 +1,21 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 + +APPBINARY=/usr/sbin/netdata +CONFIGFILE=/etc/netdata/netdata.conf + + start_service() { + mkdir -m 0755 -p /var/cache/netdata + chown nobody /var/cache/netdata + mkdir -m 0755 -p /var/lib/netdata + chown nobody /var/lib/netdata + mkdir -m 0755 -p /var/log/netdata + chown nobody /var/log/netdata + procd_open_instance + procd_set_param command $APPBINARY -nd -c $CONFIGFILE + procd_set_param file $CONFIGFILE + procd_set_param respawn + procd_close_instance + } diff --git a/admin/netdata/patches/001-disable_external_plugins_by_default.patch b/admin/netdata/patches/001-disable_external_plugins_by_default.patch new file mode 100644 index 0000000..cf9dc83 --- /dev/null +++ b/admin/netdata/patches/001-disable_external_plugins_by_default.patch @@ -0,0 +1,26 @@ +diff --git a/conf.d/charts.d.conf b/conf.d/charts.d.conf +index acb2a6f..8111859 100644 +--- a/conf.d/charts.d.conf ++++ b/conf.d/charts.d.conf +@@ -30,7 +30,7 @@ + + # the default enable/disable for all charts.d collectors + # the default is "yes" +-# enable_all_charts="yes" ++enable_all_charts="no" + + # BY DEFAULT ENABLED MODULES + # ap=yes +diff --git a/conf.d/python.d.conf b/conf.d/python.d.conf +index 940bd91..78e2f0a 100644 +--- a/conf.d/python.d.conf ++++ b/conf.d/python.d.conf +@@ -7,7 +7,7 @@ + # + + # Enable / disable the whole python.d.plugin (all its modules) +-enabled: yes ++enabled: no + + # Prevent log flood + # Define how many log messages can be written to log file in one log_interval diff --git a/admin/sudo/Makefile b/admin/sudo/Makefile new file mode 100644 index 0000000..0555161 --- /dev/null +++ b/admin/sudo/Makefile @@ -0,0 +1,98 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=sudo +PKG_VERSION:=1.8.14p3 +PKG_RELEASE:=1 +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=doc/LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.sudo.ws/dist +PKG_MD5SUM:=93dbd1e47c136179ff1b01494c1c0e75 + +PKG_INSTALL:=1 + +PKG_BUILD_DEPENDS:=sudo/host + +include $(INCLUDE_DIR)/package.mk + +define Package/sudo + SECTION:=admin + CATEGORY:=Administration + TITLE:=Delegate authority to run commands + URL:=http://www.sudo.ws/ + MAINTAINER:=Gergely Kiss +endef + +define Package/sudo/description + Sudo (su "do") allows a system administrator to delegate authority to + give certain users (or groups of users) the ability to run some (or + all) commands as root or another user while providing an audit trail of + the commands and their arguments. +endef + +define Package/sudo/conffiles +/etc/sudoers +/etc/sudoers.d/ +endef + +CONFIGURE_ARGS+= \ + --without-pam \ + --disable-pam-session \ + --with-editor=/bin/vi \ + --without-lecture \ + --disable-zlib \ + --with-rundir=/var/lib/sudo \ + --with-vardir=/var/lib/sudo + +CONFIGURE_VARS+= \ + sudo_cv_uid_t_len=10 \ + sudo_cv_func_unsetenv_void=no + +include $(INCLUDE_DIR)/host-build.mk + +define Host/Compile + cd $(HOST_BUILD_DIR)/lib/util; \ + $(MAKE) mksiglist; $(MAKE) mksigname +endef + +define Host/Install + $(INSTALL_DIR) $(HOST_BUILD_PREFIX)/bin + $(CP) $(HOST_BUILD_DIR)/lib/util/mksig{list,name} $(HOST_BUILD_PREFIX)/bin/ +endef + +$(eval $(call HostBuild)) + +define Package/sudo/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/sudo $(1)/usr/bin/ + chmod 4755 $(1)/usr/bin/sudo + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/visudo $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/sudoers $(1)/etc/ + chmod 0440 $(1)/etc/sudoers + $(INSTALL_DIR) $(1)/etc/sudoers.d + $(INSTALL_DIR) $(1)/usr/lib/sudo + $(CP) $(PKG_INSTALL_DIR)/usr/lib/sudo/*.so* $(1)/usr/lib/sudo/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/sudo.init $(1)/etc/init.d/sudo +endef + +define Package/sudo/postinst +#!/bin/sh + +[ -n "$$IPKG_INSTROOT" ] || { + /etc/init.d/sudo enable + /etc/init.d/sudo start +} +endef + +$(eval $(call BuildPackage,sudo)) diff --git a/admin/sudo/files/sudo.init b/admin/sudo/files/sudo.init new file mode 100755 index 0000000..705fe84 --- /dev/null +++ b/admin/sudo/files/sudo.init @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 OpenWrt.org + +START=99 + +start() { + [ -d /var/lib/sudo ] || { + mkdir -m 0755 -p /var/lib/sudo + chmod 0700 /var/lib/sudo + } +} diff --git a/admin/sudo/patches/010-cross-compile-fixes.patch b/admin/sudo/patches/010-cross-compile-fixes.patch new file mode 100644 index 0000000..b9c1e79 --- /dev/null +++ b/admin/sudo/patches/010-cross-compile-fixes.patch @@ -0,0 +1,16 @@ +diff -rupN sudo-1.8.11p2.orig/lib/util/Makefile.in sudo-1.8.11p2/lib/util/Makefile.in +--- sudo-1.8.11p2.orig/lib/util/Makefile.in 2014-10-07 22:26:20.000000000 +0200 ++++ sudo-1.8.11p2/lib/util/Makefile.in 2014-12-09 21:44:35.610041162 +0100 +@@ -142,10 +142,10 @@ libsudo_util.la: $(LTOBJS) @LT_LDDEP@ + esac + + siglist.c: mksiglist +- ./mksiglist > $@ ++ mksiglist > $@ + + signame.c: mksigname +- ./mksigname > $@ ++ mksigname > $@ + + mksiglist: $(srcdir)/mksiglist.c $(srcdir)/mksiglist.h $(incdir)/sudo_compat.h $(top_builddir)/config.h + $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@ diff --git a/admin/sudo/patches/020-no-owner-change.patch b/admin/sudo/patches/020-no-owner-change.patch new file mode 100644 index 0000000..417e95d --- /dev/null +++ b/admin/sudo/patches/020-no-owner-change.patch @@ -0,0 +1,12 @@ +diff -rupN sudo-1.8.11p2.orig/Makefile.in sudo-1.8.11p2/Makefile.in +--- sudo-1.8.11p2.orig/Makefile.in 2014-10-07 22:26:20.000000000 +0200 ++++ sudo-1.8.11p2/Makefile.in 2014-12-09 22:00:27.256934143 +0100 +@@ -62,7 +62,7 @@ SHELL = @SHELL@ + SED = @SED@ + + INSTALL = $(SHELL) $(top_srcdir)/install-sh -c +-INSTALL_OWNER = -o $(install_uid) -g $(install_gid) ++INSTALL_OWNER = + + ECHO_N = @ECHO_N@ + ECHO_C = @ECHO_C@ diff --git a/admin/sudo/patches/030-musl-fix-missing-header.patch b/admin/sudo/patches/030-musl-fix-missing-header.patch new file mode 100644 index 0000000..efb7d87 --- /dev/null +++ b/admin/sudo/patches/030-musl-fix-missing-header.patch @@ -0,0 +1,12 @@ +diff -rupN sudo-1.8.14p3.orig/include/sudo_util.h sudo-1.8.14p3/include/sudo_util.h +--- sudo-1.8.14p3.orig/include/sudo_util.h 2015-07-22 14:22:49.000000000 +0200 ++++ sudo-1.8.14p3/include/sudo_util.h 2015-08-30 18:41:24.509814946 +0200 +@@ -23,6 +23,8 @@ + # include "compat/stdbool.h" + #endif /* HAVE_STDBOOL_H */ + ++#include ++ + /* + * Macros for operating on struct timeval. + */ diff --git a/admin/zabbix/Makefile b/admin/zabbix/Makefile new file mode 100644 index 0000000..f66c237 --- /dev/null +++ b/admin/zabbix/Makefile @@ -0,0 +1,235 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=zabbix +PKG_VERSION:=3.0.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/zabbix +PKG_MD5SUM:=7c45d37000e67d75042695344c9937e0 + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/zabbix/Default + SECTION:=admin + CATEGORY:=Administration + TITLE:=Zabbix + URL:=http://www.zabbix.com/ + SUBMENU:=zabbix + MAINTAINER:=Etienne CHAMPETIER + USERID:=zabbix=53:zabbix=53 + DEPENDS += $(ICONV_DEPENDS) +endef + +define Package/zabbix-agentd + $(call Package/zabbix/Default) + TITLE+= agentd +endef + +define Package/zabbix-extra-mac80211 + $(call Package/zabbix/Default) + TITLE+= discovery/userparameters for mac80211 + DEPENDS = +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS +endef + +define Package/zabbix-extra-network + $(call Package/zabbix/Default) + TITLE+= discovery/userparameters for network + DEPENDS = +zabbix-agentd +libuci-lua +lua +endef + +define Package/zabbix-extra-wifi + $(call Package/zabbix/Default) + TITLE+= discovery/userparameters for wifi + DEPENDS = +zabbix-agentd +libiwinfo-lua +libuci-lua +lua +endef + +define Package/zabbix-sender + $(call Package/zabbix/Default) + TITLE+= sender +endef + +define Package/zabbix-get + $(call Package/zabbix/Default) + TITLE+= get +endef + +define Package/zabbix-server + $(call Package/zabbix/Default) + TITLE+= server + DEPENDS += +libsqlite3 +endef + +define Package/zabbix-proxy + $(call Package/zabbix/Default) + TITLE+= proxy + DEPENDS += +libsqlite3 +endef + +define Package/zabbix-extra-mac80211/description +An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters. +It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root. +See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. +endef + +define Package/zabbix-extra-network/description +An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces. +The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0) +See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. +endef + +define Package/zabbix-extra-wifi/description +An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters. +As it uses libiwinfo, it works with all wifi devices supported by openwrt. +See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates. +endef + +CONFIGURE_ARGS+= \ + --enable-agent \ + --enable-server \ + --enable-proxy \ + $(call autoconf_bool,CONFIG_IPV6,ipv6) \ + --disable-java \ + --with-sqlite3="$(STAGING_DIR)/usr" + +MAKE_FLAGS += ARCH="linux" + +define Package/zabbix/install/sbin + $(INSTALL_DIR) \ + $(1)/usr/sbin + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \ + $(1)/usr/sbin/ +endef + +define Package/zabbix/install/bin + $(INSTALL_DIR) \ + $(1)/usr/bin + + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \ + $(1)/usr/bin/ +endef + +define Package/zabbix/install/etc + $(INSTALL_DIR) \ + $(1)/etc + + $(INSTALL_CONF) \ + $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \ + $(1)/etc/ +endef + +define Package/zabbix/install/init.d + $(INSTALL_DIR) \ + $(1)/etc/init.d + + $(INSTALL_BIN) \ + ./files/zabbix_$(2).init \ + $(1)/etc/init.d/zabbix_$(2) +endef + +define Package/zabbix/install/zabbix.conf.d + $(INSTALL_DIR) \ + $(1)/etc/zabbix_agentd.conf.d + + $(INSTALL_BIN) \ + ./files/$(2) \ + $(1)/etc/zabbix_agentd.conf.d/$(2) +endef + +define Package/zabbix-agentd/conffiles +/etc/zabbix_agentd.conf +endef +define Package/zabbix-server/conffiles +/etc/zabbix_server.conf +endef +define Package/zabbix-proxy/conffiles +/etc/zabbix_proxy.conf +endef + +ifdef CONFIG_PACKAGE_zabbix-extra-mac80211 +define Build/Prepare/zabbix-extra-mac80211 + mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211 + $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/ +endef + +define Build/Compile/zabbix-extra-mac80211 + $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 +endef +endif + +define Build/Prepare + $(call Build/Prepare/Default) + $(call Build/Prepare/zabbix-extra-mac80211) +endef + +define Build/Compile + $(call Build/Compile/Default) + $(call Build/Compile/zabbix-extra-mac80211) +endef + +define Package/zabbix-agentd/install + $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d + $(call Package/zabbix/install/sbin,$(1),agentd) + $(call Package/zabbix/install/etc,$(1),agentd) + $(call Package/zabbix/install/init.d,$(1),agentd) +endef + +define Package/zabbix-extra-mac80211/install + $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211) + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/ + chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211 +endef + +define Package/zabbix-extra-network/install + $(call Package/zabbix/install/zabbix.conf.d,$(1),network) +endef + +define Package/zabbix-extra-wifi/install + $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi) +endef + +define Package/zabbix-sender/install + $(call Package/zabbix/install/bin,$(1),sender) +endef + +define Package/zabbix-get/install + $(call Package/zabbix/install/bin,$(1),get) +endef + +define Package/zabbix-server/install + $(call Package/zabbix/install/sbin,$(1),server) + $(call Package/zabbix/install/etc,$(1),server) +endef + +define Package/zabbix-proxy/install + $(call Package/zabbix/install/sbin,$(1),proxy) + $(call Package/zabbix/install/etc,$(1),proxy) +endef + +$(eval $(call BuildPackage,zabbix-agentd)) +$(eval $(call BuildPackage,zabbix-extra-mac80211)) +$(eval $(call BuildPackage,zabbix-extra-network)) +$(eval $(call BuildPackage,zabbix-extra-wifi)) +$(eval $(call BuildPackage,zabbix-sender)) +$(eval $(call BuildPackage,zabbix-server)) +$(eval $(call BuildPackage,zabbix-proxy)) +$(eval $(call BuildPackage,zabbix-get)) diff --git a/admin/zabbix/files/mac80211 b/admin/zabbix/files/mac80211 new file mode 100644 index 0000000..afa50ae --- /dev/null +++ b/admin/zabbix/files/mac80211 @@ -0,0 +1,27 @@ +#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates + +# If you want to know the exact meaning of an UserParameter, you can search in the ieee80211 standard: +# http://standards.ieee.org/getieee802/download/802.11-2012.pdf +# example: for mac80211.ACKFailureCount search for dot11ACKFailureCount (page 2145) + +# mac80211 phy discovery (like 'phy0') +# example: {"data":[{"{#PHY}":"phy0"}]} +# +UserParameter=mac80211.phydiscovery,zabbix_helper_mac80211 discovery + +#phy statistics (you need {#PHY} as parameter) +# +UserParameter=mac80211.ACKFailureCount[*],zabbix_helper_mac80211 $1 dot11ACKFailureCount +UserParameter=mac80211.FCSErrorCount[*],zabbix_helper_mac80211 $1 dot11FCSErrorCount +UserParameter=mac80211.RTSFailureCount[*],zabbix_helper_mac80211 $1 dot11RTSFailureCount +UserParameter=mac80211.RTSSuccessCount[*],zabbix_helper_mac80211 $1 dot11RTSSuccessCount +UserParameter=mac80211.FailedCount[*],zabbix_helper_mac80211 $1 failed_count +UserParameter=mac80211.FrameDuplicateCount[*],zabbix_helper_mac80211 $1 frame_duplicate_count +UserParameter=mac80211.MulticastReceivedFrameCount[*],zabbix_helper_mac80211 $1 multicast_received_frame_count +UserParameter=mac80211.MulticastTransmittedFrameCount[*],zabbix_helper_mac80211 $1 multicast_transmitted_frame_count +UserParameter=mac80211.MultipleRetryCount[*],zabbix_helper_mac80211 $1 multiple_retry_count +UserParameter=mac80211.ReceivedFragmentCount[*],zabbix_helper_mac80211 $1 received_fragment_count +UserParameter=mac80211.RetryCount[*],zabbix_helper_mac80211 $1 retry_count +UserParameter=mac80211.TransmittedFragmentCount[*],zabbix_helper_mac80211 $1 transmitted_fragment_count +UserParameter=mac80211.TransmittedFrameCount[*],zabbix_helper_mac80211 $1 transmitted_frame_count + diff --git a/admin/zabbix/files/network b/admin/zabbix/files/network new file mode 100644 index 0000000..b68e2a5 --- /dev/null +++ b/admin/zabbix/files/network @@ -0,0 +1,9 @@ +#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates + +# network interface discovery +# example: {"data":[{"{#IF}":"lo", "{#NET}":"loopback"},{"{#IF}":"br-lan", "{#NET}":"lan"},{"{#IF}":"eth0.1", "{#NET}":"wan"}]} +# +UserParameter=netowrt.discovery,lua -l uci -e 'x = uci.cursor(nil, "/var/state");list = "{\"data\":[";x:foreach("network", "interface", function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", \"{#NET}\":\""..s[".name"].."\"}," end); list=string.gsub(list,",$",""); print(list.."]}")' + + + diff --git a/admin/zabbix/files/wifi b/admin/zabbix/files/wifi new file mode 100644 index 0000000..f03d9b4 --- /dev/null +++ b/admin/zabbix/files/wifi @@ -0,0 +1,25 @@ +#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates + +# wifi interface discovery +# example: {"data":[{"{#IF}":"wlan0", "{#MODE}":"ap", "{#SSID}":"Openwrt", "{#NET}":"lan", "{#DEV}":"radio0", "{#ENC}":"psk2+ccmp", "{#TYPE}":"mac80211", "{#HWMODE}":"11ng", "{#CHANNEL}":"11", "{#BSSID}":"xx:xx:xx:xx:xx:xx"}]} +# ubus call only work as root so you need to run zabbix as root to use wifi.ifdiscovery +UserParameter=wifi.ifdiscovery, lua -l ubus -l iwinfo -e 'u=ubus.connect();list="{\"data\":[";stat=u:call("network.wireless", "status", {});for dev, dev_table in pairs(stat) do for i, iface in pairs(dev_table["interfaces"]) do c=iface["config"];i=iface["ifname"];t=iwinfo.type(i);iw=iwinfo[t];e = iw.encryption(i);e = e and e.description or "None";n = table.concat(c["network"]," ");list=list.."{\"{#IF}\":\""..i.."\", \"{#MODE}\":\""..iw.mode(i).."\", \"{#SSID}\":\""..c["ssid"].."\", \"{#NET}\":\""..n.."\", \"{#DEV}\":\""..dev.."\", \"{#ENC}\":\""..e.."\", \"{#TYPE}\":\""..t.."\", \"{#HWMODE}\":\"".."?".."\", \"{#CHANNEL}\":\""..iw.channel(i).."\", \"{#BSSID}\":\""..iw.bssid(i).."\"},";end;end;list=string.gsub(list,",$","");print(list.."]}")' + + +#iwinfo info (you need {#IF} as parameter, like 'wlan0') +UserParameter=wifi.iwinfo.channel[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].channel('$1'))" +UserParameter=wifi.iwinfo.frequency[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].frequency('$1'))" +UserParameter=wifi.iwinfo.txpower[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].txpower('$1'))" +UserParameter=wifi.iwinfo.bitrate[*],lua -l iwinfo -e "b = iwinfo[iwinfo.type('$1')].bitrate('$1'); print(b or '0')" +UserParameter=wifi.iwinfo.signal[*],lua -l iwinfo -e "s = iwinfo[iwinfo.type('$1')].signal('$1'); print(s or '-255')" +UserParameter=wifi.iwinfo.noise[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].noise('$1'))" +UserParameter=wifi.iwinfo.quality[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality('$1'))" +UserParameter=wifi.iwinfo.quality_max[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality_max('$1'))" +UserParameter=wifi.iwinfo.mode[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].mode('$1'))" +UserParameter=wifi.iwinfo.ssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].ssid('$1'))" +UserParameter=wifi.iwinfo.bssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].bssid('$1'))" +UserParameter=wifi.iwinfo.country[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].country('$1'))" +UserParameter=wifi.iwinfo.nbusers[*],lua -l iwinfo -e "n = 0; for _,_ in pairs(iwinfo[iwinfo.type('$1')].assoclist('$1')) do n = n + 1 end; print(n)" +UserParameter=wifi.iwinfo.encryption[*],lua -l iwinfo -e "e = iwinfo[iwinfo.type('$1')].encryption('$1'); print(e and e.description or 'None')" +UserParameter=wifi.iwinfo.hwmode[*],lua -l iwinfo -e "x=iwinfo[iwinfo.type('$1')].hwmodelist('$1'); print((x.a and 'a' or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or ''))" + diff --git a/admin/zabbix/files/zabbix_agentd.init b/admin/zabbix/files/zabbix_agentd.init new file mode 100755 index 0000000..ea88634 --- /dev/null +++ b/admin/zabbix/files/zabbix_agentd.init @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2011 OpenWrt.org + +START=60 + +USE_PROCD=1 +PROG=/usr/sbin/zabbix_agentd +CONFIG=/etc/zabbix_agentd.conf + +start_service() { + # Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf + [ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG} + + [ -f ${CONFIG} ] || return 1 + + procd_open_instance + procd_set_param command ${PROG} -c ${CONFIG} -f + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance +} + diff --git a/admin/zabbix/files/zabbix_helper_mac80211.c b/admin/zabbix/files/zabbix_helper_mac80211.c new file mode 100644 index 0000000..1442d27 --- /dev/null +++ b/admin/zabbix/files/zabbix_helper_mac80211.c @@ -0,0 +1,77 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +int discovery() +{ + DIR *dir; + struct dirent *ent; + bool comma = false; + if ((dir = opendir ("/sys/kernel/debug/ieee80211/")) != NULL) { + printf("{\"data\":["); + while ((ent = readdir (dir)) != NULL) { + if (strcmp(".", ent->d_name) && strcmp("..", ent->d_name)) { + if (comma) + printf(","); + printf("{\"{#PHY}\":\"%s\"}", ent->d_name); + comma = true; + } + } + printf("]}\n"); + closedir(dir); + } else { + perror(""); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} + +int get_param(char *phy, char *stat) +{ + char *filename = NULL; + FILE *f = NULL; + phy = basename(phy); + stat = basename(stat); + if (asprintf(&filename, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy, stat) > 0) + f = fopen(filename, "r"); + + if (f != NULL) { + char temp[256]; + while (fgets(temp, 256, f) != NULL) + printf("%s",temp); + + fclose(f); + } else { + perror(""); + return EXIT_FAILURE; + } + free(filename); + return EXIT_SUCCESS; +} + +int usage(char *name) +{ + fprintf(stderr, "Usage:\n"); + fprintf(stderr, " %s discovery\n", name); + fprintf(stderr, " => print mac80211.phydiscovery discovery rule\n"); + fprintf(stderr, " %s PHY STAT\n", name); + fprintf(stderr, " => cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n"); + return EXIT_FAILURE; +} + +int main(int argc, char *argv[]) +{ + + switch (argc) { + case 2: + return discovery(); + case 3: + return get_param(argv[1], argv[2]); + default: + return usage(argv[0]); + } +} diff --git a/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch b/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch new file mode 100644 index 0000000..f4b5d33 --- /dev/null +++ b/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch @@ -0,0 +1,35 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -161,6 +161,10 @@ if test "x$found_resolv" != "xyes"; then + AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)]) + fi + LIBS="${LIBS} ${RESOLV_LIBS}" ++AC_SEARCH_LIBS([res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])]) ++AC_SEARCH_LIBS([__res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])]) ++AC_SEARCH_LIBS([res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])]) ++AC_SEARCH_LIBS([__res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])]) + + dnl ***************************************************************** + dnl * * +--- a/src/libs/zbxsysinfo/common/net.c ++++ b/src/libs/zbxsysinfo/common/net.c +@@ -471,6 +471,7 @@ static int dns_query(AGENT_REQUEST *requ + return SYSINFO_RET_FAIL; + } + ++#if defined(HAVE_RES_MKQUERY) && defined(HAVE_RES_SEND) + if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf)))) + { + SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot create DNS query: %s", zbx_strerror(errno))); +@@ -505,6 +506,11 @@ static int dns_query(AGENT_REQUEST *requ + _res.retry = retry; + + res = res_send(buf, res, answer.buffer, sizeof(answer.buffer)); ++#else /* defined(HAVE_RES_QUERY) && defined(HAVE_RES_SEND) */ ++ /* retrand and retry are ignored */ ++ if (-1 == (res = res_query(zone, C_IN, type, answer.buffer, sizeof(answer.buffer)))) ++ return SYSINFO_RET_FAIL; ++#endif + + _res.options = saved_options; + _res.retrans = saved_retrans; diff --git a/admin/zabbix/patches/002-uclibc_loadavg.patch b/admin/zabbix/patches/002-uclibc_loadavg.patch new file mode 100644 index 0000000..ce62d06 --- /dev/null +++ b/admin/zabbix/patches/002-uclibc_loadavg.patch @@ -0,0 +1,48 @@ +--- a/src/libs/zbxsysinfo/linux/cpu.c ++++ b/src/libs/zbxsysinfo/linux/cpu.c +@@ -22,6 +22,45 @@ + #include "stats.h" + #include "log.h" + ++ ++/* uclibc and dietlibc do not have this junk -ReneR */ ++#if defined (__UCLIBC__) || defined (__dietlibc__) ++static int getloadavg (double loadavg[], int nelem) ++{ ++ int fd; ++ ++ fd = open ("/proc/loadavg", O_RDONLY); ++ if (fd < 0) ++ return -1; ++ else ++ { ++ char buf[65], *p; ++ ssize_t nread; ++ int i; ++ ++ nread = read (fd, buf, sizeof buf - 1); ++ close (fd); ++ if (nread <= 0) ++ return -1; ++ buf[nread - 1] = '\0'; ++ ++ if (nelem > 3) ++ nelem = 3; ++ p = buf; ++ for (i = 0; i < nelem; ++i) ++ { ++ char *endp; ++ loadavg[i] = strtod (p, &endp); ++ if (endp == p) ++ return -1; ++ p = endp; ++ } ++ ++ return i; ++ } ++} ++#endif ++ + int SYSTEM_CPU_NUM(AGENT_REQUEST *request, AGENT_RESULT *result) + { + char *type; diff --git a/admin/zabbix/patches/003-change-user-and-foreground.patch b/admin/zabbix/patches/003-change-user-and-foreground.patch new file mode 100644 index 0000000..6779e47 --- /dev/null +++ b/admin/zabbix/patches/003-change-user-and-foreground.patch @@ -0,0 +1,17 @@ +--- a/src/libs/zbxnix/daemon.c ++++ b/src/libs/zbxnix/daemon.c +@@ -300,11 +300,14 @@ int daemon_start(int allow_root, const c + + if (0 == allow_root && 0 == getuid()) /* running as root? */ + { ++#if 0 ++/* allow changing user and foreground */ + if (0 != (flags & ZBX_TASK_FLAG_FOREGROUND)) + { + zbx_error("cannot run as root!"); + exit(EXIT_FAILURE); + } ++#endif + + if (NULL == user) + user = "zabbix"; diff --git a/admin/zabbix/patches/010-change-agentd-config.patch b/admin/zabbix/patches/010-change-agentd-config.patch new file mode 100644 index 0000000..8b16b28 --- /dev/null +++ b/admin/zabbix/patches/010-change-agentd-config.patch @@ -0,0 +1,65 @@ +--- a/conf/zabbix_agentd.conf ++++ b/conf/zabbix_agentd.conf +@@ -3,12 +3,11 @@ + + ############ GENERAL PARAMETERS ################# + +-### Option: PidFile +-# Name of PID file. +-# +-# Mandatory: no +-# Default: +-# PidFile=/tmp/zabbix_agentd.pid ++# We do not need PidFile with procd ++# PidFile=/var/run/zabbix_agentd.pid ++ ++# use syslog ++LogType=system + + ### Option: LogType + # Specifies where log messages are written to: +@@ -27,8 +26,6 @@ + # Default: + # LogFile= + +-LogFile=/tmp/zabbix_agentd.log +- + ### Option: LogFileSize + # Maximum size of log file in MB. + # 0 - disable automatic log rotation. +@@ -114,6 +111,7 @@ Server=127.0.0.1 + # Range: 0-100 + # Default: + # StartAgents=3 ++StartAgents=1 + + ##### Active checks related + +@@ -129,8 +127,6 @@ Server=127.0.0.1 + # Default: + # ServerActive= + +-ServerActive=127.0.0.1 +- + ### Option: Hostname + # Unique, case sensitive hostname. + # Required for active checks and must match hostname as configured on the server. +@@ -140,8 +136,6 @@ ServerActive=127.0.0.1 + # Default: + # Hostname= + +-Hostname=Zabbix server +- + ### Option: HostnameItem + # Item used for generating Hostname if it is undefined. Ignored if Hostname is defined. + # Does not support UserParameters or aliases. +@@ -259,8 +253,8 @@ Hostname=Zabbix server + # Include= + + # Include=/usr/local/etc/zabbix_agentd.userparams.conf +-# Include=/usr/local/etc/zabbix_agentd.conf.d/ + # Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf ++Include=/etc/zabbix_agentd.conf.d/ + + ####### USER-DEFINED MONITORED PARAMETERS ####### + diff --git a/admin/zabbix/patches/100-musl-compat.patch b/admin/zabbix/patches/100-musl-compat.patch new file mode 100644 index 0000000..61aeb9e --- /dev/null +++ b/admin/zabbix/patches/100-musl-compat.patch @@ -0,0 +1,23 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -51,7 +51,7 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string + syslog.h time.h errno.h sys/types.h sys/stat.h netinet/in.h \ + math.h sys/socket.h dirent.h ctype.h \ + mtent.h fcntl.h sys/param.h arpa/inet.h \ +- sys/vfs.h sys/pstat.h sys/sysinfo.h sys/statvfs.h sys/statfs.h \ ++ sys/vfs.h sys/pstat.h sys/statvfs.h sys/statfs.h \ + sys/socket.h sys/loadavg.h arpa/inet.h \ + sys/vmmeter.h strings.h vm/vm_param.h \ + sys/time.h kstat.h sys/syscall.h sys/sysmacros.h \ +@@ -63,6 +63,11 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string + Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \ + execinfo.h libperfstat.h sys/systemcfg.h sys/mnttab.h mntent.h sys/times.h \ + dlfcn.h sys/utsname.h) ++AC_CHECK_HEADERS(sys/sysinfo.h, [], [], [ ++#ifdef HAVE_LINUX_KERNEL_H ++# include ++#endif ++]) + AC_CHECK_HEADERS(resolv.h, [], [], [ + #ifdef HAVE_SYS_TYPES_H + # include diff --git a/devel/autoconf/Makefile b/devel/autoconf/Makefile new file mode 100644 index 0000000..598654d --- /dev/null +++ b/devel/autoconf/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=autoconf +PKG_VERSION:=2.69 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=@GNU/autoconf +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MD5SUM:=50f97f4159805e374639a73e2636f22e +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_VARS += M4=m4 EMACS=no + +define Package/autoconf + SECTION:=devel + CATEGORY:=Development + TITLE:=autoconf + URL:=https://www.gnu.org/software/autoconf/ + DEPENDS:=+m4 +perl +perlbase-data +perlbase-file +perlbase-getopt \ + +perlbase-dynaloader +perlbase-text +endef + +define Package/autoconf/description + Autoconf is an extensible package of M4 macros that produce shell scripts to + automatically configure software source code packages. +endef + +define Build/Install + $(SED) 's/@PERL@/\/usr\/bin\/perl/g' $(PKG_BUILD_DIR)/bin/Makefile.in + $(call Build/Install/Default) +endef + +define Package/autoconf/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/autoconf + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/INSTALL \ + $(1)/usr/share/autoconf/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autom4te.cfg \ + $(1)/usr/share/autoconf/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/Autom4te + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/Autom4te/* \ + $(1)/usr/share/autoconf/Autom4te/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/autoconf + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autoconf/* \ + $(1)/usr/share/autoconf/autoconf/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/autoscan + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autoscan/* \ + $(1)/usr/share/autoconf/autoscan/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/autotest + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/autotest/* \ + $(1)/usr/share/autoconf/autotest/ + $(INSTALL_DIR) $(1)/usr/share/autoconf/m4sugar + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/autoconf/m4sugar/* \ + $(1)/usr/share/autoconf/m4sugar/ +endef + +$(eval $(call BuildPackage,autoconf)) diff --git a/devel/automake/Makefile b/devel/automake/Makefile new file mode 100644 index 0000000..8357011 --- /dev/null +++ b/devel/automake/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=automake +PKG_VERSION:=1.15 +PKG_RELEASE:=4 + +PKG_SOURCE_URL:=@GNU/automake +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MD5SUM:=9a1ddb0e053474d9d1105cfe39b0c48d +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/automake + SECTION:=devel + CATEGORY:=Development + TITLE:=automake + URL:=https://www.gnu.org/software/automake/ + DEPENDS:=+autoconf +perlbase-thread +perlbase-attributes +endef + +define Package/automake/description + Automake is a tool for automatically generating Makefile.in files compliant + with the GNU Coding Standards. +endef + +FIX_PATHS = $(SED) '1c \#!/usr/bin/perl' -e 's| /[^ ]*/bin/perl| /usr/bin/perl|g' + +define Package/automake/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/automake-$(PKG_VERSION) \ + $(1)/usr/bin/automake-$(PKG_VERSION) + $(LN) automake-$(PKG_VERSION) $(1)/usr/bin/automake + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aclocal-$(PKG_VERSION) \ + $(1)/usr/bin/aclocal-$(PKG_VERSION) + $(LN) aclocal-$(PKG_VERSION) $(1)/usr/bin/aclocal + $(FIX_PATHS) $(1)/usr/bin/automake-$(PKG_VERSION) + $(FIX_PATHS) $(1)/usr/bin/aclocal-$(PKG_VERSION) + $(INSTALL_DIR) $(1)/usr/share/automake-$(PKG_VERSION) + + for dir in \ + automake-$(PKG_VERSION) automake-$(PKG_VERSION)/Automake \ + automake-$(PKG_VERSION)/am aclocal \ + aclocal-$(PKG_VERSION) aclocal-$(PKG_VERSION)/internal \ + ; do \ + $(INSTALL_DIR) $(1)/usr/share/$$$$dir; \ + for file in $$$$(cd $(PKG_INSTALL_DIR) && \ + find usr/share/$$$$dir -maxdepth 1 -type f); do \ + $(INSTALL_DATA) $$(PKG_INSTALL_DIR)/$$$$file \ + $(1)/$$$$file; \ + done; \ + done +endef + +$(eval $(call BuildPackage,automake)) diff --git a/devel/diffutils/Makefile b/devel/diffutils/Makefile new file mode 100644 index 0000000..fb00a42 --- /dev/null +++ b/devel/diffutils/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2008-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=diffutils +PKG_VERSION:=3.3 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/diffutils +PKG_MD5SUM:=99180208ec2a82ce71f55b0d7389f1b3 +PKG_MAINTAINER:=Roger D +PKG_LICENSE:=GPL-3.0 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/diffutils + SECTION:=devel + CATEGORY:=Development + DEPENDS:=+USE_GLIBC:librt + TITLE:=diffutils + URL:=http://www.gnu.org/software/diffutils/ +endef + +define Package/diffutils/description + The Diffutils package contains programs that show the differences between + files or directories. +endef + +CONFIGURE_VARS += \ + ac_cv_func_mempcpy=n +TARGET_CFLAGS += --std=gnu99 + +define Package/diffutils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sdiff,diff3,diff,cmp} $(1)/usr/bin/ +endef + +define Package/diffutils/preinst +#!/bin/sh +for x in sdiff diff3 diff cmp; do + [ -L "$${IPKG_INSTROOT}/usr/bin/$$x" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/$$x" +done +exit 0 +endef + +define Package/diffutils/postrm +#!/bin/sh +for x in sdiff diff3 diff cmp; do + /bin/busybox $$x -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/$$x +done +exit 0 +endef + +$(eval $(call BuildPackage,diffutils)) diff --git a/devel/gcc/Makefile b/devel/gcc/Makefile new file mode 100644 index 0000000..b23b7ab --- /dev/null +++ b/devel/gcc/Makefile @@ -0,0 +1,167 @@ +# +# Copyright (C) 2008 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gcc +PKG_VERSION:=5.4.0 +PKG_RELEASE:=1 +PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION) +PKG_MD5SUM:=4c626ac2a83ef30dfb9260e6f59c2b30 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_INSTALL:=1 +PKG_FIXUP:=libtool +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +TARGET_LANGUAGES:="c,c++" +BUGURL=https://dev.openwrt.org/ +PKGVERSION=OpenWrt GCC $(PKG_VERSION) + +# not using sstrip here as this fucks up the .so's somehow +STRIP:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip +RSTRIP:= \ + NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \ + STRIP="$(STRIP)" \ + STRIP_KMOD="$(STRIP) --strip-debug" \ + $(SCRIPT_DIR)/rstrip.sh + + +define Package/gcc + SECTION:=devel + CATEGORY:=Development + TITLE:=gcc + MAINTAINER:=Noble Pepper + DEPENDS:= +binutils +libstdcpp +endef + +define Package/gcc/description + build a native toolchain for compiling on target +endef + +GMPSRC=gmp-4.3.2 + +define Download/gmp + URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/ + FILE:=$(GMPSRC).tar.bz2 + MD5SUM:=dd60683d7057917e34630b4a787932e8 +endef +$(eval $(call Download,gmp)) + +MPCSRC=mpc-0.8.1 + +define Download/mpc + URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/ + FILE:=$(MPCSRC).tar.gz + MD5SUM:=5b34aa804d514cc295414a963aedb6bf +endef +$(eval $(call Download,mpc)) + +MPFRSRC=mpfr-2.4.2 + +define Download/mpfr + URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/ + FILE:=$(MPFRSRC).tar.bz2 + MD5SUM:=89e59fe665e2b3ad44a6789f40b059a0 +endef +$(eval $(call Download,mpfr)) + +define Build/Prepare + $(PKG_UNPACK) +# we have to download and unpack additional stuff before patching + tar -C $(PKG_BUILD_DIR) -xvjf $(DL_DIR)/$(GMPSRC).tar.bz2 + ln -sf $(PKG_BUILD_DIR)/$(GMPSRC) $(PKG_BUILD_DIR)/gmp + tar -C $(PKG_BUILD_DIR) -xvzf $(DL_DIR)/$(MPCSRC).tar.gz + ln -sf $(PKG_BUILD_DIR)/$(MPCSRC) $(PKG_BUILD_DIR)/mpc + tar -C $(PKG_BUILD_DIR) -xvjf $(DL_DIR)/$(MPFRSRC).tar.bz2 + ln -sf $(PKG_BUILD_DIR)/$(MPFRSRC) $(PKG_BUILD_DIR)/mpfr + $(Build/Patch) +# poor man's fix for `none-openwrt-linux' not recognized when building with musl + cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpfr/ + cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/gmp/ + cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpc/ +endef + + +define Build/Configure + (cd $(PKG_BUILD_DIR); rm -f config.cache; \ + SHELL="$(BASH)" \ + $(TARGET_CONFIGURE_OPTS) \ + $(PKG_BUILD_DIR)/configure \ + $(CONFIGURE_ARGS) \ + --build=$(GNU_HOST_NAME) \ + --host=$(REAL_GNU_TARGET_NAME) \ + --target=$(REAL_GNU_TARGET_NAME) \ + --enable-languages=$(TARGET_LANGUAGES) \ + --with-bugurl=$(BUGURL) \ + --with-pkgversion="$(PKGVERSION)" \ + --enable-shared \ + $(if $(CONFIG_LIBC_USE_GLIBC),--enable,--disable)-__cxa_atexit \ + --with-default-libstdcxx-abi=gcc4-compatible \ + --enable-target-optspace \ + --with-gnu-ld \ + --disable-nls \ + --disable-libsanitizer \ + --disable-libvtv \ + --disable-libcilkrts \ + --disable-libmudflap \ + --disable-multilib \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-decimal-float \ + --disable-libstdcxx-pch \ + --with-host-libstdcxx=-lstdc++ \ + --prefix=/usr \ + --libexecdir=/usr/lib \ + --with-local-prefix=/usr \ + $(SOFT_FLOAT_CONFIG_OPTION) \ + $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \ + ); +endef + +define Build/Compile + export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install +endef + +ENVCFLAGS:="$(TARGET_OPTIMIZATION) $(EXTRA_OPTIMIZATION) +ifeq ($(CONFIG_SOFT_FLOAT),y) + ifeq ($(CONFIG_arm),y) + ENVCFLAGS+= -mfloat-abi=soft + else + ENVCFLAGS+= -msoft-float + endif +endif +ENVCFLAGS+=" + +ENVLDFLAGS:="-Wl,-rpath=/usr/lib -Wl,--dynamic-linker=/usr/lib/$(DYNLINKER) -L/usr/lib" + +define Package/gcc/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr + cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin + ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++ + ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++ + ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++ + ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc + ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION) + cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib + cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr + cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + cp -a $(TOOLCHAIN_DIR)/lib/libm.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION) + rm -f $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libgo* + rm -f $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libcc1* + echo '#!/bin/sh' > $(1)/usr/bin/gcc_env.sh + echo 'export LDFLAGS=$(ENVLDFLAGS)' >> $(1)/usr/bin/gcc_env.sh + echo 'export CFLAGS=$(ENVCFLAGS)' >> $(1)/usr/bin/gcc_env.sh + chmod +x $(1)/usr/bin/gcc_env.sh +endef + +$(eval $(call BuildPackage,gcc)) diff --git a/devel/gcc/README b/devel/gcc/README new file mode 100644 index 0000000..58db474 --- /dev/null +++ b/devel/gcc/README @@ -0,0 +1,10 @@ +Native GCC that runs on target. + +To save disk space, this GCC only supports dynamic linking on the target box, +there are no static libraries shipped except libgcc.a on those architectures +that need it. + +For now, this was only tested on arm (EABI) and mips targets. Others to be +done... + + Christian Beier diff --git a/devel/gcc/patches/001-revert_register_mode_search.patch b/devel/gcc/patches/001-revert_register_mode_search.patch new file mode 100644 index 0000000..06373eb --- /dev/null +++ b/devel/gcc/patches/001-revert_register_mode_search.patch @@ -0,0 +1,65 @@ +Revert of: + +commit 275035b56823b26d5fb7e90fad945b998648edf2 +Author: bergner +Date: Thu Sep 5 14:09:07 2013 +0000 + + PR target/58139 + * reginfo.c (choose_hard_reg_mode): Scan through all mode classes + looking for widest mode. + + + git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202286 138bc75d-0d04-0410-961f-82ee72b054a4 + + +--- a/gcc/reginfo.c ++++ b/gcc/reginfo.c +@@ -665,35 +665,40 @@ choose_hard_reg_mode (unsigned int regno + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + ++ if (found_mode != VOIDmode) ++ return found_mode; ++ + for (mode = GET_CLASS_NARROWEST_MODE (MODE_FLOAT); + mode != VOIDmode; + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + ++ if (found_mode != VOIDmode) ++ return found_mode; ++ + for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_FLOAT); + mode != VOIDmode; + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + ++ if (found_mode != VOIDmode) ++ return found_mode; ++ + for (mode = GET_CLASS_NARROWEST_MODE (MODE_VECTOR_INT); + mode != VOIDmode; + mode = GET_MODE_WIDER_MODE (mode)) + if ((unsigned) hard_regno_nregs[regno][mode] == nregs + && HARD_REGNO_MODE_OK (regno, mode) +- && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode)) +- && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode)) ++ && (! call_saved || ! HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))) + found_mode = mode; + + if (found_mode != VOIDmode) diff --git a/devel/gcc/patches/002-case_insensitive.patch b/devel/gcc/patches/002-case_insensitive.patch new file mode 100644 index 0000000..b3d2dbe --- /dev/null +++ b/devel/gcc/patches/002-case_insensitive.patch @@ -0,0 +1,14 @@ +--- a/include/filenames.h ++++ b/include/filenames.h +@@ -43,11 +43,6 @@ extern "C" { + # define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) + # define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) + #else /* not DOSish */ +-# if defined(__APPLE__) +-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM +-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 +-# endif +-# endif /* __APPLE__ */ + # define HAS_DRIVE_SPEC(f) (0) + # define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) + # define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f) diff --git a/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch b/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch new file mode 100644 index 0000000..a00cbcd --- /dev/null +++ b/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch @@ -0,0 +1,14 @@ +--- a/gcc/real.h ++++ b/gcc/real.h +@@ -75,9 +75,10 @@ + + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */ + + /* Verify the guess. */ ++#ifndef __LP64__ + extern char test_real_width + [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1]; +- ++#endif + /* Calculate the format for CONST_DOUBLE. We need as many slots as + are necessary to overlay a REAL_VALUE_TYPE on them. This could be + as many as four (32-bit HOST_WIDE_INT, 128-bit REAL_VALUE_TYPE). diff --git a/devel/gcc/patches/003-mpfr-longlong-mips.patch b/devel/gcc/patches/003-mpfr-longlong-mips.patch new file mode 100644 index 0000000..0ab9fe5 --- /dev/null +++ b/devel/gcc/patches/003-mpfr-longlong-mips.patch @@ -0,0 +1,38 @@ +diff -Naurd mpfr-2.4.2-a/mpfr-longlong.h mpfr-2.4.2-b/mpfr-longlong.h +--- -a/mpfr-2.4.2/mpfr-longlong.h 2009-11-30 02:43:08.000000000 +0000 ++++ -b/mpfr-2.4.2/mpfr-longlong.h 2009-12-18 12:04:29.000000000 +0000 +@@ -1011,7 +1011,15 @@ + #endif /* __m88000__ */ + + #if defined (__mips) && W_TYPE_SIZE == 32 +-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 ++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) ++#define umul_ppmm(w1, w0, u, v) \ ++ do { \ ++ UDItype _r; \ ++ _r = (UDItype) u * v; \ ++ (w1) = _r >> 32; \ ++ (w0) = (USItype) _r; \ ++ } while (0) ++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 + #define umul_ppmm(w1, w0, u, v) \ + __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v)) + #else +@@ -1024,7 +1032,16 @@ + #endif /* __mips */ + + #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64 +-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 ++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) ++typedef unsigned int UTItype __attribute__ ((mode (TI))); ++#define umul_ppmm(w1, w0, u, v) \ ++ do { \ ++ UTItype _r; \ ++ _r = (UTItype) u * v; \ ++ (w1) = _r >> 64; \ ++ (w0) = (UDItype) _r; \ ++ } while (0) ++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 + #define umul_ppmm(w1, w0, u, v) \ + __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v)) + #else diff --git a/devel/gcc/patches/010-documentation.patch b/devel/gcc/patches/010-documentation.patch new file mode 100644 index 0000000..07064a9 --- /dev/null +++ b/devel/gcc/patches/010-documentation.patch @@ -0,0 +1,23 @@ +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -2941,18 +2941,10 @@ doc/gcc.info: $(TEXI_GCC_FILES) + doc/gccint.info: $(TEXI_GCCINT_FILES) + doc/cppinternals.info: $(TEXI_CPPINT_FILES) + +-doc/%.info: %.texi +- if [ x$(BUILD_INFO) = xinfo ]; then \ +- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \ +- -I $(gcc_docdir)/include -o $@ $<; \ +- fi ++doc/%.info: + + # Duplicate entry to handle renaming of gccinstall.info +-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES) +- if [ x$(BUILD_INFO) = xinfo ]; then \ +- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \ +- -I $(gcc_docdir)/include -o $@ $<; \ +- fi ++doc/gccinstall.info: + + doc/cpp.dvi: $(TEXI_CPP_FILES) + doc/gcc.dvi: $(TEXI_GCC_FILES) diff --git a/devel/gcc/patches/020-no-plt-backport.patch b/devel/gcc/patches/020-no-plt-backport.patch new file mode 100644 index 0000000..b9702c9 --- /dev/null +++ b/devel/gcc/patches/020-no-plt-backport.patch @@ -0,0 +1,28 @@ +--- a/gcc/calls.c ++++ b/gcc/calls.c +@@ -225,6 +225,12 @@ prepare_call_address (tree fndecl_or_typ + && targetm.small_register_classes_for_mode_p (FUNCTION_MODE)) + ? force_not_mem (memory_address (FUNCTION_MODE, funexp)) + : memory_address (FUNCTION_MODE, funexp)); ++ else if (flag_pic && !flag_plt && fndecl_or_type ++ && TREE_CODE (fndecl_or_type) == FUNCTION_DECL ++ && !targetm.binds_local_p (fndecl_or_type)) ++ { ++ funexp = force_reg (Pmode, funexp); ++ } + else if (! sibcallp) + { + #ifndef NO_FUNCTION_CSE +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -1779,6 +1779,10 @@ fpie + Common Report Var(flag_pie,1) Negative(fPIC) + Generate position-independent code for executables if possible (small mode) + ++fplt ++Common Report Var(flag_plt) Init(1) ++Use PLT for PIC calls (-fno-plt: load the address from GOT at call site) ++ + fplugin= + Common Joined RejectNegative Var(common_deferred_options) Defer + Specify a plugin to load diff --git a/devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch b/devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch new file mode 100644 index 0000000..e88af34 --- /dev/null +++ b/devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch @@ -0,0 +1,23 @@ +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -8001,9 +8001,17 @@ mask_low_and_shift_p (machine_mode mode, + bool + and_operands_ok (machine_mode mode, rtx op1, rtx op2) + { +- return (memory_operand (op1, mode) +- ? and_load_operand (op2, mode) +- : and_reg_operand (op2, mode)); ++ if (!memory_operand (op1, mode)) ++ return and_reg_operand (op2, mode); ++ ++ if (!and_load_operand (op2, mode)) ++ return false; ++ ++ if (!TARGET_MIPS16 || si_mask_operand(op2, mode)) ++ return true; ++ ++ op1 = XEXP (op1, 0); ++ return !(REG_P (op1) && REGNO (op1) == STACK_POINTER_REGNUM); + } + + /* The canonical form of a mask-low-and-shift-left operation is diff --git a/devel/gcc/patches/100-uclibc-conf.patch b/devel/gcc/patches/100-uclibc-conf.patch new file mode 100644 index 0000000..ff9ad94 --- /dev/null +++ b/devel/gcc/patches/100-uclibc-conf.patch @@ -0,0 +1,33 @@ +--- a/contrib/regression/objs-gcc.sh ++++ b/contrib/regression/objs-gcc.sh +@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H + then + make all-gdb all-dejagnu all-ld || exit 1 + make install-gdb install-dejagnu install-ld || exit 1 ++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ] ++ then ++ make all-gdb all-dejagnu all-ld || exit 1 ++ make install-gdb install-dejagnu install-ld || exit 1 + elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then + make bootstrap || exit 1 + make install || exit 1 +--- a/libjava/classpath/ltconfig ++++ b/libjava/classpath/ltconfig +@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)- + + # Transform linux* to *-*-linux-gnu*, to support old configure scripts. + case $host_os in +-linux-gnu*) ;; ++linux-gnu*|linux-uclibc*) ;; + linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` + esac + +@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux + ;; + + # This must be Linux ELF. +-linux-gnu*) ++linux*) + version_type=linux + need_lib_prefix=no + need_version=no diff --git a/devel/gcc/patches/200-musl_config.patch b/devel/gcc/patches/200-musl_config.patch new file mode 100644 index 0000000..b9a5b28 --- /dev/null +++ b/devel/gcc/patches/200-musl_config.patch @@ -0,0 +1,309 @@ +From: ktkachov +Date: Fri, 8 May 2015 08:25:47 +0000 (+0000) +Subject: [PATCH 2/13] musl libc config +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a9173ceabaf29c16f8ef226fbf98af373a4b2ceb + +[PATCH 2/13] musl libc config + +2015-05-08 Gregor Richards + Szabolcs Nagy + + * config.gcc (LIBC_MUSL): New tm_defines macro. + * config/linux.h (OPTION_MUSL): Define. + (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER32,) + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32,) + (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,) + (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,) + (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define. + * config/linux.opt (mmusl): New option. + * doc/invoke.texi (GNU/Linux Options): Document -mmusl. + * configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*. + (gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*. + * configure: Regenerate. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222904 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -575,7 +575,7 @@ case ${target} in + esac + + # Common C libraries. +-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" ++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" + + # 32-bit x86 processors supported by --with-arch=. Each processor + # MUST be separated by exactly one space. +@@ -720,6 +720,9 @@ case ${target} in + *-*-*uclibc*) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" + ;; ++ *-*-*musl*) ++ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" ++ ;; + *) + tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" + ;; +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ +@@ -50,21 +52,25 @@ see the files COPYING3 and COPYING.RUNTI + } while (0) + + /* Determine which dynamic linker to use depending on whether GLIBC or +- uClibc or Bionic is the default C library and whether +- -muclibc or -mglibc or -mbionic has been passed to change the default. */ ++ uClibc or Bionic or musl is the default C library and whether ++ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change ++ the default. */ + +-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ +- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" ++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ ++ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" + + #if DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) + #elif DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) + #elif DEFAULT_LIBC == LIBC_BIONIC +-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ +- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ ++ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) + #else + #error "Unsupported DEFAULT_LIBC" + #endif /* DEFAULT_LIBC */ +@@ -81,24 +87,100 @@ see the files COPYING3 and COPYING.RUNTI + #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" + #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" + #define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32" ++/* Should be redefined for each target that supports musl. */ ++#define MUSL_DYNAMIC_LINKER "/dev/null" ++#define MUSL_DYNAMIC_LINKER32 "/dev/null" ++#define MUSL_DYNAMIC_LINKER64 "/dev/null" ++#define MUSL_DYNAMIC_LINKERX32 "/dev/null" + + #define GNU_USER_DYNAMIC_LINKER \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ +- BIONIC_DYNAMIC_LINKER) ++ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + #define GNU_USER_DYNAMIC_LINKER32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ +- BIONIC_DYNAMIC_LINKER32) ++ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ +- BIONIC_DYNAMIC_LINKER64) ++ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + #define GNU_USER_DYNAMIC_LINKERX32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ +- BIONIC_DYNAMIC_LINKERX32) ++ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32) + + /* Whether we have Bionic libc runtime */ + #undef TARGET_HAS_BIONIC + #define TARGET_HAS_BIONIC (OPTION_BIONIC) + ++/* musl avoids problematic includes by rearranging the include directories. ++ * Unfortunately, this is mostly duplicated from cppdefault.c */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define INCLUDE_DEFAULTS_MUSL_GPP \ ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, ++ ++#ifdef LOCAL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_LOCAL ++#endif ++ ++#ifdef PREFIX_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_PREFIX ++#endif ++ ++#ifdef CROSS_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_CROSS \ ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#ifdef TOOL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_TOOL \ ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_TOOL ++#endif ++ ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_NATIVE ++#endif ++ ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL ++# define INCLUDE_DEFAULTS_MUSL_LOCAL ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE ++# define INCLUDE_DEFAULTS_MUSL_NATIVE ++#else ++# undef INCLUDE_DEFAULTS_MUSL_CROSS ++# define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#undef INCLUDE_DEFAULTS ++#define INCLUDE_DEFAULTS \ ++ { \ ++ INCLUDE_DEFAULTS_MUSL_GPP \ ++ INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ INCLUDE_DEFAULTS_MUSL_CROSS \ ++ INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { 0, 0, 0, 0, 0, 0 } \ ++ } ++#endif ++ + #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ + /* This is a *uclinux* target. We don't define below macros to normal linux + versions, because doing so would require *uclinux* targets to include +--- a/gcc/config/linux.opt ++++ b/gcc/config/linux.opt +@@ -28,5 +28,9 @@ Target Report RejectNegative Var(linux_l + Use GNU C library + + muclibc +-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic) ++Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl) + Use uClibc C library ++ ++mmusl ++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic) ++Use musl C library +--- a/gcc/configure ++++ b/gcc/configure +@@ -27833,6 +27833,9 @@ if test "${gcc_cv_libc_provides_ssp+set} + else + gcc_cv_libc_provides_ssp=no + case "$target" in ++ *-*-musl*) ++ # All versions of musl provide stack protector ++ gcc_cv_libc_provides_ssp=yes;; + *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) + # glibc 2.4 and later provides __stack_chk_fail and + # either __stack_chk_guard, or TLS access to stack guard canary. +@@ -27865,6 +27868,7 @@ fi + # ) and for now + # simply assert that glibc does provide this, which is true for all + # realistically usable GNU/Hurd configurations. ++ # All supported versions of musl provide it as well + gcc_cv_libc_provides_ssp=yes;; + *-*-darwin* | *-*-freebsd*) + ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail" +@@ -27961,6 +27965,9 @@ case "$target" in + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -5287,6 +5287,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe + gcc_cv_libc_provides_ssp, + [gcc_cv_libc_provides_ssp=no + case "$target" in ++ *-*-musl*) ++ # All versions of musl provide stack protector ++ gcc_cv_libc_provides_ssp=yes;; + *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) + # glibc 2.4 and later provides __stack_chk_fail and + # either __stack_chk_guard, or TLS access to stack guard canary. +@@ -5313,6 +5316,7 @@ AC_CACHE_CHECK(__stack_chk_fail in targe + # ) and for now + # simply assert that glibc does provide this, which is true for all + # realistically usable GNU/Hurd configurations. ++ # All supported versions of musl provide it as well + gcc_cv_libc_provides_ssp=yes;; + *-*-darwin* | *-*-freebsd*) + AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], +@@ -5386,6 +5390,9 @@ case "$target" in + gcc_cv_target_dl_iterate_phdr=no + fi + ;; ++ *-linux-musl*) ++ gcc_cv_target_dl_iterate_phdr=yes ++ ;; + esac + GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) + if test x$gcc_cv_target_dl_iterate_phdr = xyes; then +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -667,7 +667,7 @@ Objective-C and Objective-C++ Dialects}. + -mcpu=@var{cpu}} + + @emph{GNU/Linux Options} +-@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol ++@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol + -tno-android-cc -tno-android-ld} + + @emph{H8/300 Options} +@@ -15340,13 +15340,19 @@ These @samp{-m} options are defined for + @item -mglibc + @opindex mglibc + Use the GNU C library. This is the default except +-on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets. ++on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and ++@samp{*-*-linux-*android*} targets. + + @item -muclibc + @opindex muclibc + Use uClibc C library. This is the default on + @samp{*-*-linux-*uclibc*} targets. + ++@item -mmusl ++@opindex mmusl ++Use the musl C library. This is the default on ++@samp{*-*-linux-*musl*} targets. ++ + @item -mbionic + @opindex mbionic + Use Bionic C library. This is the default on diff --git a/devel/gcc/patches/201-musl_arm.patch b/devel/gcc/patches/201-musl_arm.patch new file mode 100644 index 0000000..27a26af --- /dev/null +++ b/devel/gcc/patches/201-musl_arm.patch @@ -0,0 +1,43 @@ +From: ktkachov +Date: Wed, 27 May 2015 13:17:11 +0000 (+0000) +Subject: [PATCH 4/13] arm musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=de799bd087ab9a179768fea75bd195a31d3432a4 + +[PATCH 4/13] arm musl support + +On behalf of szabolcs.nagy@arm.com + +2015-05-27 Gregor Richards + + * config/arm/linux-eabi.h (MUSL_DYNAMIC_LINKER): Define. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223749 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -77,6 +77,23 @@ + %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \ + %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}" + ++/* For ARM musl currently supports four dynamic linkers: ++ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI ++ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI ++ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB ++ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB ++ musl does not support the legacy OABI mode. ++ All the dynamic linkers live in /lib. ++ We default to soft-float, EL. */ ++#undef MUSL_DYNAMIC_LINKER ++#if TARGET_BIG_ENDIAN_DEFAULT ++#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}" ++#endif ++#define MUSL_DYNAMIC_LINKER \ ++ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC diff --git a/devel/gcc/patches/202-musl_mips.patch b/devel/gcc/patches/202-musl_mips.patch new file mode 100644 index 0000000..816dd8d --- /dev/null +++ b/devel/gcc/patches/202-musl_mips.patch @@ -0,0 +1,35 @@ +From: ktkachov +Date: Fri, 8 May 2015 15:16:50 +0000 (+0000) +Subject: [PATCH 6/13] mips musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2550b6a866c887472b587bef87d433c51cf1ebc8 + +[PATCH 6/13] mips musl support + +2015-05-08 Gregor Richards + Szabolcs Nagy + + * config/mips/linux.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERN32): Define. + (GNU_USER_DYNAMIC_LINKERN32): Update. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222915 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/mips/linux.h ++++ b/gcc/config/mips/linux.h +@@ -37,7 +37,13 @@ along with GCC; see the file COPYING3. + #define UCLIBC_DYNAMIC_LINKERN32 \ + "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}" + ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1" ++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1" ++ + #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32" + #define GNU_USER_DYNAMIC_LINKERN32 \ + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \ +- BIONIC_DYNAMIC_LINKERN32) ++ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32) diff --git a/devel/gcc/patches/203-musl_powerpc.patch b/devel/gcc/patches/203-musl_powerpc.patch new file mode 100644 index 0000000..b4f34e8 --- /dev/null +++ b/devel/gcc/patches/203-musl_powerpc.patch @@ -0,0 +1,209 @@ + +gcc/Changelog: + +2015-04-24 Gregor Richards + Szabolcs Nagy + + * config.gcc (secure_plt): Add *-linux*-musl*. + * config/rs6000/linux64.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64): Define. + (GNU_USER_DYNAMIC_LINKER32): Update. + (GNU_USER_DYNAMIC_LINKER64): Update. + (CHOOSE_DYNAMIC_LINKER): Update. + + * config/rs6000/secureplt.h (LINK_SECURE_PLT_DEFAULT_SPEC): Define. + * config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Update. + (MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER_E,) + (INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,) + (INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,) + (INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define. + (LINK_SECURE_PLT_DEFAULT_SPEC): Define. + (CHOOSE_DYNAMIC_LINKER, LINK_TARGET_SPEC, LINK_OS_LINUX_SPEC): Update. + + * config/rs6000/sysv4le.h (MUSL_DYNAMIC_LINKER_E): Define. + +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -365,17 +365,21 @@ extern int dot_symbols; + #endif + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER32 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) + #define GNU_USER_DYNAMIC_LINKER64 \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) + + #undef DEFAULT_ASM_ENDIAN + #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) +--- a/gcc/config/rs6000/secureplt.h ++++ b/gcc/config/rs6000/secureplt.h +@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3. + . */ + + #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt" ++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt" +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + #ifndef CC1_SECURE_PLT_DEFAULT_SPEC + #define CC1_SECURE_PLT_DEFAULT_SPEC "" + #endif ++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC ++#define LINK_SECURE_PLT_DEFAULT_SPEC "" ++#endif + + /* Pass -G xxx to the compiler. */ + #undef CC1_SPEC +@@ -574,7 +577,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + %{R*} \ + %(link_shlib) \ + %{!T*: %(link_start) } \ +-%(link_os)" ++%(link_os)" \ ++"%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}" + + /* Shared libraries are not default. */ + #define LINK_SHLIB_SPEC "\ +@@ -757,17 +761,22 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + + #define LINK_START_LINUX_SPEC "" + ++#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","") ++ + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" ++#elif DEFAULT_LIBC == LIBC_MUSL ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" + #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC +-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" + #else + #error "Unsupported DEFAULT_LIBC" + #endif + #define GNU_USER_DYNAMIC_LINKER \ +- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) + + #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ + %{rdynamic:-export-dynamic} \ +@@ -889,6 +898,7 @@ ncrtn.o%s" + { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ + { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ + { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ ++ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \ + { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ + { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ + { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ +@@ -943,3 +953,72 @@ ncrtn.o%s" + /* This target uses the sysv4.opt file. */ + #define TARGET_USES_SYSV4_OPT 1 + ++/* Include order changes for musl, same as in generic linux.h. */ ++#if DEFAULT_LIBC == LIBC_MUSL ++#define INCLUDE_DEFAULTS_MUSL_GPP \ ++ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ ++ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ ++ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \ ++ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, ++ ++#ifdef LOCAL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_LOCAL \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \ ++ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_LOCAL ++#endif ++ ++#ifdef PREFIX_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_PREFIX ++#endif ++ ++#ifdef CROSS_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_CROSS \ ++ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#ifdef TOOL_INCLUDE_DIR ++#define INCLUDE_DEFAULTS_MUSL_TOOL \ ++ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, ++#else ++#define INCLUDE_DEFAULTS_MUSL_TOOL ++#endif ++ ++#ifdef NATIVE_SYSTEM_HEADER_DIR ++#define INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ ++ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, ++#else ++#define INCLUDE_DEFAULTS_MUSL_NATIVE ++#endif ++ ++#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) ++# undef INCLUDE_DEFAULTS_MUSL_LOCAL ++# define INCLUDE_DEFAULTS_MUSL_LOCAL ++# undef INCLUDE_DEFAULTS_MUSL_NATIVE ++# define INCLUDE_DEFAULTS_MUSL_NATIVE ++#else ++# undef INCLUDE_DEFAULTS_MUSL_CROSS ++# define INCLUDE_DEFAULTS_MUSL_CROSS ++#endif ++ ++#undef INCLUDE_DEFAULTS ++#define INCLUDE_DEFAULTS \ ++ { \ ++ INCLUDE_DEFAULTS_MUSL_GPP \ ++ INCLUDE_DEFAULTS_MUSL_PREFIX \ ++ INCLUDE_DEFAULTS_MUSL_CROSS \ ++ INCLUDE_DEFAULTS_MUSL_TOOL \ ++ INCLUDE_DEFAULTS_MUSL_NATIVE \ ++ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ ++ { 0, 0, 0, 0, 0, 0 } \ ++ } ++#endif +--- a/gcc/config/rs6000/sysv4le.h ++++ b/gcc/config/rs6000/sysv4le.h +@@ -31,3 +31,5 @@ + /* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */ + #define LINUX64_DEFAULT_ABI_ELFv2 + ++#undef MUSL_DYNAMIC_LINKER_E ++#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","le") +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -2416,6 +2416,10 @@ powerpc*-*-linux*) + powerpc*-*-linux*paired*) + tm_file="${tm_file} rs6000/750cl.h" ;; + esac ++ case ${target} in ++ *-linux*-musl*) ++ enable_secureplt=yes ;; ++ esac + if test x${enable_secureplt} = xyes; then + tm_file="rs6000/secureplt.h ${tm_file}" + fi diff --git a/devel/gcc/patches/204-musl_sh.patch b/devel/gcc/patches/204-musl_sh.patch new file mode 100644 index 0000000..8c3753d --- /dev/null +++ b/devel/gcc/patches/204-musl_sh.patch @@ -0,0 +1,39 @@ +gcc/Changelog: + +2015-04-27 Gregor Richards + Szabolcs Nagy + + * config/sh/linux.h (MUSL_DYNAMIC_LINKER): Define. + (MUSL_DYNAMIC_LINKER_E, MUSL_DYNAMIC_LINKER_FP): Define. + +--- a/gcc/config/sh/linux.h ++++ b/gcc/config/sh/linux.h +@@ -43,6 +43,28 @@ along with GCC; see the file COPYING3. + + #define TARGET_ASM_FILE_END file_end_indicate_exec_stack + ++#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN ++#define MUSL_DYNAMIC_LINKER_E "%{mb:eb}" ++#else ++#define MUSL_DYNAMIC_LINKER_E "%{!ml:eb}" ++#endif ++ ++#if TARGET_CPU_DEFAULT & ( MASK_HARD_SH2A_DOUBLE | MASK_SH4 ) ++/* "-nofpu" if any nofpu option is specified */ ++#define MUSL_DYNAMIC_LINKER_FP \ ++ "%{m1|m2|m2a-nofpu|m3|m4-nofpu|m4-100-nofpu|m4-200-nofpu|m4-300-nofpu|" \ ++ "m4-340|m4-400|m4-500|m4al|m5-32media-nofpu|m5-64media-nofpu|" \ ++ "m5-compact-nofpu:-nofpu}" ++#else ++/* "-nofpu" if none of the hard fpu options are specified */ ++#define MUSL_DYNAMIC_LINKER_FP \ ++ "%{m2a|m4|m4-100|m4-200|m4-300|m4a|m5-32media|m5-64media|m5-compact:;:-nofpu}" ++#endif ++ ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER \ ++ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP ".so.1" ++ + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + + #undef SUBTARGET_LINK_EMUL_SUFFIX diff --git a/devel/gcc/patches/205-musl_x86.patch b/devel/gcc/patches/205-musl_x86.patch new file mode 100644 index 0000000..8772328 --- /dev/null +++ b/devel/gcc/patches/205-musl_x86.patch @@ -0,0 +1,41 @@ +From: ktkachov +Date: Fri, 15 May 2015 13:20:01 +0000 (+0000) +Subject: [PATCH 9/13] x86 musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=5551c8d927c17f60837f15f8dfe46f945ba3fa9c + +[PATCH 9/13] x86 musl support + +On behalf of Szabolcs Nagy. + +2015-05-15 Gregor Richards + + * config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define. + * config/i386/linux64.h (MUSL_DYNAMIC_LINKER32): Define. + (MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32): Define. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223218 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/i386/linux.h ++++ b/gcc/config/i386/linux.h +@@ -21,3 +21,6 @@ along with GCC; see the file COPYING3. + + #define GNU_USER_LINK_EMULATION "elf_i386" + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" +--- a/gcc/config/i386/linux64.h ++++ b/gcc/config/i386/linux64.h +@@ -30,3 +30,10 @@ see the files COPYING3 and COPYING.RUNTI + #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2" + #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2" + #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2" ++ ++#undef MUSL_DYNAMIC_LINKER32 ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" ++#undef MUSL_DYNAMIC_LINKER64 ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" ++#undef MUSL_DYNAMIC_LINKERX32 ++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" diff --git a/devel/gcc/patches/206-musl_aarch64.patch b/devel/gcc/patches/206-musl_aarch64.patch new file mode 100644 index 0000000..6925a02 --- /dev/null +++ b/devel/gcc/patches/206-musl_aarch64.patch @@ -0,0 +1,31 @@ +From: jgreenhalgh +Date: Wed, 27 May 2015 16:46:39 +0000 (+0000) +Subject: [PATCH 3/13] aarch64 musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=b3ff21cf0531be91bc3fb8200296a7633090ec78 + +[PATCH 3/13] aarch64 musl support + +gcc/Changelog: + +2015-05-27 Gregor Richards + Szabolcs Nagy + + * config/aarch64/aarch64-linux.h (MUSL_DYNAMIC_LINKER): Define. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223766 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/aarch64/aarch64-linux.h ++++ b/gcc/config/aarch64/aarch64-linux.h +@@ -23,6 +23,9 @@ + + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" + ++#undef MUSL_DYNAMIC_LINKER ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" ++ + #undef ASAN_CC1_SPEC + #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}" + diff --git a/devel/gcc/patches/207-musl_fixincludes.patch b/devel/gcc/patches/207-musl_fixincludes.patch new file mode 100644 index 0000000..0ff33d3 --- /dev/null +++ b/devel/gcc/patches/207-musl_fixincludes.patch @@ -0,0 +1,30 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:18:16 +0000 (+0000) +Subject: fixincludes update for musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2dc727de2e87c2756a514cbb43cea23c99deaa3d + +fixincludes update for musl support + +On behalf of Szabolcs.Nagy@arm.com + +2015-04-22 Gregor Richards + + * mkfixinc.sh: Add *-musl* with no fixes. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222327 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/fixincludes/mkfixinc.sh ++++ b/fixincludes/mkfixinc.sh +@@ -19,7 +19,8 @@ case $machine in + powerpc-*-eabi* | \ + powerpc-*-rtems* | \ + powerpcle-*-eabisim* | \ +- powerpcle-*-eabi* ) ++ powerpcle-*-eabi* | \ ++ *-musl* ) + # IF there is no include fixing, + # THEN create a no-op fixer and exit + (echo "#! /bin/sh" ; echo "exit 0" ) > ${target} diff --git a/devel/gcc/patches/209-musl_libstdc++.patch b/devel/gcc/patches/209-musl_libstdc++.patch new file mode 100644 index 0000000..d2414d0 --- /dev/null +++ b/devel/gcc/patches/209-musl_libstdc++.patch @@ -0,0 +1,72 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:24:11 +0000 (+0000) +Subject: libstdc++, libgfortran gthr workaround for musl +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=1e5f711c11cb80ce609db9e9c1d8b2da0f7b5b61 + +libstdc++, libgfortran gthr workaround for musl + +On behalf of szabolcs.nagy@arm.com + +[libstdc++-v3/] +2015-04-22 Szabolcs Nagy + + * config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define. + * configure.host (os_include_dir): Set to "os/generic" for linux-musl*. + +[libgfortran/] +2015-04-22 Szabolcs Nagy + + * acinclude.m4 (GTHREAD_USE_WEAK): Define as 0 for *-*-musl*. + * configure: Regenerate. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222329 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/libgfortran/acinclude.m4 ++++ b/libgfortran/acinclude.m4 +@@ -100,7 +100,7 @@ void foo (void); + [Define to 1 if the target supports #pragma weak]) + fi + case "$host" in +- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) ++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* ) + AC_DEFINE(GTHREAD_USE_WEAK, 0, + [Define to 0 if the target shouldn't use #pragma weak]) + ;; +--- a/libgfortran/configure ++++ b/libgfortran/configure +@@ -26456,7 +26456,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>con + + fi + case "$host" in +- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) ++ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* ) + + $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h + +--- a/libstdc++-v3/config/os/generic/os_defines.h ++++ b/libstdc++-v3/config/os/generic/os_defines.h +@@ -33,4 +33,9 @@ + // System-specific #define, typedefs, corrections, etc, go here. This + // file will come before all others. + ++// Disable the weak reference logic in gthr.h for os/generic because it ++// is broken on every platform unless there is implementation specific ++// workaround in gthr-posix.h and at link-time for static linking. ++#define _GLIBCXX_GTHREAD_USE_WEAK 0 ++ + #endif +--- a/libstdc++-v3/configure.host ++++ b/libstdc++-v3/configure.host +@@ -273,6 +273,9 @@ case "${host_os}" in + freebsd*) + os_include_dir="os/bsd/freebsd" + ;; ++ linux-musl*) ++ os_include_dir="os/generic" ++ ;; + gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) + if [ "$uclibc" = "yes" ]; then + os_include_dir="os/uclibc" diff --git a/devel/gcc/patches/230-musl_libssp.patch b/devel/gcc/patches/230-musl_libssp.patch new file mode 100644 index 0000000..30f42e9 --- /dev/null +++ b/devel/gcc/patches/230-musl_libssp.patch @@ -0,0 +1,13 @@ +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -727,7 +727,9 @@ proper position among the other output f + #endif + + #ifndef LINK_SSP_SPEC +-#ifdef TARGET_LIBC_PROVIDES_SSP ++#if DEFAULT_LIBC == LIBC_MUSL ++#define LINK_SSP_SPEC "-lssp_nonshared" ++#elif defined(TARGET_LIBC_PROVIDES_SSP) + #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ + "|fstack-protector-strong|fstack-protector-explicit:}" + #else diff --git a/devel/gcc/patches/240-musl-libitm-fixes.patch b/devel/gcc/patches/240-musl-libitm-fixes.patch new file mode 100644 index 0000000..533cb68 --- /dev/null +++ b/devel/gcc/patches/240-musl-libitm-fixes.patch @@ -0,0 +1,61 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:11:25 +0000 (+0000) +Subject: libitm fixes for musl support +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=e53a4d49c3d03ab8eaddb073cf972c1c46d75338 + +libitm fixes for musl support + +On behalf of Szabolcs.Nagy@arm.com + +2015-04-22 Gregor Richards + + * config/arm/hwcap.cc: Use fcntl.h instead of sys/fcntl.h. + * config/linux/x86/tls.h: Only use __GLIBC_PREREQ if defined. + + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222325 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/libitm/config/arm/hwcap.cc ++++ b/libitm/config/arm/hwcap.cc +@@ -40,7 +40,7 @@ int GTM_hwcap HIDDEN = 0 + + #ifdef __linux__ + #include +-#include ++#include + #include + + static void __attribute__((constructor)) +--- a/libitm/config/linux/x86/tls.h ++++ b/libitm/config/linux/x86/tls.h +@@ -25,16 +25,19 @@ + #ifndef LIBITM_X86_TLS_H + #define LIBITM_X86_TLS_H 1 + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + /* Use slots in the TCB head rather than __thread lookups. + GLIBC has reserved words 10 through 13 for TM. */ + #define HAVE_ARCH_GTM_THREAD 1 + #define HAVE_ARCH_GTM_THREAD_DISP 1 + #endif ++#endif + + #include "config/generic/tls.h" + +-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) ++#if defined(__GLIBC_PREREQ) ++#if __GLIBC_PREREQ(2, 10) + namespace GTM HIDDEN { + + #ifdef __x86_64__ +@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a + + } // namespace GTM + #endif /* >= GLIBC 2.10 */ ++#endif + + #endif // LIBITM_X86_TLS_H diff --git a/devel/gcc/patches/250-add-musl.patch b/devel/gcc/patches/250-add-musl.patch new file mode 100644 index 0000000..8cbedde --- /dev/null +++ b/devel/gcc/patches/250-add-musl.patch @@ -0,0 +1,120 @@ +From: ktkachov +Date: Fri, 8 May 2015 08:30:40 +0000 (+0000) +Subject: [PATCH 0/13] Add musl support to GCC +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=f2d678afa5b8385d763b93772d73d6bf80a9739e + +[PATCH 0/13] Add musl support to GCC + +2015-05-08 Szabolcs Nagy + + * config/glibc-stdint.h (OPTION_MUSL): Define. + (INT_FAST16_TYPE, INT_FAST32_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE): + Change the definition based on OPTION_MUSL for 64 bit targets. + * config/linux.h (OPTION_MUSL): Redefine. + * config/alpha/linux.h (OPTION_MUSL): Redefine. + * config/rs6000/linux.h (OPTION_MUSL): Redefine. + * config/rs6000/linux64.h (OPTION_MUSL): Redefine. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222905 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/gcc/config/alpha/linux.h ++++ b/gcc/config/alpha/linux.h +@@ -61,10 +61,14 @@ along with GCC; see the file COPYING3. + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; +--- a/gcc/config/glibc-stdint.h ++++ b/gcc/config/glibc-stdint.h +@@ -22,6 +22,12 @@ a copy of the GCC Runtime Library Except + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + ++/* Systems using musl libc should use this header and make sure ++ OPTION_MUSL is defined correctly before using the TYPE macros. */ ++#ifndef OPTION_MUSL ++#define OPTION_MUSL 0 ++#endif ++ + #define SIG_ATOMIC_TYPE "int" + + #define INT8_TYPE "signed char" +@@ -43,12 +49,12 @@ see the files COPYING3 and COPYING.RUNTI + #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + + #define INT_FAST8_TYPE "signed char" +-#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +-#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") ++#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") ++#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int") + #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") + #define UINT_FAST8_TYPE "unsigned char" +-#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") +-#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") ++#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") ++#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int") + #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") + + #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -32,11 +32,13 @@ see the files COPYING3 and COPYING.RUNTI + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL + #define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL + #define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + +--- a/gcc/config/rs6000/linux.h ++++ b/gcc/config/rs6000/linux.h +@@ -30,10 +30,14 @@ + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -299,10 +299,14 @@ extern int dot_symbols; + #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) + #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) + #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) + #else + #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) + #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) + #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) ++#undef OPTION_MUSL ++#define OPTION_MUSL (linux_libc == LIBC_MUSL) + #endif + + /* Determine what functions are present at the runtime; diff --git a/devel/gcc/patches/260-musl-add-unwind-fix.patch b/devel/gcc/patches/260-musl-add-unwind-fix.patch new file mode 100644 index 0000000..a3b83e2 --- /dev/null +++ b/devel/gcc/patches/260-musl-add-unwind-fix.patch @@ -0,0 +1,34 @@ +From: ktkachov +Date: Wed, 22 Apr 2015 14:20:01 +0000 (+0000) +Subject: unwind fix for musl +X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a2e31d0681d8a47389b8a3552622fbd9827bcef4 + +unwind fix for musl + +On behalf of szabolcs.nagy@arm.com + +2015-04-22 Gregor Richards + Szabolcs Nagy + + * unwind-dw2-fde-dip.c (USE_PT_GNU_EH_FRAME): Define it on + Linux if target provides dl_iterate_phdr. + + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222328 138bc75d-0d04-0410-961f-82ee72b054a4 +--- + +--- a/libgcc/unwind-dw2-fde-dip.c ++++ b/libgcc/unwind-dw2-fde-dip.c +@@ -59,6 +59,12 @@ + + #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ + && defined(TARGET_DL_ITERATE_PHDR) \ ++ && defined(__linux__) ++# define USE_PT_GNU_EH_FRAME ++#endif ++ ++#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ ++ && defined(TARGET_DL_ITERATE_PHDR) \ + && (defined(__DragonFly__) || defined(__FreeBSD__)) + # define ElfW __ElfN + # define USE_PT_GNU_EH_FRAME diff --git a/devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch b/devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch new file mode 100644 index 0000000..bdebf6c --- /dev/null +++ b/devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch @@ -0,0 +1,24 @@ +--- a/gcc/config/rs6000/linux64.h ++++ b/gcc/config/rs6000/linux64.h +@@ -369,8 +369,8 @@ extern int dot_symbols; + #endif + #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" + #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" +-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" +-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" ++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC + #define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_GLIBC +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -765,7 +765,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF + + #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" + #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1" ++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" + #if DEFAULT_LIBC == LIBC_UCLIBC + #define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" + #elif DEFAULT_LIBC == LIBC_MUSL diff --git a/devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch b/devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch new file mode 100644 index 0000000..1743658 --- /dev/null +++ b/devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch @@ -0,0 +1,14 @@ +Use the proper rtx cost model for the selected CPU, even when optimizing +for size. This generates better code. + +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -17483,7 +17483,7 @@ mips_option_override (void) + flag_pcc_struct_return = 0; + + /* Decide which rtx_costs structure to use. */ +- if (optimize_size) ++ if (0 && optimize_size) + mips_cost = &mips_rtx_cost_optimize_size; + else + mips_cost = &mips_rtx_cost_data[mips_tune]; diff --git a/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch b/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch new file mode 100644 index 0000000..0edeb13 --- /dev/null +++ b/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/arm/arm.h ++++ b/gcc/config/arm/arm.h +@@ -285,7 +285,7 @@ extern void (*arm_lang_output_object_att + /* Thumb-1 only. */ + #define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm) + +-#define TARGET_LDRD (arm_arch5e && ARM_DOUBLEWORD_ALIGN \ ++#define TARGET_LDRD (arm_arch6 && ARM_DOUBLEWORD_ALIGN \ + && !TARGET_THUMB1) + + #define TARGET_CRC32 (arm_arch_crc) diff --git a/devel/gcc/patches/810-arm-softfloat-libgcc.patch b/devel/gcc/patches/810-arm-softfloat-libgcc.patch new file mode 100644 index 0000000..1d06f5b --- /dev/null +++ b/devel/gcc/patches/810-arm-softfloat-libgcc.patch @@ -0,0 +1,25 @@ +--- a/libgcc/config/arm/t-linux ++++ b/libgcc/config/arm/t-linux +@@ -1,6 +1,10 @@ + LIB1ASMSRC = arm/lib1funcs.S + LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \ +- _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 ++ _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \ ++ _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \ ++ _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \ ++ _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \ ++ _arm_fixsfsi _arm_fixunssfsi + + # Just for these, we omit the frame pointer since it makes such a big + # difference. +--- a/gcc/config/arm/linux-elf.h ++++ b/gcc/config/arm/linux-elf.h +@@ -60,8 +60,6 @@ + %{shared:-lc} \ + %{!shared:%{profile:-lc_p}%{!profile:-lc}}" + +-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" +- + #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" + + #define LINUX_TARGET_LINK_SPEC "%{h*} \ diff --git a/devel/gcc/patches/820-libgcc_pic.patch b/devel/gcc/patches/820-libgcc_pic.patch new file mode 100644 index 0000000..42bf0c8 --- /dev/null +++ b/devel/gcc/patches/820-libgcc_pic.patch @@ -0,0 +1,36 @@ +--- a/libgcc/Makefile.in ++++ b/libgcc/Makefile.in +@@ -887,11 +887,12 @@ $(libgcov-driver-objects): %$(objext): $ + + # Static libraries. + libgcc.a: $(libgcc-objects) ++libgcc_pic.a: $(libgcc-s-objects) + libgcov.a: $(libgcov-objects) + libunwind.a: $(libunwind-objects) + libgcc_eh.a: $(libgcc-eh-objects) + +-libgcc.a libgcov.a libunwind.a libgcc_eh.a: ++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a: + -rm -f $@ + + objects="$(objects)"; \ +@@ -913,7 +914,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E + endif + + ifeq ($(enable_shared),yes) +-all: libgcc_eh.a libgcc_s$(SHLIB_EXT) ++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT) + ifneq ($(LIBUNWIND),) + all: libunwind$(SHLIB_EXT) + endif +@@ -1108,6 +1109,10 @@ install-shared: + chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a + $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a + ++ $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/ ++ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a ++ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a ++ + $(subst @multilib_dir@,$(MULTIDIR),$(subst \ + @shlib_base_name@,libgcc_s,$(subst \ + @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) diff --git a/devel/gcc/patches/830-arm_unbreak_armv4t.patch b/devel/gcc/patches/830-arm_unbreak_armv4t.patch new file mode 100644 index 0000000..37f8f2a --- /dev/null +++ b/devel/gcc/patches/830-arm_unbreak_armv4t.patch @@ -0,0 +1,13 @@ +http://sourceware.org/ml/crossgcc/2008-05/msg00009.html + +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -45,7 +45,7 @@ + The ARM10TDMI core is the default for armv5t, so set + SUBTARGET_CPU_DEFAULT to achieve this. */ + #undef SUBTARGET_CPU_DEFAULT +-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi ++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi + + /* TARGET_BIG_ENDIAN_DEFAULT is set in + config.gcc for big endian configurations. */ diff --git a/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch b/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch new file mode 100644 index 0000000..cb1fb98 --- /dev/null +++ b/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch @@ -0,0 +1,19 @@ +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -94,10 +94,15 @@ + #define MUSL_DYNAMIC_LINKER \ + "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" + ++/* For armv4 we pass --fix-v4bx to linker to support EABI */ ++#undef TARGET_FIX_V4BX_SPEC ++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\ ++ "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}" ++ + /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to + use the GNU/Linux version, not the generic BPABI version. */ + #undef LINK_SPEC +-#define LINK_SPEC EABI_LINK_SPEC \ ++#define LINK_SPEC EABI_LINK_SPEC TARGET_FIX_V4BX_SPEC \ + LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \ + LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC) + diff --git a/devel/gcc/patches/850-use_shared_libgcc.patch b/devel/gcc/patches/850-use_shared_libgcc.patch new file mode 100644 index 0000000..5818cf4 --- /dev/null +++ b/devel/gcc/patches/850-use_shared_libgcc.patch @@ -0,0 +1,47 @@ +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -131,10 +131,6 @@ + #define ENDFILE_SPEC \ + LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC) + +-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we +- do not use -lfloat. */ +-#undef LIBGCC_SPEC +- + /* Clear the instruction cache from `beg' to `end'. This is + implemented in lib1funcs.S, so ensure an error if this definition + is used. */ +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -53,6 +53,10 @@ see the files COPYING3 and COPYING.RUNTI + builtin_assert ("system=posix"); \ + } while (0) + ++#ifndef LIBGCC_SPEC ++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}" ++#endif ++ + /* Determine which dynamic linker to use depending on whether GLIBC or + uClibc or Bionic or musl is the default C library and whether + -muclibc or -mglibc or -mbionic or -mmusl has been passed to change +--- a/libgcc/mkmap-symver.awk ++++ b/libgcc/mkmap-symver.awk +@@ -132,5 +132,5 @@ function output(lib) { + else if (inherit[lib]) + printf("} %s;\n", inherit[lib]); + else +- printf ("\n local:\n\t*;\n};\n"); ++ printf ("\n\t*;\n};\n"); + } +--- a/gcc/config/rs6000/linux.h ++++ b/gcc/config/rs6000/linux.h +@@ -60,6 +60,9 @@ + #undef CPP_OS_DEFAULT_SPEC + #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)" + ++#undef LIBGCC_SPEC ++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc" ++ + #undef LINK_SHLIB_SPEC + #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" + diff --git a/devel/gcc/patches/851-libgcc_no_compat.patch b/devel/gcc/patches/851-libgcc_no_compat.patch new file mode 100644 index 0000000..80c3476 --- /dev/null +++ b/devel/gcc/patches/851-libgcc_no_compat.patch @@ -0,0 +1,12 @@ +--- a/libgcc/config/t-libunwind ++++ b/libgcc/config/t-libunwind +@@ -2,8 +2,7 @@ + + HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER + +-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \ +- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c ++LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c + LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c + + # Override the default value from t-slibgcc-elf-ver and mention -lunwind diff --git a/devel/gcc/patches/870-ppc_no_crtsavres.patch b/devel/gcc/patches/870-ppc_no_crtsavres.patch new file mode 100644 index 0000000..0e64a41 --- /dev/null +++ b/devel/gcc/patches/870-ppc_no_crtsavres.patch @@ -0,0 +1,11 @@ +--- a/gcc/config/rs6000/rs6000.c ++++ b/gcc/config/rs6000/rs6000.c +@@ -21500,7 +21500,7 @@ rs6000_savres_strategy (rs6000_stack_t * + /* Define cutoff for using out-of-line functions to save registers. */ + if (DEFAULT_ABI == ABI_V4 || TARGET_ELF) + { +- if (!optimize_size) ++ if (1) + { + strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS; + strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS; diff --git a/devel/gcc/patches/880-no_java_section.patch b/devel/gcc/patches/880-no_java_section.patch new file mode 100644 index 0000000..def6c9f --- /dev/null +++ b/devel/gcc/patches/880-no_java_section.patch @@ -0,0 +1,11 @@ +--- a/gcc/defaults.h ++++ b/gcc/defaults.h +@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI + /* If we have named section and we support weak symbols, then use the + .jcr section for recording java classes which need to be registered + at program start-up time. */ +-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK ++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK + #ifndef JCR_SECTION_NAME + #define JCR_SECTION_NAME ".jcr" + #endif diff --git a/devel/gcc/patches/900-bad-mips16-crt.patch b/devel/gcc/patches/900-bad-mips16-crt.patch new file mode 100644 index 0000000..dd6e9dc --- /dev/null +++ b/devel/gcc/patches/900-bad-mips16-crt.patch @@ -0,0 +1,9 @@ +--- a/libgcc/config/mips/t-mips16 ++++ b/libgcc/config/mips/t-mips16 +@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16 + + # Version these symbols if building libgcc.so. + SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver ++ ++CRTSTUFF_T_CFLAGS += -mno-mips16 ++CRTSTUFF_T_CFLAGS_S += -mno-mips16 diff --git a/devel/gcc/patches/910-mbsd_multi.patch b/devel/gcc/patches/910-mbsd_multi.patch new file mode 100644 index 0000000..32fc9da --- /dev/null +++ b/devel/gcc/patches/910-mbsd_multi.patch @@ -0,0 +1,222 @@ + + This patch brings over a few features from MirBSD: + * -fhonour-copts + If this option is not given, it's warned (depending + on environment variables). This is to catch errors + of misbuilt packages which override CFLAGS themselves. + * -Werror-maybe-reset + Has the effect of -Wno-error if GCC_NO_WERROR is + set and not '0', a no-operation otherwise. This is + to be able to use -Werror in "make" but prevent + GNU autoconf generated configure scripts from + freaking out. + + This patch was authored by Thorsten Glaser + with copyright assignment to the FSF in effect. + +--- a/gcc/c-family/c-opts.c ++++ b/gcc/c-family/c-opts.c +@@ -122,6 +122,9 @@ static int class_dump_flags; + /* Whether any standard preincluded header has been preincluded. */ + static bool done_preinclude; + ++/* Check if a port honours COPTS. */ ++static int honour_copts = 0; ++ + static void handle_OPT_d (const char *); + static void set_std_cxx98 (int); + static void set_std_cxx11 (int); +@@ -449,6 +452,12 @@ c_common_handle_option (size_t scode, co + flag_no_builtin = !value; + break; + ++ case OPT_fhonour_copts: ++ if (c_language == clk_c) { ++ honour_copts++; ++ } ++ break; ++ + case OPT_fconstant_string_class_: + constant_string_class_name = arg; + break; +@@ -1034,6 +1043,47 @@ c_common_init (void) + return false; + } + ++ if (c_language == clk_c) { ++ char *ev = getenv ("GCC_HONOUR_COPTS"); ++ int evv; ++ if (ev == NULL) ++ evv = -1; ++ else if ((*ev == '0') || (*ev == '\0')) ++ evv = 0; ++ else if (*ev == '1') ++ evv = 1; ++ else if (*ev == '2') ++ evv = 2; ++ else if (*ev == 's') ++ evv = -1; ++ else { ++ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1"); ++ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */ ++ } ++ if (evv == 1) { ++ if (honour_copts == 0) { ++ error ("someone does not honour COPTS at all in lenient mode"); ++ return false; ++ } else if (honour_copts != 1) { ++ warning (0, "someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ } ++ } else if (evv == 2) { ++ if (honour_copts == 0) { ++ error ("someone does not honour COPTS at all in strict mode"); ++ return false; ++ } else if (honour_copts != 1) { ++ error ("someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ return false; ++ } ++ } else if (evv == 0) { ++ if (honour_copts != 1) ++ inform (0, "someone does not honour COPTS correctly, passed %d times", ++ honour_copts); ++ } ++ } ++ + return true; + } + +--- a/gcc/c-family/c.opt ++++ b/gcc/c-family/c.opt +@@ -431,6 +431,10 @@ Wfloat-conversion + C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion) + Warn for implicit type conversions that cause loss of floating point precision + ++Werror-maybe-reset ++C ObjC C++ ObjC++ ++; Documented in common.opt ++ + Wfloat-equal + C ObjC C++ ObjC++ Var(warn_float_equal) Warning + Warn if testing floating point numbers for equality +@@ -1161,6 +1165,9 @@ C++ ObjC++ Optimization Alias(fexception + fhonor-std + C++ ObjC++ Ignore Warn(switch %qs is no longer supported) + ++fhonour-copts ++C ObjC C++ ObjC++ RejectNegative ++ + fhosted + C ObjC + Assume normal C execution environment +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -561,6 +561,10 @@ Werror= + Common Joined + Treat specified warning as error + ++Werror-maybe-reset ++Common ++If environment variable GCC_NO_WERROR is set, act as -Wno-error ++ + Wextra + Common Var(extra_warnings) Warning + Print extra (possibly unwanted) warnings +@@ -1360,6 +1364,9 @@ fguess-branch-probability + Common Report Var(flag_guess_branch_prob) Optimization + Enable guessing of branch probabilities + ++fhonour-copts ++Common RejectNegative ++ + ; Nonzero means ignore `#ident' directives. 0 means handle them. + ; Generate position-independent code for executables if possible + ; On SVR4 targets, it also controls whether or not to emit a +--- a/gcc/opts.c ++++ b/gcc/opts.c +@@ -1699,6 +1699,17 @@ common_handle_option (struct gcc_options + opts, opts_set, loc, dc); + break; + ++ case OPT_Werror_maybe_reset: ++ { ++ char *ev = getenv ("GCC_NO_WERROR"); ++ if ((ev != NULL) && (*ev != '0')) ++ warnings_are_errors = 0; ++ } ++ break; ++ ++ case OPT_fhonour_copts: ++ break; ++ + case OPT_Wlarger_than_: + opts->x_larger_than_size = value; + opts->x_warn_larger_than = value != -1; +--- a/gcc/doc/cppopts.texi ++++ b/gcc/doc/cppopts.texi +@@ -163,6 +163,11 @@ in older programs. This warning is on b + Make all warnings into hard errors. Source code which triggers warnings + will be rejected. + ++ at item -Werror-maybe-reset ++ at opindex Werror-maybe-reset ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment ++variable is set to anything other than 0 or empty. ++ + @item -Wsystem-headers + @opindex Wsystem-headers + Issue warnings for code in system headers. These are normally unhelpful +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -251,7 +251,7 @@ Objective-C and Objective-C++ Dialects}. + -Wdisabled-optimization @gol + -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol + -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol +--Wno-endif-labels -Werror -Werror=* @gol ++-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol + -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol + -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol + -Wformat-security -Wformat-signedness -Wformat-y2k @gol +@@ -5382,6 +5382,22 @@ This option is only supported for C and + @option{-Wall} and by @option{-Wpedantic}, which can be disabled with + @option{-Wno-pointer-sign}. + ++ at item -Werror-maybe-reset ++ at opindex Werror-maybe-reset ++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment ++variable is set to anything other than 0 or empty. ++ ++ at item -fhonour-copts ++ at opindex fhonour-copts ++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not ++given at least once, and warn if it is given more than once. ++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not ++given exactly once. ++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option ++is not given exactly once. ++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}. ++This flag and environment variable only affect the C language. ++ + @item -Wstack-protector + @opindex Wstack-protector + @opindex Wno-stack-protector +@@ -7860,7 +7876,7 @@ so, the first branch is redirected to ei + second branch or a point immediately following it, depending on whether + the condition is known to be true or false. + +-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. ++Enabled at levels @option{-O3}. + + @item -fsplit-wide-types + @opindex fsplit-wide-types +--- a/gcc/java/jvspec.c ++++ b/gcc/java/jvspec.c +@@ -629,6 +629,7 @@ lang_specific_pre_link (void) + class name. Append dummy `.c' that can be stripped by set_input so %b + is correct. */ + set_input (concat (main_class_name, "main.c", NULL)); ++ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */ + err = do_spec (jvgenmain_spec); + if (err == 0) + { diff --git a/devel/gcc/patches/920-specs_nonfatal_getenv.patch b/devel/gcc/patches/920-specs_nonfatal_getenv.patch new file mode 100644 index 0000000..3d708f2 --- /dev/null +++ b/devel/gcc/patches/920-specs_nonfatal_getenv.patch @@ -0,0 +1,15 @@ +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -8807,8 +8807,10 @@ getenv_spec_function (int argc, const ch + + value = getenv (argv[0]); + if (!value) +- fatal_error (input_location, +- "environment variable %qs not defined", argv[0]); ++ { ++ warning (input_location, "environment variable %qs not defined", argv[0]); ++ value = ""; ++ } + + /* We have to escape every character of the environment variable so + they are not interpreted as active spec characters. A diff --git a/devel/gcc/patches/930-fix-mips-noexecstack.patch b/devel/gcc/patches/930-fix-mips-noexecstack.patch new file mode 100644 index 0000000..c05844d --- /dev/null +++ b/devel/gcc/patches/930-fix-mips-noexecstack.patch @@ -0,0 +1,111 @@ +From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001 +From: Andrew McDonnell +Date: Fri, 3 Oct 2014 19:09:00 +0930 +Subject: Add .note.GNU-stack section + +See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html +Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html + +Re: [Patch, MIPS] Add .note.GNU-stack section + + From: Steve Ellcey + +On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote: +> +> +> On Wed, Sep 10, 2014 at 9:27 AM, wrote: + +> This works except you did not update the assembly files in +> libgcc or glibc. We (Cavium) have the same patch in our tree +> for a few released versions. + +> Mind just checking yours in then Andrew? + +> Thanks! +> -eric + +I talked to Andrew about what files he changed in GCC and created and +tested this new patch. Andrew also mentioned changing some assembly +files in glibc but I don't see any use of '.section .note.GNU-stack' in +any assembly files in glibc (for any platform) so I wasn't planning on +creating a glibc to add them to mips glibc assembly language files. + +OK to check in this patch? + +Steve Ellcey +sellcey@mips.com + + + +2014-09-26 Steve Ellcey +--- + gcc/config/mips/mips.c | 3 +++ + libgcc/config/mips/crti.S | 4 ++++ + libgcc/config/mips/crtn.S | 3 +++ + libgcc/config/mips/mips16.S | 4 ++++ + libgcc/config/mips/vr4120-div.S | 4 ++++ + 5 files changed, 18 insertions(+) + +--- a/gcc/config/mips/mips.c ++++ b/gcc/config/mips/mips.c +@@ -19629,6 +19629,9 @@ mips_lra_p (void) + #undef TARGET_LRA_P + #define TARGET_LRA_P mips_lra_p + ++#undef TARGET_ASM_FILE_END ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ + struct gcc_target targetm = TARGET_INITIALIZER; + + #include "gt-mips.h" +--- a/libgcc/config/mips/crti.S ++++ b/libgcc/config/mips/crti.S +@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + ++ ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. + Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +--- a/libgcc/config/mips/crtn.S ++++ b/libgcc/config/mips/crtn.S +@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. + Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +--- a/libgcc/config/mips/mips16.S ++++ b/libgcc/config/mips/mips16.S +@@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI + values using the soft-float calling convention, but do the actual + operation using the hard floating point instructions. */ + ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ .previous ++ + #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64) + + /* This file contains 32-bit assembly code. */ +--- a/libgcc/config/mips/vr4120-div.S ++++ b/libgcc/config/mips/vr4120-div.S +@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI + -mfix-vr4120. div and ddiv do not give the correct result when one + of the operands is negative. */ + ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ .previous ++ + .set nomips16 + + #define DIV \ diff --git a/devel/gcc/patches/930-osdefines.patch b/devel/gcc/patches/930-osdefines.patch new file mode 100644 index 0000000..a1b6120 --- /dev/null +++ b/devel/gcc/patches/930-osdefines.patch @@ -0,0 +1,13 @@ +--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h 2015-01-05 06:33:28.000000000 -0600 ++++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h 2016-04-15 12:32:49.374356001 -0500 +@@ -41,8 +41,8 @@ + // Provide a declaration for the possibly deprecated gets function, as + // glibc 2.15 and later does not declare gets for ISO C11 when + // __GNU_SOURCE is defined. +-#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) ++//#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) + # undef _GLIBCXX_HAVE_GETS +-#endif ++//#endif + + #endif diff --git a/devel/gcc/patches/940-no-clobber-stamp-bits.patch b/devel/gcc/patches/940-no-clobber-stamp-bits.patch new file mode 100644 index 0000000..0b21ffa --- /dev/null +++ b/devel/gcc/patches/940-no-clobber-stamp-bits.patch @@ -0,0 +1,11 @@ +--- a/libstdc++-v3/include/Makefile.in ++++ b/libstdc++-v3/include/Makefile.in +@@ -1421,7 +1421,7 @@ stamp-bits: ${bits_headers} + @$(STAMP) stamp-bits + + stamp-bits-sup: stamp-bits ${bits_sup_headers} +- @-cd ${bits_builddir} && $(LN_S) $? . 2>/dev/null ++ @-cd ${bits_builddir} && $(LN_S) $(filter-out stamp-bits,$?) . 2>/dev/null + @$(STAMP) stamp-bits-sup + + stamp-c_base: ${c_base_headers} diff --git a/devel/gcc/patches/950-cpp_file_path_translation.patch b/devel/gcc/patches/950-cpp_file_path_translation.patch new file mode 100644 index 0000000..dc0938a --- /dev/null +++ b/devel/gcc/patches/950-cpp_file_path_translation.patch @@ -0,0 +1,182 @@ +Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047 + +--- a/gcc/c-family/c-opts.c ++++ b/gcc/c-family/c-opts.c +@@ -581,6 +581,10 @@ c_common_handle_option (size_t scode, co + add_path (xstrdup (arg), SYSTEM, 0, true); + break; + ++ case OPT_iremap: ++ add_cpp_remap_path (arg); ++ break; ++ + case OPT_iwithprefix: + add_prefixed_path (arg, SYSTEM); + break; +--- a/gcc/c-family/c.opt ++++ b/gcc/c-family/c.opt +@@ -1528,6 +1528,10 @@ iquote + C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs) + -iquote Add to the end of the quote include path + ++iremap ++C ObjC C++ ObjC++ Joined Separate ++-iremap Convert to if it occurs as prefix in __FILE__. ++ + iwithprefix + C ObjC C++ ObjC++ Joined Separate + -iwithprefix Add to the end of the system include path +--- a/gcc/doc/cpp.texi ++++ b/gcc/doc/cpp.texi +@@ -4441,6 +4441,7 @@ without notice. + @c man begin SYNOPSIS + cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}] + [@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}] ++ [@option{-iremap}@var{src}:@var{dst}] + [@option{-W}@var{warn}@dots{}] + [@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}] + [@option{-MP}] [@option{-MQ} @var{target}@dots{}] +--- a/gcc/doc/cppopts.texi ++++ b/gcc/doc/cppopts.texi +@@ -532,6 +532,12 @@ Search @var{dir} only for header files r + If @var{dir} begins with @code{=}, then the @code{=} will be replaced + by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}. + ++@item -iremap @var{src}:@var{dst} ++@opindex iremap ++Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. ++This option can be specified more than once. Processing stops at the first ++match. ++ + @item -fdirectives-only + @opindex fdirectives-only + When preprocessing, handle directives, but do not expand macros. +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -494,8 +494,8 @@ Objective-C and Objective-C++ Dialects}. + @item Directory Options + @xref{Directory Options,,Options for Directory Search}. + @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol +--iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol +---sysroot=@var{dir} --no-sysroot-suffix} ++-iquote@var{dir} -iremap@var{src}:@var{dst} -L@var{dir} -specs=@var{file} @gol ++-I- --sysroot=@var{dir} --no-sysroot-suffix} + + @item Machine Dependent Options + @xref{Submodel Options,,Hardware Models and Configurations}. +@@ -11479,6 +11479,12 @@ be searched for header files only for th + "@var{file}"}; they are not searched for @code{#include <@var{file}>}, + otherwise just like @option{-I}. + ++@item -iremap @var{src}:@var{dst} ++@opindex iremap ++Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time. ++This option can be specified more than once. Processing stops at the first ++match. ++ + @item -L@var{dir} + @opindex L + Add directory @var{dir} to the list of directories to be searched +--- a/libcpp/include/cpplib.h ++++ b/libcpp/include/cpplib.h +@@ -751,6 +751,9 @@ extern void cpp_set_lang (cpp_reader *, + /* Set the include paths. */ + extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int); + ++/* Provide src:dst pair for __FILE__ remapping. */ ++extern void add_cpp_remap_path (const char *); ++ + /* Call these to get pointers to the options, callback, and deps + structures for a given reader. These pointers are good until you + call cpp_finish on that reader. You can either edit the callbacks +--- a/libcpp/macro.c ++++ b/libcpp/macro.c +@@ -224,6 +224,64 @@ static const char * const monthnames[] = + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + ++static size_t remap_pairs; ++static char **remap_src; ++static char **remap_dst; ++ ++void ++add_cpp_remap_path (const char *arg) ++{ ++ const char *arg_dst; ++ size_t len; ++ ++ arg_dst = strchr(arg, ':'); ++ if (arg_dst == NULL) ++ { ++ fprintf(stderr, "Invalid argument for -iremap\n"); ++ exit(1); ++ } ++ ++ len = arg_dst - arg; ++ ++arg_dst; ++ ++ remap_src = (char **) xrealloc(remap_src, sizeof(char *) * (remap_pairs + 1)); ++ remap_dst = (char **) xrealloc(remap_dst, sizeof(char *) * (remap_pairs + 1)); ++ ++ remap_src[remap_pairs] = (char *) xmalloc(len + 1); ++ memcpy(remap_src[remap_pairs], arg, len); ++ remap_src[remap_pairs][len] = '\0'; ++ remap_dst[remap_pairs] = xstrdup(arg_dst); ++ ++remap_pairs; ++} ++ ++static const char * ++cpp_remap_file (const char *arg, char **tmp_name) ++{ ++ char *result; ++ size_t i, len; ++ ++ for (i = 0; i < remap_pairs; ++i) ++ { ++ len = strlen (remap_src[i]); ++ if (strncmp (remap_src[i], arg, len)) ++ continue; ++ if (arg[len] == '\0') ++ return xstrdup (remap_dst[i]); ++ if (arg[len] != '/') ++ continue; ++ arg += len; ++ len = strlen (remap_dst[i]); ++ result = (char *) xmalloc (len + strlen (arg) + 1); ++ memcpy(result, remap_dst[i], len); ++ strcpy(result + len, arg); ++ *tmp_name = result; ++ ++ return result; ++ } ++ ++ return arg; ++} ++ + /* Helper function for builtin_macro. Returns the text generated by + a builtin macro. */ + const uchar * +@@ -286,6 +344,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + { + unsigned int len; + const char *name; ++ char *tmp_name = NULL; + uchar *buf; + + if (node->value.builtin == BT_FILE) +@@ -297,6 +356,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + if (!name) + abort (); + } ++ name = cpp_remap_file (name, &tmp_name); + len = strlen (name); + buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); + result = buf; +@@ -304,6 +364,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); + *buf++ = '"'; + *buf = '\0'; ++ free (tmp_name); + } + break; + diff --git a/devel/gcc/patches/960-go_libm.patch b/devel/gcc/patches/960-go_libm.patch new file mode 100644 index 0000000..d16b020 --- /dev/null +++ b/devel/gcc/patches/960-go_libm.patch @@ -0,0 +1,11 @@ +--- a/gcc/go/Make-lang.in ++++ b/gcc/go/Make-lang.in +@@ -74,7 +74,7 @@ go_OBJS = $(GO_OBJS) go/gospec.o + + go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS) + +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ +- $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) ++ $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) -lm + + # Documentation. + diff --git a/devel/gcc/patches/970-warn_bug.patch b/devel/gcc/patches/970-warn_bug.patch new file mode 100644 index 0000000..2c5cf9b --- /dev/null +++ b/devel/gcc/patches/970-warn_bug.patch @@ -0,0 +1,11 @@ +--- a/libgo/runtime/mprof.goc ++++ b/libgo/runtime/mprof.goc +@@ -403,7 +403,7 @@ func ThreadCreateProfile(p Slice) (n int + + func Stack(b Slice, all bool) (n int) { + byte *pc, *sp; +- bool enablegc; ++ bool enablegc = false; /* workaround GCC bug #36550 */ + + sp = runtime_getcallersp(&b); + pc = (byte*)(uintptr)runtime_getcallerpc(&b); diff --git a/devel/libtool-bin/Makefile b/devel/libtool-bin/Makefile new file mode 100644 index 0000000..a10303e --- /dev/null +++ b/devel/libtool-bin/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libtool +PKG_VERSION:=2.4.6 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/libtool +PKG_MD5SUM:=1bfb9b923f2c1339b4d2ce1807064aa5 +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-2.0+ +PKG_BUILD_DIR = $(BUILD_DIR)/libtool-bin/$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +CONFIGURE_VARS += GREP=grep SED=sed + +define Package/libtool-bin + SECTION:=devel + CATEGORY:=Development + TITLE:=GNU Libtool - libtoolize + URL:=https://www.gnu.org/software/libtool/ +endef + +define Package/libtool-bin/description + GNU libtool is a generic library support script. + Libtool hides the complexity of using shared libraries behind a consistent, + portable interface. + This package contains the libtoolize executable. +endef + +define Package/libtool-bin/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libtoolize $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/aclocal/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/*.m4 \ + $(1)/usr/share/aclocal/ + $(INSTALL_DIR) $(1)/usr/share/libtool/build-aux/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/libtool/build-aux/* \ + $(1)/usr/share/libtool/build-aux/ +endef + +$(eval $(call BuildPackage,libtool-bin)) diff --git a/devel/lpc21isp/Makefile b/devel/lpc21isp/Makefile new file mode 100644 index 0000000..292b7a4 --- /dev/null +++ b/devel/lpc21isp/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lpc21isp +PKG_VERSION:=197 +PKG_RELEASE:=1 +PKG_LICENSE:=LGPL-3.0+ +PKG_LICENSE_FILES:=README gpl.txt lgpl-3.0.txt + +PKG_BUILD_DIR:=$(BUILD_DIR)/lpc21isp_$(PKG_VERSION) +PKG_SOURCE:=lpc21isp_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/lpc21isp +PKG_MD5SUM:=0b286859a05a725647ecb1b3fe9ba606 +PKG_CAT:=zcat + +include $(INCLUDE_DIR)/package.mk + +define Package/lpc21isp + SECTION:=base + CATEGORY:=Development + TITLE:=Command line ISP for NXP LPC family and ADUC70xx + URL:=http://lpc21isp.sourceforge.net/ + MAINTAINER:=Emil 'Skeen' Madsen +endef + +define Package/lpc21isp/description + Portable command line ISP (In-circuit Programmer) for NXP LPC family + and Analog Devices ADUC70xx. +endef + +define Package/lpc21isp/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lpc21isp $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,lpc21isp)) diff --git a/devel/lttng-modules/Makefile b/devel/lttng-modules/Makefile new file mode 100644 index 0000000..99510a0 --- /dev/null +++ b/devel/lttng-modules/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2013-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lttng-modules +PKG_VERSION:=2.6.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)/ +PKG_MD5SUM:=ccfb50ad922cdaf54a809e2d9de23da4 + +PKG_LICENSE:=LGPL-2.1 GPL-2.0 MIT +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Nicolas Thill + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/lttng + SUBMENU:=Other modules + TITLE:=Linux Trace Toolkit: next generation (kernel modules) + URL:=https://lttng.org/ + DEPENDS:= @!TARGET_uml @KERNEL_FTRACE_SYSCALLS + FILES:= \ + $(PKG_BUILD_DIR)/lttng-*.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/lib/lttng-*.$(LINUX_KMOD_SUFFIX) \ + $(PKG_BUILD_DIR)/probes/lttng-*.$(LINUX_KMOD_SUFFIX) +endef + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)" \ + V="$(V)" \ + modules +endef + +$(eval $(call KernelPackage,lttng)) diff --git a/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch b/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch new file mode 100644 index 0000000..d8a0c62 --- /dev/null +++ b/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch @@ -0,0 +1,10 @@ +--- a/instrumentation/events/lttng-module/kmem.h ++++ b/instrumentation/events/lttng-module/kmem.h +@@ -287,6 +287,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT(mm + ) + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \ ++ || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0) \ + || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \ + || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0)) + diff --git a/devel/lttng-tools/Makefile b/devel/lttng-tools/Makefile new file mode 100644 index 0000000..e52c529 --- /dev/null +++ b/devel/lttng-tools/Makefile @@ -0,0 +1,60 @@ +# +# Copyright (C) 2013-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lttng-tools +PKG_VERSION:=2.6.0 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)/ +PKG_MD5SUM:=0478f60395f9564b4a19f45ce7b7f3df + +PKG_LICENSE:=LGPL-2.1 GPL-2.0 +PKG_LICENSE_FILES:=COPYING +PKG_MAINTAINER:=Nicolas Thill + +PKG_FIXUP:=autoreconf +PKG_USE_MIPS16:=0 +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lttng-tools + SECTION:=devel + CATEGORY:=Development + TITLE:=Linux Trace Toolkit: next generation (tools) + URL:=https://lttng.org/ + DEPENDS:= +lttng-ust +libpopt +libxml2 +endef + +CONFIGURE_ARGS += --disable-kmod + +TARGET_LDFLAGS += -lurcu-bp + +MAKE_FLAGS += V="$(V)" + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/lttng $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.{a,so*} $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lttng-ctl.pc $(1)/usr/lib/pkgconfig/ +endef + +define Package/lttng-tools/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lttng $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lttng* $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,lttng-tools)) diff --git a/devel/lttng-tools/patches/100-musl-compat.patch b/devel/lttng-tools/patches/100-musl-compat.patch new file mode 100644 index 0000000..8813f83 --- /dev/null +++ b/devel/lttng-tools/patches/100-musl-compat.patch @@ -0,0 +1,23 @@ +--- a/src/common/compat/poll.h ++++ b/src/common/compat/poll.h +@@ -55,6 +55,10 @@ static inline void __lttng_poll_free(voi + #include + #include + ++#ifndef __GLIBC_PREREQ ++#define __GLIBC_PREREQ(maj, min) (0) ++#endif ++ + /* See man epoll(7) for this define path */ + #define COMPAT_EPOLL_PROC_PATH "/proc/sys/fs/epoll/max_user_watches" + +--- a/src/common/runas.h ++++ b/src/common/runas.h +@@ -21,6 +21,7 @@ + + #include + #include ++#include + + int run_as_mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid); + int run_as_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid); diff --git a/devel/lttng-tools/patches/200-use-extern.patch b/devel/lttng-tools/patches/200-use-extern.patch new file mode 100644 index 0000000..180c061 --- /dev/null +++ b/devel/lttng-tools/patches/200-use-extern.patch @@ -0,0 +1,423 @@ +--- a/src/common/mi-lttng.h ++++ b/src/common/mi-lttng.h +@@ -49,133 +49,133 @@ struct mi_lttng_version { + }; + + /* Strings related to command */ +-const char * const mi_lttng_element_command; +-const char * const mi_lttng_element_command_action; +-const char * const mi_lttng_element_command_add_context; +-const char * const mi_lttng_element_command_calibrate; +-const char * const mi_lttng_element_command_create; +-const char * const mi_lttng_element_command_destroy; +-const char * const mi_lttng_element_command_disable_channel; +-const char * const mi_lttng_element_command_disable_event; +-const char * const mi_lttng_element_command_enable_channels; +-const char * const mi_lttng_element_command_enable_event; +-const char * const mi_lttng_element_command_list; +-const char * const mi_lttng_element_command_load; +-const char * const mi_lttng_element_command_name; +-const char * const mi_lttng_element_command_output; +-const char * const mi_lttng_element_command_save; +-const char * const mi_lttng_element_command_set_session; +-const char * const mi_lttng_element_command_snapshot; +-const char * const mi_lttng_element_command_snapshot_add; +-const char * const mi_lttng_element_command_snapshot_del; +-const char * const mi_lttng_element_command_snapshot_list; +-const char * const mi_lttng_element_command_snapshot_record; +-const char * const mi_lttng_element_command_start; +-const char * const mi_lttng_element_command_stop; +-const char * const mi_lttng_element_command_success; +-const char * const mi_lttng_element_command_version; ++extern const char * const mi_lttng_element_command; ++extern const char * const mi_lttng_element_command_action; ++extern const char * const mi_lttng_element_command_add_context; ++extern const char * const mi_lttng_element_command_calibrate; ++extern const char * const mi_lttng_element_command_create; ++extern const char * const mi_lttng_element_command_destroy; ++extern const char * const mi_lttng_element_command_disable_channel; ++extern const char * const mi_lttng_element_command_disable_event; ++extern const char * const mi_lttng_element_command_enable_channels; ++extern const char * const mi_lttng_element_command_enable_event; ++extern const char * const mi_lttng_element_command_list; ++extern const char * const mi_lttng_element_command_load; ++extern const char * const mi_lttng_element_command_name; ++extern const char * const mi_lttng_element_command_output; ++extern const char * const mi_lttng_element_command_save; ++extern const char * const mi_lttng_element_command_set_session; ++extern const char * const mi_lttng_element_command_snapshot; ++extern const char * const mi_lttng_element_command_snapshot_add; ++extern const char * const mi_lttng_element_command_snapshot_del; ++extern const char * const mi_lttng_element_command_snapshot_list; ++extern const char * const mi_lttng_element_command_snapshot_record; ++extern const char * const mi_lttng_element_command_start; ++extern const char * const mi_lttng_element_command_stop; ++extern const char * const mi_lttng_element_command_success; ++extern const char * const mi_lttng_element_command_version; + + /* Strings related to version command */ +-const char * const mi_lttng_element_version; +-const char * const mi_lttng_element_version_commit; +-const char * const mi_lttng_element_version_description; +-const char * const mi_lttng_element_version_license; +-const char * const mi_lttng_element_version_major; +-const char * const mi_lttng_element_version_minor; +-const char * const mi_lttng_element_version_patch_level; +-const char * const mi_lttng_element_version_str; +-const char * const mi_lttng_element_version_web; ++extern const char * const mi_lttng_element_version; ++extern const char * const mi_lttng_element_version_commit; ++extern const char * const mi_lttng_element_version_description; ++extern const char * const mi_lttng_element_version_license; ++extern const char * const mi_lttng_element_version_major; ++extern const char * const mi_lttng_element_version_minor; ++extern const char * const mi_lttng_element_version_patch_level; ++extern const char * const mi_lttng_element_version_str; ++extern const char * const mi_lttng_element_version_web; + + /* String related to a lttng_event_field */ +-const char * const mi_lttng_element_event_field; +-const char * const mi_lttng_element_event_fields; ++extern const char * const mi_lttng_element_event_field; ++extern const char * const mi_lttng_element_event_fields; + + /* String related to lttng_event_context */ +-const char * const mi_lttng_context_type_perf_counter; +-const char * const mi_lttng_context_type_perf_cpu_counter; +-const char * const mi_lttng_context_type_perf_thread_counter; ++extern const char * const mi_lttng_context_type_perf_counter; ++extern const char * const mi_lttng_context_type_perf_cpu_counter; ++extern const char * const mi_lttng_context_type_perf_thread_counter; + + /* String related to lttng_event_perf_counter_ctx */ +-const char * const mi_lttng_element_perf_counter_context; ++extern const char * const mi_lttng_element_perf_counter_context; + + /* Strings related to pid */ +-const char * const mi_lttng_element_pids; +-const char * const mi_lttng_element_pid; +-const char * const mi_lttng_element_pid_id; ++extern const char * const mi_lttng_element_pids; ++extern const char * const mi_lttng_element_pid; ++extern const char * const mi_lttng_element_pid_id; + + /* Strings related to save command */ +-const char * const mi_lttng_element_save; ++extern const char * const mi_lttng_element_save; + + /* Strings related to load command */ +-const char * const mi_lttng_element_load; ++extern const char * const mi_lttng_element_load; + + /* General element of mi_lttng */ +-const char * const mi_lttng_element_empty; +-const char * const mi_lttng_element_id; +-const char * const mi_lttng_element_nowrite; +-const char * const mi_lttng_element_success; +-const char * const mi_lttng_element_type_enum; +-const char * const mi_lttng_element_type_float; +-const char * const mi_lttng_element_type_integer; +-const char * const mi_lttng_element_type_other; +-const char * const mi_lttng_element_type_string; ++extern const char * const mi_lttng_element_empty; ++extern const char * const mi_lttng_element_id; ++extern const char * const mi_lttng_element_nowrite; ++extern const char * const mi_lttng_element_success; ++extern const char * const mi_lttng_element_type_enum; ++extern const char * const mi_lttng_element_type_float; ++extern const char * const mi_lttng_element_type_integer; ++extern const char * const mi_lttng_element_type_other; ++extern const char * const mi_lttng_element_type_string; + + /* String related to loglevel */ +-const char * const mi_lttng_loglevel_str_alert; +-const char * const mi_lttng_loglevel_str_crit; +-const char * const mi_lttng_loglevel_str_debug; +-const char * const mi_lttng_loglevel_str_debug_function; +-const char * const mi_lttng_loglevel_str_debug_line; +-const char * const mi_lttng_loglevel_str_debug_module; +-const char * const mi_lttng_loglevel_str_debug_process; +-const char * const mi_lttng_loglevel_str_debug_program; +-const char * const mi_lttng_loglevel_str_debug_system; +-const char * const mi_lttng_loglevel_str_debug_unit; +-const char * const mi_lttng_loglevel_str_emerg; +-const char * const mi_lttng_loglevel_str_err; +-const char * const mi_lttng_loglevel_str_info; +-const char * const mi_lttng_loglevel_str_notice; +-const char * const mi_lttng_loglevel_str_unknown; +-const char * const mi_lttng_loglevel_str_warning; ++extern const char * const mi_lttng_loglevel_str_alert; ++extern const char * const mi_lttng_loglevel_str_crit; ++extern const char * const mi_lttng_loglevel_str_debug; ++extern const char * const mi_lttng_loglevel_str_debug_function; ++extern const char * const mi_lttng_loglevel_str_debug_line; ++extern const char * const mi_lttng_loglevel_str_debug_module; ++extern const char * const mi_lttng_loglevel_str_debug_process; ++extern const char * const mi_lttng_loglevel_str_debug_program; ++extern const char * const mi_lttng_loglevel_str_debug_system; ++extern const char * const mi_lttng_loglevel_str_debug_unit; ++extern const char * const mi_lttng_loglevel_str_emerg; ++extern const char * const mi_lttng_loglevel_str_err; ++extern const char * const mi_lttng_loglevel_str_info; ++extern const char * const mi_lttng_loglevel_str_notice; ++extern const char * const mi_lttng_loglevel_str_unknown; ++extern const char * const mi_lttng_loglevel_str_warning; + + /* String related to loglevel JUL */ +-const char * const mi_lttng_loglevel_str_jul_all; +-const char * const mi_lttng_loglevel_str_jul_config; +-const char * const mi_lttng_loglevel_str_jul_fine; +-const char * const mi_lttng_loglevel_str_jul_finer; +-const char * const mi_lttng_loglevel_str_jul_finest; +-const char * const mi_lttng_loglevel_str_jul_info; +-const char * const mi_lttng_loglevel_str_jul_off; +-const char * const mi_lttng_loglevel_str_jul_severe; +-const char * const mi_lttng_loglevel_str_jul_warning; ++extern const char * const mi_lttng_loglevel_str_jul_all; ++extern const char * const mi_lttng_loglevel_str_jul_config; ++extern const char * const mi_lttng_loglevel_str_jul_fine; ++extern const char * const mi_lttng_loglevel_str_jul_finer; ++extern const char * const mi_lttng_loglevel_str_jul_finest; ++extern const char * const mi_lttng_loglevel_str_jul_info; ++extern const char * const mi_lttng_loglevel_str_jul_off; ++extern const char * const mi_lttng_loglevel_str_jul_severe; ++extern const char * const mi_lttng_loglevel_str_jul_warning; + + /* String related to loglevel Log4j */ +-const char * const mi_lttng_loglevel_str_log4j_off; +-const char * const mi_lttng_loglevel_str_log4j_fatal; +-const char * const mi_lttng_loglevel_str_log4j_error; +-const char * const mi_lttng_loglevel_str_log4j_warn; +-const char * const mi_lttng_loglevel_str_log4j_info; +-const char * const mi_lttng_loglevel_str_log4j_debug; +-const char * const mi_lttng_loglevel_str_log4j_trace; +-const char * const mi_lttng_loglevel_str_log4j_all; ++extern const char * const mi_lttng_loglevel_str_log4j_off; ++extern const char * const mi_lttng_loglevel_str_log4j_fatal; ++extern const char * const mi_lttng_loglevel_str_log4j_error; ++extern const char * const mi_lttng_loglevel_str_log4j_warn; ++extern const char * const mi_lttng_loglevel_str_log4j_info; ++extern const char * const mi_lttng_loglevel_str_log4j_debug; ++extern const char * const mi_lttng_loglevel_str_log4j_trace; ++extern const char * const mi_lttng_loglevel_str_log4j_all; + + /* String related to loglevel type */ +-const char * const mi_lttng_loglevel_type_all; +-const char * const mi_lttng_loglevel_type_range; +-const char * const mi_lttng_loglevel_type_single; +-const char * const mi_lttng_loglevel_type_unknown; ++extern const char * const mi_lttng_loglevel_type_all; ++extern const char * const mi_lttng_loglevel_type_range; ++extern const char * const mi_lttng_loglevel_type_single; ++extern const char * const mi_lttng_loglevel_type_unknown; + + /* Sting related to lttng_calibrate */ +-const char * const mi_lttng_element_calibrate; +-const char * const mi_lttng_element_calibrate_function; ++extern const char * const mi_lttng_element_calibrate; ++extern const char * const mi_lttng_element_calibrate_function; + + /* String related to a lttng_snapshot */ +-const char * const mi_lttng_element_snapshot_ctrl_url; +-const char * const mi_lttng_element_snapshot_data_url; +-const char * const mi_lttng_element_snapshot_max_size; +-const char * const mi_lttng_element_snapshot_n_ptr; +-const char * const mi_lttng_element_snapshot_session_name; +-const char * const mi_lttng_element_snapshots; ++extern const char * const mi_lttng_element_snapshot_ctrl_url; ++extern const char * const mi_lttng_element_snapshot_data_url; ++extern const char * const mi_lttng_element_snapshot_max_size; ++extern const char * const mi_lttng_element_snapshot_n_ptr; ++extern const char * const mi_lttng_element_snapshot_session_name; ++extern const char * const mi_lttng_element_snapshots; + + /* Utility string function */ + const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain); +--- a/src/common/config/config-session-abi.h ++++ b/src/common/config/config-session-abi.h +@@ -18,95 +18,95 @@ + #ifndef CONFIG_SESSION_INTERNAL_H + #define CONFIG_SESSION_INTERNAL_H + +-const char * const config_element_channel; +-const char * const config_element_channels; +-const char * const config_element_domain; +-const char * const config_element_domains; +-const char * const config_element_event; +-const char * const config_element_events; +-const char * const config_element_context; +-const char * const config_element_contexts; +-const char * const config_element_attributes; +-const char * const config_element_exclusion; +-const char * const config_element_exclusions; +-const char * const config_element_function_attributes; +-const char * const config_element_probe_attributes; +-const char * const config_element_symbol_name; +-const char * const config_element_address; +-const char * const config_element_offset; +-const char * const config_element_name; +-const char * const config_element_enabled; +-const char * const config_element_overwrite_mode; +-const char * const config_element_subbuf_size; +-const char * const config_element_num_subbuf; +-const char * const config_element_switch_timer_interval; +-const char * const config_element_read_timer_interval; +-const char * const config_element_output; +-const char * const config_element_output_type; +-const char * const config_element_tracefile_size; +-const char * const config_element_tracefile_count; +-const char * const config_element_live_timer_interval; +-const char * const config_element_type; +-const char * const config_element_buffer_type; +-const char * const config_element_session; +-const char * const config_element_sessions; +-const char * const config_element_perf; +-const char * const config_element_config; +-const char * const config_element_started; +-const char * const config_element_snapshot_mode; +-const char * const config_element_loglevel; +-const char * const config_element_loglevel_type; +-const char * const config_element_filter; +-const char * const config_element_snapshot_outputs; +-const char * const config_element_consumer_output; +-const char * const config_element_destination; +-const char * const config_element_path; +-const char * const config_element_net_output; +-const char * const config_element_control_uri; +-const char * const config_element_data_uri; +-const char * const config_element_max_size; +- +-const char * const config_domain_type_kernel; +-const char * const config_domain_type_ust; +-const char * const config_domain_type_jul; +-const char * const config_domain_type_log4j; +- +-const char * const config_buffer_type_per_pid; +-const char * const config_buffer_type_per_uid; +-const char * const config_buffer_type_global; +- +-const char * const config_overwrite_mode_discard; +-const char * const config_overwrite_mode_overwrite; +- +-const char * const config_output_type_splice; +-const char * const config_output_type_mmap; +- +-const char * const config_loglevel_type_all; +-const char * const config_loglevel_type_range; +-const char * const config_loglevel_type_single; +- +-const char * const config_event_type_all; +-const char * const config_event_type_tracepoint; +-const char * const config_event_type_probe; +-const char * const config_event_type_function; +-const char * const config_event_type_function_entry; +-const char * const config_event_type_noop; +-const char * const config_event_type_syscall; +-const char * const config_event_type_kprobe; +-const char * const config_event_type_kretprobe; +- +-const char * const config_event_context_pid; +-const char * const config_event_context_procname; +-const char * const config_event_context_prio; +-const char * const config_event_context_nice; +-const char * const config_event_context_vpid; +-const char * const config_event_context_tid; +-const char * const config_event_context_vtid; +-const char * const config_event_context_ppid; +-const char * const config_event_context_vppid; +-const char * const config_event_context_pthread_id; +-const char * const config_event_context_hostname; +-const char * const config_event_context_ip; +-const char * const config_event_context_perf_thread_counter; ++extern const char * const config_element_channel; ++extern const char * const config_element_channels; ++extern const char * const config_element_domain; ++extern const char * const config_element_domains; ++extern const char * const config_element_event; ++extern const char * const config_element_events; ++extern const char * const config_element_context; ++extern const char * const config_element_contexts; ++extern const char * const config_element_attributes; ++extern const char * const config_element_exclusion; ++extern const char * const config_element_exclusions; ++extern const char * const config_element_function_attributes; ++extern const char * const config_element_probe_attributes; ++extern const char * const config_element_symbol_name; ++extern const char * const config_element_address; ++extern const char * const config_element_offset; ++extern const char * const config_element_name; ++extern const char * const config_element_enabled; ++extern const char * const config_element_overwrite_mode; ++extern const char * const config_element_subbuf_size; ++extern const char * const config_element_num_subbuf; ++extern const char * const config_element_switch_timer_interval; ++extern const char * const config_element_read_timer_interval; ++extern const char * const config_element_output; ++extern const char * const config_element_output_type; ++extern const char * const config_element_tracefile_size; ++extern const char * const config_element_tracefile_count; ++extern const char * const config_element_live_timer_interval; ++extern const char * const config_element_type; ++extern const char * const config_element_buffer_type; ++extern const char * const config_element_session; ++extern const char * const config_element_sessions; ++extern const char * const config_element_perf; ++extern const char * const config_element_config; ++extern const char * const config_element_started; ++extern const char * const config_element_snapshot_mode; ++extern const char * const config_element_loglevel; ++extern const char * const config_element_loglevel_type; ++extern const char * const config_element_filter; ++extern const char * const config_element_snapshot_outputs; ++extern const char * const config_element_consumer_output; ++extern const char * const config_element_destination; ++extern const char * const config_element_path; ++extern const char * const config_element_net_output; ++extern const char * const config_element_control_uri; ++extern const char * const config_element_data_uri; ++extern const char * const config_element_max_size; ++ ++extern const char * const config_domain_type_kernel; ++extern const char * const config_domain_type_ust; ++extern const char * const config_domain_type_jul; ++extern const char * const config_domain_type_log4j; ++ ++extern const char * const config_buffer_type_per_pid; ++extern const char * const config_buffer_type_per_uid; ++extern const char * const config_buffer_type_global; ++ ++extern const char * const config_overwrite_mode_discard; ++extern const char * const config_overwrite_mode_overwrite; ++ ++extern const char * const config_output_type_splice; ++extern const char * const config_output_type_mmap; ++ ++extern const char * const config_loglevel_type_all; ++extern const char * const config_loglevel_type_range; ++extern const char * const config_loglevel_type_single; ++ ++extern const char * const config_event_type_all; ++extern const char * const config_event_type_tracepoint; ++extern const char * const config_event_type_probe; ++extern const char * const config_event_type_function; ++extern const char * const config_event_type_function_entry; ++extern const char * const config_event_type_noop; ++extern const char * const config_event_type_syscall; ++extern const char * const config_event_type_kprobe; ++extern const char * const config_event_type_kretprobe; ++ ++extern const char * const config_event_context_pid; ++extern const char * const config_event_context_procname; ++extern const char * const config_event_context_prio; ++extern const char * const config_event_context_nice; ++extern const char * const config_event_context_vpid; ++extern const char * const config_event_context_tid; ++extern const char * const config_event_context_vtid; ++extern const char * const config_event_context_ppid; ++extern const char * const config_event_context_vppid; ++extern const char * const config_event_context_pthread_id; ++extern const char * const config_event_context_hostname; ++extern const char * const config_event_context_ip; ++extern const char * const config_event_context_perf_thread_counter; + + #endif /* CONFIG_SESSION_INTERNAL_H */ diff --git a/devel/m4/Makefile b/devel/m4/Makefile new file mode 100644 index 0000000..19c8c17 --- /dev/null +++ b/devel/m4/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=m4 +PKG_VERSION:=1.4.17 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=@GNU/m4 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_MD5SUM:=12a3c829301a4fd6586a57d3fcf196dc +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/m4 + SECTION:=devel + CATEGORY:=Development + TITLE:=m4 + URL:=https://www.gnu.org/software/m4/ +endef + +define Package/m4/description + GNU M4 is an implementation of the traditional Unix macro processor. + It is used by GNU Autoconf and Automake. +endef + +define Package/m4/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/m4 $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,m4)) diff --git a/devel/make/Makefile b/devel/make/Makefile new file mode 100644 index 0000000..2a1ba49 --- /dev/null +++ b/devel/make/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=make +PKG_VERSION:=4.2.1 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=@GNU/make +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_MD5SUM:=15b012617e7c44c0ed482721629577ac +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-3.0+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/make + SECTION:=devel + CATEGORY:=Development + TITLE:=make + URL:=https://www.gnu.org/software/make/ +endef + +define Package/make/description + The Make package contains a tool to create executables from source files. +endef + +define Package/make/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/make $(1)/usr/bin/ +endef + +# provide gnumake.h at build time for other packages +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/gnumake.h $(1)/usr/include/ +endef + +$(eval $(call BuildPackage,make)) diff --git a/devel/patch/Makefile b/devel/patch/Makefile new file mode 100644 index 0000000..d705a30 --- /dev/null +++ b/devel/patch/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2008-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=patch +PKG_VERSION:=2.7.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=@GNU/patch +PKG_MD5SUM:=e3da7940431633fb65a01b91d3b7a27a +PKG_LICENSE:=GPL-3.0+ +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/patch + SECTION:=devel + CATEGORY:=Development + TITLE:=patch + URL:=http://www.gnu.org/ + MAINTAINER:=Russell Senior +endef + +define Package/patch/description + The Patch package contains a program for modifying or creating files + by applying a "patch" file typically created by the diff program. +endef + +CONFIGURE_ARGS+= --disable-xattr + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/patch/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/patch $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,patch)) diff --git a/devel/pkg-config/Makefile b/devel/pkg-config/Makefile new file mode 100644 index 0000000..7fa0076 --- /dev/null +++ b/devel/pkg-config/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2015-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=pkg-config +PKG_VERSION:=0.29.1 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://pkgconfig.freedesktop.org/releases/ +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=f739a28cae4e0ca291f82d1d41ef107d +PKG_MAINTAINER:=Heinrich Schuchardt +PKG_LICENSE:=GPL-2+ + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/pkg-config + SECTION:=devel + CATEGORY:=Development + TITLE:=pkg-config + URL:=http://www.freedesktop.org/wiki/Software/pkg-config/ + DEPENDS:=+glib2 $(INTL_DEPENDS) +endef + +define Package/pkg-config/description + pkg-config is a helper tool used when compiling applications and libraries. + It helps you insert the correct compiler options on the command line so an + application can use gcc -o test test.cpkg-config --libs --cflags glib-2.0 + for instance, rather than hard-coding values on where to find glib (or + other libraries). +endef + +define Package/pkg-config/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pkg-config $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/aclocal/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/pkg.m4 \ + $(1)/usr/share/aclocal/ +endef + +$(eval $(call BuildPackage,pkg-config)) diff --git a/ipv6/aiccu/Makefile b/ipv6/aiccu/Makefile new file mode 100644 index 0000000..4b81e10 --- /dev/null +++ b/ipv6/aiccu/Makefile @@ -0,0 +1,70 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=aiccu +PKG_VERSION:=20070115 +PKG_RELEASE:=16 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.sixxs.net/archive/sixxs/aiccu/unix +PKG_MD5SUM:=c9bcc83644ed788e22a7c3f3d4021350 +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=doc/LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/aiccu/Default + TITLE:=SixXS IPv6 Connectivity Client ($(1)) + SECTION:=net + CATEGORY:=Network + VARIANT:=$(2) + DEPENDS:=+libpthread +ip +kmod-sit +kmod-tun $(3) + URL:=http://www.sixxs.net/tools/aiccu/ + MAINTAINER:=Ondrej Caletka +endef + +Package/aiccu=$(call Package/aiccu/Default,without GNUTLS support,default) +Package/aiccu-gnutls=$(call Package/aiccu/Default,with GNUTLS support,gnutls,+libgnutls) + +define Build/Configure + $(SED) "s,strip,/bin/true," $(PKG_BUILD_DIR)/unix-console/Makefile +endef + +ifeq ($(BUILD_VARIANT),gnutls) +CONFIG_AICCU_GNUTLS:=y +endif + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" OS_NAME="Linux" OS_VERSION="$(LINUX_VERSION)" \ + EXTRA_CFLAGS="$(TARGET_CFLAGS)" \ + EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -pthread" \ + $(if $(CONFIG_AICCU_GNUTLS),HAVE_GNUTLS=1) \ + DEBUG=0 +endef + +define Package/aiccu/conffiles +/etc/config/aiccu +endef + +Package/aiccu-gnutls/conffiles=$(call Package/aiccu/conffiles) + +define Package/aiccu/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/netifd/proto $(1)/etc/hotplug.d/ntp + $(INSTALL_BIN) $(PKG_BUILD_DIR)/unix-console/$(PKG_NAME) $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/aiccu.sh $(1)/lib/netifd/proto/aiccu.sh + $(INSTALL_DATA) ./files/aiccu.hotplug $(1)/etc/hotplug.d/ntp/10-aiccu +endef + +Package/aiccu-gnutls/install=$(call Package/aiccu/install,$(1)) + +$(eval $(call BuildPackage,aiccu)) +$(eval $(call BuildPackage,aiccu-gnutls)) diff --git a/ipv6/aiccu/files/aiccu.hotplug b/ipv6/aiccu/files/aiccu.hotplug new file mode 100644 index 0000000..b521371 --- /dev/null +++ b/ipv6/aiccu/files/aiccu.hotplug @@ -0,0 +1,3 @@ +#!/bin/sh +NTPSTRATUMFILE="/var/run/aiccu_ntp_stratum" +echo $stratum > "$NTPSTRATUMFILE" diff --git a/ipv6/aiccu/files/aiccu.sh b/ipv6/aiccu/files/aiccu.sh new file mode 100755 index 0000000..584574b --- /dev/null +++ b/ipv6/aiccu/files/aiccu.sh @@ -0,0 +1,121 @@ +#!/bin/sh +# aiccu.sh - AICCU proto +# Copyright (c) 2014 OpenWrt.org + +[ -n "$INCLUDE_ONLY" ] || { + . /lib/functions.sh + . /lib/functions/network.sh + . ../netifd-proto.sh + init_proto "$@" +} + +proto_aiccu_setup() { + local cfg="$1" + local iface="$2" + local link="aiccu-$cfg" + + local username password protocol server ip6prefix tunnelid requiretls defaultroute nat heartbeat verbose sourcerouting ip6addr ntpsynctimeout + json_get_vars username password protocol server ip6prefix tunnelid requiretls defaultroute nat heartbeat verbose sourcerouting ip6addr ntpsynctimeout + + [ -z "$username" -o -z "$password" ] && { + proto_notify_error "$cfg" "MISSING_USERNAME_OR_PASSWORD" + proto_block_restart "$cfg" + return + } + + ( proto_add_host_dependency "$cfg" 0.0.0.0 ) + + CFGFILE="/var/etc/${link}.conf" + PIDFILE="/var/run/${link}.pid" + NTPSTRATUMFILE="/var/run/aiccu_ntp_stratum" + mkdir -p /var/run /var/etc + + echo "username $username" > "$CFGFILE" + echo "password $password" >> "$CFGFILE" + echo "ipv6_interface $link" >> "$CFGFILE" + [ -n "$server" ] && echo "server $server" >> "$CFGFILE" + [ -n "$protocol" ] && echo "protocol $protocol" >> "$CFGFILE" + [ -n "$tunnelid" ] && echo "tunnel_id $tunnelid" >> "$CFGFILE" + [ "$requiretls" == 1 ] && echo "requiretls true" >> "$CFGFILE" + [ "$nat" == 1 ] && echo "behindnat true" >> "$CFGFILE" + [ "$heartbeat" == 1 ] && echo "makebeats true" >> "$CFGFILE" + [ "$verbose" == 1 ] && echo "verbose true" >> "$CFGFILE" + echo "defaultroute false" >> "$CFGFILE" + echo "daemonize true" >> "$CFGFILE" + echo "pidfile $PIDFILE" >> "$CFGFILE" + + # By default, wait at most 90 seconds for NTP sync + [ -z "$ntpsynctimeout" ] && ntpsynctimeout=90 + for i in $(seq 1 $ntpsynctimeout); do + [ -f "$NTPSTRATUMFILE" ] && \ + [ "$(cat $NTPSTRATUMFILE)" -lt 16 ] && \ + echo "NTP synced, stratum $(cat $NTPSTRATUMFILE)" && break + [ "$(( $i % 10 ))" -eq 0 ] && echo "Waiting ${i} secs for NTP sync..." + sleep 1 + done + + aiccu start "$CFGFILE" + + [ "$?" -ne 0 ] && { + proto_notify_error "$cfg" "AICCU_FAILED_SEE_LOG" + proto_block_restart "$cfg" + return + } + + proto_init_update "$link" 1 + + local source="" + [ "$sourcerouting" != "0" ] && source="::/128" + [ "$defaultroute" != "0" ] && proto_add_ipv6_route "::" 0 "" "" "" "$source" + + [ -n "$ip6addr" ] && { + local local6="${ip6addr%%/*}" + local mask6="${ip6addr##*/}" + [[ "$local6" = "$mask6" ]] && mask6= + proto_add_ipv6_address "$local6" "$mask6" + [ "$defaultroute" != "0" -a "$sourcerouting" != "0" ] && proto_add_ipv6_route "::" 0 "" "" "" "$local6/$mask6" + } + + [ -n "$ip6prefix" ] && { + proto_add_ipv6_prefix "$ip6prefix" + [ "$defaultroute" != "0" -a "$sourcerouting" != "0" ] && proto_add_ipv6_route "::" 0 "" "" "" "$ip6prefix" + } + + proto_send_update "$cfg" + +} + +proto_aiccu_teardown() { + local cfg="$1" + local link="aiccu-$cfg" + CFGFILE="/var/etc/${link}.conf" + PIDFILE="/var/run/${link}.pid" + [ -f "$CFGFILE" -a -f "$PIDFILE" ] && { + local pid="$(cat "$PIDFILE")" + [ -d /proc/$pid -a $(cat /proc/$pid/comm) = "aiccu" ] && \ + aiccu stop "$CFGFILE" + } +} + +proto_aiccu_init_config() { + no_device=1 + available=1 + proto_config_add_string "username" + proto_config_add_string "password" + proto_config_add_string "protocol" + proto_config_add_string "server" + proto_config_add_string "ip6addr:ip6addr" + proto_config_add_string "ip6prefix:ip6addr" + proto_config_add_string "tunnelid" + proto_config_add_boolean "requiretls" + proto_config_add_boolean "defaultroute" + proto_config_add_boolean "sourcerouting" + proto_config_add_boolean "nat" + proto_config_add_boolean "heartbeat" + proto_config_add_boolean "verbose" + proto_config_add_int "ntpsynctimeout" +} + +[ -n "$INCLUDE_ONLY" ] || { + add_protocol aiccu +} diff --git a/ipv6/aiccu/patches/100-cross_compile.patch b/ipv6/aiccu/patches/100-cross_compile.patch new file mode 100644 index 0000000..6ef8ad5 --- /dev/null +++ b/ipv6/aiccu/patches/100-cross_compile.patch @@ -0,0 +1,101 @@ +--- a/unix-console/Makefile ++++ b/unix-console/Makefile +@@ -25,7 +25,8 @@ CWARNS += -W -Wall -Wshadow -Wpointer-ar + # CWARNS += -Wpacked + + #CFLAGS += $(CWARNS) -D_GNU_SOURCE -D_DEBUG -g3 -O0 +-CFLAGS += $(CWARNS) -D_GNU_SOURCE ++CFLAGS += $(CWARNS) $(EXTRA_CFLAGS) -D_GNU_SOURCE ++LDFLAGS += $(EXTRA_LDFLAGS) + CC = @gcc + RM = rm + +@@ -40,25 +41,25 @@ CFLAGS += -D AICCU_CONSOLE + # GnuTLS Support ? + # Used by TIC to secure that communication + # Currently defaultly builds only on Linux, but other platforms might easily also support it +-ifeq ($(shell uname | grep -c "Linux"),1) ++ifneq ($(HAVE_GNUTLS),) + CFLAGS += -D AICCU_GNUTLS + LDFLAGS += -lgnutls + endif + + # Linux +-ifeq ($(shell uname | grep -c "Linux"),1) ++ifeq ($(OS_NAME),Linux) + CFLAGS += -D_LINUX -D HAS_IFHEAD -D AICCU_TYPE="\"linux\"" + SRCS += ../common/aiccu_linux.c + OBJS += ../common/aiccu_linux.o +-LDFLAGS += -lpthread -lresolv ++LDFLAGS += -pthread -lresolv + endif + + # FreeBSD +-ifeq ($(shell uname | grep -c "FreeBSD"),1) ++ifeq ($(OS_NAME),FreeBSD) + CFLAGS += -D_FREEBSD + + # FreeBSD 4.x +-ifeq ($(shell uname -r | cut -c 1),4) ++ifeq ($(shell echo $(OS_VERSION) | cut -c 1),4) + CFLAGS += -D AICCU_TYPE="\"freebsd4\"" + SRCS += ../common/aiccu_freebsd4.c + OBJS += ../common/aiccu_freebsd4.o +@@ -71,7 +72,7 @@ endif + endif + + # DragonFlyBSD +-ifeq ($(shell uname | grep -c "DragonFly"),1) ++ifeq ($(OS_NAME),DragonFly) + CFLAGS += -D_DFBSD -D NEED_IFHEAD -D AICCU_TYPE="\"dragonfly\"" + SRCS += ../common/aiccu_freebsd4.c + OBJS += ../common/aiccu_freebsd4.o +@@ -79,7 +80,7 @@ CFLAGS += -pthread + endif + + # NetBSD +-ifeq ($(shell uname | grep -c "NetBSD"),1) ++ifeq ($(OS_NAME),NetBSD) + CFLAGS += -D_NETBSD -D AICCU_TYPE="\"kame\"" + + # Check if net/if_tun.h has TUNSIFHEAD and enable support for it +@@ -97,10 +98,10 @@ CFLAGS += -pthread -D_NETBSD_SOURCE + endif + + # OpenBSD +-ifeq ($(shell uname | grep -c "OpenBSD"),1) ++ifeq ($(OS_NAME),OpenBSD) + CFLAGS += -D_OPENBSD -D HAS_IFHEAD + # 2.7-2.9 +-ifeq ($(shell uname -r | cut -c 1),2) ++ifeq ($(shell echo $(OS_VERSION) | cut -c 1),2) + CFLAGS += -D AICCU_TYPE="\"openbsd2\"" + SRCS += ../common/aiccu_openbsd2.c + OBJS += ../common/aiccu_openbsd2.o +@@ -114,7 +115,7 @@ CFLAGS += -pthread + endif + + # Darwin +-ifeq ($(shell uname | grep -c "Darwin"),1) ++ifeq ($(OS_NAME),Darwin) + CFLAGS += -D_DARWIN -D NEED_IFHEAD -D AICCU_TYPE="\"darwin\"" + SRCS += ../common/aiccu_darwin.c + OBJS += ../common/aiccu_darwin.o +@@ -122,7 +123,7 @@ LDFLAGS += -lresolv + endif + + # SunOS / Solaris +-ifeq ($(shell uname | grep -c "SunOS"),1) ++ifeq ($(OS_NAME),SunOS) + CFLAGS += -D_SUNOS -D AICCU_TYPE="\"sunos\"" + SRCS += ../common/aiccu_sunos.c + OBJS += ../common/aiccu_sunos.o +@@ -130,7 +131,7 @@ LDFLAGS += -lsocket -lnsl -lresolv + endif + + # AIX +-ifeq ($(shell uname | grep -c "AIX"),1) ++ifeq ($(OS_NAME),AIX) + CC = @/usr/vac/bin/xlc_r + CFLAGS = -qthreaded -q64 -qlanglvl=stdc99 -bmaxdata:0xD0000000 -D_64BIT -g -qdbxextra -qfullpath -qheapdebug -qformat=all -qcheck=all + CFLAGS += -D AICCU_CONSOLE diff --git a/ipv6/aiccu/patches/200-add_dn_skipname.patch b/ipv6/aiccu/patches/200-add_dn_skipname.patch new file mode 100644 index 0000000..3ce1e92 --- /dev/null +++ b/ipv6/aiccu/patches/200-add_dn_skipname.patch @@ -0,0 +1,68 @@ +--- /dev/null ++++ b/common/dn_skipname.c +@@ -0,0 +1,51 @@ ++#include ++#include ++ ++/* Ripped from glibc 2.4 sources. */ ++ ++/* ++ * ns_name_skip(ptrptr, eom) ++ * Advance *ptrptr to skip over the compressed name it points at. ++ * return: ++ * 0 on success, -1 (with errno set) on failure. ++ */ ++int ns_name_skip(const u_char **ptrptr, const u_char *eom) ++{ ++ const u_char *cp; ++ u_int n; ++ ++ cp = *ptrptr; ++ while (cp < eom && (n = *cp++) != 0) ++ { ++ /* Check for indirection. */ ++ switch (n & NS_CMPRSFLGS) { ++ case 0: /* normal case, n == len */ ++ cp += n; ++ continue; ++ case NS_CMPRSFLGS: /* indirection */ ++ cp++; ++ break; ++ default: /* illegal type */ ++ errno = EMSGSIZE; ++ return (-1); ++ } ++ break; ++ } ++ if (cp > eom) ++ { ++ errno = EMSGSIZE; ++ return (-1); ++ } ++ *ptrptr = cp; ++ return (0); ++} ++ ++int dn_skipname(const u_char *ptr, const u_char *eom) ++{ ++ const u_char *saveptr = ptr; ++ ++ if(ns_name_skip(&ptr, eom) == -1) ++ return (-1); ++ return (ptr - saveptr); ++} ++ +--- a/unix-console/Makefile ++++ b/unix-console/Makefile +@@ -10,9 +10,9 @@ + # $Date: 2007-01-15 11:04:27 $ + # **********************************************************/ + +-SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c ++SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c ../common/dn_skipname.c + INCS = ../common/tun.h ../common/aiccu.h ../common/hash_md5.h ../common/hash_sha1.h ../common/common.h ../common/heartbeat.h ../common/tic.h ../common/ayiya.h ../common/resolver.h +-OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o ++OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o ../common/dn_skipname.o + + # New features not fully implemented and thus disabled for now + #CFLAGS += -D NEWSTUFF_TSP -D NEWSTUFF_TEEPEE diff --git a/ipv6/aiccu/patches/300-resolver-uclibc.patch b/ipv6/aiccu/patches/300-resolver-uclibc.patch new file mode 100644 index 0000000..b88ef5c --- /dev/null +++ b/ipv6/aiccu/patches/300-resolver-uclibc.patch @@ -0,0 +1,29 @@ +--- a/common/resolver.c ++++ b/common/resolver.c +@@ -26,7 +26,7 @@ + + int getrrs(const char *label, int rrtype, void gotrec(unsigned int num, int type, const char *record)) + { +-#ifdef _LINUX ++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) + struct __res_state res; + #endif + unsigned char answer[8192]; +@@ -38,7 +38,7 @@ int getrrs(const char *label, int rrtype + uint16_t type = 0, class = 0; + uint32_t ttl = 0; + +-#ifdef _LINUX ++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) + memset(&res, 0, sizeof(res)); + res.options = RES_DEBUG; + res_ninit(&res); +@@ -47,7 +47,7 @@ int getrrs(const char *label, int rrtype + #endif + + memset(answer, 0, sizeof(answer)); +-#ifdef _LINUX ++#if defined(_LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) + ret = res_nquery(&res, label, C_IN, rrtype, answer, sizeof(answer)); + #else + ret = res_query(label, C_IN, rrtype, answer, sizeof(answer)); diff --git a/ipv6/aiccu/patches/400-musl-compat.patch b/ipv6/aiccu/patches/400-musl-compat.patch new file mode 100644 index 0000000..b6e0c32 --- /dev/null +++ b/ipv6/aiccu/patches/400-musl-compat.patch @@ -0,0 +1,31 @@ +--- a/common/common.h ++++ b/common/common.h +@@ -50,6 +50,7 @@ + #include + #include + #include ++#include + #include + + #if defined(_SUNOS) || defined(_AIX) || defined(_DARWIN) +@@ -91,7 +92,9 @@ + #include + + #include ++#if defined(__GLIBC__) || defined(__UCLIBC__) + #include ++#endif + #ifdef linux + #include + #include +--- a/common/dn_skipname.c ++++ b/common/dn_skipname.c +@@ -1,6 +1,8 @@ + #include + #include + ++#include ++ + /* Ripped from glibc 2.4 sources. */ + + /* diff --git a/ipv6/aiccu/patches/500-gnutls_3.4.patch b/ipv6/aiccu/patches/500-gnutls_3.4.patch new file mode 100644 index 0000000..a314784 --- /dev/null +++ b/ipv6/aiccu/patches/500-gnutls_3.4.patch @@ -0,0 +1,22 @@ +--- aiccu/common/common.c ++++ aiccu/common/common.c +@@ -271,8 +271,6 @@ + TLSSOCKET sock_alloc(void) + { + #ifdef AICCU_GNUTLS +- /* Allow connections to servers that have OpenPGP keys as well */ +- const int cert_type_priority[3] = { GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0 }; + int ret; + #endif /* AICCU_GNUTLS*/ + +@@ -300,7 +298,8 @@ + gnutls_set_default_priority(sock->session); + /* XXX: Return value is not documented in GNUTLS documentation! */ + +- gnutls_certificate_type_set_priority(sock->session, cert_type_priority); ++ /* Allow connections to servers that have OpenPGP keys as well */ ++ gnutls_priority_set_direct(sock->session, "NORMAL:+CTYPE-OPENPGP", NULL); + /* XXX: Return value is not documented in GNUTLS documentation! */ + + /* Configure the x509 credentials for the current session */ + diff --git a/ipv6/tayga/Makefile b/ipv6/tayga/Makefile new file mode 100644 index 0000000..d68a271 --- /dev/null +++ b/ipv6/tayga/Makefile @@ -0,0 +1,49 @@ +# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tayga +PKG_VERSION:=0.9.2 +PKG_RELEASE:=2 + +PKG_SOURCE:=tayga-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://www.litech.org/tayga/ +PKG_MD5SUM:=7a7b24165ce008df772f398d86fa280e +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/tayga + SECTION:=net + CATEGORY:=Network + DEPENDS:=+ip @IPV6 +kmod-tun + TITLE:=Out-of-kernel stateless NAT64 implementation for Linux + URL:=http://www.litech.org/tayga/ + MAINTAINER:=Ondrej Caletka +endef + +define Package/tayga/description + TAYGA is an out-of-kernel stateless NAT64 implementation for + Linux. It uses the TUN driver to exchange packets with the + kernel, which is the same driver used by OpenVPN and QEMU/KVM. +endef + +ifdef CONFIG_PACKAGE_netifd + define Package/tayga/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/netifd/proto + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tayga $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/tayga-proto.sh $(1)/lib/netifd/proto/tayga.sh + endef +else + define Package/tayga/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/lib/network $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) $(PKG_BUILD_DIR)/tayga $(1)/usr/sbin/ + $(INSTALL_DATA) ./files/tayga.sh $(1)/lib/network/tayga.sh + $(INSTALL_DATA) ./files/tayga.hotplug $(1)/etc/hotplug.d/iface/95-tayga + endef +endif + +$(eval $(call BuildPackage,tayga)) diff --git a/ipv6/tayga/files/tayga-proto.sh b/ipv6/tayga/files/tayga-proto.sh new file mode 100755 index 0000000..b92c2a6 --- /dev/null +++ b/ipv6/tayga/files/tayga-proto.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# tayga.sh - TAYGA proto +# Copyright (c) 2014 OpenWrt.org + +[ -n "$INCLUDE_ONLY" ] || { + . /lib/functions.sh + . /lib/functions/network.sh + . ../netifd-proto.sh + init_proto "$@" +} + +proto_tayga_setup() { + local cfg="$1" + local iface="$2" + local link="tayga-$cfg" + + local ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr noroutes + json_get_vars ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr noroutes + [ -z "$ipv4_addr" -o -z "$prefix" ] && { + proto_notify_error "$cfg" "REQUIRED_PARAMETERS_MISSING" + proto_block_restart "$cfg" + return + } + + local tmpconf="/var/etc/tayga-$cfg.conf" + mkdir -p /var/etc + mkdir -p /var/run/tayga/$cfg + + echo "tun-device $link" >$tmpconf + echo "ipv4-addr $ipv4_addr" >>$tmpconf + [ -n "$ipv6_addr" ] && + echo "ipv6-addr $ipv6_addr" >>$tmpconf + [ -n "$prefix" ] && + echo "prefix $prefix" >>$tmpconf + [ -n "$dynamic_pool" ] && + echo "dynamic-pool $dynamic_pool" >>$tmpconf + echo "data-dir /var/run/tayga/$cfg" >>$tmpconf + #TODO: Support static mapping of IPv4 <-> IPv6 + + # here we create TUN device and check configuration + tayga -c $tmpconf --mktun + [ "$?" -ne 0 ] && { + proto_notify_error "$cfg" "TAYGA_FAILED" + proto_block_restart "$cfg" + return + } + + proto_init_update "$link" 1 + + [ -n "$ipaddr" ] && proto_add_ipv4_address "$ipaddr" "255.255.255.255" + [ -n "$ip6addr" ] && proto_add_ipv6_address "$ip6addr" "128" + + [ "$noroutes" != 1 ] && { + [ -n "$ipv6_addr" ] && proto_add_ipv6_route "$ipv6_addr" "128" + [ -n "$dynamic_pool" ] && { + local pool="${dynamic_pool%%/*}" + local mask="${dynamic_pool##*/}" + proto_add_ipv4_route "$pool" "$mask" + } + [ -n "$prefix" ] && { + local prefix6="${prefix%%/*}" + local mask6="${prefix##*/}" + proto_add_ipv6_route "$prefix6" "$mask6" + } + } + + proto_send_update "$cfg" + + proto_run_command "$cfg" tayga -n -c $tmpconf \ + -p /var/run/$link.pid + +} + +proto_tayga_teardown() { + local cfg="$1" + local tmpconf="/var/etc/tayga-$cfg.conf" + proto_kill_command "$cfg" + sleep 1 + tayga -c $tmpconf --rmtun +} + +proto_tayga_init_config() { + no_device=1 + available=1 + proto_config_add_string "ipv4_addr" + proto_config_add_string "ipv6_addr" + proto_config_add_string "prefix" + proto_config_add_string "dynamic_pool" + proto_config_add_string "ipaddr" + proto_config_add_string "ip6addr:ip6addr" + proto_config_add_boolean "noroutes" +} + +[ -n "$INCLUDE_ONLY" ] || { + add_protocol tayga +} diff --git a/ipv6/tayga/files/tayga.hotplug b/ipv6/tayga/files/tayga.hotplug new file mode 100644 index 0000000..fb989bd --- /dev/null +++ b/ipv6/tayga/files/tayga.hotplug @@ -0,0 +1,37 @@ +#!/bin/sh + +if [ "$ACTION" = ifup ]; then + . /lib/functions.sh + + include /lib/network + scan_interfaces + + update_tunnel() { + local cfg="$1" + + local proto + config_get proto "$cfg" proto + [ "$proto" = tayga ] || return 0 + + local wandev4 + config_get wandev4 "$cfg" wan4_device "$(find_tayga_wanif4)" + + local wandev6 + config_get wandev6 "$cfg" wan6_device "$(find_tayga_wanif6)" + + [ "$wandev4" = "$DEVICE" ] || [ "$wandev6" = "$DEVICE" ] || return 0 + + local wanip4=$(find_tayga_wanip4 "$wandev4") + local wanip6=$(find_tayga_wanip6 "$wandev6") + + [ -n "$wanip4" ] && [ -n "$wanip6" ] && { + uci_set_state network "$cfg" ipv4addr "$wanip4" + uci_set_state network "$cfg" ipv6addr "$wanip6" + + logger -t tayga-update "Re-establishing tayga NAT64 due to change on $INTERFACE ($DEVICE)" + ifup "$cfg" & + } + } + + config_foreach update_tunnel interface +fi diff --git a/ipv6/tayga/files/tayga.sh b/ipv6/tayga/files/tayga.sh new file mode 100644 index 0000000..a9edb6d --- /dev/null +++ b/ipv6/tayga/files/tayga.sh @@ -0,0 +1,152 @@ +# tayga.sh - NAT64 backend + +find_tayga_wanif4() { + local if=$(ip -4 r l e 0.0.0.0/0); if="${if#default* dev }"; if="${if%% *}" + [ -n "$if" ] && grep -qs "^ *$if:" /proc/net/dev && echo "$if" +} + +find_tayga_wanip4() { + local ip=$(ip -4 a s dev "$1"); ip="${ip#*inet }" + echo "${ip%%[^0-9.]*}" +} + +find_tayga_wanif6() { + local if=$(ip -6 r l e ::/0); if="${if#default* dev }"; if="${if%% *}" + [ -n "$if" ] && grep -qs "^ *$if:" /proc/net/dev && echo "$if" +} + +find_tayga_wanip6() { + local ip=$(ip -6 a s dev "$1"); ip="${ip#*inet6 }" + echo "${ip%%[^0-9A-Fa-f:]*}" +} + +# Hook into scan_interfaces() to synthesize a .device option +# This is needed for /sbin/ifup to properly dispatch control +# to setup_interface_tayga() even if no .ifname is set in +# the configuration. +scan_tayga() { + config_set "$1" device "tayga-$1" +} + +coldplug_interface_tayga() { + setup_interface_tayga "tayga-$1" "$1" +} + +tayga_add_static_mappings() { + local tmpconf="$1" + + ( + . /lib/functions.sh + config_load firewall + + tayga_map_rule_add() { + local cfg="$1" + local tmpconf="$2" + local ipv4_addr ipv6_addr + config_get ipv4_addr "$cfg" ipv4_addr "" + config_get ipv6_addr "$cfg" ipv6_addr "" + [ -n "$ipv4_addr" ] && [ -n "$ipv6_addr" ] && + echo "map $ipv4_addr $ipv6_addr" >>$tmpconf + } + + config_foreach tayga_map_rule_add nat64 "$tmpconf" + ) +} + +setup_interface_tayga() { + local iface="$1" + local cfg="$2" + local link="tayga-$cfg" + + local ipv4_addr ipv6_addr prefix dynamic_pool + + config_get ipv4_addr "$cfg" ipv4_addr + config_get ipv6_addr "$cfg" ipv6_addr + config_get prefix "$cfg" prefix + config_get dynamic_pool "$cfg" dynamic_pool + + local args + + include /lib/network + scan_interfaces + + local wanip4=$(uci_get network "$cfg" ipv4addr) + local wanip6=$(uci_get network "$cfg" ipv6addr) + + local wanif4=$(find_tayga_wanif4) + local wanif6=$(find_tayga_wanif6) + + [ -z "$wanip4" ] && { + [ -n "$wanif4" ] && { + wanip4=$(find_tayga_wanip4 "$wanif4") + uci_set_state network "$cfg" wan4_device "$wanif4" + } + } + + [ -z "$wanip6" ] && { + [ -n "$wanif6" ] && { + wanip6=$(find_tayga_wanip6 "$wanif6") + uci_set_state network "$cfg" wan6_device "$wanif6" + } + } + + [ -n "$wanip4" ] && [ -n "$wanip6" ] || { + echo "Cannot determine local IPv4 and IPv6 addressed for tayga NAT64 $cfg - skipping" + return 1 + } + + local tmpconf="/var/etc/tayga-$cfg.conf" + args="-c $tmpconf" + mkdir -p /var/etc + mkdir -p /var/run/tayga/$cfg + + echo "tun-device $link" >$tmpconf + echo "ipv4-addr $ipv4_addr" >>$tmpconf + [ -n "$ipv6_addr" ] && + echo "ipv6-addr $ipv6_addr" >>$tmpconf + [ -n "$prefix" ] && + echo "prefix $prefix" >>$tmpconf + + tayga_add_static_mappings "$tmpconf" + + [ -n "$dynamic_pool" ] && + echo "dynamic-pool $dynamic_pool" >>$tmpconf + echo "data-dir /var/run/tayga/$cfg" >>$tmpconf + + # creating the tunnel below will trigger a net subsystem event + # prevent it from touching or iface by disabling .auto here + uci_set_state network "$cfg" ifname $link + uci_set_state network "$cfg" auto 0 + + # here we create TUN device and check configuration + tayga $args --mktun || return 1 + + ip link set "$link" up + + ip addr add "$wanip4" dev "$link" + ip addr add "$wanip6" dev "$link" + + [ -n "$dynamic_pool" ] && + ip -4 route add "$dynamic_pool" dev "$link" + [ -n "$prefix" ] && + ip -6 route add "$prefix" dev "$link" + + start-stop-daemon -S -x tayga -- $args -p /var/run/$link.pid + + env -i ACTION="ifup" DEVICE="$link" INTERFACE="$cfg" PROTO="tayga" \ + /sbin/hotplug-call iface +} + +stop_interface_tayga() { + local cfg="$1" + local link="tayga-$cfg" + + env -i ACTION="ifdown" DEVICE="$link" INTERFACE="$cfg" PROTO="tayga" \ + /sbin/hotplug-call iface + + service_kill tayga "/var/run/$link.pid" + + ip link set "$link" down + ip addr flush dev "$link" + ip route flush dev "$link" +} diff --git a/ipv6/tayga/patches/001-configure_unset_CFLAGS.patch b/ipv6/tayga/patches/001-configure_unset_CFLAGS.patch new file mode 100644 index 0000000..c56b5f2 --- /dev/null +++ b/ipv6/tayga/patches/001-configure_unset_CFLAGS.patch @@ -0,0 +1,11 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -5,8 +5,6 @@ AC_CONFIG_HEADERS(config.h) + + AC_PROG_CC + +-CFLAGS='-g -Wall' +- + tayga_conf_path=${sysconfdir}/tayga.conf + + AC_SUBST(tayga_conf_path) diff --git a/ipv6/tayga/patches/002-bigendian_wrong_checksum.patch b/ipv6/tayga/patches/002-bigendian_wrong_checksum.patch new file mode 100644 index 0000000..d8deac3 --- /dev/null +++ b/ipv6/tayga/patches/002-bigendian_wrong_checksum.patch @@ -0,0 +1,53 @@ +--- a/nat64.c ++++ b/nat64.c +@@ -19,6 +19,11 @@ + + extern struct config *gcfg; + ++static uint16_t checksum_extend_byte(uint8_t b) ++{ ++ return htons(b << 8); ++} ++ + static uint16_t ip_checksum(void *d, int c) + { + uint32_t sum = 0xffff; +@@ -30,7 +35,7 @@ static uint16_t ip_checksum(void *d, int + } + + if (c) +- sum += htons(*((uint8_t *)p) << 8); ++ sum += checksum_extend_byte(*((uint8_t *)p)); + + while (sum > 0xffff) + sum = (sum & 0xffff) + (sum >> 16); +@@ -180,10 +185,12 @@ static int xlate_payload_4to6(struct pkt + cksum = ones_add(p->icmp->cksum, cksum); + if (p->icmp->type == 8) { + p->icmp->type = 128; +- p->icmp->cksum = ones_add(cksum, ~(128 - 8)); ++ p->icmp->cksum = ones_add(cksum, ++ ~checksum_extend_byte(128 - 8)); + } else { + p->icmp->type = 129; +- p->icmp->cksum = ones_add(cksum, ~(129 - 0)); ++ p->icmp->cksum = ones_add(cksum, ++ ~checksum_extend_byte(129 - 0)); + } + return 0; + case 17: +@@ -668,10 +675,12 @@ static int xlate_payload_6to4(struct pkt + cksum = ones_add(p->icmp->cksum, cksum); + if (p->icmp->type == 128) { + p->icmp->type = 8; +- p->icmp->cksum = ones_add(cksum, 128 - 8); ++ p->icmp->cksum = ones_add(cksum, ++ checksum_extend_byte(128 - 8)); + } else { + p->icmp->type = 0; +- p->icmp->cksum = ones_add(cksum, 129 - 0); ++ p->icmp->cksum = ones_add(cksum, ++ checksum_extend_byte(129 - 0)); + } + return 0; + case 17: diff --git a/kernel/exfat-nofuse/Makefile b/kernel/exfat-nofuse/Makefile new file mode 100644 index 0000000..694ad1e --- /dev/null +++ b/kernel/exfat-nofuse/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2014 Bruno Randolf +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=exfat-nofuse +PKG_VERSION=2016-09-26-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/dorimanx/exfat-nofuse.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=051167ceccbe75d9d77fc4f5356f5a39a01779e8 + +PKG_MAINTAINER:=Bruno Randolf +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/fs-exfat + SUBMENU:=Filesystems + TITLE:=ExFAT Kernel driver + FILES:=$(PKG_BUILD_DIR)/exfat.ko + AUTOLOAD:=$(call AutoLoad,30,exfat,1) + DEPENDS:=+kmod-nls-base @BUILD_PATENTED +endef + +define KernelPackage/fs-exfat/description + Kernel module for ExFAT Filesytems +endef + +MAKE_OPTS:= \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + M="$(PKG_BUILD_DIR)" + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + CONFIG_EXFAT_FS=m \ + modules +endef + +$(eval $(call KernelPackage,fs-exfat)) diff --git a/kernel/mtd-rw/Makefile b/kernel/mtd-rw/Makefile new file mode 100644 index 0000000..7385df9 --- /dev/null +++ b/kernel/mtd-rw/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2016 Joseph C. Lehner +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=mtd-rw +PKG_VERSION:=git-20160214 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/jclehner/mtd-rw.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=7e8562067d6a366c8cbaa8084396c33b7e12986b + +PKG_MAINTAINER=Joseph C. Lehner +PKG_LICENSE=GPL-2.0 +PKG_LICENSE_FILES=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/mtd-rw + SUBMENU:=Other modules + TITLE:=Write-enabler for MTD partitions + FILES:=$(PKG_BUILD_DIR)/mtd-rw.ko +endef + +define KernelPackage/mtd-rw/description + A kernel module that temporarily makes all MTD partitions writeable. +endef + +MAKE_OPTS:= \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + M="$(PKG_BUILD_DIR)" + +define Build/Compile + $(MAKE) -C "$(LINUX_DIR)" \ + $(MAKE_OPTS) \ + CONFIG_MTD_RW=m \ + modules +endef + +$(eval $(call KernelPackage,mtd-rw)) diff --git a/lang/chardet/Makefile b/lang/chardet/Makefile new file mode 100644 index 0000000..6343b4e --- /dev/null +++ b/lang/chardet/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=chardet +PKG_VERSION:=2.3.0 +PKG_RELEASE:=1 +PKG_LICENSE:=LGPL-2.1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/c/chardet/ +PKG_MD5SUM:=25274d664ccb5130adae08047416e1a8 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/chardet + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Universal encoding detector for Python 2 and 3 + URL:=https://github.com/chardet/chardet + DEPENDS:=+python +endef + +define Package/chardet/description + Universal encoding detector for Python 2 and 3 +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/chardet/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/chardetect \ + $(1)/usr/bin + # fix python exec path in scripts + sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/bin/chardetect +endef + +$(eval $(call BuildPackage,chardet)) diff --git a/lang/django-appconf/Makefile b/lang/django-appconf/Makefile new file mode 100644 index 0000000..c06fa6a --- /dev/null +++ b/lang/django-appconf/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-appconf +PKG_VERSION:=1.0.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/34/b9/d07195652ab494b026f7cb0341dd6e5f2e6e39be177abe05e2cec8bd46e4/ +PKG_MD5SUM:=cc11511a47088bc56531df67cd5d6261 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-appconf + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A helper class for handling configuration defaults of packaged apps gracefully. + URL:=http://django-appconf.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/django-appconf/description + A helper class for handling configuration defaults of packaged apps gracefully. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-appconf/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-appconf)) diff --git a/lang/django-compressor/Makefile b/lang/django-compressor/Makefile new file mode 100644 index 0000000..414e342 --- /dev/null +++ b/lang/django-compressor/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-compressor +PKG_VERSION:=2.1 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=django_compressor-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/23/46/2c7d582255969ad5259937f5f9e14aec1f3349d0fc0651129330918d1c6d/ +PKG_BUILD_DIR:=$(BUILD_DIR)/django_compressor-$(PKG_VERSION)/ +PKG_MD5SUM:=21ecfe4e8615eae64f7068a5599df9af +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-compressor + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Compresses linked and inline JavaScript or CSS into single cached files. + URL:=http://django-compressor.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/django-compressor/description + Compresses linked and inline JavaScript or CSS into single cached files. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-compressor/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-compressor)) diff --git a/lang/django-constance/Makefile b/lang/django-constance/Makefile new file mode 100644 index 0000000..11dd2e2 --- /dev/null +++ b/lang/django-constance/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-constance +PKG_VERSION:=1.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/0a/ff/1c1caae2b7be9c26f2aee0703236998e22cf5557fa56726347b5afa149d1/ +PKG_MD5SUM:=f9f8e527df50b0a1533149d9be0b814b +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-constance + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Django live settings with pluggable backends, including Redis. + URL:=https://github.com/jazzband/django-constance + DEPENDS:=+python +django +endef + +define Package/django-constance/description + Django live settings with pluggable backends, including Redis. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-constance/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-constance)) diff --git a/lang/django-jsonfield/Makefile b/lang/django-jsonfield/Makefile new file mode 100644 index 0000000..40a9ff7 --- /dev/null +++ b/lang/django-jsonfield/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-jsonfield +PKG_VERSION:=1.0.1 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/e4/b2/a079f0a2218e0eb7892edbf404e0bbfbb281a6bbf06966b775f5142ed159/ +PKG_MD5SUM:=2e5e737a3f93f3b5d7ae6026b1340167 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-jsonfield + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=JSONField for django models + URL:=https://github.com/bradjasper/django-jsonfield + DEPENDS:=+python +django +endef + +define Package/django-jsonfield/description + JSONField for django models +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-jsonfield/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-jsonfield)) diff --git a/lang/django-picklefield/Makefile b/lang/django-picklefield/Makefile new file mode 100644 index 0000000..0747796 --- /dev/null +++ b/lang/django-picklefield/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-picklefield +PKG_VERSION:=0.3.2 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/d/django-picklefield/ +PKG_MD5SUM:=b2c17ca9e03704ce33890e6aefc7b2e5 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-picklefield + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Pickled object field for Django + URL:=http://github.com/gintas/django-picklefield/ + DEPENDS:=+python +django +endef + +define Package/django-picklefield/description + Pickled object field for Django +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-picklefield/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-picklefield)) diff --git a/lang/django-postoffice/Makefile b/lang/django-postoffice/Makefile new file mode 100644 index 0000000..18dce36 --- /dev/null +++ b/lang/django-postoffice/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-postoffice +PKG_VERSION:=2.0.8 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=django-post_office-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/52/25/cc0cfe923f183d7c19b162cac3bf8430ddaed7bad28202b8f93a97d248a4/ +PKG_BUILD_DIR:=$(BUILD_DIR)/django-post_office-$(PKG_VERSION)/ +PKG_MD5SUM:=437bf62cef06381d346ae2bc087c0e3c +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-postoffice + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A Django app to monitor and send mail asynchronously, complete with template support. + URL:=https://github.com/ui/django-postoffice + DEPENDS:=+python +django +django-jsonfield +endef + +define Package/django-postoffice/description + A Django app to monitor and send mail asynchronously, complete with template support. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-postoffice/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-postoffice)) diff --git a/lang/django-restframework/Makefile b/lang/django-restframework/Makefile new file mode 100644 index 0000000..5ae6956 --- /dev/null +++ b/lang/django-restframework/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-restframework +PKG_VERSION:=3.3.3 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=djangorestframework-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/d/djangorestframework/ +PKG_BUILD_DIR:=$(BUILD_DIR)/djangorestframework-$(PKG_VERSION) +PKG_MD5SUM:=6f5ee9646e7fa87dad4385d3c7e7678d +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-restframework + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Web APIs for Django, made easy. + URL:=http://www.django-rest-framework.org/ + DEPENDS:=+python +django +endef + +define Package/django-restframework/description + Web APIs for Django, made easy. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-restframework/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-restframework)) diff --git a/lang/django-statici18n/Makefile b/lang/django-statici18n/Makefile new file mode 100644 index 0000000..5d94774 --- /dev/null +++ b/lang/django-statici18n/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django-statici18n +PKG_VERSION:=1.2.1 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/72/76/6ee13019e1691bff6b759136068ee77fcc2982b700135caa134030937b28/ +PKG_MD5SUM:=67cac19909dd3272ae1fc73ad8d1dca3 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django-statici18n + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A Django app that provides helper for generating JavaScript catalog to static files. + URL:=http://django-statici18n.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/django-statici18n/description + A Django app that provides helper for generating JavaScript catalog to static files. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/django-statici18n/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,django-statici18n)) diff --git a/lang/django/Makefile b/lang/django/Makefile new file mode 100644 index 0000000..c932cc1 --- /dev/null +++ b/lang/django/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=django +PKG_VERSION:=1.8.12 +PKG_RELEASE=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/django/django.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=c168aeba175dbb92c615460a360cb1ea978de5d3 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/django + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=The web framework for perfectionists with deadlines. + MAINTAINER:=Gergely Kiss + URL:=https://www.djangoproject.com/ + DEPENDS:=+python +endef + +define Package/django/description + The web framework for perfectionists with deadlines. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/django-admin.py \ + $(1)/usr/bin +endef + +define Package/django/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/django-admin.py \ + $(1)/usr/bin + # fix python exec path + sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/bin/django-admin.py +endef + +$(eval $(call BuildPackage,django)) diff --git a/lang/dkjson/Makefile b/lang/dkjson/Makefile new file mode 100644 index 0000000..efb0012 --- /dev/null +++ b/lang/dkjson/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 20013-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dkjson +PKG_VERSION:=2.5 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=https://github.com/LuaDist/dkjson.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=e72ba0c9f5d8b8746fc306f6189a819dbb5cd0be +PKG_LICENSE:=MIT +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/dkjson + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=DKJSON + URL:=http://dkolf.de/src/dkjson-lua.fsl/home + MAINTAINER:=Lars Gierth + DEPENDS:=+lua +endef + +define Package/dkjson/description + Lua JSON parser/serializer with UTF-8 support +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/dkjson/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dkjson.lua $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,dkjson)) diff --git a/lang/erlang/Makefile b/lang/erlang/Makefile new file mode 100644 index 0000000..3a86aa5 --- /dev/null +++ b/lang/erlang/Makefile @@ -0,0 +1,339 @@ +# +# Copyright (C) 2009-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=erlang +PKG_VERSION:=17.5 +PKG_RELEASE:=3 + +PKG_SOURCE:=otp_src_$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= http://www.erlang.org/download/ \ + http://erlang.mirror.su.se/ +PKG_MD5SUM:=346dd0136bf1cc28cebc140e505206bb + +PKG_LICENSE:=ErlPL-1.1 +PKG_LICENSE_FILES:=EPLICENCE +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_DEPENDS:=erlang/host openssl +PKG_USE_MIPS16:=0 + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/otp_src_$(PKG_VERSION) +PKG_BUILD_DIR:=$(BUILD_DIR)/otp_src_$(PKG_VERSION) + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/erlang/Default + SUBMENU:=Erlang + SECTION:=lang + CATEGORY:=Languages + TITLE:=Erlang/OTP programming language + URL:=http://www.erlang.org/ +endef + +define Package/erlang/Default/description + Erlang/OTP is a general-purpose programming language and runtime + environment. Erlang has built-in support for concurrency, distribution + and fault tolerance. +endef + +define Package/erlang +$(call Package/erlang/Default) + DEPENDS+= +libncurses +librt +zlib + PROVIDES:= erlang-erts=6.4 erlang-kernel=3.2 erlang-sasl=2.4.1 erlang-stdlib=2.4 +endef + +define Package/erlang/description +$(call Package/erlang/Default/description) + . + This package contains the runtime implementation and a minimal set of + modules (erts, kernel, sasl & stdlib). +endef + + +define Package/erlang-asn1 +$(call Package/erlang/Default) + TITLE:=Abstract Syntax Notation One (ASN.1) support + VERSION:=3.0.4 + DEPENDS+= +erlang +erlang-syntax-tools +endef + +define Package/erlang-asn1/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides Abstract Syntax Notation One (ASN.1) + support. +endef + + +define Package/erlang-compiler +$(call Package/erlang/Default) + TITLE:=Byte code compiler + VERSION:=5.0.4 + DEPENDS+= +erlang +erlang-hipe +endef + +define Package/erlang-compiler/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides a byte code compiler for Erlang which + produces highly compact code. +endef + + +define Package/erlang-crypto +$(call Package/erlang/Default) + TITLE:=Cryptography support + VERSION:=3.5 + DEPENDS+= +erlang +libopenssl +endef + +define Package/erlang-crypto/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides functions for computation of message + digests, and encryption and decryption functions. +endef + + +define Package/erlang-hipe +$(call Package/erlang/Default) + TITLE:=High Performance Erlang + VERSION:=3.11.3 + DEPENDS+= +erlang +endef + +define Package/erlang-hipe/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides HiPE (High Performance Erlang) + support. +endef + + +define Package/erlang-inets +$(call Package/erlang/Default) + TITLE:=Internet clients and servers + VERSION:=5.10.6 + DEPENDS+= +erlang +endef + +define Package/erlang-inets/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides a container for Internet clients and + servers. Currently a FTP client, a HTTP client and server, and a tftp + client and server have been incorporated in Inets. +endef + + +define Package/erlang-mnesia +$(call Package/erlang/Default) + TITLE:=Distributed database + VERSION:=4.12.5 + DEPENDS+= +erlang +endef + +define Package/erlang-mnesia/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides a distributed DataBase Management + System (DBMS), appropriate for telecommunications applications and + other Erlang applications which require continuous operation and + exhibit soft real-time properties. +endef + + +define Package/erlang-runtime-tools +$(call Package/erlang/Default) + TITLE:=Low-profile debugging/tracing tools + VERSION:=1.8.16 + DEPENDS+= +erlang +endef + +define Package/erlang-runtime-tools/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides low footprint tracing/debugging tools + suitable for inclusion in a production system. +endef + + +define Package/erlang-snmp +$(call Package/erlang/Default) + TITLE:=Simple Network Management Protocol (SNMP) support + VERSION:=5.1.1 + DEPENDS+= +erlang +erlang-asn1 +endef + +define Package/erlang-snmp/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides Simple Network Management Protocol + (SNMP) support including a MIB compiler and tools for creating SNMP + agents. +endef + + +define Package/erlang-ssh +$(call Package/erlang/Default) + TITLE:=Secure Shell (SSH) support + VERSION:=3.2 + DEPENDS+= +erlang +erlang-crypto +endef + +define Package/erlang-ssh/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides an implementation of the Secure Shell + protocol, with SSH & SFTP support. +endef + + +define Package/erlang-ssl +$(call Package/erlang/Default) + TITLE:=Secure Sockets Layer (SSL) support + VERSION:=6.0 + DEPENDS+= +erlang +erlang-crypto +endef + +define Package/erlang-ssl/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides support for secure communication over + sockets. +endef + + +define Package/erlang-syntax-tools +$(call Package/erlang/Default) + TITLE:=Abstract Erlang syntax trees handling support + VERSION:=1.6.18 + DEPENDS+= +erlang +endef + +define Package/erlang-syntax-tools/description +$(call Package/erlang/Default/description) + . + This Erlang/OTP package provides support for handling abstract Erlang + syntax trees. +endef + + +# Host + +HOST_CONFIGURE_ARGS += \ + --disable-hipe \ + --disable-smp-support \ + --without-javac + +HOST_CFLAGS += -D_GNU_SOURCE + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR) all +endef + +define Host/Install + $(MAKE) -C $(HOST_BUILD_DIR) install +endef + + +# Target + +CONFIGURE_ARGS += \ + --disable-hipe \ + --disable-smp-support \ + --without-javac \ + --enable-dynamic-ssl-lib + +CONFIGURE_VARS += \ + SHLIB_LD="$(TARGET_CC)" \ + TARGET_ARCH="$(TARGET_ARCH)" \ + ac_cv_func_mmap_fixed_mapped=yes \ + ac_cv_path_WX_CONFIG_PATH=no \ + erl_xcomp_getaddrinfo=no \ + erl_xcomp_sysroot="$(STAGING_DIR)" + +EXTRA_CFLAGS+=-D_GNU_SOURCE +EXTRA_LDFLAGS+=-lz + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + noboot + $(MAKE) -C $(PKG_BUILD_DIR) \ + INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \ + install +endef + +define Package/erlang/install + $(INSTALL_DIR) $(1)/usr/bin + for f in epmd erl erlc escript run_erl; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/$$$$f $(1)/usr/bin/ ; \ + done + $(INSTALL_DIR) $(1)/usr/lib/erlang/bin + for f in erl erlc escript run_erl start start.boot start.script start_clean.boot start_erl start_sasl.boot to_erl; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/bin/$$$$f $(1)/usr/lib/erlang/bin/ ; \ + done + $(INSTALL_DIR) $(1)/usr/lib/erlang/lib + for m in erts kernel sasl stdlib; do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/lib/$$$$m-* $(1)/usr/lib/erlang/lib/ ; \ + rm -rf $(1)/usr/lib/erlang/lib/$$$$m-*/examples ; \ + rm -rf $(1)/usr/lib/erlang/lib/$$$$m-*/src ; \ + done + $(INSTALL_DIR) $(1)/usr/lib/erlang + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/erts-* $(1)/usr/lib/erlang/ + rm -rf $(1)/usr/lib/erlang/erts-*/{doc,include,lib,man,src} + rm -rf $(1)/usr/lib/erlang/erts-*/bin/*.src + $(INSTALL_DIR) $(1)/usr/lib/erlang/releases + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/releases/* $(1)/usr/lib/erlang/releases/ + $(SED) 's,%ERL_ROOT%,/usr/lib/erlang,g' \ + $(1)/usr/lib/erlang/releases/RELEASES.src + mv -f $(1)/usr/lib/erlang/releases/RELEASES.src \ + $(1)/usr/lib/erlang/releases/RELEASES + for f in bin/erl bin/start erts-*/bin/erl erts-*/bin/start; do \ + $(SED) 's,^\(ROOTDIR\)=.*,\1=/usr/lib/erlang,g' \ + $(1)/usr/lib/erlang/$$$$f ; \ + done +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/lib/erl_interface/obj/*/*.a $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_BUILD_DIR)/lib/erl_interface/include/*.h $(1)/usr/include/ +endef + +define BuildModule + + define Package/erlang-$(1)/install + $(INSTALL_DIR) $$(1)/usr/lib/erlang/lib + for m in $(2); do \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/erlang/lib/$$$$$$$$m-* $$(1)/usr/lib/erlang/lib/ ; \ + rm -rf $$(1)/usr/lib/erlang/lib/$$$$$$$$m-*/{examples,priv/obj,src} ; \ + done + endef + + $$(eval $$(call BuildPackage,erlang-$(1))) + +endef + + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,erlang)) +$(eval $(call BuildModule,asn1,asn1)) +$(eval $(call BuildModule,compiler,compiler)) +$(eval $(call BuildModule,crypto,crypto)) +$(eval $(call BuildModule,hipe,hipe)) +$(eval $(call BuildModule,inets,inets)) +$(eval $(call BuildModule,mnesia,mnesia)) +$(eval $(call BuildModule,runtime-tools,runtime_tools)) +$(eval $(call BuildModule,snmp,snmp)) +$(eval $(call BuildModule,ssh,ssh)) +$(eval $(call BuildModule,ssl,ssl)) +$(eval $(call BuildModule,syntax-tools,syntax_tools)) diff --git a/lang/erlang/patches/101-emulator_includes.patch b/lang/erlang/patches/101-emulator_includes.patch new file mode 100644 index 0000000..5a413af --- /dev/null +++ b/lang/erlang/patches/101-emulator_includes.patch @@ -0,0 +1,11 @@ +--- a/erts/emulator/Makefile.in ++++ b/erts/emulator/Makefile.in +@@ -682,7 +682,7 @@ $(OBJDIR)/beam_emu.o: beam/beam_emu.c + endif + + $(OBJDIR)/%.o: beam/%.c +- $(V_CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) $(INCLUDES) -c $< -o $@ ++ $(V_CC) $(INCLUDES) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) -c $< -o $@ + + $(OBJDIR)/%.o: $(TARGET)/%.c + $(V_CC) $(CFLAGS) $(INCLUDES) -Idrivers/common -c $< -o $@ diff --git a/lang/erlang/patches/102-musl_compat.patch b/lang/erlang/patches/102-musl_compat.patch new file mode 100644 index 0000000..d23900e --- /dev/null +++ b/lang/erlang/patches/102-musl_compat.patch @@ -0,0 +1,11 @@ +--- a/lib/erl_interface/src/connect/ei_resolve.c ++++ b/lib/erl_interface/src/connect/ei_resolve.c +@@ -642,7 +642,7 @@ struct hostent *ei_gethostbyname_r(const + #ifndef HAVE_GETHOSTBYNAME_R + return my_gethostbyname_r(name,hostp,buffer,buflen,h_errnop); + #else +-#if (defined(__GLIBC__) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__)) ++#if (defined(_GNU_SOURCE) || (__FreeBSD_version >= 602000) || defined(__DragonFly__) || defined(__ANDROID__)) + struct hostent *result; + + gethostbyname_r(name, hostp, buffer, buflen, &result, h_errnop); diff --git a/lang/erlang/patches/103-disable_emacs.patch b/lang/erlang/patches/103-disable_emacs.patch new file mode 100644 index 0000000..9412195 --- /dev/null +++ b/lang/erlang/patches/103-disable_emacs.patch @@ -0,0 +1,11 @@ +--- a/lib/tools/Makefile ++++ b/lib/tools/Makefile +@@ -23,7 +23,7 @@ include $(ERL_TOP)/make/$(TARGET)/otp.mk + # Macros + # ---------------------------------------------------- + +-SUB_DIRECTORIES = c_src src doc/src examples priv emacs ++SUB_DIRECTORIES = c_src src doc/src examples priv + + include vsn.mk + VSN = $(TOOLS_VSN) diff --git a/lang/et_xmlfile/Makefile b/lang/et_xmlfile/Makefile new file mode 100644 index 0000000..f0c0139 --- /dev/null +++ b/lang/et_xmlfile/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=et_xmlfile +PKG_VERSION:=1.0.1 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/e/et_xmlfile/ +PKG_MD5SUM:=f47940fd9d556375420b2e276476cfaf +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/et_xmlfile + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=An implementation of lxml.xmlfile for the standard library + URL:=https://bitbucket.org/openpyxl/et_xmlfile + DEPENDS:=+python +endef + +define Package/et_xmlfile/description + An implementation of lxml.xmlfile for the standard library +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/et_xmlfile/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,et_xmlfile)) diff --git a/lang/flup/Makefile b/lang/flup/Makefile new file mode 100644 index 0000000..b0514f4 --- /dev/null +++ b/lang/flup/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=flup +PKG_VERSION:=1.0.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/f/flup/ +PKG_MD5SUM:=24dad7edc5ada31dddd49456ee8d5254 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/flup + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Random assortment of WSGI servers + URL:=http://www.saddi.com/software/flup/ + DEPENDS:=+python +endef + +define Package/flup/description + Random assortment of WSGI servers +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/flup/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,flup)) diff --git a/lang/gunicorn/Makefile b/lang/gunicorn/Makefile new file mode 100644 index 0000000..efdf9f4 --- /dev/null +++ b/lang/gunicorn/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gunicorn +PKG_VERSION:=19.6.0 +PKG_RELEASE=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/84/ce/7ea5396efad1cef682bbc4068e72a0276341d9d9d0f501da609fab9fcb80/ +PKG_MD5SUM:=338e5e8a83ea0f0625f768dba4597530 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/gunicorn + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=WSGI HTTP Server for UNIX + MAINTAINER:=Gergely Kiss + URL:=http://gunicorn.org/ + DEPENDS:=+python +python-setuptools +endef + +define Package/gunicorn/description + WSGI HTTP Server for UNIX +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/gunicorn/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gunicorn* \ + $(1)/usr/bin + # fix python exec path in scripts + $(SED) 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/bin/gunicorn* +endef + +$(eval $(call BuildPackage,gunicorn)) diff --git a/lang/jamvm/Makefile b/lang/jamvm/Makefile new file mode 100644 index 0000000..996dfa0 --- /dev/null +++ b/lang/jamvm/Makefile @@ -0,0 +1,67 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=jamvm +PKG_VERSION:=2.0.0 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0+ +PKG_MAINTAINER:=Dana H. Myers + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/$(PKG_NAME) +PKG_MD5SUM:=a6e3321ef4b3cfb4afc20bd75452e11e + +PKG_USE_MIPS16:=0 + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/jamvm + SUBMENU:=Java + SECTION:=lang + CATEGORY:=Languages + TITLE:=A compact Java Virtual Machine + URL:=http://sourceforge.net/projects/jamvm + DEPENDS:=+zlib +libpthread +librt +classpath @!avr32 +endef + +define Package/jamvm/description + JamVM is a new Java Virtual Machine which conforms to the JVM + specification version (blue book). In comparison to most other VM's (free + and commercial) it is extremely small.However, unlike other small VMs + (e.g. KVM) it is designed to support the full specification, and includes + support for object finalisation, Soft/Weak/Phantom References, the Java + Native Interface (JNI) and the Reflection API. +endef + +CONFIGURE_ARGS += \ + --with-java-runtime-library=gnuclasspath \ + --with-classpath-install-dir=/usr \ + --disable-int-inlining \ + --disable-shared \ + --without-pic + +MAKE_FLAGS += \ + GLIBJ_ZIP=$(STAGING_DIR)/usr/share/classpath/glibj.zip + +define Package/jamvm/install + $(INSTALL_DIR) $(1)/usr + $(CP) \ + $(PKG_INSTALL_DIR)/usr/bin \ + $(PKG_INSTALL_DIR)/usr/share \ + $(1)/usr/ +endef + +define Build/InstallDev + $(CP) $(PKG_INSTALL_DIR)/* $(1)/ +endef + +$(eval $(call BuildPackage,jamvm)) diff --git a/lang/jdcal/Makefile b/lang/jdcal/Makefile new file mode 100644 index 0000000..34d3970 --- /dev/null +++ b/lang/jdcal/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=jdcal +PKG_VERSION:=1.2 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://pypi.python.org/packages/source/j/jdcal/ +PKG_MD5SUM:=ab8d5ba300fd1eb01514f363d19b1eb9 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/jdcal + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=Julian dates from proleptic Gregorian and Julian calendars. + URL:=http://github.com/phn/jdcal + DEPENDS:=+python +endef + +define Package/jdcal/description + Julian dates from proleptic Gregorian and Julian calendars. +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/jdcal/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,jdcal)) diff --git a/lang/json4lua/Makefile b/lang/json4lua/Makefile new file mode 100644 index 0000000..0e0c9c5 --- /dev/null +++ b/lang/json4lua/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=json4lua +PKG_VERSION:=0.9.53 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/amrhassan/json4lua.git +PKG_SOURCE_VERSION:=$(PKG_VERSION) + +PKG_MAINTAINER:=Amr Hassan +PKG_LICENSE=MIT + +LUA_MODULE_PATH:=/usr/lib/lua + +include $(INCLUDE_DIR)/package.mk + +define Package/json4lua + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=json4lua + URL:=https://github.com/amrhassan/json4lua + DEPENDS:=+lua +luasocket +endef + +define Package/json4lua/description + JSON and JSONRPC for Lua +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/json4lua/install + $(INSTALL_DIR) $(1)/$(LUA_MODULE_PATH)/json + $(INSTALL_DATA) $(PKG_BUILD_DIR)/json/json.lua $(1)/$(LUA_MODULE_PATH)/json.lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/json/rpc.lua $(1)/$(LUA_MODULE_PATH)/json/rpc.lua +endef + +$(eval $(call BuildPackage,json4lua)) diff --git a/lang/lpeg/Makefile b/lang/lpeg/Makefile new file mode 100644 index 0000000..ee8a4ef --- /dev/null +++ b/lang/lpeg/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lpeg +PKG_VERSION:=0.12.2 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.inf.puc-rio.br/~roberto/lpeg/ +PKG_MD5SUM:=fabb614eb46e370d4f6b8fd82d17ca7e + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/lpeg + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LPeg + URL:=http://www.inf.puc-rio.br/~roberto/lpeg/ + DEPENDS:=+lua +endef + +define Package/lpeg/description + LPeg is a new pattern-matching library for Lua, based on Parsing Expression Grammars (PEGs) +endef + +define Build/Configure +endef + +# add make variable overrides here +MAKE_FLAGS += + +define Package/lpeg/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lpeg.so $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lpeg)) diff --git a/lang/lua-bencode/Makefile b/lang/lua-bencode/Makefile new file mode 100644 index 0000000..0b32056 --- /dev/null +++ b/lang/lua-bencode/Makefile @@ -0,0 +1,50 @@ +# +# Copyright (C) 20013-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-bencode +PKG_VERSION:=2.1.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://bitbucket.org/wilhelmy/lua-bencode +PKG_SOURCE_PROTO:=hg +PKG_SOURCE_VERSION:=500243383cb6acbddd3cf12aee6e4667aab53324 +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-bencode + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=lua-bencode + URL:=https://bitbucket.org/wilhelmy/lua-bencode + MAINTAINER:=Lars Gierth + DEPENDS:=+lua +endef + +define Package/lua-bencode/description + This is a module for the lua programming language for decoding and encoding + bencoded data which can be used to read and write torrent files for bittorrent. +endef + +define Build/Configure +endef + +define Build/Compile +endef + + +define Package/lua-bencode/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/bencode.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-bencode)) diff --git a/lang/lua-cjson/Makefile b/lang/lua-cjson/Makefile new file mode 100644 index 0000000..7cdb350 --- /dev/null +++ b/lang/lua-cjson/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-cjson +PKG_VERSION:=2.1.0 +PKG_RELEASE:=2 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.kyne.com.au/~mark/software/download/ +PKG_MD5SUM:=24f270663e9f6ca8ba2a02cef19f7963 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=lua/host + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/lua-cjson + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua CJSON parser + URL:=https://github.com/mpx/lua-cjson + DEPENDS:= +lua +endef + +define Package/lua-cjson/description + Lua CJSON is a fast JSON encoding/parsing module for Lua. +endef + +CMAKE_OPTIONS += \ + -DUSE_LUA=ON + +CMAKE_HOST_OPTIONS += \ + -DLUA_MATH_LIBRARY=m + +define Package/lua-cjson/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cjson.so $(1)/usr/lib/lua/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/cjson + $(INSTALL_DATA) $(PKG_BUILD_DIR)/lua/cjson/util.lua $(1)/usr/lib/lua/cjson +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,lua-cjson)) diff --git a/lang/lua-copas/Makefile b/lang/lua-copas/Makefile new file mode 100644 index 0000000..4f073e2 --- /dev/null +++ b/lang/lua-copas/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2009-2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-copas +PKG_VERSION:=2.0.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/copas.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=f39a80add9f7c010ac979297652bbaaea0360a27 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-copas + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-Copas + URL:=https://github.com/keplerproject/copas + DEPENDS:=+lua +endef + +define Package/lua-copas/description + Copas is a dispatcher based on coroutines that can be used by TCP/IP servers. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + T="$(BUILD_VARIANT)" \ + PREFIX="$(PKG_INSTALL_DIR)/usr" \ + install +endef + +# add make variable overrides here +MAKE_FLAGS += + +define Package/lua-copas/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas.lua $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/ftp.lua $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/smtp.lua $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/http.lua $(1)/usr/lib/lua/copas + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/copas/limit.lua $(1)/usr/lib/lua/copas +endef + +$(eval $(call BuildPackage,lua-copas)) diff --git a/lang/lua-copas/patches/makefile.patch b/lang/lua-copas/patches/makefile.patch new file mode 100644 index 0000000..10e4734 --- /dev/null +++ b/lang/lua-copas/patches/makefile.patch @@ -0,0 +1,15 @@ +--- lua-copas-1.2.1_org/Makefile 2014-06-04 16:39:17.451563827 +0800 ++++ lua-copas-1.2.1/Makefile 2014-06-04 16:39:41.115563309 +0800 +@@ -1,10 +1,10 @@ + # $Id: Makefile,v 1.3 2007/10/29 22:50:16 carregal Exp $ + + # Default prefix +-PREFIX = /usr/local ++PREFIX ?= $(DESTDIR)/usr + + # System's lua directory (where Lua libraries are installed) +-LUA_DIR= $(PREFIX)/share/lua/5.1 ++LUA_DIR= $(PREFIX)/lib/lua + + install: + mkdir -p $(LUA_DIR)/copas diff --git a/lang/lua-coxpcall/Makefile b/lang/lua-coxpcall/Makefile new file mode 100644 index 0000000..6ca3ff8 --- /dev/null +++ b/lang/lua-coxpcall/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2009-2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-coxpcall +PKG_VERSION:=1.15.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/coxpcall.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=979257892884816c97391dfd7b0a7b30dcc8f479 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-coxpcall + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-Coxpcall + URL:=https://github.com/keplerproject/coxpcall + DEPENDS:=+lua +endef + +define Package/lua-coxpcall/description + Coxpcall encapsulates the protected calls with a coroutine based loop, + so errors can be dealed without the usual pcall/xpcall issues with coroutines. +endef + +TARGET_CFLAGS += $(FPIC) +# add make variable overrides here +MAKE_FLAGS += + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + T="$(BUILD_VARIANT)" \ + LUA_DIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + install +endef + +define Package/lua-coxpcall/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/coxpcall.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-coxpcall)) diff --git a/lang/lua-coxpcall/patches/config.patch b/lang/lua-coxpcall/patches/config.patch new file mode 100644 index 0000000..2a1dbfd --- /dev/null +++ b/lang/lua-coxpcall/patches/config.patch @@ -0,0 +1,4 @@ +--- lua-coxpcall-1.15.0_org/config 1970-01-01 08:00:00.000000000 +0800 ++++ lua-coxpcall-1.15.0/config 2014-06-04 16:51:55.487547258 +0800 +@@ -0,0 +1 @@ ++LUA_DIR ?=$(DESTDIR)/usr/lib/lua diff --git a/lang/lua-lsqlite3/Makefile b/lang/lua-lsqlite3/Makefile new file mode 100644 index 0000000..473e215 --- /dev/null +++ b/lang/lua-lsqlite3/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lsqlite3 +PKG_VERSION:=0.9.3 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=http://lua.sqlite.org/index.cgi/zip/lsqlite3_fsl09w.zip +PKG_MD5SUM:=8e16ef4fda82eb73295bf2f1050d14f1 + +PKG_LICENSE:=MIT +PKG_MAINTAINER:=Oskari Rauta + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)_fsl09w.zip + +include $(INCLUDE_DIR)/package.mk + +define Package/lsqlite3 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua wrapper for the SQLite3 library + URL:=http://lua.sqlite.org + DEPENDS:= +lua +libsqlite3 +endef + +define Package/lsqlite3/description + LuaSQLite3 is a thin wrapper around the public domain SQLite3 database engine. +endef + +TARGET_CFLAGS += $(FPIC) -std=gnu99 +TARGET_CPPFLAGS += -DLUA_USE_LINUX +TARGET_LDFLAGS += -llua -lsqlite3 -lpthread + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) \ + -c $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.c \ + -o $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.o \ + -DSQLITE_VERSION="$(PKG_VERSION)" + $(TARGET_CC) $(TARGET_LDFLAGS) -shared \ + $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.o \ + -o $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/lsqlite3.so +endef + +define Package/lsqlite3/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(CP) $(PKG_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/*.so $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,lsqlite3)) diff --git a/lang/lua-lzlib/Makefile b/lang/lua-lzlib/Makefile new file mode 100644 index 0000000..e4094f5 --- /dev/null +++ b/lang/lua-lzlib/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-lzlib +PKG_VERSION:=0.4.3 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/LuaDist/lzlib.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=79329a07d8f79c19eadd7ea2752b4c4e1574b015 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-lzlib + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua zlib binding + URL:=http://github.com/LuaDist/lzlib + DEPENDS:= +lua +zlib +endef + +define Package/lua-lzlib/description + A library to access zlib library functions and also to read/write gzip files using an interface similar to the base io package. +endef + +MAKE_FLAGS += \ + LUA="$(STAGING_DIR)/usr" \ + OFLAGS="$(TARGET_CFLAGS)" \ + +define Package/lua-lzlib/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/zlib.so $(1)/usr/lib/lua/ + + $(INSTALL_DATA) $(PKG_BUILD_DIR)/gzip.lua $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,lua-lzlib)) diff --git a/lang/lua-lzlib/patches/001-allow_optim_flags.patch b/lang/lua-lzlib/patches/001-allow_optim_flags.patch new file mode 100644 index 0000000..78f981d --- /dev/null +++ b/lang/lua-lzlib/patches/001-allow_optim_flags.patch @@ -0,0 +1,12 @@ +--- a/Makefile ++++ b/Makefile +@@ -14,7 +14,8 @@ LUABIN= $(LUA)/bin + ZLIB=../zlib-1.2.3 + + # no need to change anything below here +-CFLAGS= $(INCS) $(DEFS) $(WARN) -O0 -fPIC ++CFLAGS= $(INCS) $(DEFS) $(WARN) $(OFLAGS) -fPIC ++OFLAGS= -O0 + WARN= -g -Werror -Wall -pedantic #-ansi + INCS= -I$(LUAINC) -I$(ZLIB) + LIBS= -L$(ZLIB) -lz -L$(LUALIB) -L$(LUABIN) #-llua51 diff --git a/lang/lua-md5/Makefile b/lang/lua-md5/Makefile new file mode 100644 index 0000000..36e0d9d --- /dev/null +++ b/lang/lua-md5/Makefile @@ -0,0 +1,75 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-md5 +PKG_VERSION:=1.2 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/md5.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=024b65738b4434860777fc43d7cacaefea29ec60 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-md5 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-MD5 + URL:=https://github.com/keplerproject/md5 + DEPENDS:=+lua +endef + +define Package/lua-md5/description + MD5 offers basic cryptographic facilities for Lua +endef + +TARGET_CFLAGS += $(FPIC) + +# add make variable overrides here +MAKE_FLAGS += + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + PREFIX="$(STAGING_DIR)/usr" \ + LUA_LIBDIR="$(STAGING_DIR)/usr/lib/lua" \ + clean + $(MAKE) -C $(PKG_BUILD_DIR) \ + PREFIX="$(STAGING_DIR)/usr" \ + LUA_LIBDIR="$(STAGING_DIR)/usr/lib/lua" \ + LIB_OPTION="-shared" \ + CC="$(TARGET_CROSS)gcc" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + all +endef + +define Build/Install + $(MAKE) -C $(PKG_BUILD_DIR) \ + LUA_LIBDIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + LUA_DIR="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + install +endef + +define Package/lua-md5/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/md5.lua $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/md5 + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/core.so $(1)/usr/lib/lua/md5/core.so +endef + +$(eval $(call BuildPackage,lua-md5)) diff --git a/lang/lua-md5/patches/config.patch b/lang/lua-md5/patches/config.patch new file mode 100644 index 0000000..abea3a8 --- /dev/null +++ b/lang/lua-md5/patches/config.patch @@ -0,0 +1,19 @@ +--- lua-md5-1.2/config 2014-06-04 16:55:50.000000000 +0800 ++++ lua-md5-1.2_new/config 2014-06-04 16:57:54.223539416 +0800 +@@ -1,13 +1,13 @@ + # Installation directories + + # Default prefix +-PREFIX = /usr/local ++PREFIX = /usr + + # System's libraries directory (where binary libraries are installed) +-LUA_LIBDIR= $(PREFIX)/lib/lua/5.1 ++LUA_LIBDIR= $(PREFIX)/lib/lua + + # System's lua directory (where Lua libraries are installed) +-LUA_DIR= $(PREFIX)/share/lua/5.1 ++LUA_DIR= $(PREFIX)/lib/lua + + # Lua includes directory + LUA_INC= $(PREFIX)/include diff --git a/lang/lua-md5/patches/makefile.patch b/lang/lua-md5/patches/makefile.patch new file mode 100644 index 0000000..89a2e33 --- /dev/null +++ b/lang/lua-md5/patches/makefile.patch @@ -0,0 +1,10 @@ +--- a/Makefile.orig 2014-06-04 17:16:40.083514808 +0800 ++++ b/Makefile 2014-06-04 17:17:27.111513780 +0800 +@@ -1,6 +1,6 @@ + # $Id: Makefile,v 1.7 2007/10/11 00:02:56 carregal Exp $ + +-CONFIG= ./config ++CFLAGS+= -fPIC + + include $(CONFIG) + diff --git a/lang/lua-mobdebug/Makefile b/lang/lua-mobdebug/Makefile new file mode 100644 index 0000000..3d11539 --- /dev/null +++ b/lang/lua-mobdebug/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-mobdebug +PKG_VERSION:=0.61 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/pkulchenko/MobDebug.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=9a03aa59696647ba3b7f9ae2f29a9f28532a4feb +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-mobdebug + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-MobDebug + URL:=https://github.com/pkulchenko/MobDebug + DEPENDS:=+lua +endef + +define Package/lua-mobdebug/description + MobDebug is a remote debugger for Lua (including Lua 5.1, Lua 5.2, Lua 5.3, and LuaJIT 2.x). +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Build/Install +endef + +# add make variable overrides here +MAKE_FLAGS += + +define Package/lua-mobdebug/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/mobdebug.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-mobdebug)) diff --git a/lang/lua-openssl/Makefile b/lang/lua-openssl/Makefile new file mode 100644 index 0000000..6f46e7a --- /dev/null +++ b/lang/lua-openssl/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2016 Amnon Paz +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-openssl +PKG_VERSION:=0.6.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Amnon Paz +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://github.com/zhaozg/lua-openssl.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=1b950e6ff8617205cda1a1b612637ef21b9daf96 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua openSSL binding + URL:=http://github.com/zhaozg/lua-openssl + DEPENDS:=+lua +libopenssl +librt +endef + +define Package/lua-openssl/description + A free, MIT-licensed OpenSSL binding for Lua. +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/openssl.so $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/lua-openssl/patches/0001-Revise-Makefile.patch b/lang/lua-openssl/patches/0001-Revise-Makefile.patch new file mode 100644 index 0000000..e084c0b --- /dev/null +++ b/lang/lua-openssl/patches/0001-Revise-Makefile.patch @@ -0,0 +1,135 @@ +diff --git a/Makefile b/Makefile +index 6cb1176..6605879 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,85 +1,45 @@ +-T=openssl +- +-PREFIX ?=/usr/local +-LIB_OPTION ?= -shared +- +-#Lua auto detect +-LUA_VERSION ?= $(shell pkg-config luajit --print-provides) +-ifeq ($(LUA_VERSION),) ############ Not use luajit +-LUAV ?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)") +-LUA_CFLAGS ?= -I$(PREFIX)/include/lua$(LUAV) +-LUA_LIBS ?= -L$(PREFIX)/lib +-LUA_LIBDIR ?= $(PREFIX)/lib/lua/$(LUAV) +-else +-LUAV ?= $(shell lua -e "_,_,v=string.find(_VERSION,'Lua (.+)');print(v)") +-LUA_CFLAGS ?= $(shell pkg-config luajit --cflags) +-LUA_LIBS ?= $(shell pkg-config luajit --libs) +-LUA_LIBDIR ?= $(PREFIX)/lib/lua/$(LUAV) +-endif +- +-#OS auto detect +-SYS := $(shell gcc -dumpmachine) +- +-ifneq (, $(findstring linux, $(SYS))) +-# Do linux things +-LDFLAGS = -fPIC -lrt -ldl +-OPENSSL_LIBS ?= $(shell pkg-config openssl --libs) +-OPENSSL_CFLAGS ?= $(shell pkg-config openssl --cflags) +-CFLAGS = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-ifneq (, $(findstring apple, $(SYS))) +-# Do darwin things +-LDFLAGS = -fPIC -lrt -ldl +-OPENSSL_LIBS ?= $(shell pkg-config openssl --libs) +-OPENSSL_CFLAGS ?= $(shell pkg-config openssl --cflags) +-CFLAGS = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-ifneq (, $(findstring mingw, $(SYS))) +-# Do mingw things +-V = $(shell lua -e "v=string.gsub('$(LUAV)','%.','');print(v)") +-LDFLAGS = -mwindows -lcrypt32 -lssl -lcrypto -lws2_32 $(PREFIX)/bin/lua$(V).dll +-LUA_CFLAGS = -DLUA_LIB -DLUA_BUILD_AS_DLL -I$(PREFIX)/include/ +-CFLAGS = $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-ifneq (, $(findstring cygwin, $(SYS))) +-# Do cygwin things +-OPENSSL_LIBS ?= $(shell pkg-config openssl --libs) +-OPENSSL_CFLAGS ?= $(shell pkg-config openssl --cflags) +-CFLAGS = -fPIC $(OPENSSL_CFLAGS) $(LUA_CFLAGS) +-endif +-#custome config +-ifeq (.config, $(wildcard .config)) +-include .config +-endif +- +-LIBNAME= $T.so.$V +- +-#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X +- +-# Compilation directives +-WARN_MOST = -Wall -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic +-WARN = -Wall -Wno-unused-value +-WARN_MIN = +-CFLAGS += $(WARN_MIN) -DPTHREADS +-CC= gcc -g $(CFLAGS) -Ideps +- +- +-OBJS=src/asn1.o src/auxiliar.o src/bio.o src/cipher.o src/cms.o src/compat.o src/crl.o src/csr.o src/dh.o src/digest.o src/dsa.o \ +-src/ec.o src/engine.o src/hmac.o src/lbn.o src/lhash.o src/misc.o src/ocsp.o src/openssl.o src/ots.o src/pkcs12.o src/pkcs7.o \ +-src/pkey.o src/rsa.o src/ssl.o src/th-lock.o src/util.o src/x509.o src/xattrs.o src/xexts.o src/xname.o src/xstore.o src/xalgor.o src/callback.o +- +-.c.o: +- $(CC) -c -o $@ $? +- +-all: $T.so +- echo $(SYS) +- +-$T.so: $(OBJS) +- MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; $(CC) $(CFLAGS) $(LIB_OPTION) -o $T.so $(OBJS) $(OPENSSL_LIBS) $(LUA_LIBS) $(LDFLAGS) +- +-install: all +- mkdir -p $(LUA_LIBDIR) +- cp $T.so $(LUA_LIBDIR) +- +-clean: +- rm -f $T.so $(OBJS) ++.PHONY: install clean ++ ++PKGC ?= pkg-config ++ ++LIBNAME = openssl.so ++LIB_OPTION = -shared ++ ++# lua's package config can be under various names ++LUAPKGC := $(shell for pc in lua lua5.1 lua5.2 lua5.3; do \ ++ $(PKGC) --exists $$pc && echo $$pc && break; \ ++ done) ++ ++BUILD_DIR = $(shell pwd) ++ ++# LUA include/libraries build flags ++LUA_LIBDIR := $(shell $(PKGC) --variable=libdir $(LUAPKGC)) ++LUA_CFLAGS := $(shell $(PKGC) --cflags $(LUAPKGC)) ++LUA_LIBS := $(shell $(PKGC) --libs-only-L $(LUAPKGC)) ++ ++# openssl include/libraries build flags ++OPENSSL_LIBS = $(shell $(PKGC) openssl --libs) ++OPENSSL_CFLAGS = $(shell $(PKGC) openssl --cflags) ++ ++# openssl include/libraries build flags ++LOCAL_INCLUDE = -I$(BUILD_DIR)/deps ++ ++CFLAGS += -fPIC -DPTHREADS -g $(LOCAL_INCLUDE) $(OPENSSL_CFLAGS) $(LUA_CFLAGS) ++LDFLAGS += -lrt -ldl $(OPENSSL_LIBS) $(LUA_LIBS) ++ ++OBJS = src/asn1.o src/auxiliar.o src/bio.o src/cipher.o src/cms.o src/compat.o src/crl.o src/csr.o src/dh.o src/digest.o src/dsa.o src/ec.o src/engine.o src/hmac.o src/lbn.o src/lhash.o src/misc.o src/ocsp.o src/openssl.o src/ots.o src/pkcs12.o src/pkcs7.o src/pkey.o src/rsa.o src/ssl.o src/th-lock.o src/util.o src/x509.o src/xattrs.o src/xexts.o src/xname.o src/xstore.o src/xalgor.o src/callback.o ++ ++all: clean $(LIBNAME) ++ ++$(LIBNAME): $(OBJS) ++ $(CC) $(LDFLAGS) $(LIB_OPTION) $(OBJS) -o $@ ++ ++%.o: %.c ++ $(CC) $(CFLAGS) -c $< -o $@ ++ ++install: all ++ mkdir -p $(LUA_LIBDIR) ++ cp $(LIBNAME) $(LUA_LIBDIR) ++ ++clean: ++ rm -f $(LIBNAME) $(OBJS) diff --git a/lang/lua-openssl/patches/0010-Fix-Linkage.patch b/lang/lua-openssl/patches/0010-Fix-Linkage.patch new file mode 100644 index 0000000..52bcf1a --- /dev/null +++ b/lang/lua-openssl/patches/0010-Fix-Linkage.patch @@ -0,0 +1,36 @@ +diff --git a/deps/lua-compat/c-api/compat-5.3.c b/deps/lua-compat/c-api/compat-5.3.c +index 4395bbc..4a8877c 100644 +--- a/deps/lua-compat/c-api/compat-5.3.c ++++ b/deps/lua-compat/c-api/compat-5.3.c +@@ -491,17 +491,6 @@ COMPAT53_API int lua_geti (lua_State *L, int index, lua_Integer i) { + } + + +-COMPAT53_API int lua_isinteger (lua_State *L, int index) { +- if (lua_type(L, index) == LUA_TNUMBER) { +- lua_Number n = lua_tonumber(L, index); +- lua_Integer i = lua_tointeger(L, index); +- if (i == n) +- return 1; +- } +- return 0; +-} +- +- + static void compat53_reverse (lua_State *L, int a, int b) { + for (; a < b; ++a, --b) { + lua_pushvalue(L, a); +diff --git a/deps/lua-compat/c-api/compat-5.3.h b/deps/lua-compat/c-api/compat-5.3.h +index 2309294..8e67bae 100644 +--- a/deps/lua-compat/c-api/compat-5.3.h ++++ b/deps/lua-compat/c-api/compat-5.3.h +@@ -244,9 +244,6 @@ typedef int (*lua_KFunction)(lua_State *L, int status, lua_KContext ctx); + #define lua_geti COMPAT53_CONCAT(COMPAT53_PREFIX, _geti) + COMPAT53_API int lua_geti (lua_State *L, int index, lua_Integer i); + +-#define lua_isinteger COMPAT53_CONCAT(COMPAT53_PREFIX, _isinteger) +-COMPAT53_API int lua_isinteger (lua_State *L, int index); +- + #define lua_numbertointeger(n, p) \ + ((*(p) = (lua_Integer)(n)), 1) + diff --git a/lang/lua-openssl/patches/0020-support-OPENSSL_NO_SSL3_METHOD.patch b/lang/lua-openssl/patches/0020-support-OPENSSL_NO_SSL3_METHOD.patch new file mode 100644 index 0000000..2f29680 --- /dev/null +++ b/lang/lua-openssl/patches/0020-support-OPENSSL_NO_SSL3_METHOD.patch @@ -0,0 +1,41 @@ +--- lua-openssl-0.6.0.old/src/ssl.c 2016-09-19 08:30:43.735075695 +0200 ++++ lua-openssl-0.6.0/src/ssl.c 2016-09-19 09:02:45.733813437 +0200 +@@ -24,12 +24,17 @@ + SSL_METHOD* method = NULL; + const char* ciphers; + SSL_CTX* ctx; +- if (strcmp(meth, "SSLv3") == 0) ++ if (0); ++ ++#ifndef OPENSSL_NO_SSL3 ++ else if (strcmp(meth, "SSLv3") == 0) + method = SSLv3_method(); /* SSLv3 */ + else if (strcmp(meth, "SSLv3_server") == 0) + method = SSLv3_server_method(); /* SSLv3 */ + else if (strcmp(meth, "SSLv3_client") == 0) + method = SSLv3_client_method(); /* SSLv3 */ ++#endif ++ + else if (strcmp(meth, "SSLv23") == 0) + method = SSLv23_method(); /* SSLv3 but can rollback to v2 */ + else if (strcmp(meth, "SSLv23_server") == 0) +@@ -79,15 +84,15 @@ + #endif + else + luaL_error(L, "#1:%s not supported\n" +- "Maybe SSLv3 SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", +- "default is SSLv3", ++ "Maybe [SSLv3] SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", ++ "default is TLSv1", + meth); + ciphers = luaL_optstring(L, 2, SSL_DEFAULT_CIPHER_LIST); + ctx = SSL_CTX_new(method); + if (!ctx) + luaL_error(L, "#1:%s not supported\n" +- "Maybe SSLv3 SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", +- "default is SSLv3", ++ "Maybe [SSLv3] SSLv23 TLSv1 TLSv1_1 TLSv1_2 DTLSv1 [SSLv2], option followed by _client or _server\n", ++ "default is TLSv1", + meth); + openssl_newvalue(L, ctx); + SSL_CTX_set_cipher_list(ctx, ciphers); diff --git a/lang/lua-openssl/patches/0030-support-OPENSSL_NO_COMP.patch b/lang/lua-openssl/patches/0030-support-OPENSSL_NO_COMP.patch new file mode 100644 index 0000000..44e5330 --- /dev/null +++ b/lang/lua-openssl/patches/0030-support-OPENSSL_NO_COMP.patch @@ -0,0 +1,20 @@ +--- lua-openssl-0.6.0.old/src/ssl.c 2016-09-19 08:30:43.735075695 +0200 ++++ lua-openssl-0.6.0/src/ssl.c 2016-09-19 08:48:37.393737125 +0200 +@@ -1245,7 +1250,7 @@ + lua_pushinteger(L, st); + return 2; + } +-#ifndef LIBRESSL_VERSION_NUMBER ++#if !defined(OPENSSL_NO_COMP) && !defined(LIBRESSL_VERSION_NUMBER) + static int openssl_ssl_current_compression(lua_State *L) + { + SSL* s = CHECK_OBJECT(1, SSL, "openssl.ssl"); +@@ -1803,7 +1808,7 @@ + {"getfd", openssl_ssl_getfd}, + + {"current_cipher", openssl_ssl_current_cipher}, +-#ifndef LIBRESSL_VERSION_NUMBER ++#if !defined(OPENSSL_NO_COMP) && !defined(LIBRESSL_VERSION_NUMBER) + {"current_compression", openssl_ssl_current_compression}, + #endif + {"getpeerverification", openssl_ssl_getpeerverification}, diff --git a/lang/lua-penlight/Makefile b/lang/lua-penlight/Makefile new file mode 100644 index 0000000..5c1b72a --- /dev/null +++ b/lang/lua-penlight/Makefile @@ -0,0 +1,46 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-penlight +PKG_VERSION:=1.3.2 +PKG_RELEASE:=2 +PKG_BUILD_DIR:=$(BUILD_DIR)/Penlight-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/stevedonovan/Penlight/archive/ +PKG_MD5SUM:=0315a39834bb6fab07741ec04ede1bf4 +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.md + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Penlight + URL:=http://stevedonovan.github.io/Penlight/api/manual/01-introduction.md.html + DEPENDS:=+luafilesystem + MAINTAINER:= Karl Palsson +endef + +define Package/$(PKG_NAME)/description + It is often said of Lua that it does not include batteries. + Penlight is the batteries. +endef + +define Build/Compile + echo "Nothing to compile, pure lua package" +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(CP) $(PKG_BUILD_DIR)/lua/pl $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/lua-rings/Makefile b/lang/lua-rings/Makefile new file mode 100644 index 0000000..7b2e270 --- /dev/null +++ b/lang/lua-rings/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-rings +PKG_VERSION:=1.3.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/rings.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=2b8a900f8b9dbde304859a3ac9d437795c3fdde3 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_FIXUP:=autoreconf + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-rings + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua-Rings + URL:=http://keplerproject.github.io/rings/ + DEPENDS:=+lua +endef + +define Package/lua-rings/description + Rings is a library which provides a way to create new Lua states from within Lua. +endef + +TARGET_CFLAGS += $(FPIC) +# add make variable overrides here +MAKE_FLAGS += + +define Build/Configure +endef + +define Package/lua-rings/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rings.so $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/stable.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,lua-rings)) diff --git a/lang/lua-rings/patches/config.patch b/lang/lua-rings/patches/config.patch new file mode 100644 index 0000000..5740fae --- /dev/null +++ b/lang/lua-rings/patches/config.patch @@ -0,0 +1,28 @@ +--- lua-rings-1.3.0_org/config 2014-06-04 15:24:24.223662038 +0800 ++++ lua-rings-1.3.0/config 2014-06-04 16:16:15.183594040 +0800 +@@ -1,15 +1,15 @@ + # Installation directories + + # Default prefix +-PREFIX ?= /usr/local ++PREFIX ?= /usr + + DESTDIR ?= / + + # System's libraries directory (where binary libraries are installed) +-LUA_LIBDIR ?= $(PREFIX)/lib/lua/5.1 ++LUA_LIBDIR ?= $(PREFIX)/lib/lua + + # System's lua directory (where Lua libraries are installed) +-LUA_DIR ?= $(PREFIX)/share/lua/5.1 ++LUA_DIR ?= $(PREFIX)/lib/lua + + # Lua includes directory + LUA_INC ?= $(PREFIX)/include +@@ -24,6 +24,5 @@ + WARN ?= -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -Wpointer-arith -pedantic + INCS ?= -I$(LUA_INC) + CFLAGS ?= $(WARN) $(INCS) +-CC ?= gcc + + # $Id: config,v 1.7 2007/10/29 22:51:39 carregal Exp $ diff --git a/lang/lua-rings/patches/makefile.patch b/lang/lua-rings/patches/makefile.patch new file mode 100644 index 0000000..8bb0551 --- /dev/null +++ b/lang/lua-rings/patches/makefile.patch @@ -0,0 +1,11 @@ +--- lua-rings-1.3.0_org/Makefile 2014-06-04 15:24:37.583661746 +0800 ++++ lua-rings-1.3.0/Makefile 2014-06-04 15:23:41.611662970 +0800 +@@ -3,6 +3,8 @@ + T= rings + CONFIG= ./config + ++CFLAGS+= -fPIC ++ + include $(CONFIG) + + SRCS= src/rings.c diff --git a/lang/lua-rs232/Makefile b/lang/lua-rs232/Makefile new file mode 100644 index 0000000..7ef5ac7 --- /dev/null +++ b/lang/lua-rs232/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-rs232 +PKG_VERSION:=1.0.3 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/srdgame/librs232.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=a9d463181e7f7034fe6a55bc38e845fb04fa93ba +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-rs232 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua Serial Library + URL:=https://github.com/srdgame/librs232 + DEPENDS:= +lua +endef + +define Package/lua-rs232/description + multiplatform library for serial communications over RS-232 +endef + +CONFIGURE_ARGS += \ + --with-lua-inc=$(STAGING_DIR)/usr/include \ + --with-lua-lib=$(STAGING_DIR)/usr/lib + +#define Build/Configure +# ( cd "$(PKG_BUILD_DIR)"; ./autogen.sh ) +# $(call Build/Configure/Default) +#endef +define Build/Configure +endef + +define Build/Compile + (cd "$(PKG_BUILD_DIR)"; $(TARGET_CC) src/rs232.c src/rs232_posix.c bindings/lua/luars232.c -DLUAROCKS_HACK -std=gnu99 -I./include -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib -fPIC -shared -o luars232.so) +endef + +define Build/Install +endef + +define Package/lua-rs232/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/luars232.so $(1)/usr/lib/lua/ +endef + +$(eval $(call BuildPackage,lua-rs232)) diff --git a/lang/lua-sha2/Makefile b/lang/lua-sha2/Makefile new file mode 100644 index 0000000..321d6de --- /dev/null +++ b/lang/lua-sha2/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 20013-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-sha2 +PKG_VERSION:=0.2.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/lgierth/lua-sha2.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=02bd4bfdc8062c7e1ae51c5a72906efc0a6375ee +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-sha2 + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua binding for Aaron Gifford's SHA-2 implementation + URL:=https://code.google.com/p/sha2/ + MAINTAINER:=Lars Gierth + DEPENDS:=+lua +endef + +define Package/lua-sha2/description + Lua Binding for the SHA-2 (SHA-256/384/512) BSD-licensed C implementation by Aaron Gifford. + Also contains a HMAC implementation in Lua. +endef + +TARGET_CFLAGS += -fPIC -DSHA2_USE_INTTYPES_H -DBYTE_ORDER -DLITTLE_ENDIAN +TARGET_LDFLAGS += -fPIC -DSHA2_USE_INTTYPES_H -DBYTE_ORDER -DLITTLE_ENDIAN + +define Build/Configure +endef + +define Package/lua-sha2/install + $(INSTALL_DIR) $(1)/usr/lib/lua/hmac + $(INSTALL_DATA) $(PKG_BUILD_DIR)/sha2.so $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/hmac.lua $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/hmac/sha2.lua $(1)/usr/lib/lua/hmac + $(INSTALL_DATA) $(PKG_BUILD_DIR)/hmac/md5.lua $(1)/usr/lib/lua/hmac +endef + +$(eval $(call BuildPackage,lua-sha2)) diff --git a/lang/lua-sha2/patches/001-makefile.patch b/lang/lua-sha2/patches/001-makefile.patch new file mode 100644 index 0000000..e395044 --- /dev/null +++ b/lang/lua-sha2/patches/001-makefile.patch @@ -0,0 +1,14 @@ +From: Lars Gierth +Date: Tue, 2 Sep 2014 00:05:39 +0200 + + Add rump Makefile + +new file mode 100644 +index 0000000..f081d38 +--- /dev/null ++++ b/Makefile +@@ -0,0 +1,4 @@ ++all: sha2.o sha2lib.o ++ $(CC) -shared -o sha2.so sha2.o sha2lib.o ++ ++.PHONY: all diff --git a/lang/lua-wsapi/Makefile b/lang/lua-wsapi/Makefile new file mode 100644 index 0000000..5117596 --- /dev/null +++ b/lang/lua-wsapi/Makefile @@ -0,0 +1,95 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-wsapi +PKG_VERSION:=1.6.1 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/wsapi.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=eed8338401196cc155e59280adbe58d78933ead0 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-wsapi/Default + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua WSAPI + URL:=https://keplerproject.github.io/wsapi/ + DEPENDS:= +lua +endef + +define Package/lua-wsapi/Default/description + WSAPI is an API that abstracts the web server from Lua web applications +endef + + +define Package/lua-wsapi-base +$(call Package/lua-wsapi/Default) + TITLE+= base + DEPENDS+= +luafilesystem + VARIANT:=base +endef + +define Package/lua-wsapi-base/description +$(call Package/lua-wsapi/Default/description) + . + This package contains the basic stuff. +endef + +define Package/lua-wsapi-xavante +$(call Package/lua-wsapi/Default) + TITLE+= xavante + DEPENDS+= +lua-wsapi-base +lua-xavante + VARIANT:=xavante +endef + +define Package/lua-wsapi-xavante/description +$(call Package/lua-wsapi/Default/description) + . + This package contains the Xavante stuff. +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Build/Install +endef + +define Package/lua-wsapi-base/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/wsapi.lua $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/launcher/wsapi.cgi $(1)/usr/bin + + $(INSTALL_DIR) $(1)/usr/lib/lua/wsapi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/wsapi/{common,request,response,util,cgi,sapi,ringer,mock}.lua $(1)/usr/lib/lua/wsapi +endef + +define Package/lua-wsapi-xavante/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/launcher/wsapi $(1)/usr/bin + + $(INSTALL_DIR) $(1)/usr/lib/lua/wsapi + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/wsapi/xavante.lua $(1)/usr/lib/lua/wsapi +endef + + +$(eval $(call BuildPackage,lua-wsapi-base)) +$(eval $(call BuildPackage,lua-wsapi-xavante)) diff --git a/lang/lua-xavante/Makefile b/lang/lua-xavante/Makefile new file mode 100644 index 0000000..71ed8bd --- /dev/null +++ b/lang/lua-xavante/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-xavante +PKG_VERSION:=2.3.0 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/xavante.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=9825b905133e14d37a4c179f2d02367ab93f1ef6 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-xavante + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Xavante Web Server + URL:=http://keplerproject.github.io/xavante/ + DEPENDS:= +lua +endef + +define Package/lua-xavante/description + Xavante is a Lua HTTP 1.1 Web server that uses a modular architecture based on URI mapped handlers. +endef + + +define Build/Configure +endef + +define Build/Compile +endef + +define Build/Install +endef + +define Package/lua-xavante/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/sajax/sajax.lua $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/xavante/xavante.lua $(1)/usr/lib/lua + + $(INSTALL_DIR) $(1)/usr/lib/lua/xavante + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/xavante/{cgiluahandler,encoding,filehandler,httpd,mime,patternhandler,redirecthandler,vhostshandler,indexhandler,urlhandler,ruleshandler}.lua $(1)/usr/lib/lua/xavante +endef + +$(eval $(call BuildPackage,lua-xavante)) diff --git a/lang/luabitop/Makefile b/lang/luabitop/Makefile new file mode 100644 index 0000000..6153c8d --- /dev/null +++ b/lang/luabitop/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luabitop +PKG_VERSION:=1.0.2 +PKG_RELEASE:=1 + +_BASENAME:=LuaBitOp + +PKG_MAINTAINER:=Maxim Storchak +PKG_SOURCE:=$(_BASENAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://bitop.luajit.org/download/ +PKG_MD5SUM:=d0c1080fe0c844e8477279668e2d0d06 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(_BASENAME)-$(PKG_VERSION) +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/luabitop + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luabitop + URL:=http://bitop.luajit.org/ + DEPENDS:=+liblua +endef + +define Package/luabitop/description +Lua BitOp is a C extension module for Lua 5.1/5.2 which adds bitwise operations on numbers. +endef + +define Build/Configure +endef + + +TARGET_CFLAGS += $(FPIC) -DLUA_USE_LINUX -DLUA_NUMBER_DOUBLE + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_CPPFLAGS) -std=gnu99 $(FPIC) -DLUA_USE_LINUX -shared -o $(PKG_BUILD_DIR)/bit.so $(PKG_BUILD_DIR)/bit.c +endef + +define Package/luabitop/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/bit.so $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,luabitop)) diff --git a/lang/luaexpat/Makefile b/lang/luaexpat/Makefile new file mode 100644 index 0000000..eae164f --- /dev/null +++ b/lang/luaexpat/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luaexpat +PKG_VERSION:=1.3.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://matthewwild.co.uk/projects/luaexpat +PKG_MD5SUM:=3c20b5795e7107f847f8da844fbfe2da + +include $(INCLUDE_DIR)/package.mk + +define Package/luaexpat + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaExpat + URL:=http://matthewwild.co.uk/projects/luaexpat/ + MAINTAINER:=W. Michael Petullo + DEPENDS:=+lua +libexpat +endef + +define Package/luaexpat/description + LuaExpat is a SAX XML parser based on the Expat library. +endef + +define Build/Configure +endef + +define Build/Compile + $(CP) files/compat-5.1r5 $(PKG_BUILD_DIR)/compat-5.1r5 + $(MAKE) -C $(PKG_BUILD_DIR) \ + EXPAT_INC="-I$(STAGING_DIR)/usr/include/" \ + LUA_INC="-I$(STAGING_DIR)/usr/include/" \ + LUA_LIBDIR="$(STAGING_DIR)/usr/lib/" \ + COMPAT_DIR="$(PKG_BUILD_DIR)/compat-5.1r5" \ + LDFLAGS="-shared $(TARGET_LDFLAGS)" \ + CC="$(TARGET_CC) $(TARGET_CFLAGS) $(FPIC) -std=c99" \ + LD="$(TARGET_CROSS)ld -shared" +endef + +define Package/luaexpat/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lxp.so $(1)/usr/lib/lua/lxp.so + $(INSTALL_DIR) $(1)/usr/lib/lua/lxp + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lxp/lom.lua $(1)/usr/lib/lua/lxp +endef + +$(eval $(call BuildPackage,luaexpat)) diff --git a/lang/luaexpat/files/compat-5.1r5/compat-5.1.c b/lang/luaexpat/files/compat-5.1r5/compat-5.1.c new file mode 100644 index 0000000..6fdb8b7 --- /dev/null +++ b/lang/luaexpat/files/compat-5.1r5/compat-5.1.c @@ -0,0 +1,97 @@ +/* +** Compat-5.1 +** Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat) +** $Id: compat-5.1.c,v 1.13 2006/02/20 21:12:47 carregal Exp $ +*/ + +#include +#include +#include "lua.h" +#include "lauxlib.h" +#include "compat-5.1.h" + +static void getfield(lua_State *L, int idx, const char *name) { + const char *end = strchr(name, '.'); + lua_pushvalue(L, idx); + while (end) { + lua_pushlstring(L, name, end - name); + lua_gettable(L, -2); + lua_remove(L, -2); + if (lua_isnil(L, -1)) return; + name = end+1; + end = strchr(name, '.'); + } + lua_pushstring(L, name); + lua_gettable(L, -2); + lua_remove(L, -2); +} + +static void setfield(lua_State *L, int idx, const char *name) { + const char *end = strchr(name, '.'); + lua_pushvalue(L, idx); + while (end) { + lua_pushlstring(L, name, end - name); + lua_gettable(L, -2); + /* create table if not found */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushlstring(L, name, end - name); + lua_pushvalue(L, -2); + lua_settable(L, -4); + } + lua_remove(L, -2); + name = end+1; + end = strchr(name, '.'); + } + lua_pushstring(L, name); + lua_pushvalue(L, -3); + lua_settable(L, -3); + lua_pop(L, 2); +} + +LUALIB_API void luaL_module(lua_State *L, const char *libname, + const luaL_reg *l, int nup) { + if (libname) { + getfield(L, LUA_GLOBALSINDEX, libname); /* check whether lib already exists */ + if (lua_isnil(L, -1)) { + int env, ns; + lua_pop(L, 1); /* get rid of nil */ + lua_pushliteral(L, "require"); + lua_gettable(L, LUA_GLOBALSINDEX); /* look for require */ + lua_getfenv(L, -1); /* getfenv(require) */ + lua_remove(L, -2); /* remove function require */ + env = lua_gettop(L); + + lua_newtable(L); /* create namespace for lib */ + ns = lua_gettop(L); + getfield(L, env, "package.loaded"); /* get package.loaded table */ + if (lua_isnil(L, -1)) { /* create package.loaded table */ + lua_pop(L, 1); /* remove previous result */ + lua_newtable(L); + lua_pushvalue(L, -1); + setfield(L, env, "package.loaded"); + } + else if (!lua_istable(L, -1)) + luaL_error(L, "name conflict for library `%s'", libname); + lua_pushstring(L, libname); + lua_pushvalue(L, ns); + lua_settable(L, -3); /* package.loaded[libname] = ns */ + lua_pop(L, 1); /* get rid of package.loaded table */ + lua_pushvalue(L, ns); /* copy namespace */ + setfield(L, LUA_GLOBALSINDEX, libname); + lua_remove (L, env); /* remove env */ + } + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + lua_pushstring(L, l->name); + for (i=0; ifunc, nup); + lua_settable(L, -(nup+3)); + } + lua_pop(L, nup); /* remove upvalues */ +} + diff --git a/lang/luaexpat/files/compat-5.1r5/compat-5.1.h b/lang/luaexpat/files/compat-5.1r5/compat-5.1.h new file mode 100644 index 0000000..97570d9 --- /dev/null +++ b/lang/luaexpat/files/compat-5.1r5/compat-5.1.h @@ -0,0 +1,13 @@ +/* +** Compat-5.1 +** Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat/) +** $Id: compat-5.1.h,v 1.8 2006/02/20 21:12:47 carregal Exp $ +*/ + +#ifndef COMPAT_H + +LUALIB_API void luaL_module(lua_State *L, const char *libname, + const luaL_reg *l, int nup); +#define luaL_openlib luaL_module + +#endif diff --git a/lang/luaexpat/files/compat-5.1r5/compat-5.1.lua b/lang/luaexpat/files/compat-5.1r5/compat-5.1.lua new file mode 100644 index 0000000..0938d56 --- /dev/null +++ b/lang/luaexpat/files/compat-5.1r5/compat-5.1.lua @@ -0,0 +1,267 @@ +-- +-- Compat-5.1 +-- Copyright Kepler Project 2004-2006 (http://www.keplerproject.org/compat) +-- According to Lua 5.1 +-- $Id: compat-5.1.lua,v 1.22 2006/02/20 21:12:47 carregal Exp $ +-- + +_COMPAT51 = "Compat-5.1 R5" + +local LUA_DIRSEP = '/' +local LUA_OFSEP = '_' +local OLD_LUA_OFSEP = '' +local POF = 'luaopen_' +local LUA_PATH_MARK = '?' +local LUA_IGMARK = ':' + +local assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type = assert, error, getfenv, ipairs, loadfile, loadlib, pairs, setfenv, setmetatable, type +local find, format, gfind, gsub, sub = string.find, string.format, string.gfind, string.gsub, string.sub + +-- +-- avoid overwriting the package table if it's already there +-- +package = package or {} +local _PACKAGE = package + +package.path = LUA_PATH or os.getenv("LUA_PATH") or + ("./?.lua;" .. + "/usr/local/share/lua/5.0/?.lua;" .. + "/usr/local/share/lua/5.0/?/?.lua;" .. + "/usr/local/share/lua/5.0/?/init.lua" ) + +package.cpath = LUA_CPATH or os.getenv("LUA_CPATH") or + "./?.so;" .. + "./l?.so;" .. + "/usr/local/lib/lua/5.0/?.so;" .. + "/usr/local/lib/lua/5.0/l?.so" + +-- +-- make sure require works with standard libraries +-- +package.loaded = package.loaded or {} +package.loaded.debug = debug +package.loaded.string = string +package.loaded.math = math +package.loaded.io = io +package.loaded.os = os +package.loaded.table = table +package.loaded.base = _G +package.loaded.coroutine = coroutine +local _LOADED = package.loaded + +-- +-- avoid overwriting the package.preload table if it's already there +-- +package.preload = package.preload or {} +local _PRELOAD = package.preload + + +-- +-- looks for a file `name' in given path +-- +local function findfile (name, pname) + name = gsub (name, "%.", LUA_DIRSEP) + local path = _PACKAGE[pname] + assert (type(path) == "string", format ("package.%s must be a string", pname)) + for c in gfind (path, "[^;]+") do + c = gsub (c, "%"..LUA_PATH_MARK, name) + local f = io.open (c) + if f then + f:close () + return c + end + end + return nil -- not found +end + + +-- +-- check whether library is already loaded +-- +local function loader_preload (name) + assert (type(name) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + assert (type(_PRELOAD) == "table", "`package.preload' must be a table") + return _PRELOAD[name] +end + + +-- +-- Lua library loader +-- +local function loader_Lua (name) + assert (type(name) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + local filename = findfile (name, "path") + if not filename then + return false + end + local f, err = loadfile (filename) + if not f then + error (format ("error loading module `%s' (%s)", name, err)) + end + return f +end + + +local function mkfuncname (name) + name = gsub (name, "^.*%"..LUA_IGMARK, "") + name = gsub (name, "%.", LUA_OFSEP) + return POF..name +end + +local function old_mkfuncname (name) + --name = gsub (name, "^.*%"..LUA_IGMARK, "") + name = gsub (name, "%.", OLD_LUA_OFSEP) + return POF..name +end + +-- +-- C library loader +-- +local function loader_C (name) + assert (type(name) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + local filename = findfile (name, "cpath") + if not filename then + return false + end + local funcname = mkfuncname (name) + local f, err = loadlib (filename, funcname) + if not f then + funcname = old_mkfuncname (name) + f, err = loadlib (filename, funcname) + if not f then + error (format ("error loading module `%s' (%s)", name, err)) + end + end + return f +end + + +local function loader_Croot (name) + local p = gsub (name, "^([^.]*).-$", "%1") + if p == "" then + return + end + local filename = findfile (p, "cpath") + if not filename then + return + end + local funcname = mkfuncname (name) + local f, err, where = loadlib (filename, funcname) + if f then + return f + elseif where ~= "init" then + error (format ("error loading module `%s' (%s)", name, err)) + end +end + +-- create `loaders' table +package.loaders = package.loaders or { loader_preload, loader_Lua, loader_C, loader_Croot, } +local _LOADERS = package.loaders + + +-- +-- iterate over available loaders +-- +local function load (name, loaders) + -- iterate over available loaders + assert (type (loaders) == "table", "`package.loaders' must be a table") + for i, loader in ipairs (loaders) do + local f = loader (name) + if f then + return f + end + end + error (format ("module `%s' not found", name)) +end + +-- sentinel +local sentinel = function () end + +-- +-- new require +-- +function _G.require (modname) + assert (type(modname) == "string", format ( + "bad argument #1 to `require' (string expected, got %s)", type(name))) + local p = _LOADED[modname] + if p then -- is it there? + if p == sentinel then + error (format ("loop or previous error loading module '%s'", modname)) + end + return p -- package is already loaded + end + local init = load (modname, _LOADERS) + _LOADED[modname] = sentinel + local actual_arg = _G.arg + _G.arg = { modname } + local res = init (modname) + if res then + _LOADED[modname] = res + end + _G.arg = actual_arg + if _LOADED[modname] == sentinel then + _LOADED[modname] = true + end + return _LOADED[modname] +end + + +-- findtable +local function findtable (t, f) + assert (type(f)=="string", "not a valid field name ("..tostring(f)..")") + local ff = f.."." + local ok, e, w = find (ff, '(.-)%.', 1) + while ok do + local nt = rawget (t, w) + if not nt then + nt = {} + t[w] = nt + elseif type(t) ~= "table" then + return sub (f, e+1) + end + t = nt + ok, e, w = find (ff, '(.-)%.', e+1) + end + return t +end + +-- +-- new package.seeall function +-- +function _PACKAGE.seeall (module) + local t = type(module) + assert (t == "table", "bad argument #1 to package.seeall (table expected, got "..t..")") + local meta = getmetatable (module) + if not meta then + meta = {} + setmetatable (module, meta) + end + meta.__index = _G +end + + +-- +-- new module function +-- +function _G.module (modname, ...) + local ns = _LOADED[modname] + if type(ns) ~= "table" then + ns = findtable (_G, modname) + if not ns then + error (string.format ("name conflict for module '%s'", modname)) + end + _LOADED[modname] = ns + end + if not ns._NAME then + ns._NAME = modname + ns._M = ns + ns._PACKAGE = gsub (modname, "[^.]*$", "") + end + setfenv (2, ns) + for i, f in ipairs (arg) do + f (ns) + end +end diff --git a/lang/luafilesystem/Makefile b/lang/luafilesystem/Makefile new file mode 100644 index 0000000..13abef6 --- /dev/null +++ b/lang/luafilesystem/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2008-2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luafilesystem +PKG_VERSION:=1.6.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/keplerproject/luafilesystem.git +PKG_SOURCE_VERSION:=2fd989cd6c777583be1c93616018c55b2cbb1bcf +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luafilesystem + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaFileSystem + URL:=http://keplerproject.github.com/luafilesystem/ + MAINTAINER:=W. Michael Petullo + DEPENDS:=+liblua +endef + +define Package/luafilesystem/description + This package contains the LuaFileSystem library, a set of portable + functions for directory creation, listing and deletion and for file + locking. +endef + +define Build/Configure +endef + +TARGET_CFLAGS += $(FPIC) $(TARGET_CPPFLAGS) + +TARGET_LDFLAGS += -llua + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -std=gnu99" \ + LDFLAGS="$(TARGET_LDFLAGS)" + $(TARGET_CROSS)ar r $(PKG_BUILD_DIR)/src/luafilesystem.a $(PKG_BUILD_DIR)/src/lfs.o +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include + $(INSTALL_DIR) $(STAGING_DIR)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lfs.h $(STAGING_DIR)/usr/include + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lfs.so $(STAGING_DIR)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/luafilesystem.a $(STAGING_DIR)/usr/lib/lua +endef + +define Package/luafilesystem/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lfs.so $(1)/usr/lib/lua/lfs.so +endef + +$(eval $(call BuildPackage,luafilesystem)) diff --git a/lang/luai2c/Makefile b/lang/luai2c/Makefile new file mode 100755 index 0000000..5022b49 --- /dev/null +++ b/lang/luai2c/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luai2c +PKG_VERSION:=1.0.0 +PKG_RELEASE:=3 +PKG_MAINTAINER:=Frank Edelhaeuser +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/mrpace2/i2c-lua.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luai2c + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua I2C binding + URL:=https://github.com/mrpace2/i2c-lua/ + DEPENDS:=+liblua +kmod-i2c-core + MAINTAINER:=Frank Edelhaeuser +endef + +define Package/luai2c/description + This is the Lua binding for I2C. It provides access to I2C slaves supported by the kernel. +endef + +define Package/luai2c/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/i2c.so $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/i2c + $(INSTALL_DATA) $(PKG_BUILD_DIR)/examples/* $(1)/usr/lib/lua/i2c +endef + +$(eval $(call BuildPackage,luai2c)) diff --git a/lang/lualanes/Makefile b/lang/lualanes/Makefile new file mode 100644 index 0000000..6161290 --- /dev/null +++ b/lang/lualanes/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2007-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lualanes +PKG_REV:=aa9bfcf2dd49f55f11b27e7c21d5b75d81ccfc7e +PKG_VERSION:=3.9.4 +PKG_RELEASE=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz +PKG_SOURCE_URL:=https://github.com/LuaLanes/lanes.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_BUILD_DEPENDS:=lua/host luac/host + +include $(INCLUDE_DIR)/package.mk + +define Package/lualanes + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaLanes + URL:=http://luaforge.net/projects/lanes/ + DEPENDS:=+lua +luac +liblua +libpthread + MAINTAINER:=Vladimir Malyutin +endef + +define Package/lualanes/description + Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 and 5.2. +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) all \ + CC="$(TARGET_CC)" \ + LUA="$(STAGING_DIR)/host/bin/lua" \ + LUAC="$(STAGING_DIR)/host/bin/luac" \ + OPT_FLAGS="$(TARGET_CFLAGS) --std=c99 -Dpthread_yield=sched_yield" +endef + +define Package/lualanes/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lanes.lua $(1)/usr/lib/lua/ + $(INSTALL_DIR) $(1)/usr/lib/lua/lanes + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lanes/core.so $(1)/usr/lib/lua/lanes/core.so +endef + +$(eval $(call BuildPackage,lualanes)) diff --git a/lang/lualanes/patches/100-musl-compat.patch b/lang/lualanes/patches/100-musl-compat.patch new file mode 100644 index 0000000..ba3f49f --- /dev/null +++ b/lang/lualanes/patches/100-musl-compat.patch @@ -0,0 +1,13 @@ +diff --git a/src/threading.h b/src/threading.h +index bfa9ab8..7b3d6a1 100644 +--- a/src/threading.h ++++ b/src/threading.h +@@ -128,7 +128,7 @@ enum e_status { PENDING, RUNNING, WAITING, DONE, ERROR_ST, CANCELLED }; + #endif // PLATFORM_WIN32 + #include + +- #ifdef PLATFORM_LINUX ++ #if defined(PLATFORM_LINUX) && defined(__UCLIBC__) + # define _MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP + #else + /* OS X, ... */ diff --git a/lang/luaposix/Makefile b/lang/luaposix/Makefile new file mode 100644 index 0000000..9bf3628 --- /dev/null +++ b/lang/luaposix/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luaposix +PKG_VERSION:=v33.2.1 +PKG_RELEASE:=5 + +PKG_SOURCE:=release-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/luaposix/luaposix/archive/ +PKG_MD5SUM:=aa68b5c07ab1ecea81bb466c81e88056 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-release-$(PKG_VERSION) +PKG_REMOVE_FILES:=aclocal.m4 +PKG_FIXUP:=autoreconf +PKG_MAINTAINER:=Maxim Storchak +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/luaposix + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luaposix + URL:=http://luaforge.net/projects/luaposix/ + DEPENDS:=+lua +librt + PKG_BUILD_DEPENDS:=+lua/host +endef + +define Package/luaposix/description + luaposix is a general POSIX library for Lua providing access + to various low level libc functions. +endef + +CONFIGURE_VARS += ac_cv_path_LDOC="true" + +TARGET_CFLAGS += -DLUA_USE_LINUX $(FPIC) -std=gnu99 +ifeq ($(CONFIG_USE_MUSL),y) + TARGET_CFLAGS += -D_POSIX_PRIORITY_SCHEDULING +endif + +ifneq ($(CONFIG_USE_GLIBC),) + ifeq ($(CONFIG_EGLIBC_OPTION_EGLIBC_UTMP),) + TARGET_CFLAGS += -DNO_GETLOGIN + endif +endif + + +define Package/luaposix/install + $(INSTALL_DIR) $(1)/usr/lib/lua/posix + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ext/posix/.libs/posix.so $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/posix.lua $(1)/usr/lib/lua +endef + +$(eval $(call BuildPackage,luaposix)) diff --git a/lang/luaposix/patches/100-eglibc-compat.patch b/lang/luaposix/patches/100-eglibc-compat.patch new file mode 100644 index 0000000..e4df63b --- /dev/null +++ b/lang/luaposix/patches/100-eglibc-compat.patch @@ -0,0 +1,30 @@ +diff --git a/ext/posix/unistd.c b/ext/posix/unistd.c +index 9276640..69c8cef 100644 +--- a/ext/posix/unistd.c ++++ b/ext/posix/unistd.c +@@ -525,6 +525,7 @@ Pgetgroups(lua_State *L) + #endif + + ++#ifndef NO_GETLOGIN + /*** + Current logged-in user. + @treturn[1] string username, if successful +@@ -537,6 +538,7 @@ Pgetlogin(lua_State *L) + checknargs(L, 0); + return pushstringresult(getlogin()); + } ++#endif + + + /*** +@@ -1044,7 +1046,9 @@ static const luaL_Reg posix_unistd_fns[] = + LPOSIX_FUNC( Pgetegid ), + LPOSIX_FUNC( Pgeteuid ), + LPOSIX_FUNC( Pgetgid ), ++#ifndef NO_GETLOGIN + LPOSIX_FUNC( Pgetlogin ), ++#endif + LPOSIX_FUNC( Pgetpgrp ), + LPOSIX_FUNC( Pgetpid ), + LPOSIX_FUNC( Pgetppid ), diff --git a/lang/luaposix/patches/101-disable-curses.patch b/lang/luaposix/patches/101-disable-curses.patch new file mode 100644 index 0000000..6412799 --- /dev/null +++ b/lang/luaposix/patches/101-disable-curses.patch @@ -0,0 +1,32 @@ +diff --git a/configure.ac b/configure.ac +index dfd4199..19924d0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -153,15 +153,6 @@ AC_CHECK_LIB([rt], [clock_gettime]) + AC_SUBST([LIBRT], [$LIBS]) + LIBS=$save_LIBS + +-## Curses +-AX_WITH_CURSES +-AC_ARG_VAR(CURSES_LIB, [linker flags for curses library]) +- +-save_LIBS=$LIBS +-LIBS="$CURSES_LIB $LIBS" +-AC_CHECK_FUNCS([resizeterm]) +-LIBS=$save_LIBS +- + ## Use system implementation, or bundled replacement? + AC_CHECK_FUNCS([strlcpy]) + +diff --git a/ext/posix/posix.c b/ext/posix/posix.c +index 6019df0..2d75487 100644 +--- a/ext/posix/posix.c ++++ b/ext/posix/posix.c +@@ -12,7 +12,6 @@ + + #include "bit32.c" + #include "ctype.c" +-#include "curses.c" + #include "dirent.c" + #include "errno.c" + #include "fcntl.c" diff --git a/lang/luaposix/patches/102-disable-compat-deprecated.diff b/lang/luaposix/patches/102-disable-compat-deprecated.diff new file mode 100644 index 0000000..7c58be4 --- /dev/null +++ b/lang/luaposix/patches/102-disable-compat-deprecated.diff @@ -0,0 +1,20 @@ +diff --git a/lib/posix.lua.in b/lib/posix.lua.in +index 17ef39a..a248d9b 100644 +--- a/lib/posix.lua.in ++++ b/lib/posix.lua.in +@@ -35,15 +35,6 @@ for _, sub in ipairs { + end + end + +- +--- Inject deprecated APIs (overwriting submodules) for backwards compatibility. +-for k, v in pairs (require "posix.deprecated") do +- M[k] = v +-end +-for k, v in pairs (require "posix.compat") do +- M[k] = v +-end +- + M.version = "posix for " .. _VERSION .. " / @PACKAGE_STRING@" + + diff --git a/lang/luarocks/Makefile b/lang/luarocks/Makefile new file mode 100644 index 0000000..7519f8f --- /dev/null +++ b/lang/luarocks/Makefile @@ -0,0 +1,58 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luarocks +PKG_VERSION:=2.2.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/keplerproject/luarocks.git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) + +PKG_MAINTAINER:=Amr Hassan +PKG_INSTALL=1 +PKG_BUILD_DEPENDS:=lua/host luac/host +PKG_LICENSE=GPL + +include $(INCLUDE_DIR)/package.mk + +define Package/luarocks + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=luarocks + URL:=https://github.com/keplerproject/luarocks + DEPENDS:=+lua +luac +liblua +luasocket +unzip +curl +luasec +endef + +define Package/luarocks/description + LuaRocks is a deployment and management system for Lua modules. +endef + +# My custom args, copied and modified from SDK_ROOT/include/package-defaults.mk +CONFIGURE_ARGS = \ + --prefix=$(CONFIGURE_PREFIX) \ + --sysconfdir=/etc \ + --with-lua=$(STAGING_DIR)/host + +define Build/Compile + $(call Build/Compile/Default,build) +endef + +define Package/luarocks/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luarocks-5.1 $(1)/usr/bin/luarocks + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luarocks-admin-5.1 $(1)/usr/bin/luarocks-admin + $(CP) $(PKG_INSTALL_DIR)/usr/share $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/etc $(1)/etc +endef + +$(eval $(call BuildPackage,luarocks)) diff --git a/lang/luarocks/patches/01_dont_modify_bin_shebang.diff b/lang/luarocks/patches/01_dont_modify_bin_shebang.diff new file mode 100644 index 0000000..a1bad21 --- /dev/null +++ b/lang/luarocks/patches/01_dont_modify_bin_shebang.diff @@ -0,0 +1,13 @@ +diff -rupN luarocks/Makefile luarocks.new/Makefile +--- luarocks/Makefile 2015-02-19 13:24:07.027310956 +0200 ++++ luarocks.new/Makefile 2015-02-22 13:28:24.497353543 +0200 +@@ -104,7 +104,7 @@ build_bins: cleanup_bins + for f in $(BIN_FILES) ;\ + do \ + sed "1d" src/bin/$$f > src/bin/$$f.bak ;\ +- echo "#!$(LUA_BINDIR)/lua$(LUA_SUFFIX)" > src/bin/$$f ;\ ++ echo "#!/usr/bin/env lua" > src/bin/$$f ;\ + echo "package.path = [[$(LUADIR)/?.lua;]]..package.path" | sed "s,//,/,g" >> src/bin/$$f ;\ + cat src/bin/$$f.bak >> src/bin/$$f ;\ + chmod +x src/bin/$$f ;\ +Binary files luarocks/src/bin/.luarocks.swp and luarocks.new/src/bin/.luarocks.swp differ diff --git a/lang/luasec/Makefile b/lang/luasec/Makefile new file mode 100644 index 0000000..b2bde57 --- /dev/null +++ b/lang/luasec/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2009-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luasec +PKG_VERSION:=0.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/brunoos/luasec/archive/ +PKG_MD5SUM:=14e1aef6d2aae96bbf98afc6b6634af2 +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_NAME)-$(PKG_VERSION) + +MAINTAINER:=W. Michael Petullo +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/luasec + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaSec + URL:=https://github.com/brunoos/luasec + DEPENDS:=+lua +libopenssl +luasocket +endef + +define Package/luasec/description + LuaSec is a binding for OpenSSL library to provide TLS/SSL communication. +endef + +define Build/Configure +endef + +MAKE_FLAGS += \ + INCDIR="$(TARGET_CPPFLAGS) -I." \ + LIBDIR="$(TARGET_LDFLAGS) -L./luasocket" \ + LUACPATH="$(PKG_INSTALL_DIR)/usr/lib/lua" \ + LUAPATH="$(PKG_INSTALL_DIR)/usr/lib/lua" + +define Build/Compile +$(call Build/Compile/Default,linux) +endef + +define Package/luasec/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl.so $(1)/usr/lib/lua/ + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl.lua $(1)/usr/lib/lua/ + $(INSTALL_DIR) $(1)/usr/lib/lua/ssl + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/lua/ssl/https.lua $(1)/usr/lib/lua/ssl/ +endef + +$(eval $(call BuildPackage,luasec)) diff --git a/lang/luasoap/Makefile b/lang/luasoap/Makefile new file mode 100644 index 0000000..6ebf03b --- /dev/null +++ b/lang/luasoap/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luasoap +PKG_VERSION:=2014-08-21 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/tomasguisasola/luasoap.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=af1e100281cee4b972df10121e37e51d53367a98 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz +PKG_MIRROR_MD5SUM:= + +PKG_MAINTAINER:=Liu Peng +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/luasoap + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaSOAP + URL:=https://github.com/tomasguisasola/luasoap + DEPENDS:=+lua +luaexpat +luasec +luasocket +endef + +define Package/luasoap/description + LuaSOAP is a library of functions to deal with SOAP. +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/luasoap/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/soap.lua $(1)/usr/lib/lua/ + $(INSTALL_DIR) $(1)/usr/lib/lua/soap + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{client,server}.lua $(1)/usr/lib/lua/soap/ + $(INSTALL_DIR) $(1)/usr/lib/lua/soap/client + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/client/https.lua $(1)/usr/lib/lua/soap/client/ + $(INSTALL_DIR) $(1)/usr/lib/lua/soap/tests + $(INSTALL_DATA) $(PKG_BUILD_DIR)/tests/test{,-http,-server}.lua $(1)/usr/lib/lua/soap/tests/ +endef + +$(eval $(call BuildPackage,luasoap)) diff --git a/lang/luasocket/Makefile b/lang/luasocket/Makefile new file mode 100644 index 0000000..5e7c983 --- /dev/null +++ b/lang/luasocket/Makefile @@ -0,0 +1,63 @@ +# +# Copyright (C) 2009-2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luasocket +PKG_SOURCE_VERSION:=6d5e40c324c84d9c1453ae88e0ad5bdd0a631448 +PKG_VERSION:=3.0-rc1-20130909 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://github.com/diegonehab/luasocket.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luasocket + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=LuaSocket + URL:=http://luasocket.luaforge.net/ + MAINTAINER:=W. Michael Petullo + DEPENDS:=+lua +endef + +define Package/luasocket/description + LuaSocket is the most comprehensive networking support + library for the Lua language. It provides easy access to + TCP, UDP, DNS, SMTP, FTP, HTTP, MIME and much more. +endef + +define Build/Configure +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/ \ + LIBDIR="$(TARGET_LDFLAGS)" \ + CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) -std=gnu99" \ + LD="$(TARGET_CROSS)ld -shared" \ + all +endef + + +define Package/luasocket/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{ltn12,mime,socket}.lua $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mime.so.1.0.3 $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/socket.so.3.0-rc1 $(1)/usr/lib/lua + $(INSTALL_DIR) $(1)/usr/lib/lua/mime + ln -sf ../mime.so.1.0.3 $(1)/usr/lib/lua/mime/core.so + $(INSTALL_DIR) $(1)/usr/lib/lua/socket + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/{ftp,http,smtp,tp,url,headers}.lua $(1)/usr/lib/lua/socket + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/unix.so $(1)/usr/lib/lua/socket + ln -sf ../socket.so.3.0-rc1 $(1)/usr/lib/lua/socket/core.so +endef + +$(eval $(call BuildPackage,luasocket)) diff --git a/lang/luasocket/patches/0001-Add-interface-support.patch b/lang/luasocket/patches/0001-Add-interface-support.patch new file mode 100644 index 0000000..3be42ed --- /dev/null +++ b/lang/luasocket/patches/0001-Add-interface-support.patch @@ -0,0 +1,237 @@ +From 96fdf07acf78ecfc9be76a8b0591f38fe6f1a875 Mon Sep 17 00:00:00 2001 +From: Steven Barth +Date: Sat, 9 Nov 2013 12:01:42 +0100 +Subject: [PATCH] Add interface resolving + +--- + src/if.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + src/if.h | 27 ++++++++++++++ + src/luasocket.c | 2 + + src/makefile | 2 + + src/options.c | 9 +++++ + 5 files changed, 153 insertions(+) + create mode 100644 src/if.c + create mode 100644 src/if.h + +diff --git a/src/if.c b/src/if.c +new file mode 100644 +index 0000000..db231aa +--- /dev/null ++++ b/src/if.c +@@ -0,0 +1,113 @@ ++/* ++ * $Id: if.c $ ++ * ++ * Author: Markus Stenberg ++ * ++ * Copyright (c) 2012 cisco Systems, Inc. ++ * ++ * Created: Tue Dec 4 14:50:34 2012 mstenber ++ * Last modified: Wed Dec 5 18:51:08 2012 mstenber ++ * Edit time: 24 min ++ * ++ */ ++ ++#include ++#include ++#include ++ ++#include "if.h" ++ ++#include "lauxlib.h" ++ ++static int if_global_indextoname(lua_State *L); ++static int if_global_nametoindex(lua_State *L); ++static int if_global_nameindex(lua_State *L); ++ ++static luaL_Reg func[] = { ++ { "indextoname", if_global_indextoname}, ++ { "nametoindex", if_global_nametoindex}, ++ { "nameindex", if_global_nameindex}, ++ { NULL, NULL} ++}; ++ ++int if_open(lua_State *L) ++{ ++ lua_pushstring(L, "iface"); ++ lua_newtable(L); ++ luaL_openlib(L, NULL, func, 0); ++ lua_settable(L, -3); ++ return 0; ++} ++ ++int if_global_indextoname(lua_State *L) ++{ ++ unsigned int ifnumber; ++ const char *name; ++ char buf[IF_NAMESIZE+1]; ++ ++ if (!lua_isnumber(L, 1)) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "indextoname expects only number argument"); ++ return 2; ++ } ++ ifnumber = lua_tonumber(L, 1); ++ if (!(name = if_indextoname(ifnumber, buf))) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "nonexistent interface"); ++ return 2; ++ } ++ lua_pushstring(L, name); ++ return 1; ++} ++ ++int if_global_nametoindex(lua_State *L) ++{ ++ unsigned int ifnumber; ++ if (!lua_isstring(L, 1)) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "nametoindex expects only string argument"); ++ return 2; ++ } ++ if (!(ifnumber = if_nametoindex(lua_tostring(L, 1)))) ++ { ++ lua_pushnil(L); ++ lua_pushstring(L, "nonexistent interface"); ++ return 2; ++ } ++ lua_pushnumber(L, ifnumber); ++ return 1; ++} ++ ++int if_global_nameindex(lua_State *L) ++{ ++ struct if_nameindex *ni, *oni; ++ int i = 1; ++ oni = ni = if_nameindex(); ++ lua_newtable(L); ++ while (ni && ni->if_index && *(ni->if_name)) ++ { ++ /* at result[i], we store.. */ ++ lua_pushnumber(L, i); ++ ++ /* new table with two items - index, name*/ ++ lua_newtable(L); ++ lua_pushstring(L, "index"); ++ lua_pushnumber(L, ni->if_index); ++ lua_settable(L, -3); ++ ++ lua_pushstring(L, "name"); ++ lua_pushstring(L, ni->if_name); ++ lua_settable(L, -3); ++ ++ /* Then, actually store it */ ++ lua_settable(L, -3); ++ ++ i++; ++ ni++; ++ } ++ if_freenameindex(oni); ++ return 1; ++} +diff --git a/src/if.h b/src/if.h +new file mode 100644 +index 0000000..dc7faf8 +--- /dev/null ++++ b/src/if.h +@@ -0,0 +1,27 @@ ++/* ++ * $Id: if.h $ ++ * ++ * Author: Markus Stenberg ++ * ++ * Copyright (c) 2012 cisco Systems, Inc. ++ * ++ * Created: Tue Dec 4 14:37:24 2012 mstenber ++ * Last modified: Tue Dec 4 14:51:43 2012 mstenber ++ * Edit time: 7 min ++ * ++ */ ++ ++/* This module provides Lua wrapping for the advanced socket API ++ * defined in RFC3542, or mainly, the access to the system's interface ++ * list. It is necessary for use of recvmsg/sendmsg. ++ * ++ * TODO - Do something clever with Windows? ++ */ ++#ifndef IF_H ++#define IF_H ++ ++#include "lua.h" ++ ++int if_open(lua_State *L); ++ ++#endif /* IF_H */ +diff --git a/src/luasocket.c b/src/luasocket.c +index e6ee747..85d41a6 100644 +--- a/src/luasocket.c ++++ b/src/luasocket.c +@@ -31,6 +31,7 @@ + #include "tcp.h" + #include "udp.h" + #include "select.h" ++#include "if.h" + + /*-------------------------------------------------------------------------*\ + * Internal function prototypes +@@ -51,6 +52,7 @@ static const luaL_Reg mod[] = { + {"tcp", tcp_open}, + {"udp", udp_open}, + {"select", select_open}, ++ {"iface", if_open}, + {NULL, NULL} + }; + +diff --git a/src/makefile b/src/makefile +index 8d3521e..09d4882 100644 +--- a/src/makefile ++++ b/src/makefile +@@ -262,6 +262,7 @@ SOCKET_OBJS= \ + auxiliar.$(O) \ + options.$(O) \ + inet.$(O) \ ++ if.$(O) \ + $(SOCKET) \ + except.$(O) \ + select.$(O) \ +@@ -387,6 +388,7 @@ auxiliar.$(O): auxiliar.c auxiliar.h + buffer.$(O): buffer.c buffer.h io.h timeout.h + except.$(O): except.c except.h + inet.$(O): inet.c inet.h socket.h io.h timeout.h usocket.h ++if.$(O): if.c if.h + io.$(O): io.c io.h timeout.h + luasocket.$(O): luasocket.c luasocket.h auxiliar.h except.h \ + timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \ +diff --git a/src/options.c b/src/options.c +index 8ac2a14..1c73e6f 100644 +--- a/src/options.c ++++ b/src/options.c +@@ -3,6 +3,9 @@ + * LuaSocket toolkit + \*=========================================================================*/ + #include ++#include ++#include ++#include + + #include "lauxlib.h" + +@@ -285,6 +288,12 @@ static int opt_ip6_setmembership(lua_State *L, p_socket ps, int level, int name) + if (!lua_isnil(L, -1)) { + if (lua_isnumber(L, -1)) { + val.ipv6mr_interface = (unsigned int) lua_tonumber(L, -1); ++ } else if (lua_isstring(L, -1)) { ++ if (!(val.ipv6mr_interface = if_nametoindex(lua_tostring(L, -1)))) { ++ lua_pushnil(L); ++ lua_pushstring(L, "nonexistent interface"); ++ return 2; ++ } + } else + luaL_argerror(L, -1, "number 'interface' field expected"); + } +-- +1.8.4.rc3 + diff --git a/lang/luasql/Makefile b/lang/luasql/Makefile new file mode 100644 index 0000000..135ebff --- /dev/null +++ b/lang/luasql/Makefile @@ -0,0 +1,118 @@ +# +# Copyright (C) 2010-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luasql +PKG_VERSION:=2.3.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://github.com/keplerproject/luasql.git +PKG_SOURCE_VERSION:=v$(PKG_VERSION) + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=docs/us/license.html +PKG_MAINTAINER:=Nicolas Thill + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk + +define Package/luasql/Default + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua SQL binding + URL:=http://keplerproject.github.io/luasql/ + DEPENDS:= +lua +endef + +define Package/luasql/Default/description + LuaSQL is a simple interface from Lua to a DBMS. +endef + + +define Package/luasql-mysql +$(call Package/luasql/Default) + TITLE+= for MySQL + DEPENDS+= +libmysqlclient + VARIANT:=mysql +endef + +define Package/luasql-mysql/description +$(call Package/luasql/Default/description) + . + This package contains the MySQL binding. +endef + + +define Package/luasql-pgsql +$(call Package/luasql/Default) + TITLE+= for PostgreSQL + DEPENDS+= +libpq + VARIANT:=postgres +endef + +define Package/luasql-pgsql/description +$(call Package/luasql/Default/description) + . + This package contains the PostgreSQL binding. +endef + + +define Package/luasql-sqlite3 +$(call Package/luasql/Default) + TITLE+= for SQLite 3 + DEPENDS+= +libsqlite3 + VARIANT:=sqlite3 +endef + +define Package/luasql-sqlite3/description +$(call Package/luasql/Default/description) + . + This package contains the SQLite 3 binding. +endef + + +TARGET_CFLAGS += $(FPIC) -std=gnu99 +TARGET_CPPFLAGS += -DLUA_USE_LINUX + +ifeq ($(BUILD_VARIANT),mysql) + TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/mysql + TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz +endif + +ifeq ($(BUILD_VARIANT),postgres) + TARGET_LDFLAGS += -lpq +endif + +ifeq ($(BUILD_VARIANT),sqlite3) + TARGET_LDFLAGS += -lsqlite3 -lpthread +endif + +MAKE_FLAGS += \ + T="$(BUILD_VARIANT)" \ + DRIVER_INCS="$(TARGET_CPPFLAGS)" \ + DRIVER_LIBS="$(TARGET_LDFLAGS)" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \ + lib + +define Package/Install/Default + $(INSTALL_DIR) $(1)/usr/lib/lua/luasql + $(CP) $(PKG_BUILD_DIR)/src/*.so $(1)/usr/lib/lua/luasql/ +endef + +Package/luasql-mysql/install = $(Package/Install/Default) +Package/luasql-pgsql/install = $(Package/Install/Default) +Package/luasql-sqlite3/install = $(Package/Install/Default) + +$(eval $(call BuildPackage,luasql-mysql)) +$(eval $(call BuildPackage,luasql-pgsql)) +$(eval $(call BuildPackage,luasql-sqlite3)) diff --git a/lang/lzmq/Makefile b/lang/lzmq/Makefile new file mode 100644 index 0000000..b17b945 --- /dev/null +++ b/lang/lzmq/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lzmq +PKG_VERSION:=0.4.3 +PKG_RELEASE:=1 +PKG_MAINTAINER:=Dirk Chang +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/zeromq/lzmq/tar.gz/v$(PKG_VERSION)? +PKG_MD5SUM:=c4e51a60a5a26987bdce59e45d674a9e + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/lzmq + SUBMENU:=Lua + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lua ZeroMQ binding + URL:=https://github.com/moteus/lzmq/ + DEPENDS:= +lua +libzmq +endef + +define Package/lzmq/description + LZMQ is a Lua binding to ZeroMQ. +endef + +CMAKE_OPTIONS += \ + -DUSE_LUA=ON + +define Package/lzmq/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lzmq.so $(1)/usr/lib/lua/ + + $(INSTALL_DIR) $(1)/usr/lib/lua/lzmq + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lzmq/timer.so $(1)/usr/lib/lua/lzmq + $(CP) -R $(PKG_BUILD_DIR)/src/lua/lzmq/* $(1)/usr/lib/lua/lzmq +endef + +$(eval $(call BuildPackage,lzmq)) diff --git a/lang/micropython-lib/Makefile b/lang/micropython-lib/Makefile new file mode 100644 index 0000000..2f3fc61 --- /dev/null +++ b/lang/micropython-lib/Makefile @@ -0,0 +1,55 @@ +# +# Copyright (C) 2008-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=micropython-lib +PKG_VERSION=1.8.6-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Roger D +PKG_LICENSE:=MIT, PSFL +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/micropython/micropython-lib.git +PKG_SOURCE_VERSION:=f81e979c56dddb771ad36ec381b7f2c6cd12111f + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/micropython-lib + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=micropython-lib + URL:=https://github.com/micropython/micropython-lib + DEPENDS:=+micropython +endef + +define Package/micropython-lib/description + This package contains micropython-lib, a project to develop a non-monolothic + standard library for Micro Python. Note that this is a work in progress and + several libraries may be missing, incomplete or buggy. +endef + +MAKE_FLAGS:=\ + -C $(PKG_BUILD_DIR) \ + PREFIX=$(PKG_BUILD_DIR)/_install_tmp \ + install + +define Package/micropython-lib/install + $(INSTALL_DIR) $(1)/usr/lib/micropython + $(CP) $(PKG_BUILD_DIR)/_install_tmp/* $(1)/usr/lib/micropython +endef + +$(eval $(call BuildPackage,micropython-lib)) + diff --git a/lang/micropython/Makefile b/lang/micropython/Makefile new file mode 100644 index 0000000..7ee5882 --- /dev/null +++ b/lang/micropython/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2008-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=micropython +PKG_VERSION=1.8.6-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Roger D +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/micropython/micropython.git +PKG_SOURCE_VERSION:=5a1d63fc14dae788f705403a43c2d8639b7dd9cd + +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/micropython + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=Micro Python + URL:=http://micropython.org + DEPENDS:=+libffi +endef + +define Package/micropython/description + This package contains Micro Python, a lean and fast implementation of the Python 3.4 programming language + that is optimised to run on a microcontroller (and low power computers). +endef + + +MAKE_FLAGS += -C $(PKG_BUILD_DIR)/unix + +define Build/Compile + $(call Build/Compile/Default,axtls) + $(call Build/Compile/Default) + +endef + +define Package/micropython/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/unix/micropython $(1)/usr/bin/micropython +endef + +$(eval $(call BuildPackage,micropython)) diff --git a/lang/micropython/patches/000-Makefile-no-errors b/lang/micropython/patches/000-Makefile-no-errors new file mode 100644 index 0000000..765f3e7 --- /dev/null +++ b/lang/micropython/patches/000-Makefile-no-errors @@ -0,0 +1,13 @@ +Index: micropython-1.5-20161117-e81a5353cb794b8d6c57317488e5db6a1c524755/unix/Makefile +=================================================================== +--- micropython-1.5-20161117-e81a5353cb794b8d6c57317488e5db6a1c524755.orig/unix/Makefile 2016-11-17 02:43:13.000000000 +0100 ++++ micropython-1.5-20161117-e81a5353cb794b8d6c57317488e5db6a1c524755/unix/Makefile 2016-11-17 16:49:02.937809018 +0100 +@@ -21,7 +21,7 @@ + INC += -I$(BUILD) + + # compiler settings +-CWARN = -Wall -Werror ++CWARN = -Wall + CWARN += -Wpointer-arith -Wuninitialized + CFLAGS = $(INC) $(CWARN) -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA) + diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile new file mode 100644 index 0000000..f4de0c0 --- /dev/null +++ b/lang/node-arduino-firmata/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2014 Arduino LLC +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=arduino-firmata +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.3.3 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git +PKG_SOURCE_VERSION:=16e76007edf218d72df590adbd711ac6b7432845 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE.txt + +include $(INCLUDE_DIR)/package.mk + +define Package/node-arduino-firmata + DEPENDS:=+node + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + DEPENDS:=+node +node-serialport + TITLE:=Node.js package to access serial ports for reading and writing + URL:=https://www.npmjs.org/package/serialport +endef + +define Package/node-arduino-firmata/description + Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them! +endef + +define Build/Prepare + /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 + $(Build/Patch) +endef + +EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ + +define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install -g $(PKG_BUILD_DIR) +endef + +define Package/node-arduino-firmata/install + mkdir -p $(1)/usr/lib/node + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node + rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/ + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,node-arduino-firmata)) + diff --git a/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js b/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js new file mode 100644 index 0000000..578bd40 --- /dev/null +++ b/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js @@ -0,0 +1,306 @@ +(function() { + 'use strict'; + var ArduinoFirmata, SerialPort, debug, events, exports, serialport, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + events = require('eventemitter2'); + + SerialPort = (serialport = require('serialport')).SerialPort; + + debug = require('debug')('arduino-firmata'); + + exports = module.exports = ArduinoFirmata = (function(superClass) { + extend(ArduinoFirmata, superClass); + + ArduinoFirmata.Status = { + CLOSE: 0, + OPEN: 1 + }; + + ArduinoFirmata.INPUT = 0; + + ArduinoFirmata.OUTPUT = 1; + + ArduinoFirmata.ANALOG = 2; + + ArduinoFirmata.PWM = 3; + + ArduinoFirmata.SERVO = 4; + + ArduinoFirmata.SHIFT = 5; + + ArduinoFirmata.I2C = 6; + + ArduinoFirmata.LOW = 0; + + ArduinoFirmata.HIGH = 1; + + ArduinoFirmata.MAX_DATA_BYTES = 32; + + ArduinoFirmata.DIGITAL_MESSAGE = 0x90; + + ArduinoFirmata.ANALOG_MESSAGE = 0xE0; + + ArduinoFirmata.REPORT_ANALOG = 0xC0; + + ArduinoFirmata.REPORT_DIGITAL = 0xD0; + + ArduinoFirmata.SET_PIN_MODE = 0xF4; + + ArduinoFirmata.REPORT_VERSION = 0xF9; + + ArduinoFirmata.SYSTEM_RESET = 0xFF; + + ArduinoFirmata.START_SYSEX = 0xF0; + + ArduinoFirmata.END_SYSEX = 0xF7; + + ArduinoFirmata.list = function(callback) { + return serialport.list(function(err, ports) { + var devices, j, len, port; + if (err) { + return callback(err); + } + devices = []; + for (j = 0, len = ports.length; j < len; j++) { + port = ports[j]; + if (/usb|acm|com\d+/i.test(port.comName)) { + devices.push(port.comName); + } + } + return callback(null, devices); + }); + }; + + function ArduinoFirmata() { + this.status = ArduinoFirmata.Status.CLOSE; + this.wait_for_data = 0; + this.execute_multi_byte_command = 0; + this.multi_byte_channel = 0; + this.stored_input_data = []; + this.parsing_sysex = false; + this.sysex_bytes_read = 0; + this.digital_output_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.digital_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.analog_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.boardVersion = null; + } + + ArduinoFirmata.prototype.isOldArduinoDevice = function() { + return /usbserial|USB/.test(this.serialport_name); + }; + + ArduinoFirmata.prototype.connect = function(serialport_name, opts) { + this.serialport_name = serialport_name; + if (opts == null) { + opts = { + baudrate: 57600 + }; + } + opts.parser = serialport.parsers.raw; + if (!this.serialport_name) { + ArduinoFirmata.list((function(_this) { + return function(err, devices) { + return _this.connect(devices[0], opts); + }; + })(this)); + return this; + } + this.once('boardReady', function() { + var io_init_wait; + debug('boardReady'); + io_init_wait = this.isOldArduinoDevice() ? (debug("old arduino device found " + this.serialport_name), 3000) : (debug("new arduino device found " + this.serialport_name), 100); + debug("wait " + io_init_wait + "(msec)"); + return setTimeout((function(_this) { + return function() { + var i, j, k; + for (i = j = 0; j < 6; i = ++j) { + _this.write([ArduinoFirmata.REPORT_ANALOG | i, 1]); + } + for (i = k = 0; k < 2; i = ++k) { + _this.write([ArduinoFirmata.REPORT_DIGITAL | i, 1]); + } + debug('init IO ports'); + return _this.emit('connect'); + }; + })(this), io_init_wait); + }); + this.serialport = new SerialPort(this.serialport_name, opts); + this.serialport.once('open', (function(_this) { + return function() { + var cid; + cid = setInterval(function() { + debug('request REPORT_VERSION'); + return _this.write([ArduinoFirmata.REPORT_VERSION]); + }, 500); + _this.once('boardVersion', function(version) { + clearInterval(cid); + _this.status = ArduinoFirmata.Status.OPEN; + return _this.emit('boardReady'); + }); + return _this.serialport.on('data', function(data) { + var byte, j, len, results; + results = []; + for (j = 0, len = data.length; j < len; j++) { + byte = data[j]; + results.push(_this.process_input(byte)); + } + return results; + }); + }; + })(this)); + return this; + }; + + ArduinoFirmata.prototype.isOpen = function() { + return this.status === ArduinoFirmata.Status.OPEN; + }; + + ArduinoFirmata.prototype.close = function(callback) { + this.status = ArduinoFirmata.Status.CLOSE; + return this.serialport.close(callback); + }; + + ArduinoFirmata.prototype.reset = function(callback) { + return this.write([ArduinoFirmata.SYSTEM_RESET], callback); + }; + + ArduinoFirmata.prototype.write = function(bytes, callback) { + return this.serialport.write(bytes, callback); + }; + + ArduinoFirmata.prototype.sysex = function(command, data, callback) { + var write_data; + if (data == null) { + data = []; + } + data = data.map(function(i) { + return i & 0x7f; + }); + write_data = [ArduinoFirmata.START_SYSEX, command].concat(data, [ArduinoFirmata.END_SYSEX]); + return this.write(write_data, callback); + }; + + ArduinoFirmata.prototype.pinMode = function(pin, mode, callback) { + switch (mode) { + case true: + mode = ArduinoFirmata.OUTPUT; + break; + case false: + mode = ArduinoFirmata.INPUT; + } + return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode], callback); + }; + + ArduinoFirmata.prototype.digitalWrite = function(pin, value, callback) { + var port_num; + this.pinMode(pin, ArduinoFirmata.OUTPUT); + port_num = (pin >>> 3) & 0x0F; + if (value === 0 || value === false) { + this.digital_output_data[port_num] &= ~(1 << (pin & 0x07)); + } else { + this.digital_output_data[port_num] |= 1 << (pin & 0x07); + } + return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7], callback); + }; + + ArduinoFirmata.prototype.analogWrite = function(pin, value, callback) { + value = Math.floor(value); + this.pinMode(pin, ArduinoFirmata.PWM); + return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7], callback); + }; + + ArduinoFirmata.prototype.servoWrite = function(pin, angle, callback) { + this.pinMode(pin, ArduinoFirmata.SERVO); + return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7], callback); + }; + + ArduinoFirmata.prototype.digitalRead = function(pin) { + return ((this.digital_input_data[pin >>> 3] >>> (pin & 0x07)) & 0x01) > 0; + }; + + ArduinoFirmata.prototype.analogRead = function(pin) { + return this.analog_input_data[pin]; + }; + + ArduinoFirmata.prototype.process_input = function(input_data) { + var analog_value, command, diff, i, j, old_analog_value, results, stat, sysex_command, sysex_data; + if (this.parsing_sysex) { + if (input_data === ArduinoFirmata.END_SYSEX) { + this.parsing_sysex = false; + sysex_command = this.stored_input_data[0]; + sysex_data = this.stored_input_data.slice(1, this.sysex_bytes_read); + return this.emit('sysex', { + command: sysex_command, + data: sysex_data + }); + } else { + this.stored_input_data[this.sysex_bytes_read] = input_data; + return this.sysex_bytes_read += 1; + } + } else if (this.wait_for_data > 0 && input_data < 128) { + this.wait_for_data -= 1; + this.stored_input_data[this.wait_for_data] = input_data; + if (this.execute_multi_byte_command !== 0 && this.wait_for_data === 0) { + switch (this.execute_multi_byte_command) { + case ArduinoFirmata.DIGITAL_MESSAGE: + input_data = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; + diff = this.digital_input_data[this.multi_byte_channel] ^ input_data; + this.digital_input_data[this.multi_byte_channel] = input_data; + if (this.listeners('digitalChange').length > 0) { + results = []; + for (i = j = 0; j <= 13; i = ++j) { + if (((0x01 << i) & diff) > 0) { + stat = (input_data & diff) > 0; + results.push(this.emit('digitalChange', { + pin: i + this.multi_byte_channel * 8, + value: stat, + old_value: !stat + })); + } else { + results.push(void 0); + } + } + return results; + } + break; + case ArduinoFirmata.ANALOG_MESSAGE: + analog_value = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; + old_analog_value = this.analogRead(this.multi_byte_channel); + this.analog_input_data[this.multi_byte_channel] = analog_value; + if (old_analog_value !== analog_value) { + return this.emit('analogChange', { + pin: this.multi_byte_channel, + value: analog_value, + old_value: old_analog_value + }); + } + break; + case ArduinoFirmata.REPORT_VERSION: + this.boardVersion = this.stored_input_data[1] + "." + this.stored_input_data[0]; + return this.emit('boardVersion', this.boardVersion); + } + } + } else { + if (input_data < 0xF0) { + command = input_data & 0xF0; + this.multi_byte_channel = input_data & 0x0F; + } else { + command = input_data; + } + if (command === ArduinoFirmata.START_SYSEX) { + this.parsing_sysex = true; + return this.sysex_bytes_read = 0; + } else if (command === ArduinoFirmata.DIGITAL_MESSAGE || command === ArduinoFirmata.ANALOG_MESSAGE || command === ArduinoFirmata.REPORT_VERSION) { + this.wait_for_data = 2; + return this.execute_multi_byte_command = command; + } + } + }; + + return ArduinoFirmata; + + })(events.EventEmitter2); + +}).call(this); diff --git a/lang/node-arduino-firmata/patches/000-new-serialport.patch b/lang/node-arduino-firmata/patches/000-new-serialport.patch new file mode 100644 index 0000000..10eab64 --- /dev/null +++ b/lang/node-arduino-firmata/patches/000-new-serialport.patch @@ -0,0 +1,10 @@ +--- a/package.json ++++ b/package.json +@@ -30,7 +30,6 @@ + "author": "Sho Hashimoto ", + "license": "MIT", + "dependencies": { +- "serialport": "*", + "eventemitter2": "*", + "debug": "*" + }, diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile new file mode 100644 index 0000000..13833a3 --- /dev/null +++ b/lang/node-cylon/Makefile @@ -0,0 +1,99 @@ +# +# Copyright (C) 2014 Arduino LLC +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=cylon +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.22.0 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git +PKG_SOURCE_VERSION:=0c37da77e48b3e2cc3a8d566822a17689de91b40 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/node-cylon/default + DEPENDS:=+node $(2) + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + TITLE:=CylonJS - $(1) + URL:=https://www.npmjs.org/package/cylon +endef + +define Package/node-cylon + $(call Package/node-cylon/default,Core) +endef + +define Package/node-cylon-i2c + $(call Package/node-cylon/default,I2C,+node-cylon) +endef + +define Package/node-cylon-gpio + $(call Package/node-cylon/default,GPIO,+node-cylon) +endef + +define Package/node-cylon-firmata + $(call Package/node-cylon/default,Firmata,+node-cylon-gpio +node-cylon-i2c +node-arduino-firmata) +endef + +define Package/node-cylon/description + JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started +endef + +define Build/Prepare + /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 + $(Build/Patch) +endef + +EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ + +define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install -g $(PKG_BUILD_DIR) +endef + +define Package/node-cylon/install + mkdir -p $(1)/usr/lib/node/cylon + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/ +endef + +define Package/node-cylon-i2c/install + mkdir -p $(1)/usr/lib/node/cylon-i2c + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/ +endef + +define Package/node-cylon-gpio/install + mkdir -p $(1)/usr/lib/node/cylon-gpio + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/ +endef + +define Package/node-cylon-firmata/install + mkdir -p $(1)/usr/lib/node/cylon-firmata + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/{index.js,lib,LICENSE,package.json,README.md,RELEASES.md,spec} $(1)/usr/lib/node/cylon-firmata/ +endef + +$(eval $(call BuildPackage,node-cylon)) +$(eval $(call BuildPackage,node-cylon-i2c)) +$(eval $(call BuildPackage,node-cylon-gpio)) +$(eval $(call BuildPackage,node-cylon-firmata)) + diff --git a/lang/node-cylon/patches/0001-serialport.patch b/lang/node-cylon/patches/0001-serialport.patch new file mode 100644 index 0000000..08d579c --- /dev/null +++ b/lang/node-cylon/patches/0001-serialport.patch @@ -0,0 +1,12 @@ +Index: node-cylon-0.22.0/package.json +=================================================================== +--- node-cylon-0.22.0.orig/package.json 2015-10-20 20:32:48.000000000 +0200 ++++ node-cylon-0.22.0/package.json 2015-10-21 10:42:20.616109122 +0200 +@@ -38,7 +38,6 @@ + }, + + "dependencies": { +- "firmata": ">= 0.3.2", + "cylon": "1.1.0", + "cylon-gpio": "0.26.0", + "cylon-i2c": "0.22.0" diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile new file mode 100644 index 0000000..b8a5b7a --- /dev/null +++ b/lang/node-hid/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=hid +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.5.1 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=35d830b7810c87d32484d0a346621568c4849441 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=Custom +PKG_LICENSE_FILES:= + +include $(INCLUDE_DIR)/package.mk + +define Package/node-hid + DEPENDS:=+node + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + DEPENDS:=+libusb-1.0 +hidapi +libstdcpp + TITLE:=Node.js package to access HID devices + URL:=https://github.com/node-hid/node-hid +endef + +define Package/node-hid/description + Node.js package to access HID devices +endef + +CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) + +EXTRA_CFLAGS+=-I$(STAGING_DIR)/usr/include/libusb-1.0 + +define Build/Compile + git init $(PKG_BUILD_DIR) + $(MAKE_VARS) \ + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR) +endef + +define Package/node-hid/install + mkdir -p $(1)/usr/lib/node/node-hid/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ +endef + +$(eval $(call BuildPackage,node-hid)) + diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile new file mode 100644 index 0000000..3109404 --- /dev/null +++ b/lang/node-serialport/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2014 Arduino LLC +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=serialport +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=3.0.0 +PKG_RELEASE:=3 + +PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +PKG_MD5SUM:=ea20a17746dd64e72d5f6f2019d9e28d + +PKG_BUILD_DEPENDS:=node/host +PKG_NODE_VERSION:=4.4.5 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:=Custom +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/node-serialport + DEPENDS:=+node + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + TITLE:=Node.js package to access serial ports for reading and writing + URL:=https://www.npmjs.org/package/serialport +endef + +define Package/node-serialport/description + Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them! +endef + +define Build/Prepare + /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 + $(Build/Patch) +endef + +CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) + +EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ + +define Build/Compile + $(MAKE_FLAGS) \ + npm_config_arch=$(CONFIG_ARCH) \ + npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ + npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ + PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR) +endef + +define Package/node-serialport/install + mkdir -p $(1)/usr/lib/node/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ +endef + +$(eval $(call BuildPackage,node-serialport)) + diff --git a/lang/node/Makefile b/lang/node/Makefile new file mode 100644 index 0000000..6cb1e20 --- /dev/null +++ b/lang/node/Makefile @@ -0,0 +1,94 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=node +PKG_VERSION:=v4.4.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=node-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} +PKG_MD5SUM:=376140907bbe362f36065a30af04f020 + +HOST_BUILD_DEPENDS:=python/host +PKG_BUILD_DEPENDS:=python/host +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 + +HOST_BUILD_PARALLEL:=1 +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=John Crispin +PKG_LICENSE:= + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/node + SECTION:=lang + CATEGORY:=Languages + SUBMENU:=Node.js + TITLE:=Node.js is a platform built on Chrome's JavaScript runtime + URL:=http://nodejs.org/ + DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +zlib +endef + +define Package/node/description + Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses + an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' + package ecosystem, npm, is the largest ecosystem of open source libraries in the world. +endef + +CPU:=$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))) + +MAKE_VARS += \ + DESTCPU=$(CPU) + +CONFIGURE_ARGS= \ + --dest-cpu=$(CPU) \ + --dest-os=linux \ + --without-snapshot \ + --shared-zlib \ + --shared-openssl \ + --prefix=/usr + +ifneq ($(findstring arm,$(ARCH)),) +CONFIGURE_ARGS+= \ + $(if $(CONFIG_SOFT_FLOAT),--with-arm-float-abi=soft,--with-arm-float-abi=hard) +endif + +ifneq ($(findstring mips,$(ARCH)),) +CONFIGURE_ARGS+= \ + $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft,--with-mips-float-abi=hard) +endif + +HOST_CONFIGURE_VARS:= + +HOST_CONFIGURE_ARGS:= \ + --dest-os=linux \ + --without-snapshot \ + --prefix=$(HOST_BUILD_PREFIX) + +HOST_CONFIGURE_CMD:=python ./configure + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ +endef + +define Package/node/install + mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules} + $(CP) $(PKG_INSTALL_DIR)/usr/bin/{node,npm} $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/ +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,node)) diff --git a/lang/node/patches/001-hardfloat.patch b/lang/node/patches/001-hardfloat.patch new file mode 100644 index 0000000..1bb2493 --- /dev/null +++ b/lang/node/patches/001-hardfloat.patch @@ -0,0 +1,12 @@ +diff --git a/deps/v8/src/base/cpu.cc b/deps/v8/src/base/cpu.cc +index 4f58720..1f3071e 100644 +--- a/deps/v8/src/base/cpu.cc ++++ b/deps/v8/src/base/cpu.cc +@@ -143,6 +143,7 @@ int __detect_fp64_mode(void) { + ".set push\n\t" + ".set noreorder\n\t" + ".set oddspreg\n\t" ++ ".set hardfloat\n\t" + "lui $t0, 0x3FF0\n\t" + "ldc1 $f0, %0\n\t" + "mtc1 $t0, $f1\n\t" diff --git a/lang/node/patches/002-addr_info.patch b/lang/node/patches/002-addr_info.patch new file mode 100644 index 0000000..0aa02da --- /dev/null +++ b/lang/node/patches/002-addr_info.patch @@ -0,0 +1,10 @@ +--- a/deps/uv/src/unix/getaddrinfo.c ++++ b/deps/uv/src/unix/getaddrinfo.c +@@ -99,6 +99,7 @@ static void uv__getaddrinfo_work(struct + int err; + + req = container_of(w, uv_getaddrinfo_t, work_req); ++ req->hints->ai_flags &= ~AI_V4MAPPED; + err = getaddrinfo(req->hostname, req->service, req->hints, &req->addrinfo); + req->retcode = uv__getaddrinfo_translate_error(err); + } diff --git a/lang/node/patches/003-path.patch b/lang/node/patches/003-path.patch new file mode 100644 index 0000000..01a71c6 --- /dev/null +++ b/lang/node/patches/003-path.patch @@ -0,0 +1,12 @@ +--- a/lib/module.js ++++ b/lib/module.js +@@ -453,7 +453,8 @@ Module._initPaths = function() { + homeDir = process.env.HOME; + } + +- var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')]; ++ var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node'), ++ path.resolve(process.execPath, '..', '..', 'lib', 'node_modules')]; + + if (homeDir) { + paths.unshift(path.resolve(homeDir, '.node_libraries')); diff --git a/lang/openpyxl/Makefile b/lang/openpyxl/Makefile new file mode 100644 index 0000000..6656d56 --- /dev/null +++ b/lang/openpyxl/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=openpyxl +PKG_VERSION:=2.4.0 +PKG_RELEASE:=1 +PKG_LICENSE:=MIT + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://pypi.python.org/packages/7e/75/9bb309f80e4f75d139ecc55e9edf65c5844336b5a84966a609267255f961/ +PKG_MD5SUM:=e3376d1fce0681fd0b4047ab89218af4 +PKG_BUILD_DEPENDS:=python python-setuptools + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/openpyxl + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + MAINTAINER:=Gergely Kiss + TITLE:=A Python library to read/write Excel 2010 xlsx/xlsm files + URL:=https://openpyxl.readthedocs.org/ + DEPENDS:=+python +django +endef + +define Package/openpyxl/description + A Python library to read/write Excel 2010 xlsx/xlsm files +endef + +define Build/Compile + $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +endef + +define Package/openpyxl/install + $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) + $(CP) \ + $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ + $(1)$(PYTHON_PKG_DIR) +endef + +$(eval $(call BuildPackage,openpyxl)) diff --git a/lang/perl-cgi/Makefile b/lang/perl-cgi/Makefile new file mode 100644 index 0000000..afecaa0 --- /dev/null +++ b/lang/perl-cgi/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-cgi +PKG_VERSION:=4.28 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEEJO +PKG_SOURCE:=CGI-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=28efb391377f6e98c19c23292d5fcc8c + +PKG_LICENSE:=GPL Artistic-2.0 +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/CGI-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-cgi + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Handle Common Gateway Interface requests and responses + URL:=http://search.cpan.org/dist/CGI/ + DEPENDS:=perl +perl-html-parser +perlbase-base +perlbase-config +perlbase-encode +perlbase-essential +perlbase-file +perlbase-if +perlbase-utf8 +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-cgi/install + $(call perlmod/Install,$(1),CGI CGI.pm auto/CGI) +endef + + +$(eval $(call BuildPackage,perl-cgi)) diff --git a/lang/perl-compress-bzip2/Makefile b/lang/perl-compress-bzip2/Makefile new file mode 100644 index 0000000..2876646 --- /dev/null +++ b/lang/perl-compress-bzip2/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014, 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-compress-bzip2 +PKG_VERSION:=2.24 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/R/RU/RURBAN/ +PKG_SOURCE:=Compress-Bzip2-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=d5ef04d1e51fe45743b3044abad967d2 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Compress-Bzip2-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-compress-bzip2 + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl interface to bzip2 compression library + URL:=http://search.cpan.org/dist/Compress-Bzip2/ + DEPENDS:=perl +libbz2 +perlbase-autoloader +perlbase-config +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-getopt +perlbase-test +perlbase-xsloader +endef + +define Build/Configure + $(call perlmod/Configure,,BUILD_BZLIB=0) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-compress-bzip2/install + $(call perlmod/Install,$(1),Compress auto/Compress) +endef + + +$(eval $(call BuildPackage,perl-compress-bzip2)) diff --git a/lang/perl-dbi/Makefile b/lang/perl-dbi/Makefile new file mode 100644 index 0000000..3c594d1 --- /dev/null +++ b/lang/perl-dbi/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2014, 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-dbi +PKG_VERSION:=1.634 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/T/TI/TIMB/ +PKG_SOURCE:=DBI-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4ad15a9c2cc9b68e3fe1f5cadf9cdb30 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/DBI-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/DBI-$(PKG_VERSION) + +HOST_BUILD_DEPENDS:=perl/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-dbi + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Database independent interface for Perl + URL:=http://search.cpan.org/dist/DBI/ + DEPENDS:=perl +perlbase-base +perlbase-config +perlbase-cwd +perlbase-data +perlbase-dynaloader +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-io +perlbase-ipc +perlbase-scalar +perlbase-storable +perlbase-symbol +perlbase-tie +perlbase-universal +perlbase-utf8 +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Host/Configure + $(call perlmod/host/Configure,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Package/perl-dbi/install + $(call perlmod/Install,$(1),DB* auto/DBI,DBI/W32ODBC.pm auto/DBI/*.h) +endef + + +$(eval $(call BuildPackage,perl-dbi)) +$(eval $(call HostBuild)) diff --git a/lang/perl-device-serialport/Makefile b/lang/perl-device-serialport/Makefile new file mode 100644 index 0000000..2069bed --- /dev/null +++ b/lang/perl-device-serialport/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2014, 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-device-serialport +PKG_VERSION:=1.04 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CO/COOK/ +PKG_SOURCE:=Device-SerialPort-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=82c698151f934eb28c65d1838cee7d9e + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Paul Oranje + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Device-SerialPort-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-device-serialport + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=A POSIX-based version of the Win32::SerialPort module + URL:=http://search.cpan.org/dist/Device-SerialPort/ + DEPENDS:=perl +perlbase-essential +perlbase-io +perlbase-posix +perlbase-test +perlbase-xsloader +endef + +define Package/perl-device-serialport/description + A POSIX-based version of the Win32::SerialPort module + that provides modem support to Perl applications +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-device-serialport/install + $(call perlmod/Install,$(1),Device auto/Device) +endef + + +$(eval $(call BuildPackage,perl-device-serialport)) diff --git a/lang/perl-device-usb/Makefile b/lang/perl-device-usb/Makefile new file mode 100644 index 0000000..0a2c737 --- /dev/null +++ b/lang/perl-device-usb/Makefile @@ -0,0 +1,73 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-device-usb +PKG_VERSION:=0.36 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GW/GWADEJ/ +PKG_SOURCE:=Device-USB-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=aa91bee777f7ed7a18225a84f8795344 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Device-USB-$(PKG_VERSION) +PKG_BUILD_DEPENDS:=perl-inline-c/host + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-device-usb + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=libusb library wrapper + URL:=http://search.cpan.org/dist/Device-USB/ + DEPENDS:=perl +libusb-compat +perl-inline +perl-inline-c +perlbase-essential +perlbase-test +endef + +# Device::USB will generate a second Makefile.PL to build it's native code +# using Inline::C under _Inline/. The goal here is to prevent Inline::C from +# running that one automatically, as we need to supply a bunch of overrides via +# perlmod/Configure. +# _INLINE_C_NO_COMPILE_ is an OpenWRT-specific environment variable to Inline::C +# that does just that. +define Build/Configure + $(call perlmod/Configure,,) + + # Prepare a library directory where we can link againt lusb-0.1(as + # opposed to -lusb) to avoid confusion at runtime + mkdir $(PKG_BUILD_DIR)/syslib + $(LN) $(STAGING_DIR)/usr/lib/libusb.so $(PKG_BUILD_DIR)/syslib/libusb-0.1.so + + # Generate _Inline + $(call perlmod/Compile,config,LIBUSB_LIBDIR=$(PKG_BUILD_DIR)/syslib \ + _INLINE_C_NO_COMPILE_=1 \ + _INLINE_C_SYSTEM_TYPEMAP_=$(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/ExtUtils/typemap) + $(call perlmod/Compile,dynamic,_INLINE_C_NO_COMPILE_=1) + + # Configure _Inline + $(call perlmod/Configure,,,$(PKG_BUILD_DIR)/_Inline/build/Device/USB) + + # Prevent re-configuring Inline code + sed 's/^dynamic :: D.*$$$$//' -i $(PKG_BUILD_DIR)/Makefile +endef + +define Build/Compile + $(call perlmod/Compile,,,$(PKG_BUILD_DIR)/_Inline/build/Device/USB) + $(call perlmod/Compile,,) +endef + +define Package/perl-device-usb/install + $(call perlmod/Install,$(1),Device auto/Device) +endef + + +$(eval $(call BuildPackage,perl-device-usb)) diff --git a/lang/perl-device-usb/README.patches b/lang/perl-device-usb/README.patches new file mode 100644 index 0000000..66ece00 --- /dev/null +++ b/lang/perl-device-usb/README.patches @@ -0,0 +1,8 @@ +This package contains some patches taken directly from Debian Jessie(stable at +the time of writing). +Namely, these are: +- 100-fix_buildsystem.patch +- 110-just_assume_libusb_is_there.diff + +The other patches are specific to OpenWRT, fixing bugs and resolving conflicts +where necessary. \ No newline at end of file diff --git a/lang/perl-device-usb/patches/100-fix_buildsystem.patch b/lang/perl-device-usb/patches/100-fix_buildsystem.patch new file mode 100644 index 0000000..5201894 --- /dev/null +++ b/lang/perl-device-usb/patches/100-fix_buildsystem.patch @@ -0,0 +1,20 @@ +Description: Ignore files we do not want installed. +Forwarded: not-needed +Author: Tim Retout +Reviewed-by: gregor herrmann +Last-Update: 2013-10-28 + +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -2,6 +2,11 @@ + use warnings; + use Inline::MakeMaker; + ++sub MY::libscan { ++ return if ($_[1] eq 'USB.pm' or $_[1] eq 'dump_usb.pl'); ++ return $_[1]; ++} ++ + if($^O eq 'MSWin32') + { + if(!$ENV{LIBUSB_LIBDIR} or !$ENV{LIBUSB_INCDIR}) diff --git a/lang/perl-device-usb/patches/110-just_assume_libusb_is_there.diff b/lang/perl-device-usb/patches/110-just_assume_libusb_is_there.diff new file mode 100644 index 0000000..9365eb4 --- /dev/null +++ b/lang/perl-device-usb/patches/110-just_assume_libusb_is_there.diff @@ -0,0 +1,30 @@ +Subject: Just assume libusb is out there + Makefile.PL should not try to check for libusb in a given list of directories + as the compiler might look in other places as well. +Origin: vendor +Bug-Debian: http://bugs.debian.org/639677 +Forwarded: not-needed +From: Ansgar Burchardt +Reviewed-by: gregor herrmann +Last-Update: 2013-10-28 + +--- libdevice-usb-perl.orig/Makefile.PL ++++ libdevice-usb-perl/Makefile.PL +@@ -21,7 +21,7 @@ + } + } + +-unless(header_found()) ++unless(1 || header_found()) + { + die <<"END"; + ERROR: Can't find usb.h header. +@@ -36,7 +36,7 @@ + END + } + +-unless(lib_found()) ++unless(1 || lib_found()) + { + die <<"END"; + ERROR: Can't find libusb library. diff --git a/lang/perl-device-usb/patches/120-use_libusb_0_1.patch b/lang/perl-device-usb/patches/120-use_libusb_0_1.patch new file mode 100644 index 0000000..7d43e73 --- /dev/null +++ b/lang/perl-device-usb/patches/120-use_libusb_0_1.patch @@ -0,0 +1,13 @@ +--- a/lib/Device/USB.pm ++++ b/lib/Device/USB.pm +@@ -9,8 +9,8 @@ use Inline ( + C => "DATA", + ($ENV{LIBUSB_LIBDIR} + ? ( LIBS => "-L\"$ENV{LIBUSB_LIBDIR}\" " . +- ($^O eq 'MSWin32' ? ' -llibusb -L\"$ENV{WINDDK}\\lib\\crt\\i386\" -lmsvcrt ' : '-lusb') ) +- : ( LIBS => '-lusb', ) ++ ($^O eq 'MSWin32' ? ' -llibusb -L\"$ENV{WINDDK}\\lib\\crt\\i386\" -lmsvcrt ' : '-lusb-0.1') ) ++ : ( LIBS => '-lusb-0.1', ) + ), + ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\"" ) : () ), + NAME => 'Device::USB', diff --git a/lang/perl-device-usb/patches/130-provide-proper-library-paths.patch b/lang/perl-device-usb/patches/130-provide-proper-library-paths.patch new file mode 100644 index 0000000..3fce75a --- /dev/null +++ b/lang/perl-device-usb/patches/130-provide-proper-library-paths.patch @@ -0,0 +1,13 @@ +--- a/lib/Device/USB.pm ++++ b/lib/Device/USB.pm +@@ -8,8 +8,8 @@ use Carp; + use Inline ( + C => "DATA", + ($ENV{LIBUSB_LIBDIR} +- ? ( LIBS => "-L\"$ENV{LIBUSB_LIBDIR}\" " . +- ($^O eq 'MSWin32' ? ' -llibusb -L\"$ENV{WINDDK}\\lib\\crt\\i386\" -lmsvcrt ' : '-lusb-0.1') ) ++ ? ( LIBS => "-L$ENV{LIBUSB_LIBDIR} " . ++ ($^O eq 'MSWin32' ? ' -llibusb -L$ENV{WINDDK}\\lib\\crt\\i386 -lmsvcrt ' : '-lusb-0.1') ) + : ( LIBS => '-lusb-0.1', ) + ), + ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\"" ) : () ), diff --git a/lang/perl-device-usb/patches/140-avoid-libusb-name-conflicts.patch b/lang/perl-device-usb/patches/140-avoid-libusb-name-conflicts.patch new file mode 100644 index 0000000..55e5cc3 --- /dev/null +++ b/lang/perl-device-usb/patches/140-avoid-libusb-name-conflicts.patch @@ -0,0 +1,219 @@ +--- a/lib/Device/USB.pm ++++ b/lib/Device/USB.pm +@@ -15,6 +15,7 @@ use Inline ( + ($ENV{LIBUSB_INCDIR} ? ( INC => "-I\"$ENV{LIBUSB_INCDIR}\"" ) : () ), + NAME => 'Device::USB', + VERSION => '0.36', ++ PREFIX => 'deviceusb_', + ); + + Inline->init(); +@@ -540,74 +541,74 @@ unsigned DeviceUSBDebugLevel() + return debugLevel; + } + +-void libusb_init() ++void deviceusb_libusb_init() + { + usb_init(); + } + +-int libusb_find_busses() ++int deviceusb_libusb_find_busses() + { + return usb_find_busses(); + } + +-int libusb_find_devices() ++int deviceusb_libusb_find_devices() + { + return usb_find_devices(); + } + +-void *libusb_get_busses() ++void *deviceusb_libusb_get_busses() + { + return usb_get_busses(); + } + +-void *libusb_open(void *dev) ++void *deviceusb_libusb_open(void *dev) + { + return usb_open( (struct usb_device*)dev ); + } + +-int libusb_close(void *dev) ++int deviceusb_libusb_close(void *dev) + { + return usb_close((usb_dev_handle *)dev); + } + +-int libusb_set_configuration(void *dev, int configuration) ++int deviceusb_libusb_set_configuration(void *dev, int configuration) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_set_configuration( %d )\n", configuration ); ++ printf( "deviceusb_libusb_set_configuration( %d )\n", configuration ); + } + return usb_set_configuration((usb_dev_handle *)dev, configuration); + } + +-int libusb_set_altinterface(void *dev, int alternate) ++int deviceusb_libusb_set_altinterface(void *dev, int alternate) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_set_altinterface( %d )\n", alternate ); ++ printf( "deviceusb_libusb_set_altinterface( %d )\n", alternate ); + } + return usb_set_altinterface((usb_dev_handle *)dev, alternate); + } + +-int libusb_clear_halt(void *dev, unsigned int ep) ++int deviceusb_libusb_clear_halt(void *dev, unsigned int ep) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_clear_halt( %d )\n", ep ); ++ printf( "deviceusb_libusb_clear_halt( %d )\n", ep ); + } + return usb_clear_halt((usb_dev_handle *)dev, ep); + } + +-int libusb_reset(void *dev) ++int deviceusb_libusb_reset(void *dev) + { + return usb_reset((usb_dev_handle *)dev); + } + +-int libusb_get_driver_np(void *dev, int interface, char *name, unsigned int namelen) ++int deviceusb_libusb_get_driver_np(void *dev, int interface, char *name, unsigned int namelen) + { + int ret = 0; + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_get_driver_np( %d )\n", interface ); ++ printf( "deviceusb_libusb_get_driver_np( %d )\n", interface ); + } + #if LIBUSB_HAS_GET_DRIVER_NP + ret = usb_get_driver_np((usb_dev_handle *)dev, interface, name, namelen); +@@ -618,11 +619,11 @@ int libusb_get_driver_np(void *dev, int + #endif + } + +-int libusb_detach_kernel_driver_np(void *dev, int interface) ++int deviceusb_libusb_detach_kernel_driver_np(void *dev, int interface) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_detach_kernel_driver_np( %d )\n", interface ); ++ printf( "deviceusb_libusb_detach_kernel_driver_np( %d )\n", interface ); + } + #if LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP + return usb_detach_kernel_driver_np((usb_dev_handle *)dev, interface); +@@ -631,25 +632,25 @@ int libusb_detach_kernel_driver_np(void + #endif + } + +-int libusb_claim_interface(void *dev, int interface) ++int deviceusb_libusb_claim_interface(void *dev, int interface) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_claim_interface( %d )\n", interface ); ++ printf( "deviceusb_libusb_claim_interface( %d )\n", interface ); + } + return usb_claim_interface((usb_dev_handle *)dev, interface); + } + +-int libusb_release_interface(void *dev, int interface) ++int deviceusb_libusb_release_interface(void *dev, int interface) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_release_interface( %d )\n", interface ); ++ printf( "deviceusb_libusb_release_interface( %d )\n", interface ); + } + return usb_release_interface((usb_dev_handle *)dev, interface); + } + +-void libusb_control_msg(void *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout) ++void deviceusb_libusb_control_msg(void *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout) + { + int i = 0; + int retval = 0; +@@ -658,7 +659,7 @@ void libusb_control_msg(void *dev, int r + + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_control_msg( %#04x, %#04x, %#04x, %#04x, %p, %d, %d )\n", ++ printf( "deviceusb_libusb_control_msg( %#04x, %#04x, %#04x, %#04x, %p, %d, %d )\n", + requesttype, request, value, index, bytes, size, timeout + ); + /* maybe need to add support for printing the bytes string. */ +@@ -691,54 +692,54 @@ void libusb_control_msg(void *dev, int r + Inline_Stack_Done; + } + +-int libusb_get_string(void *dev, int index, int langid, char *buf, size_t buflen) ++int deviceusb_libusb_get_string(void *dev, int index, int langid, char *buf, size_t buflen) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_get_string( %d, %d, %p, %lu )\n", ++ printf( "deviceusb_libusb_get_string( %d, %d, %p, %lu )\n", + index, langid, buf, (unsigned long)buflen + ); + } + return usb_get_string((usb_dev_handle *)dev, index, langid, buf, buflen); + } + +-int libusb_get_string_simple(void *dev, int index, char *buf, size_t buflen) ++int deviceusb_libusb_get_string_simple(void *dev, int index, char *buf, size_t buflen) + { + if(DeviceUSBDebugLevel()) + { +- printf( "libusb_get_string_simple( %d, %p, %lu )\n", ++ printf( "deviceusb_libusb_get_string_simple( %d, %p, %lu )\n", + index, buf, (unsigned long)buflen + ); + } + return usb_get_string_simple((usb_dev_handle *)dev, index, buf, buflen); + } + +-int libusb_get_descriptor(void *dev, unsigned char type, unsigned char index, char *buf, int size) ++int deviceusb_libusb_get_descriptor(void *dev, unsigned char type, unsigned char index, char *buf, int size) + { + return usb_get_descriptor((usb_dev_handle *)dev, type, index, buf, size); + } + +-int libusb_get_descriptor_by_endpoint(void *dev, int ep, unsigned char type, unsigned char index, char *buf, int size) ++int deviceusb_libusb_get_descriptor_by_endpoint(void *dev, int ep, unsigned char type, unsigned char index, char *buf, int size) + { + return usb_get_descriptor_by_endpoint((usb_dev_handle *)dev, ep, type, index, buf, size); + } + +-int libusb_bulk_write(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_bulk_write(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_bulk_write((usb_dev_handle *)dev, ep, bytes, size, timeout); + } + +-int libusb_bulk_read(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_bulk_read(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_bulk_read((usb_dev_handle *)dev, ep, bytes, size, timeout); + } + +-int libusb_interrupt_write(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_interrupt_write(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_interrupt_write((usb_dev_handle *)dev, ep, bytes, size, timeout); + } + +-int libusb_interrupt_read(void *dev, int ep, char *bytes, int size, int timeout) ++int deviceusb_libusb_interrupt_read(void *dev, int ep, char *bytes, int size, int timeout) + { + return usb_interrupt_read((usb_dev_handle *)dev, ep, bytes, size, timeout); + } diff --git a/lang/perl-encode-locale/Makefile b/lang/perl-encode-locale/Makefile new file mode 100644 index 0000000..54071dc --- /dev/null +++ b/lang/perl-encode-locale/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-encode-locale +PKG_VERSION:=1.05 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=Encode-Locale-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=fcfdb8e4ee34bcf62aed429b4a23db27 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Encode-Locale-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-encode-locale + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Determine the locale encoding + URL:=http://search.cpan.org/dist/Encode-Locale/ + DEPENDS:=perl +perlbase-base +perlbase-encode +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-encode-locale/install + $(call perlmod/Install,$(1),Encode auto/Encode) +endef + + +$(eval $(call BuildPackage,perl-encode-locale)) diff --git a/lang/perl-file-listing/Makefile b/lang/perl-file-listing/Makefile new file mode 100644 index 0000000..19a6938 --- /dev/null +++ b/lang/perl-file-listing/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-file-listing +PKG_VERSION:=6.04 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=File-Listing-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=83f636b477741f3a014585bb9cc079a6 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/File-Listing-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-file-listing + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Parse directory listing + URL:=http://search.cpan.org/dist/File-Listing/ + DEPENDS:=perl +perl-http-date +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-file-listing/install + $(call perlmod/Install,$(1),File auto/File) +endef + + +$(eval $(call BuildPackage,perl-file-listing)) diff --git a/lang/perl-file-sharedir-install/Makefile b/lang/perl-file-sharedir-install/Makefile new file mode 100644 index 0000000..d107d70 --- /dev/null +++ b/lang/perl-file-sharedir-install/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-file-sharedir-install +PKG_VERSION:=0.10 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GW/GWYN +PKG_SOURCE:=File-ShareDir-Install-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=37fb7fa72ce7184516dd022aba62f524 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/File-ShareDir-Install-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=perl/host +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/File-ShareDir-Install-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-file-sharedir-install + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Install read-only data files + URL:=http://search.cpan.org/dist/File-ShareDir-Install/ + DEPENDS:=perl +perlbase-essential +perlbase-extutils +perlbase-file +perlbase-io +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-file-sharedir-install/install + $(call perlmod/Install,$(1),File auto/File) +endef + + +$(eval $(call BuildPackage,perl-file-sharedir-install)) +$(eval $(call HostBuild)) diff --git a/lang/perl-html-form/Makefile b/lang/perl-html-form/Makefile new file mode 100644 index 0000000..d412a1f --- /dev/null +++ b/lang/perl-html-form/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-html-form +PKG_VERSION:=6.03 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTML-Form-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=fa6c2680207ed4fef5ea2ef09c210614 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Form-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-form + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Class that represents an HTML form element + URL:=http://search.cpan.org/dist/HTML-Form/ + DEPENDS:=perl +perl-html-parser +perl-http-message +perl-uri +perlbase-encode +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-form/install + $(call perlmod/Install,$(1),HTML auto/HTML) +endef + + +$(eval $(call BuildPackage,perl-html-form)) diff --git a/lang/perl-html-parser/Makefile b/lang/perl-html-parser/Makefile new file mode 100644 index 0000000..e977217 --- /dev/null +++ b/lang/perl-html-parser/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014 - 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-html-parser +PKG_VERSION:=3.72 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS/ +PKG_SOURCE:=HTML-Parser-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=eb7505e5f626913350df9dd4a03d54a8 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Parser-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-parser + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=A collection of modules that parse HTML text documents + URL:=http://search.cpan.org/dist/HTML-Parser/ + DEPENDS:=perl +perl-html-tagset +perlbase-essential +perlbase-xsloader +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-parser/install + $(call perlmod/Install,$(1),HTML auto/HTML) +endef + + +$(eval $(call BuildPackage,perl-html-parser)) diff --git a/lang/perl-html-tagset/Makefile b/lang/perl-html-tagset/Makefile new file mode 100644 index 0000000..4bcd10c --- /dev/null +++ b/lang/perl-html-tagset/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-html-tagset +PKG_VERSION:=3.20 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/P/PE/PETDANCE/ +PKG_SOURCE:=HTML-Tagset-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=d2bfa18fe1904df7f683e96611e87437 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Tagset-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-tagset + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Data tables pertaining to HTML + URL:=http://search.cpan.org/dist/HTML-Tagset/ + DEPENDS:=perl +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-tagset/install + $(call perlmod/Install,$(1),HTML) +endef + + +$(eval $(call BuildPackage,perl-html-tagset)) diff --git a/lang/perl-html-tree/Makefile b/lang/perl-html-tree/Makefile new file mode 100644 index 0000000..d1b4ac9 --- /dev/null +++ b/lang/perl-html-tree/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-html-tree +PKG_VERSION:=3.23 +PKG_RELEASE:=4 +PKG_MD5SUM:=6352f50be402301f79b580dd235d7762 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/P/PE/PETEK/ +PKG_SOURCE:=HTML-Tree-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=6352f50be402301f79b580dd235d7762 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTML-Tree-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-html-tree + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Represent and create HTML syntax trees + URL:=http://search.cpan.org/dist/HTML-Tree/ + DEPENDS:=perl +perl-html-parser +perl-html-tagset +perlbase-essential +perlbase-integer +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-html-tree/install + $(call perlmod/Install,$(1),HTML) +endef + + +$(eval $(call BuildPackage,perl-html-tree)) diff --git a/lang/perl-http-cookies/Makefile b/lang/perl-http-cookies/Makefile new file mode 100644 index 0000000..329767a --- /dev/null +++ b/lang/perl-http-cookies/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-http-cookies +PKG_VERSION:=6.01 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Cookies-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=ecfd0eeb88512033352c2f13c9580f03 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Cookies-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-cookies + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=HTTP cookie jars + URL:=http://search.cpan.org/dist/HTTP-Cookies/ + DEPENDS:=perl +perl-http-date +perl-http-message +perlbase-essential +perlbase-time +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-cookies/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-cookies)) diff --git a/lang/perl-http-daemon/Makefile b/lang/perl-http-daemon/Makefile new file mode 100644 index 0000000..178573d --- /dev/null +++ b/lang/perl-http-daemon/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-http-daemon +PKG_VERSION:=6.01 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Daemon-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=ed0ae02d25d7f1e89456d4d69732adc2 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Daemon-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-daemon + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=A simple http server class + URL:=http://search.cpan.org/dist/HTTP-Daemon/ + DEPENDS:=perl +perl-http-date +perl-http-message +perl-lwp-mediatypes +perlbase-essential +perlbase-io +perlbase-sys +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-daemon/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-daemon)) diff --git a/lang/perl-http-date/Makefile b/lang/perl-http-date/Makefile new file mode 100644 index 0000000..bf0bd40 --- /dev/null +++ b/lang/perl-http-date/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-http-date +PKG_VERSION:=6.02 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Date-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=52b7a0d5982d61be1edb217751d7daba + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Date-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-date + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Date conversion routines + URL:=http://search.cpan.org/dist/HTTP-Date/ + DEPENDS:=perl +perlbase-essential +perlbase-time +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-date/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-date)) diff --git a/lang/perl-http-message/Makefile b/lang/perl-http-message/Makefile new file mode 100644 index 0000000..2b90e2a --- /dev/null +++ b/lang/perl-http-message/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-http-message +PKG_VERSION:=6.11 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER +PKG_SOURCE:=HTTP-Message-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4ed7add10daea3ab30abfeab6d03872f + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Message-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-message + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=HTTP style messages + URL:=http://search.cpan.org/dist/HTTP-Message/ + DEPENDS:=perl +perl-encode-locale +perl-http-date +perl-io-html +perl-lwp-mediatypes +perl-uri +perlbase-base +perlbase-compress +perlbase-encode +perlbase-essential +perlbase-io +perlbase-mime +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-message/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-message)) diff --git a/lang/perl-http-negotiate/Makefile b/lang/perl-http-negotiate/Makefile new file mode 100644 index 0000000..a72893a --- /dev/null +++ b/lang/perl-http-negotiate/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-http-negotiate +PKG_VERSION:=6.01 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=HTTP-Negotiate-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=1236195250e264d7436e7bb02031671b + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Negotiate-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-negotiate + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Choose a variant to serve + URL:=http://search.cpan.org/dist/HTTP-Negotiate/ + DEPENDS:=perl +perl-http-message +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-negotiate/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-negotiate)) diff --git a/lang/perl-http-server-simple/Makefile b/lang/perl-http-server-simple/Makefile new file mode 100644 index 0000000..9a41da6 --- /dev/null +++ b/lang/perl-http-server-simple/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-http-server-simple +PKG_VERSION:=0.51 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/B/BP/BPS +PKG_SOURCE:=HTTP-Server-Simple-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=ef736daddc7a32a29207fa4ed5f5d62e + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/HTTP-Server-Simple-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-http-server-simple + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Lightweight HTTP server + URL:=http://search.cpan.org/dist/HTTP-Server-Simple/ + DEPENDS:=perl +perl-cgi +perlbase-base +perlbase-essential +perlbase-filehandle +perlbase-socket +perlbase-test +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-http-server-simple/install + $(call perlmod/Install,$(1),HTTP auto/HTTP) +endef + + +$(eval $(call BuildPackage,perl-http-server-simple)) diff --git a/lang/perl-inline-c/Makefile b/lang/perl-inline-c/Makefile new file mode 100644 index 0000000..52826d2 --- /dev/null +++ b/lang/perl-inline-c/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-inline-c +PKG_VERSION:=0.76 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/I/IN/INGY +PKG_SOURCE:=Inline-C-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=c0fbfdd058075c9271a1384c822c9a87 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/Inline-C-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=perl/host perl-inline/host perl-parse-recdescent/host perl-file-sharedir-install/host +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Inline-C-$(PKG_VERSION) +PKG_BUILD_DEPENDS:=perl-inline/host perl-parse-recdescent/host perl-file-sharedir-install/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-inline-c + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=C Language Support for Inline + URL:=http://search.cpan.org/dist/Inline-C/ + DEPENDS:=perl +perl-inline +perl-parse-recdescent +perlbase-config +perlbase-cwd +perlbase-data +perlbase-essential +perlbase-extutils +perlbase-file +perlbase-if +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-inline-c/install + $(call perlmod/Install,$(1),Inline auto/Inline) +endef + + +$(eval $(call BuildPackage,perl-inline-c)) +$(eval $(call HostBuild)) diff --git a/lang/perl-inline-c/patches/100-inline_c-no_compile_hack.patch b/lang/perl-inline-c/patches/100-inline_c-no_compile_hack.patch new file mode 100644 index 0000000..dcfe2bb --- /dev/null +++ b/lang/perl-inline-c/patches/100-inline_c-no_compile_hack.patch @@ -0,0 +1,11 @@ +--- a/lib/Inline/C.pm ++++ b/lib/Inline/C.pm +@@ -361,7 +361,7 @@ sub build { + $o->call('write_XS', 'Build Glue 1'); + $o->call('write_Inline_headers', 'Build Glue 2'); + $o->call('write_Makefile_PL', 'Build Glue 3'); +- $o->call('compile', 'Build Compile'); ++ $o->call('compile', 'Build Compile') unless $ENV{'_INLINE_C_NO_COMPILE_'}; + if (IS_WIN32) { + $lockfh->release or die "releasemutex $file: $^E"; + } diff --git a/lang/perl-inline-c/patches/110-inline_c-make_system_typemap_overridable.patch b/lang/perl-inline-c/patches/110-inline_c-make_system_typemap_overridable.patch new file mode 100644 index 0000000..b2ae09e --- /dev/null +++ b/lang/perl-inline-c/patches/110-inline_c-make_system_typemap_overridable.patch @@ -0,0 +1,46 @@ +--- a/lib/Inline/C.pm ++++ b/lib/Inline/C.pm +@@ -438,22 +438,28 @@ sub get_maps { + print STDERR "get_maps Stage\n" if $o->{CONFIG}{BUILD_NOISY}; + my $typemap = ''; + my $file; +- $file = File::Spec->catfile( +- $Config::Config{installprivlib}, +- "ExtUtils", +- "typemap", +- ); +- $typemap = $file if -f $file; +- $file = File::Spec->catfile( +- $Config::Config{privlibexp} +- ,"ExtUtils","typemap" +- ); +- $typemap = $file +- if (not $typemap and -f $file); +- warn "Can't find the default system typemap file" +- if (not $typemap and $^W); ++ ++ unless ($ENV{'_INLINE_C_SYSTEM_TYPEMAP_'}) { ++ $file = File::Spec->catfile( ++ $Config::Config{installprivlib}, ++ "ExtUtils", ++ "typemap", ++ ); ++ $typemap = $file if -f $file; ++ $file = File::Spec->catfile( ++ $Config::Config{privlibexp} ++ ,"ExtUtils","typemap" ++ ); ++ $typemap = $file ++ if (not $typemap and -f $file); ++ warn "Can't find the default system typemap file" ++ if (not $typemap and $^W); + +- unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $typemap) if $typemap; ++ unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $typemap) if $typemap; ++ } ++ else { ++ unshift(@{$o->{ILSM}{MAKEFILE}{TYPEMAPS}}, $ENV{'_INLINE_C_SYSTEM_TYPEMAP_'}); ++ } + + if (not $o->UNTAINT) { + require FindBin; diff --git a/lang/perl-inline/Makefile b/lang/perl-inline/Makefile new file mode 100644 index 0000000..a120705 --- /dev/null +++ b/lang/perl-inline/Makefile @@ -0,0 +1,65 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-inline +PKG_VERSION:=0.80 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/I/IN/INGY +PKG_SOURCE:=Inline-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=510bbac46e727bcaf240b7feac2646c9 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Inline-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/Inline-$(PKG_VERSION) + +HOST_BUILD_DEPENDS:=perl/host + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-inline + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Write subroutines in other languages + URL:=http://search.cpan.org/dist/Inline/ + DEPENDS:=perl +perlbase-base +perlbase-config +perlbase-cwd +perlbase-digest +perlbase-essential +perlbase-fcntl +perlbase-file +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-inline/install + $(call perlmod/Install,$(1),Inline.pm Inline auto/Inline) +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + + +$(eval $(call BuildPackage,perl-inline)) +$(eval $(call HostBuild)) diff --git a/lang/perl-io-html/Makefile b/lang/perl-io-html/Makefile new file mode 100644 index 0000000..9390c36 --- /dev/null +++ b/lang/perl-io-html/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-io-html +PKG_VERSION:=1.001 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CJ/CJM +PKG_SOURCE:=IO-HTML-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=3f8958718844dc96b9f6946f21d70d22 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/IO-HTML-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-io-html + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Open an HTML file with automatic charset detection + URL:=http://search.cpan.org/dist/IO-HTML/ + DEPENDS:=perl +perlbase-encode +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-io-html/install + $(call perlmod/Install,$(1),IO auto/IO) +endef + + +$(eval $(call BuildPackage,perl-io-html)) diff --git a/lang/perl-lockfile-simple/Makefile b/lang/perl-lockfile-simple/Makefile new file mode 100644 index 0000000..b81e678 --- /dev/null +++ b/lang/perl-lockfile-simple/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-lockfile-simple +PKG_VERSION:=0.208 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/S/SC/SCHWIGON/lockfile-simple/ +PKG_SOURCE:=LockFile-Simple-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4421283b4f32549e5299963734170044 + +PKG_LICENSE:=GPL-2.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/LockFile-Simple-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-lockfile-simple + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Simple advisory file locking + URL:=http://search.cpan.org/dist/LockFile-Simple/ + DEPENDS:=perl +perlbase-essential +perlbase-sys +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-lockfile-simple/install + $(call perlmod/Install,$(1),LockFile auto/LockFile) +endef + + +$(eval $(call BuildPackage,perl-lockfile-simple)) diff --git a/lang/perl-lwp-mediatypes/Makefile b/lang/perl-lwp-mediatypes/Makefile new file mode 100644 index 0000000..6985431 --- /dev/null +++ b/lang/perl-lwp-mediatypes/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-lwp-mediatypes +PKG_VERSION:=6.02 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=LWP-MediaTypes-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=8c5f25fb64b974d22aff424476ba13c9 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/LWP-MediaTypes-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-lwp-mediatypes + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Guess media type for a file or a URL + URL:=http://search.cpan.org/dist/LWP-MediaTypes/ + DEPENDS:=perl +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-lwp-mediatypes/install + $(call perlmod/Install,$(1),LWP auto/LWP) +endef + + +$(eval $(call BuildPackage,perl-lwp-mediatypes)) diff --git a/lang/perl-net-http/Makefile b/lang/perl-net-http/Makefile new file mode 100644 index 0000000..058ac16 --- /dev/null +++ b/lang/perl-net-http/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-net-http +PKG_VERSION:=6.09 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER +PKG_SOURCE:=Net-HTTP-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=3d84d17f64c7316d69e7eb7b4e292b9a + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Net-HTTP-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-net-http + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Low-level HTTP connection (client) + URL:=http://search.cpan.org/dist/Net-HTTP/ + DEPENDS:=perl +perl-uri +perlbase-compress +perlbase-essential +perlbase-io +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-net-http/install + $(call perlmod/Install,$(1),Net auto/Net) +endef + + +$(eval $(call BuildPackage,perl-net-http)) diff --git a/lang/perl-net-telnet/Makefile b/lang/perl-net-telnet/Makefile new file mode 100644 index 0000000..c915064 --- /dev/null +++ b/lang/perl-net-telnet/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2011-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-net-telnet +PKG_VERSION:=3.04 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/J/JR/JROGERS/ +PKG_SOURCE:=Net-Telnet-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=d2514080116c1b0fa5f96295c84538e3 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Net-Telnet-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-net-telnet + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Telnet client + URL:=http://search.cpan.org/dist/Net-Telnet/ + DEPENDS:=perl +perlbase-essential +perlbase-socket +perlbase-symbol +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-net-telnet/install + $(call perlmod/Install,$(1),Net auto/Net) +endef + + +$(eval $(call BuildPackage,perl-net-telnet)) diff --git a/lang/perl-parse-recdescent/Makefile b/lang/perl-parse-recdescent/Makefile new file mode 100644 index 0000000..bbeff7b --- /dev/null +++ b/lang/perl-parse-recdescent/Makefile @@ -0,0 +1,64 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-parse-recdescent +PKG_VERSION:=1.967013 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/J/JT/JTBRAUN +PKG_SOURCE:=Parse-RecDescent-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=98f582240556a4a92e5d57e480f9d39d + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/Parse-RecDescent-$(PKG_VERSION) +HOST_BUILD_DEPENDS:=perl/host +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Parse-RecDescent-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-parse-recdescent + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Generate Recursive-Descent Parsers + URL:=http://search.cpan.org/dist/Parse-RecDescent/ + DEPENDS:=perl +perlbase-essential +perlbase-test +perlbase-text +endef + +define Host/Configure + $(call perlmod/host/Configure,,,) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-parse-recdescent/install + $(call perlmod/Install,$(1),Parse auto/Parse) +endef + + +$(eval $(call BuildPackage,perl-parse-recdescent)) +$(eval $(call HostBuild)) diff --git a/lang/perl-sub-uplevel/Makefile b/lang/perl-sub-uplevel/Makefile new file mode 100644 index 0000000..266bce4 --- /dev/null +++ b/lang/perl-sub-uplevel/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-sub-uplevel +PKG_VERSION:=0.25 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/D/DA/DAGOLDEN +PKG_SOURCE:=Sub-Uplevel-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=5d0752dbfa94d0c91b25a264f47f5675 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Sub-Uplevel-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-sub-uplevel + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Apparently run a function in a higher stack frame + URL:=http://search.cpan.org/dist/Sub-Uplevel/ + DEPENDS:=perl +perlbase-essential +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-sub-uplevel/install + $(call perlmod/Install,$(1),Sub auto/Sub) +endef + + +$(eval $(call BuildPackage,perl-sub-uplevel)) diff --git a/lang/perl-test-harness/Makefile b/lang/perl-test-harness/Makefile new file mode 100644 index 0000000..0c14e85 --- /dev/null +++ b/lang/perl-test-harness/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2014 - 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-test-harness +PKG_VERSION:=3.36 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEONT/ +PKG_SOURCE:=Test-Harness-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=4c8d9c77e8e06ca96c7383c05c8f3616 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Test-Harness-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-test-harness + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl Test Harness + URL:=http://search.cpan.org/dist/Test-Harness/ + DEPENDS:=perl +perlbase-base +perlbase-benchmark +perlbase-config +perlbase-essential +perlbase-file +perlbase-getopt +perlbase-io +perlbase-posix +perlbase-text +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-test-harness/install + $(call perlmod/Install,$(1),App auto/Test TAP Test) +endef + + +$(eval $(call BuildPackage,perl-test-harness)) diff --git a/lang/perl-test-warn/Makefile b/lang/perl-test-warn/Makefile new file mode 100644 index 0000000..995e1ba --- /dev/null +++ b/lang/perl-test-warn/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-test-warn +PKG_VERSION:=0.30 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/C/CH/CHORNY +PKG_SOURCE:=Test-Warn-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=8306b998a96d2cc69266b5248d550472 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Test-Warn-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-test-warn + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl extension to test methods for warnings + URL:=http://search.cpan.org/dist/Test-Warn/ + DEPENDS:=perl +perl-sub-uplevel +perlbase-essential +perlbase-test +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-test-warn/install + $(call perlmod/Install,$(1),Test auto/Test) +endef + + +$(eval $(call BuildPackage,perl-test-warn)) diff --git a/lang/perl-uri/Makefile b/lang/perl-uri/Makefile new file mode 100644 index 0000000..18667fc --- /dev/null +++ b/lang/perl-uri/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 - 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-uri +PKG_VERSION:=1.71 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/ +PKG_SOURCE:=URI-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=247c3da29a794f72730e01aa5a715daf + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/URI-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-uri + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Manipulates and accesses URI strings + URL:=http://search.cpan.org/dist/URI/ + DEPENDS:=perl +perlbase-essential +perlbase-integer +perlbase-mime +perlbase-scalar +perlbase-utf8 +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-uri/install + $(call perlmod/Install,$(1),URI URI.pm) +endef + + +$(eval $(call BuildPackage,perl-uri)) diff --git a/lang/perl-www-mechanize/Makefile b/lang/perl-www-mechanize/Makefile new file mode 100644 index 0000000..93d6be2 --- /dev/null +++ b/lang/perl-www-mechanize/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-www-mechanize +PKG_VERSION:=1.75 +PKG_RELEASE:=1 + +PKG_SOURCE:=WWW-Mechanize-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/ +PKG_MD5SUM:=9a4b9c8827f519908ef0a0d2b8ae96fa + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/WWW-Mechanize-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-www-mechanize + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl WWW Mechanize + URL:=http://search.cpan.org/dist/WWW-Mechanize/ + DEPENDS:=perl +perl-cgi +perl-html-form +perl-html-parser +perl-html-tree +perl-http-daemon +perl-http-message +perl-http-server-simple +perl-test-warn +perl-uri +perl-www +perlbase-base +perlbase-essential +perlbase-file +perlbase-findbin +perlbase-getopt +perlbase-pod +perlbase-test +endef + +define Build/Configure + $(call perlmod/Configure,$(STAGING_DIR)/usr/include,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-www-mechanize/install + $(call perlmod/Install,$(1),WWW/Mechanize WWW/Mechanize.pm) +endef + + +$(eval $(call BuildPackage,perl-www-mechanize)) diff --git a/lang/perl-www-robotrules/Makefile b/lang/perl-www-robotrules/Makefile new file mode 100644 index 0000000..c28b8c2 --- /dev/null +++ b/lang/perl-www-robotrules/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-www-robotrules +PKG_VERSION:=6.02 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/G/GA/GAAS +PKG_SOURCE:=WWW-RobotRules-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=b7186e8b8b3701e70c22abf430742403 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/WWW-RobotRules-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-www-robotrules + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=database of robots.txt-derived permissions + URL:=http://search.cpan.org/dist/WWW-RobotRules/ + DEPENDS:=perl +perl-uri +perlbase-anydbm-file +perlbase-essential +perlbase-fcntl +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-www-robotrules/install + $(call perlmod/Install,$(1),WWW auto/WWW) +endef + + +$(eval $(call BuildPackage,perl-www-robotrules)) diff --git a/lang/perl-www/Makefile b/lang/perl-www/Makefile new file mode 100644 index 0000000..86bf15b --- /dev/null +++ b/lang/perl-www/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) 2013-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-www +PKG_VERSION:=6.15 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/E/ET/ETHER/ +PKG_SOURCE:=libwww-perl-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=6888c9d8728cd6f3ea3c9754461c9f94 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/libwww-perl-$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include ../perl/perlmod.mk + +define Package/perl-www + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=WWW client/server library for Perl (aka LWP) + URL:=http://search.cpan.org/dist/libwww-perl/ + DEPENDS:=perl +perl-encode-locale +perl-file-listing +perl-html-parser +perl-http-cookies +perl-http-daemon +perl-http-date +perl-http-message +perl-http-negotiate +perl-lwp-mediatypes +perl-net-http +perl-uri +perl-www-robotrules +perlbase-base +perlbase-digest +perlbase-encode +perlbase-essential +perlbase-io +perlbase-mime +perlbase-net +endef + +define Build/Configure + $(call perlmod/Configure,,) +endef + +define Build/Compile + $(call perlmod/Compile,,) +endef + +define Package/perl-www/install + $(call perlmod/Install,$(1),LWP.pm auto/LWP LWP) +endef + + +$(eval $(call BuildPackage,perl-www)) diff --git a/lang/perl-xml-parser/Makefile b/lang/perl-xml-parser/Makefile new file mode 100644 index 0000000..e5d3b2c --- /dev/null +++ b/lang/perl-xml-parser/Makefile @@ -0,0 +1,86 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl-xml-parser +PKG_VERSION:=2.44 +PKG_RELEASE:=1 + +PKG_SOURCE_URL:=http://www.cpan.org/authors/id/T/TO/TODDR/ +PKG_SOURCE:=XML-Parser-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=af4813fe3952362451201ced6fbce379 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_MAINTAINER:=Marcel Denia + +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/XML-Parser-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/XML-Parser-$(PKG_VERSION) + +HOST_BUILD_DEPENDS:=perl/host expat/host + +EXPAT_LIBPATH:=$(STAGING_DIR)/usr/lib +EXPAT_INCPATH=$(STAGING_DIR)/usr/include +HOST_EXPAT_LIBPATH:=$(STAGING_DIR)/host/lib +HOST_EXPAT_INCPATH=$(STAGING_DIR)/host/include + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include ../perl/perlmod.mk + +define Package/perl-xml-parser + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=Perl XML Parser + URL:=http://search.cpan.org/dist/XML-Parser/ + DEPENDS:=perl +libexpat +perlbase-dynaloader +perlbase-essential +endef + +define FixupExpat + # Manually reconfigure XML::Parser::Expat, as some overrides we provide will not have any effect otherwise + # Force usage of OpenWRT's expat + sed \ + -e 's!%%EXPAT_LIBPATH%%!$(2)!g' \ + -e 's!%%EXPAT_INCPATH%%!$(3)!g' \ + -i $(1)/Expat/Makefile.PL +endef + +define Build/Configure + $(call perlmod/Configure,EXPATLIBPATH=$(EXPAT_LIBPATH) EXPATINCPATH=$(EXPAT_INCPATH),,) + + $(call FixupExpat,$(PKG_BUILD_DIR),$(EXPAT_LIBPATH),$(EXPAT_INCPATH)) + $(call perlmod/Configure,,,$(PKG_BUILD_DIR)/Expat) +endef + +define Build/Compile + $(call perlmod/Compile,,) + $(call perlmod/Compile,,,$(PKG_BUILD_DIR)/Expat) +endef + +define Host/Configure + $(call perlmod/host/Configure,EXPATLIBPATH=$(HOST_EXPAT_LIBPATH) EXPATINCPATH=$(HOST_EXPAT_INCPATH),,) + $(call FixupExpat,$(HOST_BUILD_DIR),$(HOST_EXPAT_LIBPATH),$(HOST_EXPAT_INCPATH)) + $(call perlmod/host/Configure,,,$(HOST_BUILD_DIR)/Expat) +endef + +define Host/Compile + $(call perlmod/host/Compile,,) + $(call perlmod/host/Compile,,,$(HOST_BUILD_DIR)/Expat) +endef + +define Host/Install + $(call perlmod/host/Install,$(1),) +endef + +define Package/perl-xml-parser/install + $(call perlmod/Install,$(1),auto/XML XML) +endef + + +$(eval $(call BuildPackage,perl-xml-parser)) +$(eval $(call HostBuild)) diff --git a/lang/perl-xml-parser/patches/010-xml-parser-expat-use-ppport.h b/lang/perl-xml-parser/patches/010-xml-parser-expat-use-ppport.h new file mode 100644 index 0000000..e2aad83 --- /dev/null +++ b/lang/perl-xml-parser/patches/010-xml-parser-expat-use-ppport.h @@ -0,0 +1,7476 @@ +--- a/Expat/Expat.xs ++++ b/Expat/Expat.xs +@@ -20,17 +20,7 @@ + #include "patchlevel.h" + #include "encoding.h" + +- +-/* Version 5.005_5x (Development version for 5.006) doesn't like sv_... +- anymore, but 5.004 doesn't know about PL_sv.. +- Don't want to push up required version just for this. */ +- +-#if PATCHLEVEL < 5 +-#define PL_sv_undef sv_undef +-#define PL_sv_no sv_no +-#define PL_sv_yes sv_yes +-#define PL_na na +-#endif ++#include "ppport.h" + + #define BUFSIZE 32768 + +--- /dev/null ++++ b/Expat/ppport.h +@@ -0,0 +1,7452 @@ ++#if 0 ++<<'SKIP'; ++#endif ++/* ++---------------------------------------------------------------------- ++ ++ ppport.h -- Perl/Pollution/Portability Version 3.21 ++ ++ Automatically created by Devel::PPPort running under perl 5.020002. ++ ++ Do NOT edit this file directly! -- Edit PPPort_pm.PL and the ++ includes in parts/inc/ instead. ++ ++ Use 'perldoc ppport.h' to view the documentation below. ++ ++---------------------------------------------------------------------- ++ ++SKIP ++ ++=pod ++ ++=head1 NAME ++ ++ppport.h - Perl/Pollution/Portability version 3.21 ++ ++=head1 SYNOPSIS ++ ++ perl ppport.h [options] [source files] ++ ++ Searches current directory for files if no [source files] are given ++ ++ --help show short help ++ ++ --version show version ++ ++ --patch=file write one patch file with changes ++ --copy=suffix write changed copies with suffix ++ --diff=program use diff program and options ++ ++ --compat-version=version provide compatibility with Perl version ++ --cplusplus accept C++ comments ++ ++ --quiet don't output anything except fatal errors ++ --nodiag don't show diagnostics ++ --nohints don't show hints ++ --nochanges don't suggest changes ++ --nofilter don't filter input files ++ ++ --strip strip all script and doc functionality from ++ ppport.h ++ ++ --list-provided list provided API ++ --list-unsupported list unsupported API ++ --api-info=name show Perl API portability information ++ ++=head1 COMPATIBILITY ++ ++This version of F is designed to support operation with Perl ++installations back to 5.003, and has been tested up to 5.11.5. ++ ++=head1 OPTIONS ++ ++=head2 --help ++ ++Display a brief usage summary. ++ ++=head2 --version ++ ++Display the version of F. ++ ++=head2 --patch=I ++ ++If this option is given, a single patch file will be created if ++any changes are suggested. This requires a working diff program ++to be installed on your system. ++ ++=head2 --copy=I ++ ++If this option is given, a copy of each file will be saved with ++the given suffix that contains the suggested changes. This does ++not require any external programs. Note that this does not ++automagially add a dot between the original filename and the ++suffix. If you want the dot, you have to include it in the option ++argument. ++ ++If neither C<--patch> or C<--copy> are given, the default is to ++simply print the diffs for each file. This requires either ++C or a C program to be installed. ++ ++=head2 --diff=I ++ ++Manually set the diff program and options to use. The default ++is to use C, when installed, and output unified ++context diffs. ++ ++=head2 --compat-version=I ++ ++Tell F to check for compatibility with the given ++Perl version. The default is to check for compatibility with Perl ++version 5.003. You can use this option to reduce the output ++of F if you intend to be backward compatible only ++down to a certain Perl version. ++ ++=head2 --cplusplus ++ ++Usually, F will detect C++ style comments and ++replace them with C style comments for portability reasons. ++Using this option instructs F to leave C++ ++comments untouched. ++ ++=head2 --quiet ++ ++Be quiet. Don't print anything except fatal errors. ++ ++=head2 --nodiag ++ ++Don't output any diagnostic messages. Only portability ++alerts will be printed. ++ ++=head2 --nohints ++ ++Don't output any hints. Hints often contain useful portability ++notes. Warnings will still be displayed. ++ ++=head2 --nochanges ++ ++Don't suggest any changes. Only give diagnostic output and hints ++unless these are also deactivated. ++ ++=head2 --nofilter ++ ++Don't filter the list of input files. By default, files not looking ++like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped. ++ ++=head2 --strip ++ ++Strip all script and documentation functionality from F. ++This reduces the size of F dramatically and may be useful ++if you want to include F in smaller modules without ++increasing their distribution size too much. ++ ++The stripped F will have a C<--unstrip> option that allows ++you to undo the stripping, but only if an appropriate C ++module is installed. ++ ++=head2 --list-provided ++ ++Lists the API elements for which compatibility is provided by ++F. Also lists if it must be explicitly requested, ++if it has dependencies, and if there are hints or warnings for it. ++ ++=head2 --list-unsupported ++ ++Lists the API elements that are known not to be supported by ++F and below which version of Perl they probably ++won't be available or work. ++ ++=head2 --api-info=I ++ ++Show portability information for API elements matching I. ++If I is surrounded by slashes, it is interpreted as a regular ++expression. ++ ++=head1 DESCRIPTION ++ ++In order for a Perl extension (XS) module to be as portable as possible ++across differing versions of Perl itself, certain steps need to be taken. ++ ++=over 4 ++ ++=item * ++ ++Including this header is the first major one. This alone will give you ++access to a large part of the Perl API that hasn't been available in ++earlier Perl releases. Use ++ ++ perl ppport.h --list-provided ++ ++to see which API elements are provided by ppport.h. ++ ++=item * ++ ++You should avoid using deprecated parts of the API. For example, using ++global Perl variables without the C prefix is deprecated. Also, ++some API functions used to have a C prefix. Using this form is ++also deprecated. You can safely use the supported API, as F ++will provide wrappers for older Perl versions. ++ ++=item * ++ ++If you use one of a few functions or variables that were not present in ++earlier versions of Perl, and that can't be provided using a macro, you ++have to explicitly request support for these functions by adding one or ++more C<#define>s in your source code before the inclusion of F. ++ ++These functions or variables will be marked C in the list shown ++by C<--list-provided>. ++ ++Depending on whether you module has a single or multiple files that ++use such functions or variables, you want either C or global ++variants. ++ ++For a C function or variable (used only in a single source ++file), use: ++ ++ #define NEED_function ++ #define NEED_variable ++ ++For a global function or variable (used in multiple source files), ++use: ++ ++ #define NEED_function_GLOBAL ++ #define NEED_variable_GLOBAL ++ ++Note that you mustn't have more than one global request for the ++same function or variable in your project. ++ ++ Function / Variable Static Request Global Request ++ ----------------------------------------------------------------------------------------- ++ PL_parser NEED_PL_parser NEED_PL_parser_GLOBAL ++ PL_signals NEED_PL_signals NEED_PL_signals_GLOBAL ++ eval_pv() NEED_eval_pv NEED_eval_pv_GLOBAL ++ grok_bin() NEED_grok_bin NEED_grok_bin_GLOBAL ++ grok_hex() NEED_grok_hex NEED_grok_hex_GLOBAL ++ grok_number() NEED_grok_number NEED_grok_number_GLOBAL ++ grok_numeric_radix() NEED_grok_numeric_radix NEED_grok_numeric_radix_GLOBAL ++ grok_oct() NEED_grok_oct NEED_grok_oct_GLOBAL ++ load_module() NEED_load_module NEED_load_module_GLOBAL ++ my_snprintf() NEED_my_snprintf NEED_my_snprintf_GLOBAL ++ my_sprintf() NEED_my_sprintf NEED_my_sprintf_GLOBAL ++ my_strlcat() NEED_my_strlcat NEED_my_strlcat_GLOBAL ++ my_strlcpy() NEED_my_strlcpy NEED_my_strlcpy_GLOBAL ++ newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL ++ newRV_noinc() NEED_newRV_noinc NEED_newRV_noinc_GLOBAL ++ newSV_type() NEED_newSV_type NEED_newSV_type_GLOBAL ++ newSVpvn_flags() NEED_newSVpvn_flags NEED_newSVpvn_flags_GLOBAL ++ newSVpvn_share() NEED_newSVpvn_share NEED_newSVpvn_share_GLOBAL ++ pv_display() NEED_pv_display NEED_pv_display_GLOBAL ++ pv_escape() NEED_pv_escape NEED_pv_escape_GLOBAL ++ pv_pretty() NEED_pv_pretty NEED_pv_pretty_GLOBAL ++ sv_2pv_flags() NEED_sv_2pv_flags NEED_sv_2pv_flags_GLOBAL ++ sv_2pvbyte() NEED_sv_2pvbyte NEED_sv_2pvbyte_GLOBAL ++ sv_catpvf_mg() NEED_sv_catpvf_mg NEED_sv_catpvf_mg_GLOBAL ++ sv_catpvf_mg_nocontext() NEED_sv_catpvf_mg_nocontext NEED_sv_catpvf_mg_nocontext_GLOBAL ++ sv_pvn_force_flags() NEED_sv_pvn_force_flags NEED_sv_pvn_force_flags_GLOBAL ++ sv_setpvf_mg() NEED_sv_setpvf_mg NEED_sv_setpvf_mg_GLOBAL ++ sv_setpvf_mg_nocontext() NEED_sv_setpvf_mg_nocontext NEED_sv_setpvf_mg_nocontext_GLOBAL ++ vload_module() NEED_vload_module NEED_vload_module_GLOBAL ++ vnewSVpvf() NEED_vnewSVpvf NEED_vnewSVpvf_GLOBAL ++ warner() NEED_warner NEED_warner_GLOBAL ++ ++To avoid namespace conflicts, you can change the namespace of the ++explicitly exported functions / variables using the C ++macro. Just C<#define> the macro before including C: ++ ++ #define DPPP_NAMESPACE MyOwnNamespace_ ++ #include "ppport.h" ++ ++The default namespace is C. ++ ++=back ++ ++The good thing is that most of the above can be checked by running ++F on your source code. See the next section for ++details. ++ ++=head1 EXAMPLES ++ ++To verify whether F is needed for your module, whether you ++should make any changes to your code, and whether any special defines ++should be used, F can be run as a Perl script to check your ++source code. Simply say: ++ ++ perl ppport.h ++ ++The result will usually be a list of patches suggesting changes ++that should at least be acceptable, if not necessarily the most ++efficient solution, or a fix for all possible problems. ++ ++If you know that your XS module uses features only available in ++newer Perl releases, if you're aware that it uses C++ comments, ++and if you want all suggestions as a single patch file, you could ++use something like this: ++ ++ perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff ++ ++If you only want your code to be scanned without any suggestions ++for changes, use: ++ ++ perl ppport.h --nochanges ++ ++You can specify a different C program or options, using ++the C<--diff> option: ++ ++ perl ppport.h --diff='diff -C 10' ++ ++This would output context diffs with 10 lines of context. ++ ++If you want to create patched copies of your files instead, use: ++ ++ perl ppport.h --copy=.new ++ ++To display portability information for the C function, ++use: ++ ++ perl ppport.h --api-info=newSVpvn ++ ++Since the argument to C<--api-info> can be a regular expression, ++you can use ++ ++ perl ppport.h --api-info=/_nomg$/ ++ ++to display portability information for all C<_nomg> functions or ++ ++ perl ppport.h --api-info=/./ ++ ++to display information for all known API elements. ++ ++=head1 BUGS ++ ++If this version of F is causing failure during ++the compilation of this module, please check if newer versions ++of either this module or C are available on CPAN ++before sending a bug report. ++ ++If F was generated using the latest version of ++C and is causing failure of this module, please ++file a bug report using the CPAN Request Tracker at L. ++ ++Please include the following information: ++ ++=over 4 ++ ++=item 1. ++ ++The complete output from running "perl -V" ++ ++=item 2. ++ ++This file. ++ ++=item 3. ++ ++The name and version of the module you were trying to build. ++ ++=item 4. ++ ++A full log of the build that failed. ++ ++=item 5. ++ ++Any other information that you think could be relevant. ++ ++=back ++ ++For the latest version of this code, please get the C ++module from CPAN. ++ ++=head1 COPYRIGHT ++ ++Version 3.x, Copyright (c) 2004-2013, Marcus Holland-Moritz. ++ ++Version 2.x, Copyright (C) 2001, Paul Marquess. ++ ++Version 1.x, Copyright (C) 1999, Kenneth Albanowski. ++ ++This program is free software; you can redistribute it and/or ++modify it under the same terms as Perl itself. ++ ++=head1 SEE ALSO ++ ++See L. ++ ++=cut ++ ++use strict; ++ ++# Disable broken TRIE-optimization ++BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 } ++ ++my $VERSION = 3.21; ++ ++my %opt = ( ++ quiet => 0, ++ diag => 1, ++ hints => 1, ++ changes => 1, ++ cplusplus => 0, ++ filter => 1, ++ strip => 0, ++ version => 0, ++); ++ ++my($ppport) = $0 =~ /([\w.]+)$/; ++my $LF = '(?:\r\n|[\r\n])'; # line feed ++my $HS = "[ \t]"; # horizontal whitespace ++ ++# Never use C comments in this file! ++my $ccs = '/'.'*'; ++my $cce = '*'.'/'; ++my $rccs = quotemeta $ccs; ++my $rcce = quotemeta $cce; ++ ++eval { ++ require Getopt::Long; ++ Getopt::Long::GetOptions(\%opt, qw( ++ help quiet diag! filter! hints! changes! cplusplus strip version ++ patch=s copy=s diff=s compat-version=s ++ list-provided list-unsupported api-info=s ++ )) or usage(); ++}; ++ ++if ($@ and grep /^-/, @ARGV) { ++ usage() if "@ARGV" =~ /^--?h(?:elp)?$/; ++ die "Getopt::Long not found. Please don't use any options.\n"; ++} ++ ++if ($opt{version}) { ++ print "This is $0 $VERSION.\n"; ++ exit 0; ++} ++ ++usage() if $opt{help}; ++strip() if $opt{strip}; ++ ++if (exists $opt{'compat-version'}) { ++ my($r,$v,$s) = eval { parse_version($opt{'compat-version'}) }; ++ if ($@) { ++ die "Invalid version number format: '$opt{'compat-version'}'\n"; ++ } ++ die "Only Perl 5 is supported\n" if $r != 5; ++ die "Invalid version number: $opt{'compat-version'}\n" if $v >= 1000 || $s >= 1000; ++ $opt{'compat-version'} = sprintf "%d.%03d%03d", $r, $v, $s; ++} ++else { ++ $opt{'compat-version'} = 5; ++} ++ ++my %API = map { /^(\w+)\|([^|]*)\|([^|]*)\|(\w*)$/ ++ ? ( $1 => { ++ ($2 ? ( base => $2 ) : ()), ++ ($3 ? ( todo => $3 ) : ()), ++ (index($4, 'v') >= 0 ? ( varargs => 1 ) : ()), ++ (index($4, 'p') >= 0 ? ( provided => 1 ) : ()), ++ (index($4, 'n') >= 0 ? ( nothxarg => 1 ) : ()), ++ } ) ++ : die "invalid spec: $_" } qw( ++AvFILLp|5.004050||p ++AvFILL||| ++BhkDISABLE||5.019003| ++BhkENABLE||5.019003| ++BhkENTRY_set||5.019003| ++BhkENTRY||| ++BhkFLAGS||| ++CALL_BLOCK_HOOKS||| ++CLASS|||n ++CPERLscope|5.005000||p ++CX_CURPAD_SAVE||| ++CX_CURPAD_SV||| ++CopFILEAV|5.006000||p ++CopFILEGV_set|5.006000||p ++CopFILEGV|5.006000||p ++CopFILESV|5.006000||p ++CopFILE_set|5.006000||p ++CopFILE|5.006000||p ++CopSTASHPV_set|5.006000||p ++CopSTASHPV|5.006000||p ++CopSTASH_eq|5.006000||p ++CopSTASH_set|5.006000||p ++CopSTASH|5.006000||p ++CopyD|5.009002|5.004050|p ++Copy||5.004050| ++CvPADLIST||5.008001| ++CvSTASH||| ++CvWEAKOUTSIDE||| ++DEFSV_set|5.010001||p ++DEFSV|5.004050||p ++END_EXTERN_C|5.005000||p ++ENTER||| ++ERRSV|5.004050||p ++EXTEND||| ++EXTERN_C|5.005000||p ++F0convert|||n ++FREETMPS||| ++GIMME_V||5.004000|n ++GIMME|||n ++GROK_NUMERIC_RADIX|5.007002||p ++G_ARRAY||| ++G_DISCARD||| ++G_EVAL||| ++G_METHOD|5.006001||p ++G_NOARGS||| ++G_SCALAR||| ++G_VOID||5.004000| ++GetVars||| ++GvAV||| ++GvCV||| ++GvHV||| ++GvSVn|5.009003||p ++GvSV||| ++Gv_AMupdate||5.011000| ++HEf_SVKEY||5.004000| ++HeHASH||5.004000| ++HeKEY||5.004000| ++HeKLEN||5.004000| ++HePV||5.004000| ++HeSVKEY_force||5.004000| ++HeSVKEY_set||5.004000| ++HeSVKEY||5.004000| ++HeUTF8||5.010001| ++HeVAL||5.004000| ++HvENAMELEN||5.015004| ++HvENAMEUTF8||5.015004| ++HvENAME||5.013007| ++HvNAMELEN_get|5.009003||p ++HvNAMELEN||5.015004| ++HvNAMEUTF8||5.015004| ++HvNAME_get|5.009003||p ++HvNAME||| ++INT2PTR|5.006000||p ++IN_LOCALE_COMPILETIME|5.007002||p ++IN_LOCALE_RUNTIME|5.007002||p ++IN_LOCALE|5.007002||p ++IN_PERL_COMPILETIME|5.008001||p ++IS_NUMBER_GREATER_THAN_UV_MAX|5.007002||p ++IS_NUMBER_INFINITY|5.007002||p ++IS_NUMBER_IN_UV|5.007002||p ++IS_NUMBER_NAN|5.007003||p ++IS_NUMBER_NEG|5.007002||p ++IS_NUMBER_NOT_INT|5.007002||p ++IVSIZE|5.006000||p ++IVTYPE|5.006000||p ++IVdf|5.006000||p ++LEAVE||| ++LINKLIST||5.013006| ++LVRET||| ++MARK||| ++MULTICALL||5.019003| ++MY_CXT_CLONE|5.009002||p ++MY_CXT_INIT|5.007003||p ++MY_CXT|5.007003||p ++MoveD|5.009002|5.004050|p ++Move||5.004050| ++NOOP|5.005000||p ++NUM2PTR|5.006000||p ++NVTYPE|5.006000||p ++NVef|5.006001||p ++NVff|5.006001||p ++NVgf|5.006001||p ++Newxc|5.009003||p ++Newxz|5.009003||p ++Newx|5.009003||p ++Nullav||| ++Nullch||| ++Nullcv||| ++Nullhv||| ++Nullsv||| ++OP_CLASS||5.013007| ++OP_DESC||5.007003| ++OP_NAME||5.007003| ++ORIGMARK||| ++PAD_BASE_SV||| ++PAD_CLONE_VARS||| ++PAD_COMPNAME_FLAGS||| ++PAD_COMPNAME_GEN_set||| ++PAD_COMPNAME_GEN||| ++PAD_COMPNAME_OURSTASH||| ++PAD_COMPNAME_PV||| ++PAD_COMPNAME_TYPE||| ++PAD_RESTORE_LOCAL||| ++PAD_SAVE_LOCAL||| ++PAD_SAVE_SETNULLPAD||| ++PAD_SETSV||| ++PAD_SET_CUR_NOSAVE||| ++PAD_SET_CUR||| ++PAD_SVl||| ++PAD_SV||| ++PERLIO_FUNCS_CAST|5.009003||p ++PERLIO_FUNCS_DECL|5.009003||p ++PERL_ABS|5.008001||p ++PERL_BCDVERSION|5.019002||p ++PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p ++PERL_HASH|5.004000||p ++PERL_INT_MAX|5.004000||p ++PERL_INT_MIN|5.004000||p ++PERL_LONG_MAX|5.004000||p ++PERL_LONG_MIN|5.004000||p ++PERL_MAGIC_arylen|5.007002||p ++PERL_MAGIC_backref|5.007002||p ++PERL_MAGIC_bm|5.007002||p ++PERL_MAGIC_collxfrm|5.007002||p ++PERL_MAGIC_dbfile|5.007002||p ++PERL_MAGIC_dbline|5.007002||p ++PERL_MAGIC_defelem|5.007002||p ++PERL_MAGIC_envelem|5.007002||p ++PERL_MAGIC_env|5.007002||p ++PERL_MAGIC_ext|5.007002||p ++PERL_MAGIC_fm|5.007002||p ++PERL_MAGIC_glob|5.019002||p ++PERL_MAGIC_isaelem|5.007002||p ++PERL_MAGIC_isa|5.007002||p ++PERL_MAGIC_mutex|5.019002||p ++PERL_MAGIC_nkeys|5.007002||p ++PERL_MAGIC_overload_elem|5.019002||p ++PERL_MAGIC_overload_table|5.007002||p ++PERL_MAGIC_overload|5.019002||p ++PERL_MAGIC_pos|5.007002||p ++PERL_MAGIC_qr|5.007002||p ++PERL_MAGIC_regdata|5.007002||p ++PERL_MAGIC_regdatum|5.007002||p ++PERL_MAGIC_regex_global|5.007002||p ++PERL_MAGIC_shared_scalar|5.007003||p ++PERL_MAGIC_shared|5.007003||p ++PERL_MAGIC_sigelem|5.007002||p ++PERL_MAGIC_sig|5.007002||p ++PERL_MAGIC_substr|5.007002||p ++PERL_MAGIC_sv|5.007002||p ++PERL_MAGIC_taint|5.007002||p ++PERL_MAGIC_tiedelem|5.007002||p ++PERL_MAGIC_tiedscalar|5.007002||p ++PERL_MAGIC_tied|5.007002||p ++PERL_MAGIC_utf8|5.008001||p ++PERL_MAGIC_uvar_elem|5.007003||p ++PERL_MAGIC_uvar|5.007002||p ++PERL_MAGIC_vec|5.007002||p ++PERL_MAGIC_vstring|5.008001||p ++PERL_PV_ESCAPE_ALL|5.009004||p ++PERL_PV_ESCAPE_FIRSTCHAR|5.009004||p ++PERL_PV_ESCAPE_NOBACKSLASH|5.009004||p ++PERL_PV_ESCAPE_NOCLEAR|5.009004||p ++PERL_PV_ESCAPE_QUOTE|5.009004||p ++PERL_PV_ESCAPE_RE|5.009005||p ++PERL_PV_ESCAPE_UNI_DETECT|5.009004||p ++PERL_PV_ESCAPE_UNI|5.009004||p ++PERL_PV_PRETTY_DUMP|5.009004||p ++PERL_PV_PRETTY_ELLIPSES|5.010000||p ++PERL_PV_PRETTY_LTGT|5.009004||p ++PERL_PV_PRETTY_NOCLEAR|5.010000||p ++PERL_PV_PRETTY_QUOTE|5.009004||p ++PERL_PV_PRETTY_REGPROP|5.009004||p ++PERL_QUAD_MAX|5.004000||p ++PERL_QUAD_MIN|5.004000||p ++PERL_REVISION|5.006000||p ++PERL_SCAN_ALLOW_UNDERSCORES|5.007003||p ++PERL_SCAN_DISALLOW_PREFIX|5.007003||p ++PERL_SCAN_GREATER_THAN_UV_MAX|5.007003||p ++PERL_SCAN_SILENT_ILLDIGIT|5.008001||p ++PERL_SHORT_MAX|5.004000||p ++PERL_SHORT_MIN|5.004000||p ++PERL_SIGNALS_UNSAFE_FLAG|5.008001||p ++PERL_SUBVERSION|5.006000||p ++PERL_SYS_INIT3||5.010000| ++PERL_SYS_INIT||5.010000| ++PERL_SYS_TERM||5.019003| ++PERL_UCHAR_MAX|5.004000||p ++PERL_UCHAR_MIN|5.004000||p ++PERL_UINT_MAX|5.004000||p ++PERL_UINT_MIN|5.004000||p ++PERL_ULONG_MAX|5.004000||p ++PERL_ULONG_MIN|5.004000||p ++PERL_UNUSED_ARG|5.009003||p ++PERL_UNUSED_CONTEXT|5.009004||p ++PERL_UNUSED_DECL|5.007002||p ++PERL_UNUSED_VAR|5.007002||p ++PERL_UQUAD_MAX|5.004000||p ++PERL_UQUAD_MIN|5.004000||p ++PERL_USE_GCC_BRACE_GROUPS|5.009004||p ++PERL_USHORT_MAX|5.004000||p ++PERL_USHORT_MIN|5.004000||p ++PERL_VERSION|5.006000||p ++PL_DBsignal|5.005000||p ++PL_DBsingle|||pn ++PL_DBsub|||pn ++PL_DBtrace|||pn ++PL_Sv|5.005000||p ++PL_bufend|5.019002||p ++PL_bufptr|5.019002||p ++PL_check||5.006000| ++PL_compiling|5.004050||p ++PL_comppad_name||5.017004| ++PL_comppad||5.008001| ++PL_copline|5.019002||p ++PL_curcop|5.004050||p ++PL_curpad||5.005000| ++PL_curstash|5.004050||p ++PL_debstash|5.004050||p ++PL_defgv|5.004050||p ++PL_diehook|5.004050||p ++PL_dirty|5.004050||p ++PL_dowarn|||pn ++PL_errgv|5.004050||p ++PL_error_count|5.019002||p ++PL_expect|5.019002||p ++PL_hexdigit|5.005000||p ++PL_hints|5.005000||p ++PL_in_my_stash|5.019002||p ++PL_in_my|5.019002||p ++PL_keyword_plugin||5.011002| ++PL_last_in_gv|||n ++PL_laststatval|5.005000||p ++PL_lex_state|5.019002||p ++PL_lex_stuff|5.019002||p ++PL_linestr|5.019002||p ++PL_modglobal||5.005000|n ++PL_na|5.004050||pn ++PL_no_modify|5.006000||p ++PL_ofsgv|||n ++PL_opfreehook||5.011000|n ++PL_parser|5.009005|5.009005|p ++PL_peepp||5.007003|n ++PL_perl_destruct_level|5.004050||p ++PL_perldb|5.004050||p ++PL_ppaddr|5.006000||p ++PL_rpeepp||5.013005|n ++PL_rsfp_filters|5.019002||p ++PL_rsfp|5.019002||p ++PL_rs|||n ++PL_signals|5.008001||p ++PL_stack_base|5.004050||p ++PL_stack_sp|5.004050||p ++PL_statcache|5.005000||p ++PL_stdingv|5.004050||p ++PL_sv_arenaroot|5.004050||p ++PL_sv_no|5.004050||pn ++PL_sv_undef|5.004050||pn ++PL_sv_yes|5.004050||pn ++PL_tainted|5.004050||p ++PL_tainting|5.004050||p ++PL_tokenbuf|5.019002||p ++POP_MULTICALL||5.019003| ++POPi|||n ++POPl|||n ++POPn|||n ++POPpbytex||5.007001|n ++POPpx||5.005030|n ++POPp|||n ++POPs|||n ++PTR2IV|5.006000||p ++PTR2NV|5.006000||p ++PTR2UV|5.006000||p ++PTR2nat|5.009003||p ++PTR2ul|5.007001||p ++PTRV|5.006000||p ++PUSHMARK||| ++PUSH_MULTICALL||5.019003| ++PUSHi||| ++PUSHmortal|5.009002||p ++PUSHn||| ++PUSHp||| ++PUSHs||| ++PUSHu|5.004000||p ++PUTBACK||| ++PadARRAY||5.019003| ++PadMAX||5.019003| ++PadlistARRAY||5.019003| ++PadlistMAX||5.019003| ++PadlistNAMESARRAY||5.019003| ++PadlistNAMESMAX||5.019003| ++PadlistNAMES||5.019003| ++PadlistREFCNT||5.017004| ++PadnameIsOUR||| ++PadnameIsSTATE||| ++PadnameLEN||5.019003| ++PadnameOURSTASH||| ++PadnameOUTER||| ++PadnamePV||5.019003| ++PadnameSV||5.019003| ++PadnameTYPE||| ++PadnameUTF8||5.019003| ++PadnamelistARRAY||5.019003| ++PadnamelistMAX||5.019003| ++PerlIO_clearerr||5.007003| ++PerlIO_close||5.007003| ++PerlIO_context_layers||5.009004| ++PerlIO_eof||5.007003| ++PerlIO_error||5.007003| ++PerlIO_fileno||5.007003| ++PerlIO_fill||5.007003| ++PerlIO_flush||5.007003| ++PerlIO_get_base||5.007003| ++PerlIO_get_bufsiz||5.007003| ++PerlIO_get_cnt||5.007003| ++PerlIO_get_ptr||5.007003| ++PerlIO_read||5.007003| ++PerlIO_seek||5.007003| ++PerlIO_set_cnt||5.007003| ++PerlIO_set_ptrcnt||5.007003| ++PerlIO_setlinebuf||5.007003| ++PerlIO_stderr||5.007003| ++PerlIO_stdin||5.007003| ++PerlIO_stdout||5.007003| ++PerlIO_tell||5.007003| ++PerlIO_unread||5.007003| ++PerlIO_write||5.007003| ++Perl_signbit||5.009005|n ++PoisonFree|5.009004||p ++PoisonNew|5.009004||p ++PoisonWith|5.009004||p ++Poison|5.008000||p ++READ_XDIGIT||5.017006| ++RETVAL|||n ++Renewc||| ++Renew||| ++SAVECLEARSV||| ++SAVECOMPPAD||| ++SAVEPADSV||| ++SAVETMPS||| ++SAVE_DEFSV|5.004050||p ++SPAGAIN||| ++SP||| ++START_EXTERN_C|5.005000||p ++START_MY_CXT|5.007003||p ++STMT_END|||p ++STMT_START|||p ++STR_WITH_LEN|5.009003||p ++ST||| ++SV_CONST_RETURN|5.009003||p ++SV_COW_DROP_PV|5.008001||p ++SV_COW_SHARED_HASH_KEYS|5.009005||p ++SV_GMAGIC|5.007002||p ++SV_HAS_TRAILING_NUL|5.009004||p ++SV_IMMEDIATE_UNREF|5.007001||p ++SV_MUTABLE_RETURN|5.009003||p ++SV_NOSTEAL|5.009002||p ++SV_SMAGIC|5.009003||p ++SV_UTF8_NO_ENCODING|5.008001||p ++SVfARG|5.009005||p ++SVf_UTF8|5.006000||p ++SVf|5.006000||p ++SVt_INVLIST||5.019002| ++SVt_IV||| ++SVt_NULL||| ++SVt_NV||| ++SVt_PVAV||| ++SVt_PVCV||| ++SVt_PVFM||| ++SVt_PVGV||| ++SVt_PVHV||| ++SVt_PVIO||| ++SVt_PVIV||| ++SVt_PVLV||| ++SVt_PVMG||| ++SVt_PVNV||| ++SVt_PV||| ++SVt_REGEXP||5.011000| ++Safefree||| ++Slab_Alloc||| ++Slab_Free||| ++Slab_to_ro||| ++Slab_to_rw||| ++StructCopy||| ++SvCUR_set||| ++SvCUR||| ++SvEND||| ++SvGAMAGIC||5.006001| ++SvGETMAGIC|5.004050||p ++SvGROW||| ++SvIOK_UV||5.006000| ++SvIOK_notUV||5.006000| ++SvIOK_off||| ++SvIOK_only_UV||5.006000| ++SvIOK_only||| ++SvIOK_on||| ++SvIOKp||| ++SvIOK||| ++SvIVX||| ++SvIV_nomg|5.009001||p ++SvIV_set||| ++SvIVx||| ++SvIV||| ++SvIsCOW_shared_hash||5.008003| ++SvIsCOW||5.008003| ++SvLEN_set||| ++SvLEN||| ++SvLOCK||5.007003| ++SvMAGIC_set|5.009003||p ++SvNIOK_off||| ++SvNIOKp||| ++SvNIOK||| ++SvNOK_off||| ++SvNOK_only||| ++SvNOK_on||| ++SvNOKp||| ++SvNOK||| ++SvNVX||| ++SvNV_nomg||5.013002| ++SvNV_set||| ++SvNVx||| ++SvNV||| ++SvOK||| ++SvOOK_offset||5.011000| ++SvOOK||| ++SvPOK_off||| ++SvPOK_only_UTF8||5.006000| ++SvPOK_only||| ++SvPOK_on||| ++SvPOKp||| ++SvPOK||| ++SvPVX_const|5.009003||p ++SvPVX_mutable|5.009003||p ++SvPVX||| ++SvPV_const|5.009003||p ++SvPV_flags_const_nolen|5.009003||p ++SvPV_flags_const|5.009003||p ++SvPV_flags_mutable|5.009003||p ++SvPV_flags|5.007002||p ++SvPV_force_flags_mutable|5.009003||p ++SvPV_force_flags_nolen|5.009003||p ++SvPV_force_flags|5.007002||p ++SvPV_force_mutable|5.009003||p ++SvPV_force_nolen|5.009003||p ++SvPV_force_nomg_nolen|5.009003||p ++SvPV_force_nomg|5.007002||p ++SvPV_force|||p ++SvPV_mutable|5.009003||p ++SvPV_nolen_const|5.009003||p ++SvPV_nolen|5.006000||p ++SvPV_nomg_const_nolen|5.009003||p ++SvPV_nomg_const|5.009003||p ++SvPV_nomg_nolen|5.013007||p ++SvPV_nomg|5.007002||p ++SvPV_renew|5.009003||p ++SvPV_set||| ++SvPVbyte_force||5.009002| ++SvPVbyte_nolen||5.006000| ++SvPVbytex_force||5.006000| ++SvPVbytex||5.006000| ++SvPVbyte|5.006000||p ++SvPVutf8_force||5.006000| ++SvPVutf8_nolen||5.006000| ++SvPVutf8x_force||5.006000| ++SvPVutf8x||5.006000| ++SvPVutf8||5.006000| ++SvPVx||| ++SvPV||| ++SvREFCNT_dec_NN||5.017007| ++SvREFCNT_dec||| ++SvREFCNT_inc_NN|5.009004||p ++SvREFCNT_inc_simple_NN|5.009004||p ++SvREFCNT_inc_simple_void_NN|5.009004||p ++SvREFCNT_inc_simple_void|5.009004||p ++SvREFCNT_inc_simple|5.009004||p ++SvREFCNT_inc_void_NN|5.009004||p ++SvREFCNT_inc_void|5.009004||p ++SvREFCNT_inc|||p ++SvREFCNT||| ++SvROK_off||| ++SvROK_on||| ++SvROK||| ++SvRV_set|5.009003||p ++SvRV||| ++SvRXOK||5.009005| ++SvRX||5.009005| ++SvSETMAGIC||| ++SvSHARED_HASH|5.009003||p ++SvSHARE||5.007003| ++SvSTASH_set|5.009003||p ++SvSTASH||| ++SvSetMagicSV_nosteal||5.004000| ++SvSetMagicSV||5.004000| ++SvSetSV_nosteal||5.004000| ++SvSetSV||| ++SvTAINTED_off||5.004000| ++SvTAINTED_on||5.004000| ++SvTAINTED||5.004000| ++SvTAINT||| ++SvTHINKFIRST||| ++SvTRUE_nomg||5.013006| ++SvTRUE||| ++SvTYPE||| ++SvUNLOCK||5.007003| ++SvUOK|5.007001|5.006000|p ++SvUPGRADE||| ++SvUTF8_off||5.006000| ++SvUTF8_on||5.006000| ++SvUTF8||5.006000| ++SvUVXx|5.004000||p ++SvUVX|5.004000||p ++SvUV_nomg|5.009001||p ++SvUV_set|5.009003||p ++SvUVx|5.004000||p ++SvUV|5.004000||p ++SvVOK||5.008001| ++SvVSTRING_mg|5.009004||p ++THIS|||n ++UNDERBAR|5.009002||p ++UTF8_MAXBYTES|5.009002||p ++UVSIZE|5.006000||p ++UVTYPE|5.006000||p ++UVXf|5.007001||p ++UVof|5.006000||p ++UVuf|5.006000||p ++UVxf|5.006000||p ++WARN_ALL|5.006000||p ++WARN_AMBIGUOUS|5.006000||p ++WARN_ASSERTIONS|5.019002||p ++WARN_BAREWORD|5.006000||p ++WARN_CLOSED|5.006000||p ++WARN_CLOSURE|5.006000||p ++WARN_DEBUGGING|5.006000||p ++WARN_DEPRECATED|5.006000||p ++WARN_DIGIT|5.006000||p ++WARN_EXEC|5.006000||p ++WARN_EXITING|5.006000||p ++WARN_GLOB|5.006000||p ++WARN_INPLACE|5.006000||p ++WARN_INTERNAL|5.006000||p ++WARN_IO|5.006000||p ++WARN_LAYER|5.008000||p ++WARN_MALLOC|5.006000||p ++WARN_MISC|5.006000||p ++WARN_NEWLINE|5.006000||p ++WARN_NUMERIC|5.006000||p ++WARN_ONCE|5.006000||p ++WARN_OVERFLOW|5.006000||p ++WARN_PACK|5.006000||p ++WARN_PARENTHESIS|5.006000||p ++WARN_PIPE|5.006000||p ++WARN_PORTABLE|5.006000||p ++WARN_PRECEDENCE|5.006000||p ++WARN_PRINTF|5.006000||p ++WARN_PROTOTYPE|5.006000||p ++WARN_QW|5.006000||p ++WARN_RECURSION|5.006000||p ++WARN_REDEFINE|5.006000||p ++WARN_REGEXP|5.006000||p ++WARN_RESERVED|5.006000||p ++WARN_SEMICOLON|5.006000||p ++WARN_SEVERE|5.006000||p ++WARN_SIGNAL|5.006000||p ++WARN_SUBSTR|5.006000||p ++WARN_SYNTAX|5.006000||p ++WARN_TAINT|5.006000||p ++WARN_THREADS|5.008000||p ++WARN_UNINITIALIZED|5.006000||p ++WARN_UNOPENED|5.006000||p ++WARN_UNPACK|5.006000||p ++WARN_UNTIE|5.006000||p ++WARN_UTF8|5.006000||p ++WARN_VOID|5.006000||p ++WIDEST_UTYPE|5.015004||p ++XCPT_CATCH|5.009002||p ++XCPT_RETHROW|5.009002|5.007001|p ++XCPT_TRY_END|5.009002|5.004000|p ++XCPT_TRY_START|5.009002|5.004000|p ++XPUSHi||| ++XPUSHmortal|5.009002||p ++XPUSHn||| ++XPUSHp||| ++XPUSHs||| ++XPUSHu|5.004000||p ++XSPROTO|5.010000||p ++XSRETURN_EMPTY||| ++XSRETURN_IV||| ++XSRETURN_NO||| ++XSRETURN_NV||| ++XSRETURN_PV||| ++XSRETURN_UNDEF||| ++XSRETURN_UV|5.008001||p ++XSRETURN_YES||| ++XSRETURN|||p ++XST_mIV||| ++XST_mNO||| ++XST_mNV||| ++XST_mPV||| ++XST_mUNDEF||| ++XST_mUV|5.008001||p ++XST_mYES||| ++XS_APIVERSION_BOOTCHECK||5.013004| ++XS_EXTERNAL||5.019003| ++XS_INTERNAL||5.019003| ++XS_VERSION_BOOTCHECK||| ++XS_VERSION||| ++XSprePUSH|5.006000||p ++XS||| ++XopDISABLE||5.019003| ++XopENABLE||5.019003| ++XopENTRY_set||5.019003| ++XopENTRY||5.019003| ++XopFLAGS||5.013007| ++ZeroD|5.009002||p ++Zero||| ++_aMY_CXT|5.007003||p ++_add_range_to_invlist||| ++_append_range_to_invlist||| ++_core_swash_init||| ++_get_swash_invlist||| ++_invlist_array_init||| ++_invlist_contains_cp||| ++_invlist_contents||| ++_invlist_dump||| ++_invlist_intersection_maybe_complement_2nd||| ++_invlist_intersection||| ++_invlist_invert_prop||| ++_invlist_invert||| ++_invlist_len||| ++_invlist_populate_swatch||| ++_invlist_search||| ++_invlist_subtract||| ++_invlist_union_maybe_complement_2nd||| ++_invlist_union||| ++_is_uni_FOO||5.017008| ++_is_uni_perl_idcont||5.017008| ++_is_uni_perl_idstart||5.017007| ++_is_utf8_FOO||5.017008| ++_is_utf8_mark||5.017008| ++_is_utf8_perl_idcont||5.017008| ++_is_utf8_perl_idstart||5.017007| ++_new_invlist_C_array||| ++_new_invlist||| ++_pMY_CXT|5.007003||p ++_swash_inversion_hash||| ++_swash_to_invlist||| ++_to_fold_latin1||| ++_to_uni_fold_flags||5.013011| ++_to_upper_title_latin1||| ++_to_utf8_fold_flags||5.015006| ++_to_utf8_lower_flags||5.015006| ++_to_utf8_title_flags||5.015006| ++_to_utf8_upper_flags||5.015006| ++aMY_CXT_|5.007003||p ++aMY_CXT|5.007003||p ++aTHXR_|5.019002||p ++aTHXR|5.019002||p ++aTHX_|5.006000||p ++aTHX|5.006000||p ++aassign_common_vars||| ++add_cp_to_invlist||| ++add_data|||n ++add_utf16_textfilter||| ++addmad||| ++adjust_size_and_find_bucket|||n ++adjust_stack_on_leave||| ++alloc_maybe_populate_EXACT||| ++alloccopstash||| ++allocmy||| ++amagic_call||| ++amagic_cmp_locale||| ++amagic_cmp||| ++amagic_deref_call||5.013007| ++amagic_i_ncmp||| ++amagic_is_enabled||| ++amagic_ncmp||| ++anonymise_cv_maybe||| ++any_dup||| ++ao||| ++append_madprops||| ++apply_attrs_my||| ++apply_attrs_string||5.006001| ++apply_attrs||| ++apply||| ++assert_uft8_cache_coherent||| ++atfork_lock||5.007003|n ++atfork_unlock||5.007003|n ++av_arylen_p||5.009003| ++av_clear||| ++av_create_and_push||5.009005| ++av_create_and_unshift_one||5.009005| ++av_delete||5.006000| ++av_exists||5.006000| ++av_extend_guts||| ++av_extend||| ++av_fetch||| ++av_fill||| ++av_iter_p||5.011000| ++av_len||| ++av_make||| ++av_pop||| ++av_push||| ++av_reify||| ++av_shift||| ++av_store||| ++av_tindex||5.017009| ++av_top_index||5.017009| ++av_undef||| ++av_unshift||| ++ax|||n ++bad_type_gv||| ++bad_type_pv||| ++bind_match||| ++block_end||| ++block_gimme||5.004000| ++block_start||| ++blockhook_register||5.013003| ++boolSV|5.004000||p ++boot_core_PerlIO||| ++boot_core_UNIVERSAL||| ++boot_core_mro||| ++bytes_cmp_utf8||5.013007| ++bytes_from_utf8||5.007001| ++bytes_to_uni|||n ++bytes_to_utf8||5.006001| ++call_argv|5.006000||p ++call_atexit||5.006000| ++call_list||5.004000| ++call_method|5.006000||p ++call_pv|5.006000||p ++call_sv|5.006000||p ++caller_cx||5.013005| ++calloc||5.007002|n ++cando||| ++cast_i32||5.006000| ++cast_iv||5.006000| ++cast_ulong||5.006000| ++cast_uv||5.006000| ++check_locale_boundary_crossing||| ++check_type_and_open||| ++check_uni||| ++check_utf8_print||| ++checkcomma||| ++ckWARN|5.006000||p ++ck_entersub_args_core||| ++ck_entersub_args_list||5.013006| ++ck_entersub_args_proto_or_list||5.013006| ++ck_entersub_args_proto||5.013006| ++ck_warner_d||5.011001|v ++ck_warner||5.011001|v ++ckwarn_common||| ++ckwarn_d||5.009003| ++ckwarn||5.009003| ++cl_and|||n ++cl_anything|||n ++cl_init|||n ++cl_is_anything|||n ++cl_or|||n ++clear_placeholders||| ++clone_params_del|||n ++clone_params_new|||n ++closest_cop||| ++compute_EXACTish||| ++convert||| ++cop_fetch_label||5.015001| ++cop_free||| ++cop_hints_2hv||5.013007| ++cop_hints_fetch_pvn||5.013007| ++cop_hints_fetch_pvs||5.013007| ++cop_hints_fetch_pv||5.013007| ++cop_hints_fetch_sv||5.013007| ++cop_store_label||5.015001| ++cophh_2hv||5.013007| ++cophh_copy||5.013007| ++cophh_delete_pvn||5.013007| ++cophh_delete_pvs||5.013007| ++cophh_delete_pv||5.013007| ++cophh_delete_sv||5.013007| ++cophh_fetch_pvn||5.013007| ++cophh_fetch_pvs||5.013007| ++cophh_fetch_pv||5.013007| ++cophh_fetch_sv||5.013007| ++cophh_free||5.013007| ++cophh_new_empty||5.019003| ++cophh_store_pvn||5.013007| ++cophh_store_pvs||5.013007| ++cophh_store_pv||5.013007| ++cophh_store_sv||5.013007| ++core_prototype||| ++core_regclass_swash||| ++coresub_op||| ++could_it_be_a_POSIX_class||| ++cr_textfilter||| ++create_eval_scope||| ++croak_memory_wrap||5.019003|n ++croak_no_mem|||n ++croak_no_modify||5.013003|n ++croak_nocontext|||vn ++croak_popstack|||n ++croak_sv||5.013001| ++croak_xs_usage||5.010001|n ++croak|||v ++csighandler||5.009003|n ++curmad||| ++current_re_engine||| ++curse||| ++custom_op_desc||5.007003| ++custom_op_name||5.007003| ++custom_op_register||5.013007| ++custom_op_xop||5.013007| ++cv_ckproto_len_flags||| ++cv_clone_into||| ++cv_clone||| ++cv_const_sv_or_av||| ++cv_const_sv||5.004000| ++cv_dump||| ++cv_forget_slab||| ++cv_get_call_checker||5.013006| ++cv_set_call_checker||5.013006| ++cv_undef||| ++cvgv_set||| ++cvstash_set||| ++cx_dump||5.005000| ++cx_dup||| ++cxinc||| ++dAXMARK|5.009003||p ++dAX|5.007002||p ++dITEMS|5.007002||p ++dMARK||| ++dMULTICALL||5.009003| ++dMY_CXT_SV|5.007003||p ++dMY_CXT|5.007003||p ++dNOOP|5.006000||p ++dORIGMARK||| ++dSP||| ++dTHR|5.004050||p ++dTHXR|5.019002||p ++dTHXa|5.006000||p ++dTHXoa|5.006000||p ++dTHX|5.006000||p ++dUNDERBAR|5.009002||p ++dVAR|5.009003||p ++dXCPT|5.009002||p ++dXSARGS||| ++dXSI32||| ++dXSTARG|5.006000||p ++deb_curcv||| ++deb_nocontext|||vn ++deb_stack_all||| ++deb_stack_n||| ++debop||5.005000| ++debprofdump||5.005000| ++debprof||| ++debstackptrs||5.007003| ++debstack||5.007003| ++debug_start_match||| ++deb||5.007003|v ++defelem_target||| ++del_sv||| ++delete_eval_scope||| ++delimcpy||5.004000|n ++deprecate_commaless_var_list||| ++despatch_signals||5.007001| ++destroy_matcher||| ++die_nocontext|||vn ++die_sv||5.013001| ++die_unwind||| ++die|||v ++dirp_dup||| ++div128||| ++djSP||| ++do_aexec5||| ++do_aexec||| ++do_aspawn||| ++do_binmode||5.004050| ++do_chomp||| ++do_close||| ++do_delete_local||| ++do_dump_pad||| ++do_eof||| ++do_exec3||| ++do_execfree||| ++do_exec||| ++do_gv_dump||5.006000| ++do_gvgv_dump||5.006000| ++do_hv_dump||5.006000| ++do_ipcctl||| ++do_ipcget||| ++do_join||| ++do_magic_dump||5.006000| ++do_msgrcv||| ++do_msgsnd||| ++do_ncmp||| ++do_oddball||| ++do_op_dump||5.006000| ++do_op_xmldump||| ++do_open9||5.006000| ++do_openn||5.007001| ++do_open||5.004000| ++do_pmop_dump||5.006000| ++do_pmop_xmldump||| ++do_print||| ++do_readline||| ++do_seek||| ++do_semop||| ++do_shmio||| ++do_smartmatch||| ++do_spawn_nowait||| ++do_spawn||| ++do_sprintf||| ++do_sv_dump||5.006000| ++do_sysseek||| ++do_tell||| ++do_trans_complex_utf8||| ++do_trans_complex||| ++do_trans_count_utf8||| ++do_trans_count||| ++do_trans_simple_utf8||| ++do_trans_simple||| ++do_trans||| ++do_vecget||| ++do_vecset||| ++do_vop||| ++docatch||| ++doeval||| ++dofile||| ++dofindlabel||| ++doform||| ++doing_taint||5.008001|n ++dooneliner||| ++doopen_pm||| ++doparseform||| ++dopoptoeval||| ++dopoptogiven||| ++dopoptolabel||| ++dopoptoloop||| ++dopoptosub_at||| ++dopoptowhen||| ++doref||5.009003| ++dounwind||| ++dowantarray||| ++dump_all_perl||| ++dump_all||5.006000| ++dump_eval||5.006000| ++dump_exec_pos||| ++dump_fds||| ++dump_form||5.006000| ++dump_indent||5.006000|v ++dump_mstats||| ++dump_packsubs_perl||| ++dump_packsubs||5.006000| ++dump_sub_perl||| ++dump_sub||5.006000| ++dump_sv_child||| ++dump_trie_interim_list||| ++dump_trie_interim_table||| ++dump_trie||| ++dump_vindent||5.006000| ++dumpuntil||| ++dup_attrlist||| ++emulate_cop_io||| ++eval_pv|5.006000||p ++eval_sv|5.006000||p ++exec_failed||| ++expect_number||| ++fbm_compile||5.005000| ++fbm_instr||5.005000| ++feature_is_enabled||| ++filter_add||| ++filter_del||| ++filter_gets||| ++filter_read||| ++finalize_optree||| ++finalize_op||| ++find_and_forget_pmops||| ++find_array_subscript||| ++find_beginning||| ++find_byclass||| ++find_hash_subscript||| ++find_in_my_stash||| ++find_lexical_cv||| ++find_runcv_where||| ++find_runcv||5.008001| ++find_rundefsv2||| ++find_rundefsvoffset||5.009002| ++find_rundefsv||5.013002| ++find_script||| ++find_uninit_var||| ++first_symbol|||n ++foldEQ_latin1||5.013008|n ++foldEQ_locale||5.013002|n ++foldEQ_utf8_flags||5.013010| ++foldEQ_utf8||5.013002| ++foldEQ||5.013002|n ++fold_constants||| ++forbid_setid||| ++force_ident_maybe_lex||| ++force_ident||| ++force_list||| ++force_next||| ++force_strict_version||| ++force_version||| ++force_word||| ++forget_pmop||| ++form_nocontext|||vn ++form_short_octal_warning||| ++form||5.004000|v ++fp_dup||| ++fprintf_nocontext|||vn ++free_global_struct||| ++free_tied_hv_pool||| ++free_tmps||| ++gen_constant_list||| ++get_and_check_backslash_N_name||| ++get_aux_mg||| ++get_av|5.006000||p ++get_context||5.006000|n ++get_cvn_flags|5.009005||p ++get_cvs|5.011000||p ++get_cv|5.006000||p ++get_db_sub||| ++get_debug_opts||| ++get_hash_seed||| ++get_hv|5.006000||p ++get_invlist_iter_addr||| ++get_invlist_offset_addr||| ++get_invlist_previous_index_addr||| ++get_mstats||| ++get_no_modify||| ++get_num||| ++get_op_descs||5.005000| ++get_op_names||5.005000| ++get_opargs||| ++get_ppaddr||5.006000| ++get_re_arg||| ++get_sv|5.006000||p ++get_vtbl||5.005030| ++getcwd_sv||5.007002| ++getenv_len||| ++glob_2number||| ++glob_assign_glob||| ++glob_assign_ref||| ++gp_dup||| ++gp_free||| ++gp_ref||| ++grok_bin|5.007003||p ++grok_bslash_N||| ++grok_bslash_c||| ++grok_bslash_o||| ++grok_bslash_x||| ++grok_hex|5.007003||p ++grok_number|5.007002||p ++grok_numeric_radix|5.007002||p ++grok_oct|5.007003||p ++group_end||| ++gv_AVadd||| ++gv_HVadd||| ++gv_IOadd||| ++gv_SVadd||| ++gv_add_by_type||5.011000| ++gv_autoload4||5.004000| ++gv_autoload_pvn||5.015004| ++gv_autoload_pv||5.015004| ++gv_autoload_sv||5.015004| ++gv_check||| ++gv_const_sv||5.009003| ++gv_dump||5.006000| ++gv_efullname3||5.004000| ++gv_efullname4||5.006001| ++gv_efullname||| ++gv_ename||| ++gv_fetchfile_flags||5.009005| ++gv_fetchfile||| ++gv_fetchmeth_autoload||5.007003| ++gv_fetchmeth_pv_autoload||5.015004| ++gv_fetchmeth_pvn_autoload||5.015004| ++gv_fetchmeth_pvn||5.015004| ++gv_fetchmeth_pv||5.015004| ++gv_fetchmeth_sv_autoload||5.015004| ++gv_fetchmeth_sv||5.015004| ++gv_fetchmethod_autoload||5.004000| ++gv_fetchmethod_pv_flags||5.015004| ++gv_fetchmethod_pvn_flags||5.015004| ++gv_fetchmethod_sv_flags||5.015004| ++gv_fetchmethod||| ++gv_fetchmeth||| ++gv_fetchpvn_flags|5.009002||p ++gv_fetchpvs|5.009004||p ++gv_fetchpv||| ++gv_fetchsv|5.009002||p ++gv_fullname3||5.004000| ++gv_fullname4||5.006001| ++gv_fullname||| ++gv_handler||5.007001| ++gv_init_pvn||5.015004| ++gv_init_pv||5.015004| ++gv_init_svtype||| ++gv_init_sv||5.015004| ++gv_init||| ++gv_magicalize_isa||| ++gv_name_set||5.009004| ++gv_stashpvn|5.004000||p ++gv_stashpvs|5.009003||p ++gv_stashpv||| ++gv_stashsv||| ++gv_try_downgrade||| ++handle_regex_sets||| ++he_dup||| ++hek_dup||| ++hfree_next_entry||| ++hfreeentries||| ++hsplit||| ++hv_assert||| ++hv_auxinit||| ++hv_backreferences_p||| ++hv_clear_placeholders||5.009001| ++hv_clear||| ++hv_common_key_len||5.010000| ++hv_common||5.010000| ++hv_copy_hints_hv||5.009004| ++hv_delayfree_ent||5.004000| ++hv_delete_common||| ++hv_delete_ent||5.004000| ++hv_delete||| ++hv_eiter_p||5.009003| ++hv_eiter_set||5.009003| ++hv_ename_add||| ++hv_ename_delete||| ++hv_exists_ent||5.004000| ++hv_exists||| ++hv_fetch_ent||5.004000| ++hv_fetchs|5.009003||p ++hv_fetch||| ++hv_fill||5.013002| ++hv_free_ent_ret||| ++hv_free_ent||5.004000| ++hv_iterinit||| ++hv_iterkeysv||5.004000| ++hv_iterkey||| ++hv_iternext_flags||5.008000| ++hv_iternextsv||| ++hv_iternext||| ++hv_iterval||| ++hv_kill_backrefs||| ++hv_ksplit||5.004000| ++hv_magic_check|||n ++hv_magic||| ++hv_name_set||5.009003| ++hv_notallowed||| ++hv_placeholders_get||5.009003| ++hv_placeholders_p||| ++hv_placeholders_set||5.009003| ++hv_rand_set||5.017011| ++hv_riter_p||5.009003| ++hv_riter_set||5.009003| ++hv_scalar||5.009001| ++hv_store_ent||5.004000| ++hv_store_flags||5.008000| ++hv_stores|5.009004||p ++hv_store||| ++hv_undef_flags||| ++hv_undef||| ++ibcmp_locale||5.004000| ++ibcmp_utf8||5.007003| ++ibcmp||| ++incline||| ++incpush_if_exists||| ++incpush_use_sep||| ++incpush||| ++ingroup||| ++init_argv_symbols||| ++init_constants||| ++init_dbargs||| ++init_debugger||| ++init_global_struct||| ++init_i18nl10n||5.006000| ++init_i18nl14n||5.006000| ++init_ids||| ++init_interp||| ++init_main_stash||| ++init_perllib||| ++init_postdump_symbols||| ++init_predump_symbols||| ++init_stacks||5.005000| ++init_tm||5.007002| ++inplace_aassign||| ++instr|||n ++intro_my||| ++intuit_method||| ++intuit_more||| ++invert||| ++invlist_array||| ++invlist_clone||| ++invlist_extend||| ++invlist_highest||| ++invlist_is_iterating||| ++invlist_iterfinish||| ++invlist_iterinit||| ++invlist_iternext||| ++invlist_max||| ++invlist_previous_index||| ++invlist_set_len||| ++invlist_set_previous_index||| ++invlist_trim||| ++invoke_exception_hook||| ++io_close||| ++isALNUMC|5.006000||p ++isALNUM_lazy||| ++isALPHANUMERIC||5.017008| ++isALPHA||| ++isASCII|5.006000|5.006000|p ++isBLANK|5.006001||p ++isCNTRL|5.006000|5.006000|p ++isDIGIT||| ++isFOO_lc||| ++isFOO_utf8_lc||| ++isGRAPH|5.006000||p ++isGV_with_GP|5.009004||p ++isIDCONT||5.017008| ++isIDFIRST_lazy||| ++isIDFIRST||| ++isLOWER||| ++isOCTAL||5.013005| ++isPRINT|5.004000||p ++isPSXSPC|5.006001||p ++isPUNCT|5.006000||p ++isSPACE||| ++isUPPER||| ++isWORDCHAR||5.013006| ++isXDIGIT|5.006000||p ++is_an_int||| ++is_ascii_string||5.011000|n ++is_cur_LC_category_utf8||| ++is_handle_constructor|||n ++is_list_assignment||| ++is_lvalue_sub||5.007001| ++is_uni_alnum_lc||5.006000| ++is_uni_alnumc_lc||5.017007| ++is_uni_alnumc||5.017007| ++is_uni_alnum||5.006000| ++is_uni_alpha_lc||5.006000| ++is_uni_alpha||5.006000| ++is_uni_ascii_lc||5.006000| ++is_uni_ascii||5.006000| ++is_uni_blank_lc||5.017002| ++is_uni_blank||5.017002| ++is_uni_cntrl_lc||5.006000| ++is_uni_cntrl||5.006000| ++is_uni_digit_lc||5.006000| ++is_uni_digit||5.006000| ++is_uni_graph_lc||5.006000| ++is_uni_graph||5.006000| ++is_uni_idfirst_lc||5.006000| ++is_uni_idfirst||5.006000| ++is_uni_lower_lc||5.006000| ++is_uni_lower||5.006000| ++is_uni_print_lc||5.006000| ++is_uni_print||5.006000| ++is_uni_punct_lc||5.006000| ++is_uni_punct||5.006000| ++is_uni_space_lc||5.006000| ++is_uni_space||5.006000| ++is_uni_upper_lc||5.006000| ++is_uni_upper||5.006000| ++is_uni_xdigit_lc||5.006000| ++is_uni_xdigit||5.006000| ++is_utf8_alnumc||5.017007| ++is_utf8_alnum||5.006000| ++is_utf8_alpha||5.006000| ++is_utf8_ascii||5.006000| ++is_utf8_blank||5.017002| ++is_utf8_char_buf||5.015008|n ++is_utf8_char_slow|||n ++is_utf8_char||5.006000|n ++is_utf8_cntrl||5.006000| ++is_utf8_common||| ++is_utf8_digit||5.006000| ++is_utf8_graph||5.006000| ++is_utf8_idcont||5.008000| ++is_utf8_idfirst||5.006000| ++is_utf8_lower||5.006000| ++is_utf8_mark||5.006000| ++is_utf8_perl_space||5.011001| ++is_utf8_perl_word||5.011001| ++is_utf8_posix_digit||5.011001| ++is_utf8_print||5.006000| ++is_utf8_punct||5.006000| ++is_utf8_space||5.006000| ++is_utf8_string_loclen||5.009003|n ++is_utf8_string_loc||5.008001|n ++is_utf8_string||5.006001|n ++is_utf8_upper||5.006000| ++is_utf8_xdigit||5.006000| ++is_utf8_xidcont||5.013010| ++is_utf8_xidfirst||5.013010| ++isa_lookup||| ++items|||n ++ix|||n ++jmaybe||| ++join_exact||| ++keyword_plugin_standard||| ++keyword||| ++leave_scope||| ++lex_bufutf8||5.011002| ++lex_discard_to||5.011002| ++lex_grow_linestr||5.011002| ++lex_next_chunk||5.011002| ++lex_peek_unichar||5.011002| ++lex_read_space||5.011002| ++lex_read_to||5.011002| ++lex_read_unichar||5.011002| ++lex_start||5.009005| ++lex_stuff_pvn||5.011002| ++lex_stuff_pvs||5.013005| ++lex_stuff_pv||5.013006| ++lex_stuff_sv||5.011002| ++lex_unstuff||5.011002| ++listkids||| ++list||| ++load_module_nocontext|||vn ++load_module|5.006000||pv ++localize||| ++looks_like_bool||| ++looks_like_number||| ++lop||| ++mPUSHi|5.009002||p ++mPUSHn|5.009002||p ++mPUSHp|5.009002||p ++mPUSHs|5.010001||p ++mPUSHu|5.009002||p ++mXPUSHi|5.009002||p ++mXPUSHn|5.009002||p ++mXPUSHp|5.009002||p ++mXPUSHs|5.010001||p ++mXPUSHu|5.009002||p ++mad_free||| ++madlex||| ++madparse||| ++magic_clear_all_env||| ++magic_cleararylen_p||| ++magic_clearenv||| ++magic_clearhints||| ++magic_clearhint||| ++magic_clearisa||| ++magic_clearpack||| ++magic_clearsig||| ++magic_copycallchecker||| ++magic_dump||5.006000| ++magic_existspack||| ++magic_freearylen_p||| ++magic_freeovrld||| ++magic_getarylen||| ++magic_getdefelem||| ++magic_getnkeys||| ++magic_getpack||| ++magic_getpos||| ++magic_getsig||| ++magic_getsubstr||| ++magic_gettaint||| ++magic_getuvar||| ++magic_getvec||| ++magic_get||| ++magic_killbackrefs||| ++magic_methcall1||| ++magic_methcall|||v ++magic_methpack||| ++magic_nextpack||| ++magic_regdata_cnt||| ++magic_regdatum_get||| ++magic_regdatum_set||| ++magic_scalarpack||| ++magic_set_all_env||| ++magic_setarylen||| ++magic_setcollxfrm||| ++magic_setdbline||| ++magic_setdefelem||| ++magic_setenv||| ++magic_sethint||| ++magic_setisa||| ++magic_setmglob||| ++magic_setnkeys||| ++magic_setpack||| ++magic_setpos||| ++magic_setregexp||| ++magic_setsig||| ++magic_setsubstr||| ++magic_settaint||| ++magic_setutf8||| ++magic_setuvar||| ++magic_setvec||| ++magic_set||| ++magic_sizepack||| ++magic_wipepack||| ++make_matcher||| ++make_trie_failtable||| ++make_trie||| ++malloc_good_size|||n ++malloced_size|||n ++malloc||5.007002|n ++markstack_grow||| ++matcher_matches_sv||| ++mayberelocate||| ++measure_struct||| ++memEQs|5.009005||p ++memEQ|5.004000||p ++memNEs|5.009005||p ++memNE|5.004000||p ++mem_collxfrm||| ++mem_log_common|||n ++mess_alloc||| ++mess_nocontext|||vn ++mess_sv||5.013001| ++mess||5.006000|v ++method_common||| ++mfree||5.007002|n ++mg_clear||| ++mg_copy||| ++mg_dup||| ++mg_find_mglob||| ++mg_findext||5.013008| ++mg_find||| ++mg_free_type||5.013006| ++mg_free||| ++mg_get||| ++mg_length||5.005000| ++mg_localize||| ++mg_magical||| ++mg_set||| ++mg_size||5.005000| ++mini_mktime||5.007002| ++minus_v||| ++missingterm||| ++mode_from_discipline||| ++modkids||| ++more_bodies||| ++more_sv||| ++moreswitches||| ++mro_clean_isarev||| ++mro_gather_and_rename||| ++mro_get_from_name||5.010001| ++mro_get_linear_isa_dfs||| ++mro_get_linear_isa||5.009005| ++mro_get_private_data||5.010001| ++mro_isa_changed_in||| ++mro_meta_dup||| ++mro_meta_init||| ++mro_method_changed_in||5.009005| ++mro_package_moved||| ++mro_register||5.010001| ++mro_set_mro||5.010001| ++mro_set_private_data||5.010001| ++mul128||| ++mulexp10|||n ++my_atof2||5.007002| ++my_atof||5.006000| ++my_attrs||| ++my_bcopy|||n ++my_bzero|||n ++my_chsize||| ++my_clearenv||| ++my_cxt_index||| ++my_cxt_init||| ++my_dirfd||5.009005| ++my_exit_jump||| ++my_exit||| ++my_failure_exit||5.004000| ++my_fflush_all||5.006000| ++my_fork||5.007003|n ++my_kid||| ++my_lstat_flags||| ++my_lstat||5.019003| ++my_memcmp|||n ++my_memset||5.004000|n ++my_pclose||5.004000| ++my_popen_list||5.007001| ++my_popen||5.004000| ++my_setenv||| ++my_snprintf|5.009004||pvn ++my_socketpair||5.007003|n ++my_sprintf|5.009003||pvn ++my_stat_flags||| ++my_stat||5.019003| ++my_strftime||5.007002| ++my_strlcat|5.009004||pn ++my_strlcpy|5.009004||pn ++my_unexec||| ++my_vsnprintf||5.009004|n ++need_utf8|||n ++newANONATTRSUB||5.006000| ++newANONHASH||| ++newANONLIST||| ++newANONSUB||| ++newASSIGNOP||| ++newATTRSUB_flags||| ++newATTRSUB||5.006000| ++newAVREF||| ++newAV||| ++newBINOP||| ++newCONDOP||| ++newCONSTSUB_flags||5.015006| ++newCONSTSUB|5.004050||p ++newCVREF||| ++newDEFSVOP||| ++newFORM||| ++newFOROP||5.013007| ++newGIVENOP||5.009003| ++newGIVWHENOP||| ++newGP||| ++newGVOP||| ++newGVREF||| ++newGVgen_flags||5.015004| ++newGVgen||| ++newHVREF||| ++newHVhv||5.005000| ++newHV||| ++newIO||| ++newLISTOP||| ++newLOGOP||| ++newLOOPEX||| ++newLOOPOP||| ++newMADPROP||| ++newMADsv||| ++newMYSUB||5.017004| ++newNULLLIST||| ++newOP||| ++newPADOP||| ++newPMOP||| ++newPROG||| ++newPVOP||| ++newRANGE||| ++newRV_inc|5.004000||p ++newRV_noinc|5.004000||p ++newRV||| ++newSLICEOP||| ++newSTATEOP||| ++newSTUB||| ++newSUB||| ++newSVOP||| ++newSVREF||| ++newSV_type|5.009005||p ++newSVhek||5.009003| ++newSViv||| ++newSVnv||| ++newSVpadname||5.017004| ++newSVpv_share||5.013006| ++newSVpvf_nocontext|||vn ++newSVpvf||5.004000|v ++newSVpvn_flags|5.010001||p ++newSVpvn_share|5.007001||p ++newSVpvn_utf8|5.010001||p ++newSVpvn|5.004050||p ++newSVpvs_flags|5.010001||p ++newSVpvs_share|5.009003||p ++newSVpvs|5.009003||p ++newSVpv||| ++newSVrv||| ++newSVsv||| ++newSVuv|5.006000||p ++newSV||| ++newTOKEN||| ++newUNOP||| ++newWHENOP||5.009003| ++newWHILEOP||5.013007| ++newXS_flags||5.009004| ++newXS_len_flags||| ++newXSproto||5.006000| ++newXS||5.006000| ++new_collate||5.006000| ++new_constant||| ++new_ctype||5.006000| ++new_he||| ++new_logop||| ++new_numeric||5.006000| ++new_stackinfo||5.005000| ++new_version||5.009000| ++new_warnings_bitfield||| ++next_symbol||| ++nextargv||| ++nextchar||| ++ninstr|||n ++no_bareword_allowed||| ++no_fh_allowed||| ++no_op||| ++not_a_number||| ++not_incrementable||| ++nothreadhook||5.008000| ++nuke_stacks||| ++num_overflow|||n ++oopsAV||| ++oopsHV||| ++op_append_elem||5.013006| ++op_append_list||5.013006| ++op_clear||| ++op_const_sv||| ++op_contextualize||5.013006| ++op_dump||5.006000| ++op_free||| ++op_getmad_weak||| ++op_getmad||| ++op_integerize||| ++op_linklist||5.013006| ++op_lvalue_flags||| ++op_lvalue||5.013007| ++op_null||5.007002| ++op_prepend_elem||5.013006| ++op_refcnt_dec||| ++op_refcnt_inc||| ++op_refcnt_lock||5.009002| ++op_refcnt_unlock||5.009002| ++op_scope||5.013007| ++op_std_init||| ++op_unscope||| ++op_xmldump||| ++open_script||| ++opslab_force_free||| ++opslab_free_nopad||| ++opslab_free||| ++pMY_CXT_|5.007003||p ++pMY_CXT|5.007003||p ++pTHX_|5.006000||p ++pTHX|5.006000||p ++packWARN|5.007003||p ++pack_cat||5.007003| ++pack_rec||| ++package_version||| ++package||| ++packlist||5.008001| ++pad_add_anon||5.008001| ++pad_add_name_pvn||5.015001| ++pad_add_name_pvs||5.015001| ++pad_add_name_pv||5.015001| ++pad_add_name_sv||5.015001| ++pad_alloc_name||| ++pad_alloc||| ++pad_block_start||| ++pad_check_dup||| ++pad_compname_type||5.009003| ++pad_findlex||| ++pad_findmy_pvn||5.015001| ++pad_findmy_pvs||5.015001| ++pad_findmy_pv||5.015001| ++pad_findmy_sv||5.015001| ++pad_fixup_inner_anons||| ++pad_free||| ++pad_leavemy||| ++pad_new||5.008001| ++pad_peg|||n ++pad_push||| ++pad_reset||| ++pad_setsv||| ++pad_sv||| ++pad_swipe||| ++pad_tidy||5.008001| ++padlist_dup||| ++padlist_store||| ++parse_arithexpr||5.013008| ++parse_barestmt||5.013007| ++parse_block||5.013007| ++parse_body||| ++parse_fullexpr||5.013008| ++parse_fullstmt||5.013005| ++parse_ident||| ++parse_label||5.013007| ++parse_listexpr||5.013008| ++parse_lparen_question_flags||| ++parse_stmtseq||5.013006| ++parse_termexpr||5.013008| ++parse_unicode_opts||| ++parser_dup||| ++parser_free_nexttoke_ops||| ++parser_free||| ++path_is_searchable|||n ++peep||| ++pending_ident||| ++perl_alloc_using|||n ++perl_alloc|||n ++perl_clone_using|||n ++perl_clone|||n ++perl_construct|||n ++perl_destruct||5.007003|n ++perl_free|||n ++perl_parse||5.006000|n ++perl_run|||n ++pidgone||| ++pm_description||| ++pmop_dump||5.006000| ++pmop_xmldump||| ++pmruntime||| ++pmtrans||| ++pop_scope||| ++populate_isa|||v ++pregcomp||5.009005| ++pregexec||| ++pregfree2||5.011000| ++pregfree||| ++prepend_madprops||| ++prescan_version||5.011004| ++printbuf||| ++printf_nocontext|||vn ++process_special_blocks||| ++ptr_hash|||n ++ptr_table_clear||5.009005| ++ptr_table_fetch||5.009005| ++ptr_table_find|||n ++ptr_table_free||5.009005| ++ptr_table_new||5.009005| ++ptr_table_split||5.009005| ++ptr_table_store||5.009005| ++push_scope||| ++put_byte||| ++put_latin1_charclass_innards||| ++pv_display|5.006000||p ++pv_escape|5.009004||p ++pv_pretty|5.009004||p ++pv_uni_display||5.007003| ++qerror||| ++qsortsvu||| ++re_compile||5.009005| ++re_croak2||| ++re_dup_guts||| ++re_intuit_start||5.019001| ++re_intuit_string||5.006000| ++re_op_compile||| ++readpipe_override||| ++realloc||5.007002|n ++reentrant_free||5.019003| ++reentrant_init||5.019003| ++reentrant_retry||5.019003|vn ++reentrant_size||5.019003| ++ref_array_or_hash||| ++refcounted_he_chain_2hv||| ++refcounted_he_fetch_pvn||| ++refcounted_he_fetch_pvs||| ++refcounted_he_fetch_pv||| ++refcounted_he_fetch_sv||| ++refcounted_he_free||| ++refcounted_he_inc||| ++refcounted_he_new_pvn||| ++refcounted_he_new_pvs||| ++refcounted_he_new_pv||| ++refcounted_he_new_sv||| ++refcounted_he_value||| ++refkids||| ++refto||| ++ref||5.019003| ++reg_check_named_buff_matched||| ++reg_named_buff_all||5.009005| ++reg_named_buff_exists||5.009005| ++reg_named_buff_fetch||5.009005| ++reg_named_buff_firstkey||5.009005| ++reg_named_buff_iter||| ++reg_named_buff_nextkey||5.009005| ++reg_named_buff_scalar||5.009005| ++reg_named_buff||| ++reg_node||| ++reg_numbered_buff_fetch||| ++reg_numbered_buff_length||| ++reg_numbered_buff_store||| ++reg_qr_package||| ++reg_recode||| ++reg_scan_name||| ++reg_skipcomment||| ++reg_temp_copy||| ++reganode||| ++regatom||| ++regbranch||| ++regclass_swash||5.009004| ++regclass||| ++regcppop||| ++regcppush||| ++regcurly||| ++regdump_extflags||| ++regdump_intflags||| ++regdump||5.005000| ++regdupe_internal||| ++regexec_flags||5.005000| ++regfree_internal||5.009005| ++reghop3|||n ++reghop4|||n ++reghopmaybe3|||n ++reginclass||| ++reginitcolors||5.006000| ++reginsert||| ++regmatch||| ++regnext||5.005000| ++regpatws|||n ++regpiece||| ++regpposixcc||| ++regprop||| ++regrepeat||| ++regtail_study||| ++regtail||| ++regtry||| ++reguni||| ++regwhite|||n ++reg||| ++repeatcpy|||n ++report_evil_fh||| ++report_redefined_cv||| ++report_uninit||| ++report_wrongway_fh||| ++require_pv||5.006000| ++require_tie_mod||| ++restore_magic||| ++rninstr|||n ++rpeep||| ++rsignal_restore||| ++rsignal_save||| ++rsignal_state||5.004000| ++rsignal||5.004000| ++run_body||| ++run_user_filter||| ++runops_debug||5.005000| ++runops_standard||5.005000| ++rv2cv_op_cv||5.013006| ++rvpv_dup||| ++rxres_free||| ++rxres_restore||| ++rxres_save||| ++safesyscalloc||5.006000|n ++safesysfree||5.006000|n ++safesysmalloc||5.006000|n ++safesysrealloc||5.006000|n ++same_dirent||| ++save_I16||5.004000| ++save_I32||| ++save_I8||5.006000| ++save_adelete||5.011000| ++save_aelem_flags||5.011000| ++save_aelem||5.004050| ++save_alloc||5.006000| ++save_aptr||| ++save_ary||| ++save_bool||5.008001| ++save_clearsv||| ++save_delete||| ++save_destructor_x||5.006000| ++save_destructor||5.006000| ++save_freeop||| ++save_freepv||| ++save_freesv||| ++save_generic_pvref||5.006001| ++save_generic_svref||5.005030| ++save_gp||5.004000| ++save_hash||| ++save_hdelete||5.011000| ++save_hek_flags|||n ++save_helem_flags||5.011000| ++save_helem||5.004050| ++save_hints||5.010001| ++save_hptr||| ++save_int||| ++save_item||| ++save_iv||5.005000| ++save_lines||| ++save_list||| ++save_long||| ++save_magic_flags||| ++save_mortalizesv||5.007001| ++save_nogv||| ++save_op||5.005000| ++save_padsv_and_mortalize||5.010001| ++save_pptr||| ++save_pushi32ptr||5.010001| ++save_pushptri32ptr||| ++save_pushptrptr||5.010001| ++save_pushptr||5.010001| ++save_re_context||5.006000| ++save_scalar_at||| ++save_scalar||| ++save_set_svflags||5.009000| ++save_shared_pvref||5.007003| ++save_sptr||| ++save_svref||| ++save_vptr||5.006000| ++savepvn||| ++savepvs||5.009003| ++savepv||| ++savesharedpvn||5.009005| ++savesharedpvs||5.013006| ++savesharedpv||5.007003| ++savesharedsvpv||5.013006| ++savestack_grow_cnt||5.008001| ++savestack_grow||| ++savesvpv||5.009002| ++sawparens||| ++scalar_mod_type|||n ++scalarboolean||| ++scalarkids||| ++scalarseq||| ++scalarvoid||| ++scalar||| ++scan_bin||5.006000| ++scan_commit||| ++scan_const||| ++scan_formline||| ++scan_heredoc||| ++scan_hex||| ++scan_ident||| ++scan_inputsymbol||| ++scan_num||5.007001| ++scan_oct||| ++scan_pat||| ++scan_str||| ++scan_subst||| ++scan_trans||| ++scan_version||5.009001| ++scan_vstring||5.009005| ++scan_word||| ++screaminstr||5.005000| ++search_const||| ++seed||5.008001| ++sequence_num||| ++set_context||5.006000|n ++set_numeric_local||5.006000| ++set_numeric_radix||5.006000| ++set_numeric_standard||5.006000| ++setdefout||| ++share_hek_flags||| ++share_hek||5.004000| ++si_dup||| ++sighandler|||n ++simplify_sort||| ++skipspace0||| ++skipspace1||| ++skipspace2||| ++skipspace_flags||| ++softref2xv||| ++sortcv_stacked||| ++sortcv_xsub||| ++sortcv||| ++sortsv_flags||5.009003| ++sortsv||5.007003| ++space_join_names_mortal||| ++ss_dup||| ++stack_grow||| ++start_force||| ++start_glob||| ++start_subparse||5.004000| ++stdize_locale||| ++strEQ||| ++strGE||| ++strGT||| ++strLE||| ++strLT||| ++strNE||| ++str_to_version||5.006000| ++strip_return||| ++strnEQ||| ++strnNE||| ++study_chunk||| ++sub_crush_depth||| ++sublex_done||| ++sublex_push||| ++sublex_start||| ++sv_2bool_flags||5.013006| ++sv_2bool||| ++sv_2cv||| ++sv_2io||| ++sv_2iuv_common||| ++sv_2iuv_non_preserve||| ++sv_2iv_flags||5.009001| ++sv_2iv||| ++sv_2mortal||| ++sv_2num||| ++sv_2nv_flags||5.013001| ++sv_2pv_flags|5.007002||p ++sv_2pv_nolen|5.006000||p ++sv_2pvbyte_nolen|5.006000||p ++sv_2pvbyte|5.006000||p ++sv_2pvutf8_nolen||5.006000| ++sv_2pvutf8||5.006000| ++sv_2pv||| ++sv_2uv_flags||5.009001| ++sv_2uv|5.004000||p ++sv_add_arena||| ++sv_add_backref||| ++sv_backoff||| ++sv_bless||| ++sv_cat_decode||5.008001| ++sv_catpv_flags||5.013006| ++sv_catpv_mg|5.004050||p ++sv_catpv_nomg||5.013006| ++sv_catpvf_mg_nocontext|||pvn ++sv_catpvf_mg|5.006000|5.004000|pv ++sv_catpvf_nocontext|||vn ++sv_catpvf||5.004000|v ++sv_catpvn_flags||5.007002| ++sv_catpvn_mg|5.004050||p ++sv_catpvn_nomg|5.007002||p ++sv_catpvn||| ++sv_catpvs_flags||5.013006| ++sv_catpvs_mg||5.013006| ++sv_catpvs_nomg||5.013006| ++sv_catpvs|5.009003||p ++sv_catpv||| ++sv_catsv_flags||5.007002| ++sv_catsv_mg|5.004050||p ++sv_catsv_nomg|5.007002||p ++sv_catsv||| ++sv_catxmlpvn||| ++sv_catxmlpv||| ++sv_catxmlsv||| ++sv_chop||| ++sv_clean_all||| ++sv_clean_objs||| ++sv_clear||| ++sv_cmp_flags||5.013006| ++sv_cmp_locale_flags||5.013006| ++sv_cmp_locale||5.004000| ++sv_cmp||| ++sv_collxfrm_flags||5.013006| ++sv_collxfrm||| ++sv_copypv_flags||5.017002| ++sv_copypv_nomg||5.017002| ++sv_copypv||| ++sv_dec_nomg||5.013002| ++sv_dec||| ++sv_del_backref||| ++sv_derived_from_pvn||5.015004| ++sv_derived_from_pv||5.015004| ++sv_derived_from_sv||5.015004| ++sv_derived_from||5.004000| ++sv_destroyable||5.010000| ++sv_display||| ++sv_does_pvn||5.015004| ++sv_does_pv||5.015004| ++sv_does_sv||5.015004| ++sv_does||5.009004| ++sv_dump||| ++sv_dup_common||| ++sv_dup_inc_multiple||| ++sv_dup_inc||| ++sv_dup||| ++sv_eq_flags||5.013006| ++sv_eq||| ++sv_exp_grow||| ++sv_force_normal_flags||5.007001| ++sv_force_normal||5.006000| ++sv_free2||| ++sv_free_arenas||| ++sv_free||| ++sv_gets||5.004000| ++sv_grow||| ++sv_i_ncmp||| ++sv_inc_nomg||5.013002| ++sv_inc||| ++sv_insert_flags||5.010001| ++sv_insert||| ++sv_isa||| ++sv_isobject||| ++sv_iv||5.005000| ++sv_kill_backrefs||| ++sv_len_utf8_nomg||| ++sv_len_utf8||5.006000| ++sv_len||| ++sv_magic_portable|5.019003|5.004000|p ++sv_magicext_mglob||| ++sv_magicext||5.007003| ++sv_magic||| ++sv_mortalcopy_flags||| ++sv_mortalcopy||| ++sv_ncmp||| ++sv_newmortal||| ++sv_newref||| ++sv_nolocking||5.007003| ++sv_nosharing||5.007003| ++sv_nounlocking||| ++sv_nv||5.005000| ++sv_peek||5.005000| ++sv_pos_b2u_flags||5.019003| ++sv_pos_b2u_midway||| ++sv_pos_b2u||5.006000| ++sv_pos_u2b_cached||| ++sv_pos_u2b_flags||5.011005| ++sv_pos_u2b_forwards|||n ++sv_pos_u2b_midway|||n ++sv_pos_u2b||5.006000| ++sv_pvbyten_force||5.006000| ++sv_pvbyten||5.006000| ++sv_pvbyte||5.006000| ++sv_pvn_force_flags|5.007002||p ++sv_pvn_force||| ++sv_pvn_nomg|5.007003|5.005000|p ++sv_pvn||5.005000| ++sv_pvutf8n_force||5.006000| ++sv_pvutf8n||5.006000| ++sv_pvutf8||5.006000| ++sv_pv||5.006000| ++sv_recode_to_utf8||5.007003| ++sv_reftype||| ++sv_ref||| ++sv_release_COW||| ++sv_replace||| ++sv_report_used||| ++sv_resetpvn||| ++sv_reset||| ++sv_rvweaken||5.006000| ++sv_sethek||| ++sv_setiv_mg|5.004050||p ++sv_setiv||| ++sv_setnv_mg|5.006000||p ++sv_setnv||| ++sv_setpv_mg|5.004050||p ++sv_setpvf_mg_nocontext|||pvn ++sv_setpvf_mg|5.006000|5.004000|pv ++sv_setpvf_nocontext|||vn ++sv_setpvf||5.004000|v ++sv_setpviv_mg||5.008001| ++sv_setpviv||5.008001| ++sv_setpvn_mg|5.004050||p ++sv_setpvn||| ++sv_setpvs_mg||5.013006| ++sv_setpvs|5.009004||p ++sv_setpv||| ++sv_setref_iv||| ++sv_setref_nv||| ++sv_setref_pvn||| ++sv_setref_pvs||5.019003| ++sv_setref_pv||| ++sv_setref_uv||5.007001| ++sv_setsv_cow||| ++sv_setsv_flags||5.007002| ++sv_setsv_mg|5.004050||p ++sv_setsv_nomg|5.007002||p ++sv_setsv||| ++sv_setuv_mg|5.004050||p ++sv_setuv|5.004000||p ++sv_tainted||5.004000| ++sv_taint||5.004000| ++sv_true||5.005000| ++sv_unglob||| ++sv_uni_display||5.007003| ++sv_unmagicext||5.013008| ++sv_unmagic||| ++sv_unref_flags||5.007001| ++sv_unref||| ++sv_untaint||5.004000| ++sv_upgrade||| ++sv_usepvn_flags||5.009004| ++sv_usepvn_mg|5.004050||p ++sv_usepvn||| ++sv_utf8_decode||5.006000| ++sv_utf8_downgrade||5.006000| ++sv_utf8_encode||5.006000| ++sv_utf8_upgrade_flags_grow||5.011000| ++sv_utf8_upgrade_flags||5.007002| ++sv_utf8_upgrade_nomg||5.007002| ++sv_utf8_upgrade||5.007001| ++sv_uv|5.005000||p ++sv_vcatpvf_mg|5.006000|5.004000|p ++sv_vcatpvfn_flags||5.017002| ++sv_vcatpvfn||5.004000| ++sv_vcatpvf|5.006000|5.004000|p ++sv_vsetpvf_mg|5.006000|5.004000|p ++sv_vsetpvfn||5.004000| ++sv_vsetpvf|5.006000|5.004000|p ++sv_xmlpeek||| ++svtype||| ++swallow_bom||| ++swash_fetch||5.007002| ++swash_init||5.006000| ++swatch_get||| ++sys_init3||5.010000|n ++sys_init||5.010000|n ++sys_intern_clear||| ++sys_intern_dup||| ++sys_intern_init||| ++sys_term||5.010000|n ++taint_env||| ++taint_proper||| ++tied_method|||v ++tmps_grow||5.006000| ++toFOLD_uni||5.007003| ++toFOLD_utf8||5.019001| ++toFOLD||5.019001| ++toLOWER_L1||5.019001| ++toLOWER_LC||5.004000| ++toLOWER_uni||5.007003| ++toLOWER_utf8||5.015007| ++toLOWER||| ++toTITLE_uni||5.007003| ++toTITLE_utf8||5.015007| ++toTITLE||5.019001| ++toUPPER_uni||5.007003| ++toUPPER_utf8||5.015007| ++toUPPER||5.004000| ++to_byte_substr||| ++to_lower_latin1||| ++to_uni_fold||5.007003| ++to_uni_lower_lc||5.006000| ++to_uni_lower||5.007003| ++to_uni_title_lc||5.006000| ++to_uni_title||5.007003| ++to_uni_upper_lc||5.006000| ++to_uni_upper||5.007003| ++to_utf8_case||5.007003| ++to_utf8_fold||5.015007| ++to_utf8_lower||5.015007| ++to_utf8_substr||| ++to_utf8_title||5.015007| ++to_utf8_upper||5.015007| ++token_free||| ++token_getmad||| ++tokenize_use||| ++tokeq||| ++tokereport||| ++too_few_arguments_pv||| ++too_few_arguments_sv||| ++too_many_arguments_pv||| ++too_many_arguments_sv||| ++translate_substr_offsets||| ++try_amagic_bin||| ++try_amagic_un||| ++uiv_2buf|||n ++unlnk||| ++unpack_rec||| ++unpack_str||5.007003| ++unpackstring||5.008001| ++unreferenced_to_tmp_stack||| ++unshare_hek_or_pvn||| ++unshare_hek||| ++unsharepvn||5.004000| ++unwind_handler_stack||| ++update_debugger_info||| ++upg_version||5.009005| ++usage||| ++utf16_textfilter||| ++utf16_to_utf8_reversed||5.006001| ++utf16_to_utf8||5.006001| ++utf8_distance||5.006000| ++utf8_hop||5.006000| ++utf8_length||5.007001| ++utf8_mg_len_cache_update||| ++utf8_mg_pos_cache_update||| ++utf8_to_bytes||5.006001| ++utf8_to_uvchr_buf||5.015009| ++utf8_to_uvchr||5.007001| ++utf8_to_uvuni_buf||5.015009| ++utf8_to_uvuni||5.007001| ++utf8n_to_uvchr||| ++utf8n_to_uvuni||5.007001| ++utilize||| ++uvchr_to_utf8_flags||5.007003| ++uvchr_to_utf8||| ++uvuni_to_utf8_flags||5.007003| ++uvuni_to_utf8||5.007001| ++valid_utf8_to_uvchr||| ++valid_utf8_to_uvuni||5.015009| ++validate_proto||| ++validate_suid||| ++varname||| ++vcmp||5.009000| ++vcroak||5.006000| ++vdeb||5.007003| ++vform||5.006000| ++visit||| ++vivify_defelem||| ++vivify_ref||| ++vload_module|5.006000||p ++vmess||5.006000| ++vnewSVpvf|5.006000|5.004000|p ++vnormal||5.009002| ++vnumify||5.009000| ++vstringify||5.009000| ++vverify||5.009003| ++vwarner||5.006000| ++vwarn||5.006000| ++wait4pid||| ++warn_nocontext|||vn ++warn_sv||5.013001| ++warner_nocontext|||vn ++warner|5.006000|5.004000|pv ++warn|||v ++was_lvalue_sub||| ++watch||| ++whichsig_pvn||5.015004| ++whichsig_pv||5.015004| ++whichsig_sv||5.015004| ++whichsig||| ++win32_croak_not_implemented|||n ++with_queued_errors||| ++wrap_op_checker||5.015008| ++write_to_stderr||| ++xmldump_all_perl||| ++xmldump_all||| ++xmldump_attr||| ++xmldump_eval||| ++xmldump_form||| ++xmldump_indent|||v ++xmldump_packsubs_perl||| ++xmldump_packsubs||| ++xmldump_sub_perl||| ++xmldump_sub||| ++xmldump_vindent||| ++xs_apiversion_bootcheck||| ++xs_version_bootcheck||| ++yyerror_pvn||| ++yyerror_pv||| ++yyerror||| ++yylex||| ++yyparse||| ++yyunlex||| ++yywarn||| ++); ++ ++if (exists $opt{'list-unsupported'}) { ++ my $f; ++ for $f (sort { lc $a cmp lc $b } keys %API) { ++ next unless $API{$f}{todo}; ++ print "$f ", '.'x(40-length($f)), " ", format_version($API{$f}{todo}), "\n"; ++ } ++ exit 0; ++} ++ ++# Scan for possible replacement candidates ++ ++my(%replace, %need, %hints, %warnings, %depends); ++my $replace = 0; ++my($hint, $define, $function); ++ ++sub find_api ++{ ++ my $code = shift; ++ $code =~ s{ ++ / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]*) ++ | "[^"\\]*(?:\\.[^"\\]*)*" ++ | '[^'\\]*(?:\\.[^'\\]*)*' }{}egsx; ++ grep { exists $API{$_} } $code =~ /(\w+)/mg; ++} ++ ++while () { ++ if ($hint) { ++ my $h = $hint->[0] eq 'Hint' ? \%hints : \%warnings; ++ if (m{^\s*\*\s(.*?)\s*$}) { ++ for (@{$hint->[1]}) { ++ $h->{$_} ||= ''; # suppress warning with older perls ++ $h->{$_} .= "$1\n"; ++ } ++ } ++ else { undef $hint } ++ } ++ ++ $hint = [$1, [split /,?\s+/, $2]] ++ if m{^\s*$rccs\s+(Hint|Warning):\s+(\w+(?:,?\s+\w+)*)\s*$}; ++ ++ if ($define) { ++ if ($define->[1] =~ /\\$/) { ++ $define->[1] .= $_; ++ } ++ else { ++ if (exists $API{$define->[0]} && $define->[1] !~ /^DPPP_\(/) { ++ my @n = find_api($define->[1]); ++ push @{$depends{$define->[0]}}, @n if @n ++ } ++ undef $define; ++ } ++ } ++ ++ $define = [$1, $2] if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(.*)}; ++ ++ if ($function) { ++ if (/^}/) { ++ if (exists $API{$function->[0]}) { ++ my @n = find_api($function->[1]); ++ push @{$depends{$function->[0]}}, @n if @n ++ } ++ undef $function; ++ } ++ else { ++ $function->[1] .= $_; ++ } ++ } ++ ++ $function = [$1, ''] if m{^DPPP_\(my_(\w+)\)}; ++ ++ $replace = $1 if m{^\s*$rccs\s+Replace:\s+(\d+)\s+$rcce\s*$}; ++ $replace{$2} = $1 if $replace and m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+)}; ++ $replace{$2} = $1 if m{^\s*#\s*define\s+(\w+)(?:\([^)]*\))?\s+(\w+).*$rccs\s+Replace\s+$rcce}; ++ $replace{$1} = $2 if m{^\s*$rccs\s+Replace (\w+) with (\w+)\s+$rcce\s*$}; ++ ++ if (m{^\s*$rccs\s+(\w+(\s*,\s*\w+)*)\s+depends\s+on\s+(\w+(\s*,\s*\w+)*)\s+$rcce\s*$}) { ++ my @deps = map { s/\s+//g; $_ } split /,/, $3; ++ my $d; ++ for $d (map { s/\s+//g; $_ } split /,/, $1) { ++ push @{$depends{$d}}, @deps; ++ } ++ } ++ ++ $need{$1} = 1 if m{^#if\s+defined\(NEED_(\w+)(?:_GLOBAL)?\)}; ++} ++ ++for (values %depends) { ++ my %s; ++ $_ = [sort grep !$s{$_}++, @$_]; ++} ++ ++if (exists $opt{'api-info'}) { ++ my $f; ++ my $count = 0; ++ my $match = $opt{'api-info'} =~ m!^/(.*)/$! ? $1 : "^\Q$opt{'api-info'}\E\$"; ++ for $f (sort { lc $a cmp lc $b } keys %API) { ++ next unless $f =~ /$match/; ++ print "\n=== $f ===\n\n"; ++ my $info = 0; ++ if ($API{$f}{base} || $API{$f}{todo}) { ++ my $base = format_version($API{$f}{base} || $API{$f}{todo}); ++ print "Supported at least starting from perl-$base.\n"; ++ $info++; ++ } ++ if ($API{$f}{provided}) { ++ my $todo = $API{$f}{todo} ? format_version($API{$f}{todo}) : "5.003"; ++ print "Support by $ppport provided back to perl-$todo.\n"; ++ print "Support needs to be explicitly requested by NEED_$f.\n" if exists $need{$f}; ++ print "Depends on: ", join(', ', @{$depends{$f}}), ".\n" if exists $depends{$f}; ++ print "\n$hints{$f}" if exists $hints{$f}; ++ print "\nWARNING:\n$warnings{$f}" if exists $warnings{$f}; ++ $info++; ++ } ++ print "No portability information available.\n" unless $info; ++ $count++; ++ } ++ $count or print "Found no API matching '$opt{'api-info'}'."; ++ print "\n"; ++ exit 0; ++} ++ ++if (exists $opt{'list-provided'}) { ++ my $f; ++ for $f (sort { lc $a cmp lc $b } keys %API) { ++ next unless $API{$f}{provided}; ++ my @flags; ++ push @flags, 'explicit' if exists $need{$f}; ++ push @flags, 'depend' if exists $depends{$f}; ++ push @flags, 'hint' if exists $hints{$f}; ++ push @flags, 'warning' if exists $warnings{$f}; ++ my $flags = @flags ? ' ['.join(', ', @flags).']' : ''; ++ print "$f$flags\n"; ++ } ++ exit 0; ++} ++ ++my @files; ++my @srcext = qw( .xs .c .h .cc .cpp -c.inc -xs.inc ); ++my $srcext = join '|', map { quotemeta $_ } @srcext; ++ ++if (@ARGV) { ++ my %seen; ++ for (@ARGV) { ++ if (-e) { ++ if (-f) { ++ push @files, $_ unless $seen{$_}++; ++ } ++ else { warn "'$_' is not a file.\n" } ++ } ++ else { ++ my @new = grep { -f } glob $_ ++ or warn "'$_' does not exist.\n"; ++ push @files, grep { !$seen{$_}++ } @new; ++ } ++ } ++} ++else { ++ eval { ++ require File::Find; ++ File::Find::find(sub { ++ $File::Find::name =~ /($srcext)$/i ++ and push @files, $File::Find::name; ++ }, '.'); ++ }; ++ if ($@) { ++ @files = map { glob "*$_" } @srcext; ++ } ++} ++ ++if (!@ARGV || $opt{filter}) { ++ my(@in, @out); ++ my %xsc = map { /(.*)\.xs$/ ? ("$1.c" => 1, "$1.cc" => 1) : () } @files; ++ for (@files) { ++ my $out = exists $xsc{$_} || /\b\Q$ppport\E$/i || !/($srcext)$/i; ++ push @{ $out ? \@out : \@in }, $_; ++ } ++ if (@ARGV && @out) { ++ warning("Skipping the following files (use --nofilter to avoid this):\n| ", join "\n| ", @out); ++ } ++ @files = @in; ++} ++ ++die "No input files given!\n" unless @files; ++ ++my(%files, %global, %revreplace); ++%revreplace = reverse %replace; ++my $filename; ++my $patch_opened = 0; ++ ++for $filename (@files) { ++ unless (open IN, "<$filename") { ++ warn "Unable to read from $filename: $!\n"; ++ next; ++ } ++ ++ info("Scanning $filename ..."); ++ ++ my $c = do { local $/; }; ++ close IN; ++ ++ my %file = (orig => $c, changes => 0); ++ ++ # Temporarily remove C/XS comments and strings from the code ++ my @ccom; ++ ++ $c =~ s{ ++ ( ^$HS*\#$HS*include\b[^\r\n]+\b(?:\Q$ppport\E|XSUB\.h)\b[^\r\n]* ++ | ^$HS*\#$HS*(?:define|elif|if(?:def)?)\b[^\r\n]* ) ++ | ( ^$HS*\#[^\r\n]* ++ | "[^"\\]*(?:\\.[^"\\]*)*" ++ | '[^'\\]*(?:\\.[^'\\]*)*' ++ | / (?: \*[^*]*\*+(?:[^$ccs][^*]*\*+)* / | /[^\r\n]* ) ) ++ }{ defined $2 and push @ccom, $2; ++ defined $1 ? $1 : "$ccs$#ccom$cce" }mgsex; ++ ++ $file{ccom} = \@ccom; ++ $file{code} = $c; ++ $file{has_inc_ppport} = $c =~ /^$HS*#$HS*include[^\r\n]+\b\Q$ppport\E\b/m; ++ ++ my $func; ++ ++ for $func (keys %API) { ++ my $match = $func; ++ $match .= "|$revreplace{$func}" if exists $revreplace{$func}; ++ if ($c =~ /\b(?:Perl_)?($match)\b/) { ++ $file{uses_replace}{$1}++ if exists $revreplace{$func} && $1 eq $revreplace{$func}; ++ $file{uses_Perl}{$func}++ if $c =~ /\bPerl_$func\b/; ++ if (exists $API{$func}{provided}) { ++ $file{uses_provided}{$func}++; ++ if (!exists $API{$func}{base} || $API{$func}{base} > $opt{'compat-version'}) { ++ $file{uses}{$func}++; ++ my @deps = rec_depend($func); ++ if (@deps) { ++ $file{uses_deps}{$func} = \@deps; ++ for (@deps) { ++ $file{uses}{$_} = 0 unless exists $file{uses}{$_}; ++ } ++ } ++ for ($func, @deps) { ++ $file{needs}{$_} = 'static' if exists $need{$_}; ++ } ++ } ++ } ++ if (exists $API{$func}{todo} && $API{$func}{todo} > $opt{'compat-version'}) { ++ if ($c =~ /\b$func\b/) { ++ $file{uses_todo}{$func}++; ++ } ++ } ++ } ++ } ++ ++ while ($c =~ /^$HS*#$HS*define$HS+(NEED_(\w+?)(_GLOBAL)?)\b/mg) { ++ if (exists $need{$2}) { ++ $file{defined $3 ? 'needed_global' : 'needed_static'}{$2}++; ++ } ++ else { warning("Possibly wrong #define $1 in $filename") } ++ } ++ ++ for (qw(uses needs uses_todo needed_global needed_static)) { ++ for $func (keys %{$file{$_}}) { ++ push @{$global{$_}{$func}}, $filename; ++ } ++ } ++ ++ $files{$filename} = \%file; ++} ++ ++# Globally resolve NEED_'s ++my $need; ++for $need (keys %{$global{needs}}) { ++ if (@{$global{needs}{$need}} > 1) { ++ my @targets = @{$global{needs}{$need}}; ++ my @t = grep $files{$_}{needed_global}{$need}, @targets; ++ @targets = @t if @t; ++ @t = grep /\.xs$/i, @targets; ++ @targets = @t if @t; ++ my $target = shift @targets; ++ $files{$target}{needs}{$need} = 'global'; ++ for (@{$global{needs}{$need}}) { ++ $files{$_}{needs}{$need} = 'extern' if $_ ne $target; ++ } ++ } ++} ++ ++for $filename (@files) { ++ exists $files{$filename} or next; ++ ++ info("=== Analyzing $filename ==="); ++ ++ my %file = %{$files{$filename}}; ++ my $func; ++ my $c = $file{code}; ++ my $warnings = 0; ++ ++ for $func (sort keys %{$file{uses_Perl}}) { ++ if ($API{$func}{varargs}) { ++ unless ($API{$func}{nothxarg}) { ++ my $changes = ($c =~ s{\b(Perl_$func\s*\(\s*)(?!aTHX_?)(\)|[^\s)]*\))} ++ { $1 . ($2 eq ')' ? 'aTHX' : 'aTHX_ ') . $2 }ge); ++ if ($changes) { ++ warning("Doesn't pass interpreter argument aTHX to Perl_$func"); ++ $file{changes} += $changes; ++ } ++ } ++ } ++ else { ++ warning("Uses Perl_$func instead of $func"); ++ $file{changes} += ($c =~ s{\bPerl_$func(\s*)\((\s*aTHX_?)?\s*} ++ {$func$1(}g); ++ } ++ } ++ ++ for $func (sort keys %{$file{uses_replace}}) { ++ warning("Uses $func instead of $replace{$func}"); ++ $file{changes} += ($c =~ s/\b$func\b/$replace{$func}/g); ++ } ++ ++ for $func (sort keys %{$file{uses_provided}}) { ++ if ($file{uses}{$func}) { ++ if (exists $file{uses_deps}{$func}) { ++ diag("Uses $func, which depends on ", join(', ', @{$file{uses_deps}{$func}})); ++ } ++ else { ++ diag("Uses $func"); ++ } ++ } ++ $warnings += hint($func); ++ } ++ ++ unless ($opt{quiet}) { ++ for $func (sort keys %{$file{uses_todo}}) { ++ print "*** WARNING: Uses $func, which may not be portable below perl ", ++ format_version($API{$func}{todo}), ", even with '$ppport'\n"; ++ $warnings++; ++ } ++ } ++ ++ for $func (sort keys %{$file{needed_static}}) { ++ my $message = ''; ++ if (not exists $file{uses}{$func}) { ++ $message = "No need to define NEED_$func if $func is never used"; ++ } ++ elsif (exists $file{needs}{$func} && $file{needs}{$func} ne 'static') { ++ $message = "No need to define NEED_$func when already needed globally"; ++ } ++ if ($message) { ++ diag($message); ++ $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_$func\b.*$LF//mg); ++ } ++ } ++ ++ for $func (sort keys %{$file{needed_global}}) { ++ my $message = ''; ++ if (not exists $global{uses}{$func}) { ++ $message = "No need to define NEED_${func}_GLOBAL if $func is never used"; ++ } ++ elsif (exists $file{needs}{$func}) { ++ if ($file{needs}{$func} eq 'extern') { ++ $message = "No need to define NEED_${func}_GLOBAL when already needed globally"; ++ } ++ elsif ($file{needs}{$func} eq 'static') { ++ $message = "No need to define NEED_${func}_GLOBAL when only used in this file"; ++ } ++ } ++ if ($message) { ++ diag($message); ++ $file{changes} += ($c =~ s/^$HS*#$HS*define$HS+NEED_${func}_GLOBAL\b.*$LF//mg); ++ } ++ } ++ ++ $file{needs_inc_ppport} = keys %{$file{uses}}; ++ ++ if ($file{needs_inc_ppport}) { ++ my $pp = ''; ++ ++ for $func (sort keys %{$file{needs}}) { ++ my $type = $file{needs}{$func}; ++ next if $type eq 'extern'; ++ my $suffix = $type eq 'global' ? '_GLOBAL' : ''; ++ unless (exists $file{"needed_$type"}{$func}) { ++ if ($type eq 'global') { ++ diag("Files [@{$global{needs}{$func}}] need $func, adding global request"); ++ } ++ else { ++ diag("File needs $func, adding static request"); ++ } ++ $pp .= "#define NEED_$func$suffix\n"; ++ } ++ } ++ ++ if ($pp && ($c =~ s/^(?=$HS*#$HS*define$HS+NEED_\w+)/$pp/m)) { ++ $pp = ''; ++ $file{changes}++; ++ } ++ ++ unless ($file{has_inc_ppport}) { ++ diag("Needs to include '$ppport'"); ++ $pp .= qq(#include "$ppport"\n) ++ } ++ ++ if ($pp) { ++ $file{changes} += ($c =~ s/^($HS*#$HS*define$HS+NEED_\w+.*?)^/$1$pp/ms) ++ || ($c =~ s/^(?=$HS*#$HS*include.*\Q$ppport\E)/$pp/m) ++ || ($c =~ s/^($HS*#$HS*include.*XSUB.*\s*?)^/$1$pp/m) ++ || ($c =~ s/^/$pp/); ++ } ++ } ++ else { ++ if ($file{has_inc_ppport}) { ++ diag("No need to include '$ppport'"); ++ $file{changes} += ($c =~ s/^$HS*?#$HS*include.*\Q$ppport\E.*?$LF//m); ++ } ++ } ++ ++ # put back in our C comments ++ my $ix; ++ my $cppc = 0; ++ my @ccom = @{$file{ccom}}; ++ for $ix (0 .. $#ccom) { ++ if (!$opt{cplusplus} && $ccom[$ix] =~ s!^//!!) { ++ $cppc++; ++ $file{changes} += $c =~ s/$rccs$ix$rcce/$ccs$ccom[$ix] $cce/; ++ } ++ else { ++ $c =~ s/$rccs$ix$rcce/$ccom[$ix]/; ++ } ++ } ++ ++ if ($cppc) { ++ my $s = $cppc != 1 ? 's' : ''; ++ warning("Uses $cppc C++ style comment$s, which is not portable"); ++ } ++ ++ my $s = $warnings != 1 ? 's' : ''; ++ my $warn = $warnings ? " ($warnings warning$s)" : ''; ++ info("Analysis completed$warn"); ++ ++ if ($file{changes}) { ++ if (exists $opt{copy}) { ++ my $newfile = "$filename$opt{copy}"; ++ if (-e $newfile) { ++ error("'$newfile' already exists, refusing to write copy of '$filename'"); ++ } ++ else { ++ local *F; ++ if (open F, ">$newfile") { ++ info("Writing copy of '$filename' with changes to '$newfile'"); ++ print F $c; ++ close F; ++ } ++ else { ++ error("Cannot open '$newfile' for writing: $!"); ++ } ++ } ++ } ++ elsif (exists $opt{patch} || $opt{changes}) { ++ if (exists $opt{patch}) { ++ unless ($patch_opened) { ++ if (open PATCH, ">$opt{patch}") { ++ $patch_opened = 1; ++ } ++ else { ++ error("Cannot open '$opt{patch}' for writing: $!"); ++ delete $opt{patch}; ++ $opt{changes} = 1; ++ goto fallback; ++ } ++ } ++ mydiff(\*PATCH, $filename, $c); ++ } ++ else { ++fallback: ++ info("Suggested changes:"); ++ mydiff(\*STDOUT, $filename, $c); ++ } ++ } ++ else { ++ my $s = $file{changes} == 1 ? '' : 's'; ++ info("$file{changes} potentially required change$s detected"); ++ } ++ } ++ else { ++ info("Looks good"); ++ } ++} ++ ++close PATCH if $patch_opened; ++ ++exit 0; ++ ++ ++sub try_use { eval "use @_;"; return $@ eq '' } ++ ++sub mydiff ++{ ++ local *F = shift; ++ my($file, $str) = @_; ++ my $diff; ++ ++ if (exists $opt{diff}) { ++ $diff = run_diff($opt{diff}, $file, $str); ++ } ++ ++ if (!defined $diff and try_use('Text::Diff')) { ++ $diff = Text::Diff::diff($file, \$str, { STYLE => 'Unified' }); ++ $diff = <
$tmp") { ++ print F $str; ++ close F; ++ ++ if (open F, "$prog $file $tmp |") { ++ while () { ++ s/\Q$tmp\E/$file.patched/; ++ $diff .= $_; ++ } ++ close F; ++ unlink $tmp; ++ return $diff; ++ } ++ ++ unlink $tmp; ++ } ++ else { ++ error("Cannot open '$tmp' for writing: $!"); ++ } ++ ++ return undef; ++} ++ ++sub rec_depend ++{ ++ my($func, $seen) = @_; ++ return () unless exists $depends{$func}; ++ $seen = {%{$seen||{}}}; ++ return () if $seen->{$func}++; ++ my %s; ++ grep !$s{$_}++, map { ($_, rec_depend($_, $seen)) } @{$depends{$func}}; ++} ++ ++sub parse_version ++{ ++ my $ver = shift; ++ ++ if ($ver =~ /^(\d+)\.(\d+)\.(\d+)$/) { ++ return ($1, $2, $3); ++ } ++ elsif ($ver !~ /^\d+\.[\d_]+$/) { ++ die "cannot parse version '$ver'\n"; ++ } ++ ++ $ver =~ s/_//g; ++ $ver =~ s/$/000000/; ++ ++ my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; ++ ++ $v = int $v; ++ $s = int $s; ++ ++ if ($r < 5 || ($r == 5 && $v < 6)) { ++ if ($s % 10) { ++ die "cannot parse version '$ver'\n"; ++ } ++ } ++ ++ return ($r, $v, $s); ++} ++ ++sub format_version ++{ ++ my $ver = shift; ++ ++ $ver =~ s/$/000000/; ++ my($r,$v,$s) = $ver =~ /(\d+)\.(\d{3})(\d{3})/; ++ ++ $v = int $v; ++ $s = int $s; ++ ++ if ($r < 5 || ($r == 5 && $v < 6)) { ++ if ($s % 10) { ++ die "invalid version '$ver'\n"; ++ } ++ $s /= 10; ++ ++ $ver = sprintf "%d.%03d", $r, $v; ++ $s > 0 and $ver .= sprintf "_%02d", $s; ++ ++ return $ver; ++ } ++ ++ return sprintf "%d.%d.%d", $r, $v, $s; ++} ++ ++sub info ++{ ++ $opt{quiet} and return; ++ print @_, "\n"; ++} ++ ++sub diag ++{ ++ $opt{quiet} and return; ++ $opt{diag} and print @_, "\n"; ++} ++ ++sub warning ++{ ++ $opt{quiet} and return; ++ print "*** ", @_, "\n"; ++} ++ ++sub error ++{ ++ print "*** ERROR: ", @_, "\n"; ++} ++ ++my %given_hints; ++my %given_warnings; ++sub hint ++{ ++ $opt{quiet} and return; ++ my $func = shift; ++ my $rv = 0; ++ if (exists $warnings{$func} && !$given_warnings{$func}++) { ++ my $warn = $warnings{$func}; ++ $warn =~ s!^!*** !mg; ++ print "*** WARNING: $func\n", $warn; ++ $rv++; ++ } ++ if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) { ++ my $hint = $hints{$func}; ++ $hint =~ s/^/ /mg; ++ print " --- hint for $func ---\n", $hint; ++ } ++ $rv; ++} ++ ++sub usage ++{ ++ my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms; ++ my %M = ( 'I' => '*' ); ++ $usage =~ s/^\s*perl\s+\S+/$^X $0/; ++ $usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g; ++ ++ print < }; ++ my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms; ++ $copy =~ s/^(?=\S+)/ /gms; ++ $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms; ++ $self =~ s/^SKIP.*(?=^__DATA__)/SKIP ++if (\@ARGV && \$ARGV[0] eq '--unstrip') { ++ eval { require Devel::PPPort }; ++ \$@ and die "Cannot require Devel::PPPort, please install.\\n"; ++ if (eval \$Devel::PPPort::VERSION < $VERSION) { ++ die "$0 was originally generated with Devel::PPPort $VERSION.\\n" ++ . "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n" ++ . "Please install a newer version, or --unstrip will not work.\\n"; ++ } ++ Devel::PPPort::WriteFile(\$0); ++ exit 0; ++} ++print <$0" or die "cannot strip $0: $!\n"; ++ print OUT "$pl$c\n"; ++ ++ exit 0; ++} ++ ++__DATA__ ++*/ ++ ++#ifndef _P_P_PORTABILITY_H_ ++#define _P_P_PORTABILITY_H_ ++ ++#ifndef DPPP_NAMESPACE ++# define DPPP_NAMESPACE DPPP_ ++#endif ++ ++#define DPPP_CAT2(x,y) CAT2(x,y) ++#define DPPP_(name) DPPP_CAT2(DPPP_NAMESPACE, name) ++ ++#ifndef PERL_REVISION ++# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION)) ++# define PERL_PATCHLEVEL_H_IMPLICIT ++# include ++# endif ++# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL))) ++# include ++# endif ++# ifndef PERL_REVISION ++# define PERL_REVISION (5) ++ /* Replace: 1 */ ++# define PERL_VERSION PATCHLEVEL ++# define PERL_SUBVERSION SUBVERSION ++ /* Replace PERL_PATCHLEVEL with PERL_VERSION */ ++ /* Replace: 0 */ ++# endif ++#endif ++ ++#define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10)) ++#define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION)) ++ ++/* It is very unlikely that anyone will try to use this with Perl 6 ++ (or greater), but who knows. ++ */ ++#if PERL_REVISION != 5 ++# error ppport.h only works with Perl version 5 ++#endif /* PERL_REVISION != 5 */ ++#ifndef dTHR ++# define dTHR dNOOP ++#endif ++#ifndef dTHX ++# define dTHX dNOOP ++#endif ++ ++#ifndef dTHXa ++# define dTHXa(x) dNOOP ++#endif ++#ifndef pTHX ++# define pTHX void ++#endif ++ ++#ifndef pTHX_ ++# define pTHX_ ++#endif ++ ++#ifndef aTHX ++# define aTHX ++#endif ++ ++#ifndef aTHX_ ++# define aTHX_ ++#endif ++ ++#if (PERL_BCDVERSION < 0x5006000) ++# ifdef USE_THREADS ++# define aTHXR thr ++# define aTHXR_ thr, ++# else ++# define aTHXR ++# define aTHXR_ ++# endif ++# define dTHXR dTHR ++#else ++# define aTHXR aTHX ++# define aTHXR_ aTHX_ ++# define dTHXR dTHX ++#endif ++#ifndef dTHXoa ++# define dTHXoa(x) dTHXa(x) ++#endif ++ ++#ifdef I_LIMITS ++# include ++#endif ++ ++#ifndef PERL_UCHAR_MIN ++# define PERL_UCHAR_MIN ((unsigned char)0) ++#endif ++ ++#ifndef PERL_UCHAR_MAX ++# ifdef UCHAR_MAX ++# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX) ++# else ++# ifdef MAXUCHAR ++# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR) ++# else ++# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_USHORT_MIN ++# define PERL_USHORT_MIN ((unsigned short)0) ++#endif ++ ++#ifndef PERL_USHORT_MAX ++# ifdef USHORT_MAX ++# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX) ++# else ++# ifdef MAXUSHORT ++# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) ++# else ++# ifdef USHRT_MAX ++# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) ++# else ++# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef PERL_SHORT_MAX ++# ifdef SHORT_MAX ++# define PERL_SHORT_MAX ((short)SHORT_MAX) ++# else ++# ifdef MAXSHORT /* Often used in */ ++# define PERL_SHORT_MAX ((short)MAXSHORT) ++# else ++# ifdef SHRT_MAX ++# define PERL_SHORT_MAX ((short)SHRT_MAX) ++# else ++# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef PERL_SHORT_MIN ++# ifdef SHORT_MIN ++# define PERL_SHORT_MIN ((short)SHORT_MIN) ++# else ++# ifdef MINSHORT ++# define PERL_SHORT_MIN ((short)MINSHORT) ++# else ++# ifdef SHRT_MIN ++# define PERL_SHORT_MIN ((short)SHRT_MIN) ++# else ++# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++# endif ++#endif ++ ++#ifndef PERL_UINT_MAX ++# ifdef UINT_MAX ++# define PERL_UINT_MAX ((unsigned int)UINT_MAX) ++# else ++# ifdef MAXUINT ++# define PERL_UINT_MAX ((unsigned int)MAXUINT) ++# else ++# define PERL_UINT_MAX (~(unsigned int)0) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_UINT_MIN ++# define PERL_UINT_MIN ((unsigned int)0) ++#endif ++ ++#ifndef PERL_INT_MAX ++# ifdef INT_MAX ++# define PERL_INT_MAX ((int)INT_MAX) ++# else ++# ifdef MAXINT /* Often used in */ ++# define PERL_INT_MAX ((int)MAXINT) ++# else ++# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1)) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_INT_MIN ++# ifdef INT_MIN ++# define PERL_INT_MIN ((int)INT_MIN) ++# else ++# ifdef MININT ++# define PERL_INT_MIN ((int)MININT) ++# else ++# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_ULONG_MAX ++# ifdef ULONG_MAX ++# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX) ++# else ++# ifdef MAXULONG ++# define PERL_ULONG_MAX ((unsigned long)MAXULONG) ++# else ++# define PERL_ULONG_MAX (~(unsigned long)0) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_ULONG_MIN ++# define PERL_ULONG_MIN ((unsigned long)0L) ++#endif ++ ++#ifndef PERL_LONG_MAX ++# ifdef LONG_MAX ++# define PERL_LONG_MAX ((long)LONG_MAX) ++# else ++# ifdef MAXLONG ++# define PERL_LONG_MAX ((long)MAXLONG) ++# else ++# define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1)) ++# endif ++# endif ++#endif ++ ++#ifndef PERL_LONG_MIN ++# ifdef LONG_MIN ++# define PERL_LONG_MIN ((long)LONG_MIN) ++# else ++# ifdef MINLONG ++# define PERL_LONG_MIN ((long)MINLONG) ++# else ++# define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++#endif ++ ++#if defined(HAS_QUAD) && (defined(convex) || defined(uts)) ++# ifndef PERL_UQUAD_MAX ++# ifdef ULONGLONG_MAX ++# define PERL_UQUAD_MAX ((unsigned long long)ULONGLONG_MAX) ++# else ++# ifdef MAXULONGLONG ++# define PERL_UQUAD_MAX ((unsigned long long)MAXULONGLONG) ++# else ++# define PERL_UQUAD_MAX (~(unsigned long long)0) ++# endif ++# endif ++# endif ++ ++# ifndef PERL_UQUAD_MIN ++# define PERL_UQUAD_MIN ((unsigned long long)0L) ++# endif ++ ++# ifndef PERL_QUAD_MAX ++# ifdef LONGLONG_MAX ++# define PERL_QUAD_MAX ((long long)LONGLONG_MAX) ++# else ++# ifdef MAXLONGLONG ++# define PERL_QUAD_MAX ((long long)MAXLONGLONG) ++# else ++# define PERL_QUAD_MAX ((long long) (PERL_UQUAD_MAX >> 1)) ++# endif ++# endif ++# endif ++ ++# ifndef PERL_QUAD_MIN ++# ifdef LONGLONG_MIN ++# define PERL_QUAD_MIN ((long long)LONGLONG_MIN) ++# else ++# ifdef MINLONGLONG ++# define PERL_QUAD_MIN ((long long)MINLONGLONG) ++# else ++# define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3)) ++# endif ++# endif ++# endif ++#endif ++ ++/* This is based on code from 5.003 perl.h */ ++#ifdef HAS_QUAD ++# ifdef cray ++#ifndef IVTYPE ++# define IVTYPE int ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_INT_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_INT_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_UINT_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_UINT_MAX ++#endif ++ ++# ifdef INTSIZE ++#ifndef IVSIZE ++# define IVSIZE INTSIZE ++#endif ++ ++# endif ++# else ++# if defined(convex) || defined(uts) ++#ifndef IVTYPE ++# define IVTYPE long long ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_QUAD_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_QUAD_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_UQUAD_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_UQUAD_MAX ++#endif ++ ++# ifdef LONGLONGSIZE ++#ifndef IVSIZE ++# define IVSIZE LONGLONGSIZE ++#endif ++ ++# endif ++# else ++#ifndef IVTYPE ++# define IVTYPE long ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_LONG_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_LONG_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_ULONG_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_ULONG_MAX ++#endif ++ ++# ifdef LONGSIZE ++#ifndef IVSIZE ++# define IVSIZE LONGSIZE ++#endif ++ ++# endif ++# endif ++# endif ++#ifndef IVSIZE ++# define IVSIZE 8 ++#endif ++ ++#ifndef LONGSIZE ++# define LONGSIZE 8 ++#endif ++ ++#ifndef PERL_QUAD_MIN ++# define PERL_QUAD_MIN IV_MIN ++#endif ++ ++#ifndef PERL_QUAD_MAX ++# define PERL_QUAD_MAX IV_MAX ++#endif ++ ++#ifndef PERL_UQUAD_MIN ++# define PERL_UQUAD_MIN UV_MIN ++#endif ++ ++#ifndef PERL_UQUAD_MAX ++# define PERL_UQUAD_MAX UV_MAX ++#endif ++ ++#else ++#ifndef IVTYPE ++# define IVTYPE long ++#endif ++ ++#ifndef LONGSIZE ++# define LONGSIZE 4 ++#endif ++ ++#ifndef IV_MIN ++# define IV_MIN PERL_LONG_MIN ++#endif ++ ++#ifndef IV_MAX ++# define IV_MAX PERL_LONG_MAX ++#endif ++ ++#ifndef UV_MIN ++# define UV_MIN PERL_ULONG_MIN ++#endif ++ ++#ifndef UV_MAX ++# define UV_MAX PERL_ULONG_MAX ++#endif ++ ++#endif ++ ++#ifndef IVSIZE ++# ifdef LONGSIZE ++# define IVSIZE LONGSIZE ++# else ++# define IVSIZE 4 /* A bold guess, but the best we can make. */ ++# endif ++#endif ++#ifndef UVTYPE ++# define UVTYPE unsigned IVTYPE ++#endif ++ ++#ifndef UVSIZE ++# define UVSIZE IVSIZE ++#endif ++#ifndef sv_setuv ++# define sv_setuv(sv, uv) \ ++ STMT_START { \ ++ UV TeMpUv = uv; \ ++ if (TeMpUv <= IV_MAX) \ ++ sv_setiv(sv, TeMpUv); \ ++ else \ ++ sv_setnv(sv, (double)TeMpUv); \ ++ } STMT_END ++#endif ++#ifndef newSVuv ++# define newSVuv(uv) ((uv) <= IV_MAX ? newSViv((IV)uv) : newSVnv((NV)uv)) ++#endif ++#ifndef sv_2uv ++# define sv_2uv(sv) ((PL_Sv = (sv)), (UV) (SvNOK(PL_Sv) ? SvNV(PL_Sv) : sv_2nv(PL_Sv))) ++#endif ++ ++#ifndef SvUVX ++# define SvUVX(sv) ((UV)SvIVX(sv)) ++#endif ++ ++#ifndef SvUVXx ++# define SvUVXx(sv) SvUVX(sv) ++#endif ++ ++#ifndef SvUV ++# define SvUV(sv) (SvIOK(sv) ? SvUVX(sv) : sv_2uv(sv)) ++#endif ++ ++#ifndef SvUVx ++# define SvUVx(sv) ((PL_Sv = (sv)), SvUV(PL_Sv)) ++#endif ++ ++/* Hint: sv_uv ++ * Always use the SvUVx() macro instead of sv_uv(). ++ */ ++#ifndef sv_uv ++# define sv_uv(sv) SvUVx(sv) ++#endif ++ ++#if !defined(SvUOK) && defined(SvIOK_UV) ++# define SvUOK(sv) SvIOK_UV(sv) ++#endif ++#ifndef XST_mUV ++# define XST_mUV(i,v) (ST(i) = sv_2mortal(newSVuv(v)) ) ++#endif ++ ++#ifndef XSRETURN_UV ++# define XSRETURN_UV(v) STMT_START { XST_mUV(0,v); XSRETURN(1); } STMT_END ++#endif ++#ifndef PUSHu ++# define PUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); PUSHTARG; } STMT_END ++#endif ++ ++#ifndef XPUSHu ++# define XPUSHu(u) STMT_START { sv_setuv(TARG, (UV)(u)); XPUSHTARG; } STMT_END ++#endif ++ ++#ifdef HAS_MEMCMP ++#ifndef memNE ++# define memNE(s1,s2,l) (memcmp(s1,s2,l)) ++#endif ++ ++#ifndef memEQ ++# define memEQ(s1,s2,l) (!memcmp(s1,s2,l)) ++#endif ++ ++#else ++#ifndef memNE ++# define memNE(s1,s2,l) (bcmp(s1,s2,l)) ++#endif ++ ++#ifndef memEQ ++# define memEQ(s1,s2,l) (!bcmp(s1,s2,l)) ++#endif ++ ++#endif ++#ifndef memEQs ++# define memEQs(s1, l, s2) \ ++ (sizeof(s2)-1 == l && memEQ(s1, (s2 ""), (sizeof(s2)-1))) ++#endif ++ ++#ifndef memNEs ++# define memNEs(s1, l, s2) !memEQs(s1, l, s2) ++#endif ++#ifndef MoveD ++# define MoveD(s,d,n,t) memmove((char*)(d),(char*)(s), (n) * sizeof(t)) ++#endif ++ ++#ifndef CopyD ++# define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) ++#endif ++ ++#ifdef HAS_MEMSET ++#ifndef ZeroD ++# define ZeroD(d,n,t) memzero((char*)(d), (n) * sizeof(t)) ++#endif ++ ++#else ++#ifndef ZeroD ++# define ZeroD(d,n,t) ((void)memzero((char*)(d), (n) * sizeof(t)), d) ++#endif ++ ++#endif ++#ifndef PoisonWith ++# define PoisonWith(d,n,t,b) (void)memset((char*)(d), (U8)(b), (n) * sizeof(t)) ++#endif ++ ++#ifndef PoisonNew ++# define PoisonNew(d,n,t) PoisonWith(d,n,t,0xAB) ++#endif ++ ++#ifndef PoisonFree ++# define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF) ++#endif ++ ++#ifndef Poison ++# define Poison(d,n,t) PoisonFree(d,n,t) ++#endif ++#ifndef Newx ++# define Newx(v,n,t) New(0,v,n,t) ++#endif ++ ++#ifndef Newxc ++# define Newxc(v,n,t,c) Newc(0,v,n,t,c) ++#endif ++ ++#ifndef Newxz ++# define Newxz(v,n,t) Newz(0,v,n,t) ++#endif ++ ++#ifndef PERL_UNUSED_DECL ++# ifdef HASATTRIBUTE ++# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER) ++# define PERL_UNUSED_DECL ++# else ++# define PERL_UNUSED_DECL __attribute__((unused)) ++# endif ++# else ++# define PERL_UNUSED_DECL ++# endif ++#endif ++ ++#ifndef PERL_UNUSED_ARG ++# if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */ ++# include ++# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x)) ++# else ++# define PERL_UNUSED_ARG(x) ((void)x) ++# endif ++#endif ++ ++#ifndef PERL_UNUSED_VAR ++# define PERL_UNUSED_VAR(x) ((void)x) ++#endif ++ ++#ifndef PERL_UNUSED_CONTEXT ++# ifdef USE_ITHREADS ++# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl) ++# else ++# define PERL_UNUSED_CONTEXT ++# endif ++#endif ++#ifndef NOOP ++# define NOOP /*EMPTY*/(void)0 ++#endif ++ ++#ifndef dNOOP ++# define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL ++#endif ++ ++#ifndef NVTYPE ++# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) ++# define NVTYPE long double ++# else ++# define NVTYPE double ++# endif ++typedef NVTYPE NV; ++#endif ++ ++#ifndef INT2PTR ++# if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) ++# define PTRV UV ++# define INT2PTR(any,d) (any)(d) ++# else ++# if PTRSIZE == LONGSIZE ++# define PTRV unsigned long ++# else ++# define PTRV unsigned ++# endif ++# define INT2PTR(any,d) (any)(PTRV)(d) ++# endif ++#endif ++ ++#ifndef PTR2ul ++# if PTRSIZE == LONGSIZE ++# define PTR2ul(p) (unsigned long)(p) ++# else ++# define PTR2ul(p) INT2PTR(unsigned long,p) ++# endif ++#endif ++#ifndef PTR2nat ++# define PTR2nat(p) (PTRV)(p) ++#endif ++ ++#ifndef NUM2PTR ++# define NUM2PTR(any,d) (any)PTR2nat(d) ++#endif ++ ++#ifndef PTR2IV ++# define PTR2IV(p) INT2PTR(IV,p) ++#endif ++ ++#ifndef PTR2UV ++# define PTR2UV(p) INT2PTR(UV,p) ++#endif ++ ++#ifndef PTR2NV ++# define PTR2NV(p) NUM2PTR(NV,p) ++#endif ++ ++#undef START_EXTERN_C ++#undef END_EXTERN_C ++#undef EXTERN_C ++#ifdef __cplusplus ++# define START_EXTERN_C extern "C" { ++# define END_EXTERN_C } ++# define EXTERN_C extern "C" ++#else ++# define START_EXTERN_C ++# define END_EXTERN_C ++# define EXTERN_C extern ++#endif ++ ++#if defined(PERL_GCC_PEDANTIC) ++# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN ++# define PERL_GCC_BRACE_GROUPS_FORBIDDEN ++# endif ++#endif ++ ++#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) ++# ifndef PERL_USE_GCC_BRACE_GROUPS ++# define PERL_USE_GCC_BRACE_GROUPS ++# endif ++#endif ++ ++#undef STMT_START ++#undef STMT_END ++#ifdef PERL_USE_GCC_BRACE_GROUPS ++# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */ ++# define STMT_END ) ++#else ++# if defined(VOIDFLAGS) && (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__) ++# define STMT_START if (1) ++# define STMT_END else (void)0 ++# else ++# define STMT_START do ++# define STMT_END while (0) ++# endif ++#endif ++#ifndef boolSV ++# define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no) ++#endif ++ ++/* DEFSV appears first in 5.004_56 */ ++#ifndef DEFSV ++# define DEFSV GvSV(PL_defgv) ++#endif ++ ++#ifndef SAVE_DEFSV ++# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv)) ++#endif ++ ++#ifndef DEFSV_set ++# define DEFSV_set(sv) (DEFSV = (sv)) ++#endif ++ ++/* Older perls (<=5.003) lack AvFILLp */ ++#ifndef AvFILLp ++# define AvFILLp AvFILL ++#endif ++#ifndef ERRSV ++# define ERRSV get_sv("@",FALSE) ++#endif ++ ++/* Hint: gv_stashpvn ++ * This function's backport doesn't support the length parameter, but ++ * rather ignores it. Portability can only be ensured if the length ++ * parameter is used for speed reasons, but the length can always be ++ * correctly computed from the string argument. ++ */ ++#ifndef gv_stashpvn ++# define gv_stashpvn(str,len,create) gv_stashpv(str,create) ++#endif ++ ++/* Replace: 1 */ ++#ifndef get_cv ++# define get_cv perl_get_cv ++#endif ++ ++#ifndef get_sv ++# define get_sv perl_get_sv ++#endif ++ ++#ifndef get_av ++# define get_av perl_get_av ++#endif ++ ++#ifndef get_hv ++# define get_hv perl_get_hv ++#endif ++ ++/* Replace: 0 */ ++#ifndef dUNDERBAR ++# define dUNDERBAR dNOOP ++#endif ++ ++#ifndef UNDERBAR ++# define UNDERBAR DEFSV ++#endif ++#ifndef dAX ++# define dAX I32 ax = MARK - PL_stack_base + 1 ++#endif ++ ++#ifndef dITEMS ++# define dITEMS I32 items = SP - MARK ++#endif ++#ifndef dXSTARG ++# define dXSTARG SV * targ = sv_newmortal() ++#endif ++#ifndef dAXMARK ++# define dAXMARK I32 ax = POPMARK; \ ++ register SV ** const mark = PL_stack_base + ax++ ++#endif ++#ifndef XSprePUSH ++# define XSprePUSH (sp = PL_stack_base + ax - 1) ++#endif ++ ++#if (PERL_BCDVERSION < 0x5005000) ++# undef XSRETURN ++# define XSRETURN(off) \ ++ STMT_START { \ ++ PL_stack_sp = PL_stack_base + ax + ((off) - 1); \ ++ return; \ ++ } STMT_END ++#endif ++#ifndef XSPROTO ++# define XSPROTO(name) void name(pTHX_ CV* cv) ++#endif ++ ++#ifndef SVfARG ++# define SVfARG(p) ((void*)(p)) ++#endif ++#ifndef PERL_ABS ++# define PERL_ABS(x) ((x) < 0 ? -(x) : (x)) ++#endif ++#ifndef dVAR ++# define dVAR dNOOP ++#endif ++#ifndef SVf ++# define SVf "_" ++#endif ++#ifndef UTF8_MAXBYTES ++# define UTF8_MAXBYTES UTF8_MAXLEN ++#endif ++#ifndef CPERLscope ++# define CPERLscope(x) x ++#endif ++#ifndef PERL_HASH ++# define PERL_HASH(hash,str,len) \ ++ STMT_START { \ ++ const char *s_PeRlHaSh = str; \ ++ I32 i_PeRlHaSh = len; \ ++ U32 hash_PeRlHaSh = 0; \ ++ while (i_PeRlHaSh--) \ ++ hash_PeRlHaSh = hash_PeRlHaSh * 33 + *s_PeRlHaSh++; \ ++ (hash) = hash_PeRlHaSh; \ ++ } STMT_END ++#endif ++ ++#ifndef PERLIO_FUNCS_DECL ++# ifdef PERLIO_FUNCS_CONST ++# define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs ++# define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs) ++# else ++# define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs ++# define PERLIO_FUNCS_CAST(funcs) (funcs) ++# endif ++#endif ++ ++/* provide these typedefs for older perls */ ++#if (PERL_BCDVERSION < 0x5009003) ++ ++# ifdef ARGSproto ++typedef OP* (CPERLscope(*Perl_ppaddr_t))(ARGSproto); ++# else ++typedef OP* (CPERLscope(*Perl_ppaddr_t))(pTHX); ++# endif ++ ++typedef OP* (CPERLscope(*Perl_check_t)) (pTHX_ OP*); ++ ++#endif ++#ifndef isPSXSPC ++# define isPSXSPC(c) (isSPACE(c) || (c) == '\v') ++#endif ++ ++#ifndef isBLANK ++# define isBLANK(c) ((c) == ' ' || (c) == '\t') ++#endif ++ ++#ifdef EBCDIC ++#ifndef isALNUMC ++# define isALNUMC(c) isalnum(c) ++#endif ++ ++#ifndef isASCII ++# define isASCII(c) isascii(c) ++#endif ++ ++#ifndef isCNTRL ++# define isCNTRL(c) iscntrl(c) ++#endif ++ ++#ifndef isGRAPH ++# define isGRAPH(c) isgraph(c) ++#endif ++ ++#ifndef isPRINT ++# define isPRINT(c) isprint(c) ++#endif ++ ++#ifndef isPUNCT ++# define isPUNCT(c) ispunct(c) ++#endif ++ ++#ifndef isXDIGIT ++# define isXDIGIT(c) isxdigit(c) ++#endif ++ ++#else ++# if (PERL_BCDVERSION < 0x5010000) ++/* Hint: isPRINT ++ * The implementation in older perl versions includes all of the ++ * isSPACE() characters, which is wrong. The version provided by ++ * Devel::PPPort always overrides a present buggy version. ++ */ ++# undef isPRINT ++# endif ++ ++#ifdef HAS_QUAD ++# define WIDEST_UTYPE U64TYPE ++#else ++# define WIDEST_UTYPE U32 ++#endif ++#ifndef isALNUMC ++# define isALNUMC(c) (isALPHA(c) || isDIGIT(c)) ++#endif ++ ++#ifndef isASCII ++# define isASCII(c) ((WIDEST_UTYPE) (c) <= 127) ++#endif ++ ++#ifndef isCNTRL ++# define isCNTRL(c) ((WIDEST_UTYPE) (c) < ' ' || (c) == 127) ++#endif ++ ++#ifndef isGRAPH ++# define isGRAPH(c) (isALNUM(c) || isPUNCT(c)) ++#endif ++ ++#ifndef isPRINT ++# define isPRINT(c) (((c) >= 32 && (c) < 127)) ++#endif ++ ++#ifndef isPUNCT ++# define isPUNCT(c) (((c) >= 33 && (c) <= 47) || ((c) >= 58 && (c) <= 64) || ((c) >= 91 && (c) <= 96) || ((c) >= 123 && (c) <= 126)) ++#endif ++ ++#ifndef isXDIGIT ++# define isXDIGIT(c) (isDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) ++#endif ++ ++#endif ++ ++#ifndef PERL_SIGNALS_UNSAFE_FLAG ++ ++#define PERL_SIGNALS_UNSAFE_FLAG 0x0001 ++ ++#if (PERL_BCDVERSION < 0x5008000) ++# define D_PPP_PERL_SIGNALS_INIT PERL_SIGNALS_UNSAFE_FLAG ++#else ++# define D_PPP_PERL_SIGNALS_INIT 0 ++#endif ++ ++#if defined(NEED_PL_signals) ++static U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; ++#elif defined(NEED_PL_signals_GLOBAL) ++U32 DPPP_(my_PL_signals) = D_PPP_PERL_SIGNALS_INIT; ++#else ++extern U32 DPPP_(my_PL_signals); ++#endif ++#define PL_signals DPPP_(my_PL_signals) ++ ++#endif ++ ++/* Hint: PL_ppaddr ++ * Calling an op via PL_ppaddr requires passing a context argument ++ * for threaded builds. Since the context argument is different for ++ * 5.005 perls, you can use aTHXR (supplied by ppport.h), which will ++ * automatically be defined as the correct argument. ++ */ ++ ++#if (PERL_BCDVERSION <= 0x5005005) ++/* Replace: 1 */ ++# define PL_ppaddr ppaddr ++# define PL_no_modify no_modify ++/* Replace: 0 */ ++#endif ++ ++#if (PERL_BCDVERSION <= 0x5004005) ++/* Replace: 1 */ ++# define PL_DBsignal DBsignal ++# define PL_DBsingle DBsingle ++# define PL_DBsub DBsub ++# define PL_DBtrace DBtrace ++# define PL_Sv Sv ++# define PL_bufend bufend ++# define PL_bufptr bufptr ++# define PL_compiling compiling ++# define PL_copline copline ++# define PL_curcop curcop ++# define PL_curstash curstash ++# define PL_debstash debstash ++# define PL_defgv defgv ++# define PL_diehook diehook ++# define PL_dirty dirty ++# define PL_dowarn dowarn ++# define PL_errgv errgv ++# define PL_error_count error_count ++# define PL_expect expect ++# define PL_hexdigit hexdigit ++# define PL_hints hints ++# define PL_in_my in_my ++# define PL_laststatval laststatval ++# define PL_lex_state lex_state ++# define PL_lex_stuff lex_stuff ++# define PL_linestr linestr ++# define PL_na na ++# define PL_perl_destruct_level perl_destruct_level ++# define PL_perldb perldb ++# define PL_rsfp_filters rsfp_filters ++# define PL_rsfp rsfp ++# define PL_stack_base stack_base ++# define PL_stack_sp stack_sp ++# define PL_statcache statcache ++# define PL_stdingv stdingv ++# define PL_sv_arenaroot sv_arenaroot ++# define PL_sv_no sv_no ++# define PL_sv_undef sv_undef ++# define PL_sv_yes sv_yes ++# define PL_tainted tainted ++# define PL_tainting tainting ++# define PL_tokenbuf tokenbuf ++/* Replace: 0 */ ++#endif ++ ++/* Warning: PL_parser ++ * For perl versions earlier than 5.9.5, this is an always ++ * non-NULL dummy. Also, it cannot be dereferenced. Don't ++ * use it if you can avoid is and unless you absolutely know ++ * what you're doing. ++ * If you always check that PL_parser is non-NULL, you can ++ * define DPPP_PL_parser_NO_DUMMY to avoid the creation of ++ * a dummy parser structure. ++ */ ++ ++#if (PERL_BCDVERSION >= 0x5009005) ++# ifdef DPPP_PL_parser_NO_DUMMY ++# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ ++ (croak("panic: PL_parser == NULL in %s:%d", \ ++ __FILE__, __LINE__), (yy_parser *) NULL))->var) ++# else ++# ifdef DPPP_PL_parser_NO_DUMMY_WARNING ++# define D_PPP_parser_dummy_warning(var) ++# else ++# define D_PPP_parser_dummy_warning(var) \ ++ warn("warning: dummy PL_" #var " used in %s:%d", __FILE__, __LINE__), ++# endif ++# define D_PPP_my_PL_parser_var(var) ((PL_parser ? PL_parser : \ ++ (D_PPP_parser_dummy_warning(var) &DPPP_(dummy_PL_parser)))->var) ++#if defined(NEED_PL_parser) ++static yy_parser DPPP_(dummy_PL_parser); ++#elif defined(NEED_PL_parser_GLOBAL) ++yy_parser DPPP_(dummy_PL_parser); ++#else ++extern yy_parser DPPP_(dummy_PL_parser); ++#endif ++ ++# endif ++ ++/* PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf depends on PL_parser */ ++/* Warning: PL_expect, PL_copline, PL_rsfp, PL_rsfp_filters, PL_linestr, PL_bufptr, PL_bufend, PL_lex_state, PL_lex_stuff, PL_tokenbuf ++ * Do not use this variable unless you know exactly what you're ++ * doint. It is internal to the perl parser and may change or even ++ * be removed in the future. As of perl 5.9.5, you have to check ++ * for (PL_parser != NULL) for this variable to have any effect. ++ * An always non-NULL PL_parser dummy is provided for earlier ++ * perl versions. ++ * If PL_parser is NULL when you try to access this variable, a ++ * dummy is being accessed instead and a warning is issued unless ++ * you define DPPP_PL_parser_NO_DUMMY_WARNING. ++ * If DPPP_PL_parser_NO_DUMMY is defined, the code trying to access ++ * this variable will croak with a panic message. ++ */ ++ ++# define PL_expect D_PPP_my_PL_parser_var(expect) ++# define PL_copline D_PPP_my_PL_parser_var(copline) ++# define PL_rsfp D_PPP_my_PL_parser_var(rsfp) ++# define PL_rsfp_filters D_PPP_my_PL_parser_var(rsfp_filters) ++# define PL_linestr D_PPP_my_PL_parser_var(linestr) ++# define PL_bufptr D_PPP_my_PL_parser_var(bufptr) ++# define PL_bufend D_PPP_my_PL_parser_var(bufend) ++# define PL_lex_state D_PPP_my_PL_parser_var(lex_state) ++# define PL_lex_stuff D_PPP_my_PL_parser_var(lex_stuff) ++# define PL_tokenbuf D_PPP_my_PL_parser_var(tokenbuf) ++# define PL_in_my D_PPP_my_PL_parser_var(in_my) ++# define PL_in_my_stash D_PPP_my_PL_parser_var(in_my_stash) ++# define PL_error_count D_PPP_my_PL_parser_var(error_count) ++ ++ ++#else ++ ++/* ensure that PL_parser != NULL and cannot be dereferenced */ ++# define PL_parser ((void *) 1) ++ ++#endif ++#ifndef mPUSHs ++# define mPUSHs(s) PUSHs(sv_2mortal(s)) ++#endif ++ ++#ifndef PUSHmortal ++# define PUSHmortal PUSHs(sv_newmortal()) ++#endif ++ ++#ifndef mPUSHp ++# define mPUSHp(p,l) sv_setpvn(PUSHmortal, (p), (l)) ++#endif ++ ++#ifndef mPUSHn ++# define mPUSHn(n) sv_setnv(PUSHmortal, (NV)(n)) ++#endif ++ ++#ifndef mPUSHi ++# define mPUSHi(i) sv_setiv(PUSHmortal, (IV)(i)) ++#endif ++ ++#ifndef mPUSHu ++# define mPUSHu(u) sv_setuv(PUSHmortal, (UV)(u)) ++#endif ++#ifndef mXPUSHs ++# define mXPUSHs(s) XPUSHs(sv_2mortal(s)) ++#endif ++ ++#ifndef XPUSHmortal ++# define XPUSHmortal XPUSHs(sv_newmortal()) ++#endif ++ ++#ifndef mXPUSHp ++# define mXPUSHp(p,l) STMT_START { EXTEND(sp,1); sv_setpvn(PUSHmortal, (p), (l)); } STMT_END ++#endif ++ ++#ifndef mXPUSHn ++# define mXPUSHn(n) STMT_START { EXTEND(sp,1); sv_setnv(PUSHmortal, (NV)(n)); } STMT_END ++#endif ++ ++#ifndef mXPUSHi ++# define mXPUSHi(i) STMT_START { EXTEND(sp,1); sv_setiv(PUSHmortal, (IV)(i)); } STMT_END ++#endif ++ ++#ifndef mXPUSHu ++# define mXPUSHu(u) STMT_START { EXTEND(sp,1); sv_setuv(PUSHmortal, (UV)(u)); } STMT_END ++#endif ++ ++/* Replace: 1 */ ++#ifndef call_sv ++# define call_sv perl_call_sv ++#endif ++ ++#ifndef call_pv ++# define call_pv perl_call_pv ++#endif ++ ++#ifndef call_argv ++# define call_argv perl_call_argv ++#endif ++ ++#ifndef call_method ++# define call_method perl_call_method ++#endif ++#ifndef eval_sv ++# define eval_sv perl_eval_sv ++#endif ++ ++/* Replace: 0 */ ++#ifndef PERL_LOADMOD_DENY ++# define PERL_LOADMOD_DENY 0x1 ++#endif ++ ++#ifndef PERL_LOADMOD_NOIMPORT ++# define PERL_LOADMOD_NOIMPORT 0x2 ++#endif ++ ++#ifndef PERL_LOADMOD_IMPORT_OPS ++# define PERL_LOADMOD_IMPORT_OPS 0x4 ++#endif ++ ++#ifndef G_METHOD ++# define G_METHOD 64 ++# ifdef call_sv ++# undef call_sv ++# endif ++# if (PERL_BCDVERSION < 0x5006000) ++# define call_sv(sv, flags) ((flags) & G_METHOD ? perl_call_method((char *) SvPV_nolen_const(sv), \ ++ (flags) & ~G_METHOD) : perl_call_sv(sv, flags)) ++# else ++# define call_sv(sv, flags) ((flags) & G_METHOD ? Perl_call_method(aTHX_ (char *) SvPV_nolen_const(sv), \ ++ (flags) & ~G_METHOD) : Perl_call_sv(aTHX_ sv, flags)) ++# endif ++#endif ++ ++/* Replace perl_eval_pv with eval_pv */ ++ ++#ifndef eval_pv ++#if defined(NEED_eval_pv) ++static SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); ++static ++#else ++extern SV* DPPP_(my_eval_pv)(char *p, I32 croak_on_error); ++#endif ++ ++#ifdef eval_pv ++# undef eval_pv ++#endif ++#define eval_pv(a,b) DPPP_(my_eval_pv)(aTHX_ a,b) ++#define Perl_eval_pv DPPP_(my_eval_pv) ++ ++#if defined(NEED_eval_pv) || defined(NEED_eval_pv_GLOBAL) ++ ++SV* ++DPPP_(my_eval_pv)(char *p, I32 croak_on_error) ++{ ++ dSP; ++ SV* sv = newSVpv(p, 0); ++ ++ PUSHMARK(sp); ++ eval_sv(sv, G_SCALAR); ++ SvREFCNT_dec(sv); ++ ++ SPAGAIN; ++ sv = POPs; ++ PUTBACK; ++ ++ if (croak_on_error && SvTRUE(GvSV(errgv))) ++ croak(SvPVx(GvSV(errgv), na)); ++ ++ return sv; ++} ++ ++#endif ++#endif ++ ++#ifndef vload_module ++#if defined(NEED_vload_module) ++static void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); ++static ++#else ++extern void DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args); ++#endif ++ ++#ifdef vload_module ++# undef vload_module ++#endif ++#define vload_module(a,b,c,d) DPPP_(my_vload_module)(aTHX_ a,b,c,d) ++#define Perl_vload_module DPPP_(my_vload_module) ++ ++#if defined(NEED_vload_module) || defined(NEED_vload_module_GLOBAL) ++ ++void ++DPPP_(my_vload_module)(U32 flags, SV *name, SV *ver, va_list *args) ++{ ++ dTHR; ++ dVAR; ++ OP *veop, *imop; ++ ++ OP * const modname = newSVOP(OP_CONST, 0, name); ++ /* 5.005 has a somewhat hacky force_normal that doesn't croak on ++ SvREADONLY() if PL_compling is true. Current perls take care in ++ ck_require() to correctly turn off SvREADONLY before calling ++ force_normal_flags(). This seems a better fix than fudging PL_compling ++ */ ++ SvREADONLY_off(((SVOP*)modname)->op_sv); ++ modname->op_private |= OPpCONST_BARE; ++ if (ver) { ++ veop = newSVOP(OP_CONST, 0, ver); ++ } ++ else ++ veop = NULL; ++ if (flags & PERL_LOADMOD_NOIMPORT) { ++ imop = sawparens(newNULLLIST()); ++ } ++ else if (flags & PERL_LOADMOD_IMPORT_OPS) { ++ imop = va_arg(*args, OP*); ++ } ++ else { ++ SV *sv; ++ imop = NULL; ++ sv = va_arg(*args, SV*); ++ while (sv) { ++ imop = append_elem(OP_LIST, imop, newSVOP(OP_CONST, 0, sv)); ++ sv = va_arg(*args, SV*); ++ } ++ } ++ { ++ const line_t ocopline = PL_copline; ++ COP * const ocurcop = PL_curcop; ++ const int oexpect = PL_expect; ++ ++#if (PERL_BCDVERSION >= 0x5004000) ++ utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(FALSE, 0), ++ veop, modname, imop); ++#else ++ utilize(!(flags & PERL_LOADMOD_DENY), start_subparse(), ++ modname, imop); ++#endif ++ PL_expect = oexpect; ++ PL_copline = ocopline; ++ PL_curcop = ocurcop; ++ } ++} ++ ++#endif ++#endif ++ ++#ifndef load_module ++#if defined(NEED_load_module) ++static void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); ++static ++#else ++extern void DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...); ++#endif ++ ++#ifdef load_module ++# undef load_module ++#endif ++#define load_module DPPP_(my_load_module) ++#define Perl_load_module DPPP_(my_load_module) ++ ++#if defined(NEED_load_module) || defined(NEED_load_module_GLOBAL) ++ ++void ++DPPP_(my_load_module)(U32 flags, SV *name, SV *ver, ...) ++{ ++ va_list args; ++ va_start(args, ver); ++ vload_module(flags, name, ver, &args); ++ va_end(args); ++} ++ ++#endif ++#endif ++#ifndef newRV_inc ++# define newRV_inc(sv) newRV(sv) /* Replace */ ++#endif ++ ++#ifndef newRV_noinc ++#if defined(NEED_newRV_noinc) ++static SV * DPPP_(my_newRV_noinc)(SV *sv); ++static ++#else ++extern SV * DPPP_(my_newRV_noinc)(SV *sv); ++#endif ++ ++#ifdef newRV_noinc ++# undef newRV_noinc ++#endif ++#define newRV_noinc(a) DPPP_(my_newRV_noinc)(aTHX_ a) ++#define Perl_newRV_noinc DPPP_(my_newRV_noinc) ++ ++#if defined(NEED_newRV_noinc) || defined(NEED_newRV_noinc_GLOBAL) ++SV * ++DPPP_(my_newRV_noinc)(SV *sv) ++{ ++ SV *rv = (SV *)newRV(sv); ++ SvREFCNT_dec(sv); ++ return rv; ++} ++#endif ++#endif ++ ++/* Hint: newCONSTSUB ++ * Returns a CV* as of perl-5.7.1. This return value is not supported ++ * by Devel::PPPort. ++ */ ++ ++/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */ ++#if (PERL_BCDVERSION < 0x5004063) && (PERL_BCDVERSION != 0x5004005) ++#if defined(NEED_newCONSTSUB) ++static void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); ++static ++#else ++extern void DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv); ++#endif ++ ++#ifdef newCONSTSUB ++# undef newCONSTSUB ++#endif ++#define newCONSTSUB(a,b,c) DPPP_(my_newCONSTSUB)(aTHX_ a,b,c) ++#define Perl_newCONSTSUB DPPP_(my_newCONSTSUB) ++ ++#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL) ++ ++/* This is just a trick to avoid a dependency of newCONSTSUB on PL_parser */ ++/* (There's no PL_parser in perl < 5.005, so this is completely safe) */ ++#define D_PPP_PL_copline PL_copline ++ ++void ++DPPP_(my_newCONSTSUB)(HV *stash, const char *name, SV *sv) ++{ ++ U32 oldhints = PL_hints; ++ HV *old_cop_stash = PL_curcop->cop_stash; ++ HV *old_curstash = PL_curstash; ++ line_t oldline = PL_curcop->cop_line; ++ PL_curcop->cop_line = D_PPP_PL_copline; ++ ++ PL_hints &= ~HINT_BLOCK_SCOPE; ++ if (stash) ++ PL_curstash = PL_curcop->cop_stash = stash; ++ ++ newSUB( ++ ++#if (PERL_BCDVERSION < 0x5003022) ++ start_subparse(), ++#elif (PERL_BCDVERSION == 0x5003022) ++ start_subparse(0), ++#else /* 5.003_23 onwards */ ++ start_subparse(FALSE, 0), ++#endif ++ ++ newSVOP(OP_CONST, 0, newSVpv((char *) name, 0)), ++ newSVOP(OP_CONST, 0, &PL_sv_no), /* SvPV(&PL_sv_no) == "" -- GMB */ ++ newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv)) ++ ); ++ ++ PL_hints = oldhints; ++ PL_curcop->cop_stash = old_cop_stash; ++ PL_curstash = old_curstash; ++ PL_curcop->cop_line = oldline; ++} ++#endif ++#endif ++ ++/* ++ * Boilerplate macros for initializing and accessing interpreter-local ++ * data from C. All statics in extensions should be reworked to use ++ * this, if you want to make the extension thread-safe. See ext/re/re.xs ++ * for an example of the use of these macros. ++ * ++ * Code that uses these macros is responsible for the following: ++ * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts" ++ * 2. Declare a typedef named my_cxt_t that is a structure that contains ++ * all the data that needs to be interpreter-local. ++ * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t. ++ * 4. Use the MY_CXT_INIT macro such that it is called exactly once ++ * (typically put in the BOOT: section). ++ * 5. Use the members of the my_cxt_t structure everywhere as ++ * MY_CXT.member. ++ * 6. Use the dMY_CXT macro (a declaration) in all the functions that ++ * access MY_CXT. ++ */ ++ ++#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \ ++ defined(PERL_CAPI) || defined(PERL_IMPLICIT_CONTEXT) ++ ++#ifndef START_MY_CXT ++ ++/* This must appear in all extensions that define a my_cxt_t structure, ++ * right after the definition (i.e. at file scope). The non-threads ++ * case below uses it to declare the data as static. */ ++#define START_MY_CXT ++ ++#if (PERL_BCDVERSION < 0x5004068) ++/* Fetches the SV that keeps the per-interpreter data. */ ++#define dMY_CXT_SV \ ++ SV *my_cxt_sv = get_sv(MY_CXT_KEY, FALSE) ++#else /* >= perl5.004_68 */ ++#define dMY_CXT_SV \ ++ SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \ ++ sizeof(MY_CXT_KEY)-1, TRUE) ++#endif /* < perl5.004_68 */ ++ ++/* This declaration should be used within all functions that use the ++ * interpreter-local data. */ ++#define dMY_CXT \ ++ dMY_CXT_SV; \ ++ my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv)) ++ ++/* Creates and zeroes the per-interpreter data. ++ * (We allocate my_cxtp in a Perl SV so that it will be released when ++ * the interpreter goes away.) */ ++#define MY_CXT_INIT \ ++ dMY_CXT_SV; \ ++ /* newSV() allocates one more than needed */ \ ++ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ ++ Zero(my_cxtp, 1, my_cxt_t); \ ++ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) ++ ++/* This macro must be used to access members of the my_cxt_t structure. ++ * e.g. MYCXT.some_data */ ++#define MY_CXT (*my_cxtp) ++ ++/* Judicious use of these macros can reduce the number of times dMY_CXT ++ * is used. Use is similar to pTHX, aTHX etc. */ ++#define pMY_CXT my_cxt_t *my_cxtp ++#define pMY_CXT_ pMY_CXT, ++#define _pMY_CXT ,pMY_CXT ++#define aMY_CXT my_cxtp ++#define aMY_CXT_ aMY_CXT, ++#define _aMY_CXT ,aMY_CXT ++ ++#endif /* START_MY_CXT */ ++ ++#ifndef MY_CXT_CLONE ++/* Clones the per-interpreter data. */ ++#define MY_CXT_CLONE \ ++ dMY_CXT_SV; \ ++ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\ ++ Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t);\ ++ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp)) ++#endif ++ ++#else /* single interpreter */ ++ ++#ifndef START_MY_CXT ++ ++#define START_MY_CXT static my_cxt_t my_cxt; ++#define dMY_CXT_SV dNOOP ++#define dMY_CXT dNOOP ++#define MY_CXT_INIT NOOP ++#define MY_CXT my_cxt ++ ++#define pMY_CXT void ++#define pMY_CXT_ ++#define _pMY_CXT ++#define aMY_CXT ++#define aMY_CXT_ ++#define _aMY_CXT ++ ++#endif /* START_MY_CXT */ ++ ++#ifndef MY_CXT_CLONE ++#define MY_CXT_CLONE NOOP ++#endif ++ ++#endif ++ ++#ifndef IVdf ++# if IVSIZE == LONGSIZE ++# define IVdf "ld" ++# define UVuf "lu" ++# define UVof "lo" ++# define UVxf "lx" ++# define UVXf "lX" ++# elif IVSIZE == INTSIZE ++# define IVdf "d" ++# define UVuf "u" ++# define UVof "o" ++# define UVxf "x" ++# define UVXf "X" ++# else ++# error "cannot define IV/UV formats" ++# endif ++#endif ++ ++#ifndef NVef ++# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \ ++ defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000) ++ /* Not very likely, but let's try anyway. */ ++# define NVef PERL_PRIeldbl ++# define NVff PERL_PRIfldbl ++# define NVgf PERL_PRIgldbl ++# else ++# define NVef "e" ++# define NVff "f" ++# define NVgf "g" ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc(sv) \ ++ ({ \ ++ SV * const _sv = (SV*)(sv); \ ++ if (_sv) \ ++ (SvREFCNT(_sv))++; \ ++ _sv; \ ++ }) ++# else ++# define SvREFCNT_inc(sv) \ ++ ((PL_Sv=(SV*)(sv)) ? (++(SvREFCNT(PL_Sv)),PL_Sv) : NULL) ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc_simple ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc_simple(sv) \ ++ ({ \ ++ if (sv) \ ++ (SvREFCNT(sv))++; \ ++ (SV *)(sv); \ ++ }) ++# else ++# define SvREFCNT_inc_simple(sv) \ ++ ((sv) ? (SvREFCNT(sv)++,(SV*)(sv)) : NULL) ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc_NN ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc_NN(sv) \ ++ ({ \ ++ SV * const _sv = (SV*)(sv); \ ++ SvREFCNT(_sv)++; \ ++ _sv; \ ++ }) ++# else ++# define SvREFCNT_inc_NN(sv) \ ++ (PL_Sv=(SV*)(sv),++(SvREFCNT(PL_Sv)),PL_Sv) ++# endif ++#endif ++ ++#ifndef SvREFCNT_inc_void ++# ifdef PERL_USE_GCC_BRACE_GROUPS ++# define SvREFCNT_inc_void(sv) \ ++ ({ \ ++ SV * const _sv = (SV*)(sv); \ ++ if (_sv) \ ++ (void)(SvREFCNT(_sv)++); \ ++ }) ++# else ++# define SvREFCNT_inc_void(sv) \ ++ (void)((PL_Sv=(SV*)(sv)) ? ++(SvREFCNT(PL_Sv)) : 0) ++# endif ++#endif ++#ifndef SvREFCNT_inc_simple_void ++# define SvREFCNT_inc_simple_void(sv) STMT_START { if (sv) SvREFCNT(sv)++; } STMT_END ++#endif ++ ++#ifndef SvREFCNT_inc_simple_NN ++# define SvREFCNT_inc_simple_NN(sv) (++SvREFCNT(sv), (SV*)(sv)) ++#endif ++ ++#ifndef SvREFCNT_inc_void_NN ++# define SvREFCNT_inc_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) ++#endif ++ ++#ifndef SvREFCNT_inc_simple_void_NN ++# define SvREFCNT_inc_simple_void_NN(sv) (void)(++SvREFCNT((SV*)(sv))) ++#endif ++ ++#ifndef newSV_type ++ ++#if defined(NEED_newSV_type) ++static SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); ++static ++#else ++extern SV* DPPP_(my_newSV_type)(pTHX_ svtype const t); ++#endif ++ ++#ifdef newSV_type ++# undef newSV_type ++#endif ++#define newSV_type(a) DPPP_(my_newSV_type)(aTHX_ a) ++#define Perl_newSV_type DPPP_(my_newSV_type) ++ ++#if defined(NEED_newSV_type) || defined(NEED_newSV_type_GLOBAL) ++ ++SV* ++DPPP_(my_newSV_type)(pTHX_ svtype const t) ++{ ++ SV* const sv = newSV(0); ++ sv_upgrade(sv, t); ++ return sv; ++} ++ ++#endif ++ ++#endif ++ ++#if (PERL_BCDVERSION < 0x5006000) ++# define D_PPP_CONSTPV_ARG(x) ((char *) (x)) ++#else ++# define D_PPP_CONSTPV_ARG(x) (x) ++#endif ++#ifndef newSVpvn ++# define newSVpvn(data,len) ((data) \ ++ ? ((len) ? newSVpv((data), (len)) : newSVpv("", 0)) \ ++ : newSV(0)) ++#endif ++#ifndef newSVpvn_utf8 ++# define newSVpvn_utf8(s, len, u) newSVpvn_flags((s), (len), (u) ? SVf_UTF8 : 0) ++#endif ++#ifndef SVf_UTF8 ++# define SVf_UTF8 0 ++#endif ++ ++#ifndef newSVpvn_flags ++ ++#if defined(NEED_newSVpvn_flags) ++static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); ++static ++#else ++extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags); ++#endif ++ ++#ifdef newSVpvn_flags ++# undef newSVpvn_flags ++#endif ++#define newSVpvn_flags(a,b,c) DPPP_(my_newSVpvn_flags)(aTHX_ a,b,c) ++#define Perl_newSVpvn_flags DPPP_(my_newSVpvn_flags) ++ ++#if defined(NEED_newSVpvn_flags) || defined(NEED_newSVpvn_flags_GLOBAL) ++ ++SV * ++DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags) ++{ ++ SV *sv = newSVpvn(D_PPP_CONSTPV_ARG(s), len); ++ SvFLAGS(sv) |= (flags & SVf_UTF8); ++ return (flags & SVs_TEMP) ? sv_2mortal(sv) : sv; ++} ++ ++#endif ++ ++#endif ++ ++/* Backwards compatibility stuff... :-( */ ++#if !defined(NEED_sv_2pv_flags) && defined(NEED_sv_2pv_nolen) ++# define NEED_sv_2pv_flags ++#endif ++#if !defined(NEED_sv_2pv_flags_GLOBAL) && defined(NEED_sv_2pv_nolen_GLOBAL) ++# define NEED_sv_2pv_flags_GLOBAL ++#endif ++ ++/* Hint: sv_2pv_nolen ++ * Use the SvPV_nolen() or SvPV_nolen_const() macros instead of sv_2pv_nolen(). ++ */ ++#ifndef sv_2pv_nolen ++# define sv_2pv_nolen(sv) SvPV_nolen(sv) ++#endif ++ ++#ifdef SvPVbyte ++ ++/* Hint: SvPVbyte ++ * Does not work in perl-5.6.1, ppport.h implements a version ++ * borrowed from perl-5.7.3. ++ */ ++ ++#if (PERL_BCDVERSION < 0x5007000) ++ ++#if defined(NEED_sv_2pvbyte) ++static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); ++static ++#else ++extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp); ++#endif ++ ++#ifdef sv_2pvbyte ++# undef sv_2pvbyte ++#endif ++#define sv_2pvbyte(a,b) DPPP_(my_sv_2pvbyte)(aTHX_ a,b) ++#define Perl_sv_2pvbyte DPPP_(my_sv_2pvbyte) ++ ++#if defined(NEED_sv_2pvbyte) || defined(NEED_sv_2pvbyte_GLOBAL) ++ ++char * ++DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp) ++{ ++ sv_utf8_downgrade(sv,0); ++ return SvPV(sv,*lp); ++} ++ ++#endif ++ ++/* Hint: sv_2pvbyte ++ * Use the SvPVbyte() macro instead of sv_2pvbyte(). ++ */ ++ ++#undef SvPVbyte ++ ++#define SvPVbyte(sv, lp) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \ ++ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pvbyte(sv, &lp)) ++ ++#endif ++ ++#else ++ ++# define SvPVbyte SvPV ++# define sv_2pvbyte sv_2pv ++ ++#endif ++#ifndef sv_2pvbyte_nolen ++# define sv_2pvbyte_nolen(sv) sv_2pv_nolen(sv) ++#endif ++ ++/* Hint: sv_pvn ++ * Always use the SvPV() macro instead of sv_pvn(). ++ */ ++ ++/* Hint: sv_pvn_force ++ * Always use the SvPV_force() macro instead of sv_pvn_force(). ++ */ ++ ++/* If these are undefined, they're not handled by the core anyway */ ++#ifndef SV_IMMEDIATE_UNREF ++# define SV_IMMEDIATE_UNREF 0 ++#endif ++ ++#ifndef SV_GMAGIC ++# define SV_GMAGIC 0 ++#endif ++ ++#ifndef SV_COW_DROP_PV ++# define SV_COW_DROP_PV 0 ++#endif ++ ++#ifndef SV_UTF8_NO_ENCODING ++# define SV_UTF8_NO_ENCODING 0 ++#endif ++ ++#ifndef SV_NOSTEAL ++# define SV_NOSTEAL 0 ++#endif ++ ++#ifndef SV_CONST_RETURN ++# define SV_CONST_RETURN 0 ++#endif ++ ++#ifndef SV_MUTABLE_RETURN ++# define SV_MUTABLE_RETURN 0 ++#endif ++ ++#ifndef SV_SMAGIC ++# define SV_SMAGIC 0 ++#endif ++ ++#ifndef SV_HAS_TRAILING_NUL ++# define SV_HAS_TRAILING_NUL 0 ++#endif ++ ++#ifndef SV_COW_SHARED_HASH_KEYS ++# define SV_COW_SHARED_HASH_KEYS 0 ++#endif ++ ++#if (PERL_BCDVERSION < 0x5007002) ++ ++#if defined(NEED_sv_2pv_flags) ++static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++static ++#else ++extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++#endif ++ ++#ifdef sv_2pv_flags ++# undef sv_2pv_flags ++#endif ++#define sv_2pv_flags(a,b,c) DPPP_(my_sv_2pv_flags)(aTHX_ a,b,c) ++#define Perl_sv_2pv_flags DPPP_(my_sv_2pv_flags) ++ ++#if defined(NEED_sv_2pv_flags) || defined(NEED_sv_2pv_flags_GLOBAL) ++ ++char * ++DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) ++{ ++ STRLEN n_a = (STRLEN) flags; ++ return sv_2pv(sv, lp ? lp : &n_a); ++} ++ ++#endif ++ ++#if defined(NEED_sv_pvn_force_flags) ++static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++static ++#else ++extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags); ++#endif ++ ++#ifdef sv_pvn_force_flags ++# undef sv_pvn_force_flags ++#endif ++#define sv_pvn_force_flags(a,b,c) DPPP_(my_sv_pvn_force_flags)(aTHX_ a,b,c) ++#define Perl_sv_pvn_force_flags DPPP_(my_sv_pvn_force_flags) ++ ++#if defined(NEED_sv_pvn_force_flags) || defined(NEED_sv_pvn_force_flags_GLOBAL) ++ ++char * ++DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags) ++{ ++ STRLEN n_a = (STRLEN) flags; ++ return sv_pvn_force(sv, lp ? lp : &n_a); ++} ++ ++#endif ++ ++#endif ++ ++#if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) ) ++# define DPPP_SVPV_NOLEN_LP_ARG &PL_na ++#else ++# define DPPP_SVPV_NOLEN_LP_ARG 0 ++#endif ++#ifndef SvPV_const ++# define SvPV_const(sv, lp) SvPV_flags_const(sv, lp, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_mutable ++# define SvPV_mutable(sv, lp) SvPV_flags_mutable(sv, lp, SV_GMAGIC) ++#endif ++#ifndef SvPV_flags ++# define SvPV_flags(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_2pv_flags(sv, &lp, flags)) ++#endif ++#ifndef SvPV_flags_const ++# define SvPV_flags_const(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX_const(sv)) : \ ++ (const char*) sv_2pv_flags(sv, &lp, flags|SV_CONST_RETURN)) ++#endif ++#ifndef SvPV_flags_const_nolen ++# define SvPV_flags_const_nolen(sv, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX_const(sv) : \ ++ (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN)) ++#endif ++#ifndef SvPV_flags_mutable ++# define SvPV_flags_mutable(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) : \ ++ sv_2pv_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) ++#endif ++#ifndef SvPV_force ++# define SvPV_force(sv, lp) SvPV_force_flags(sv, lp, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_force_nolen ++# define SvPV_force_nolen(sv) SvPV_force_flags_nolen(sv, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_force_mutable ++# define SvPV_force_mutable(sv, lp) SvPV_force_flags_mutable(sv, lp, SV_GMAGIC) ++#endif ++ ++#ifndef SvPV_force_nomg ++# define SvPV_force_nomg(sv, lp) SvPV_force_flags(sv, lp, 0) ++#endif ++ ++#ifndef SvPV_force_nomg_nolen ++# define SvPV_force_nomg_nolen(sv) SvPV_force_flags_nolen(sv, 0) ++#endif ++#ifndef SvPV_force_flags ++# define SvPV_force_flags(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX(sv)) : sv_pvn_force_flags(sv, &lp, flags)) ++#endif ++#ifndef SvPV_force_flags_nolen ++# define SvPV_force_flags_nolen(sv, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ++ ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags)) ++#endif ++#ifndef SvPV_force_flags_mutable ++# define SvPV_force_flags_mutable(sv, lp, flags) \ ++ ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \ ++ ? ((lp = SvCUR(sv)), SvPVX_mutable(sv)) \ ++ : sv_pvn_force_flags(sv, &lp, flags|SV_MUTABLE_RETURN)) ++#endif ++#ifndef SvPV_nolen ++# define SvPV_nolen(sv) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC)) ++#endif ++#ifndef SvPV_nolen_const ++# define SvPV_nolen_const(sv) \ ++ ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN)) ++#endif ++#ifndef SvPV_nomg ++# define SvPV_nomg(sv, lp) SvPV_flags(sv, lp, 0) ++#endif ++ ++#ifndef SvPV_nomg_const ++# define SvPV_nomg_const(sv, lp) SvPV_flags_const(sv, lp, 0) ++#endif ++ ++#ifndef SvPV_nomg_const_nolen ++# define SvPV_nomg_const_nolen(sv) SvPV_flags_const_nolen(sv, 0) ++#endif ++ ++#ifndef SvPV_nomg_nolen ++# define SvPV_nomg_nolen(sv) ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \ ++ ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, 0)) ++#endif ++#ifndef SvPV_renew ++# define SvPV_renew(sv,n) STMT_START { SvLEN_set(sv, n); \ ++ SvPV_set((sv), (char *) saferealloc( \ ++ (Malloc_t)SvPVX(sv), (MEM_SIZE)((n)))); \ ++ } STMT_END ++#endif ++#ifndef SvMAGIC_set ++# define SvMAGIC_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ ++ (((XPVMG*) SvANY(sv))->xmg_magic = (val)); } STMT_END ++#endif ++ ++#if (PERL_BCDVERSION < 0x5009003) ++#ifndef SvPVX_const ++# define SvPVX_const(sv) ((const char*) (0 + SvPVX(sv))) ++#endif ++ ++#ifndef SvPVX_mutable ++# define SvPVX_mutable(sv) (0 + SvPVX(sv)) ++#endif ++#ifndef SvRV_set ++# define SvRV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ++ (((XRV*) SvANY(sv))->xrv_rv = (val)); } STMT_END ++#endif ++ ++#else ++#ifndef SvPVX_const ++# define SvPVX_const(sv) ((const char*)((sv)->sv_u.svu_pv)) ++#endif ++ ++#ifndef SvPVX_mutable ++# define SvPVX_mutable(sv) ((sv)->sv_u.svu_pv) ++#endif ++#ifndef SvRV_set ++# define SvRV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_RV); \ ++ ((sv)->sv_u.svu_rv = (val)); } STMT_END ++#endif ++ ++#endif ++#ifndef SvSTASH_set ++# define SvSTASH_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) >= SVt_PVMG); \ ++ (((XPVMG*) SvANY(sv))->xmg_stash = (val)); } STMT_END ++#endif ++ ++#if (PERL_BCDVERSION < 0x5004000) ++#ifndef SvUV_set ++# define SvUV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ ++ (((XPVIV*) SvANY(sv))->xiv_iv = (IV) (val)); } STMT_END ++#endif ++ ++#else ++#ifndef SvUV_set ++# define SvUV_set(sv, val) \ ++ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ ++ (((XPVUV*) SvANY(sv))->xuv_uv = (val)); } STMT_END ++#endif ++ ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf) ++#if defined(NEED_vnewSVpvf) ++static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); ++static ++#else ++extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args); ++#endif ++ ++#ifdef vnewSVpvf ++# undef vnewSVpvf ++#endif ++#define vnewSVpvf(a,b) DPPP_(my_vnewSVpvf)(aTHX_ a,b) ++#define Perl_vnewSVpvf DPPP_(my_vnewSVpvf) ++ ++#if defined(NEED_vnewSVpvf) || defined(NEED_vnewSVpvf_GLOBAL) ++ ++SV * ++DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args) ++{ ++ register SV *sv = newSV(0); ++ sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); ++ return sv; ++} ++ ++#endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf) ++# define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf) ++# define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg) ++#if defined(NEED_sv_catpvf_mg) ++static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++#endif ++ ++#define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg) ++ ++#if defined(NEED_sv_catpvf_mg) || defined(NEED_sv_catpvf_mg_GLOBAL) ++ ++void ++DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...) ++{ ++ va_list args; ++ va_start(args, pat); ++ sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++ ++#ifdef PERL_IMPLICIT_CONTEXT ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext) ++#if defined(NEED_sv_catpvf_mg_nocontext) ++static void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++#endif ++ ++#define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) ++#define Perl_sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext) ++ ++#if defined(NEED_sv_catpvf_mg_nocontext) || defined(NEED_sv_catpvf_mg_nocontext_GLOBAL) ++ ++void ++DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...) ++{ ++ dTHX; ++ va_list args; ++ va_start(args, pat); ++ sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++#endif ++ ++/* sv_catpvf_mg depends on sv_catpvf_mg_nocontext */ ++#ifndef sv_catpvf_mg ++# ifdef PERL_IMPLICIT_CONTEXT ++# define sv_catpvf_mg Perl_sv_catpvf_mg_nocontext ++# else ++# define sv_catpvf_mg Perl_sv_catpvf_mg ++# endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vcatpvf_mg) ++# define sv_vcatpvf_mg(sv, pat, args) \ ++ STMT_START { \ ++ sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ ++ SvSETMAGIC(sv); \ ++ } STMT_END ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg) ++#if defined(NEED_sv_setpvf_mg) ++static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...); ++#endif ++ ++#define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg) ++ ++#if defined(NEED_sv_setpvf_mg) || defined(NEED_sv_setpvf_mg_GLOBAL) ++ ++void ++DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...) ++{ ++ va_list args; ++ va_start(args, pat); ++ sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++ ++#ifdef PERL_IMPLICIT_CONTEXT ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext) ++#if defined(NEED_sv_setpvf_mg_nocontext) ++static void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...); ++#endif ++ ++#define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) ++#define Perl_sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext) ++ ++#if defined(NEED_sv_setpvf_mg_nocontext) || defined(NEED_sv_setpvf_mg_nocontext_GLOBAL) ++ ++void ++DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...) ++{ ++ dTHX; ++ va_list args; ++ va_start(args, pat); ++ sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); ++ SvSETMAGIC(sv); ++ va_end(args); ++} ++ ++#endif ++#endif ++#endif ++ ++/* sv_setpvf_mg depends on sv_setpvf_mg_nocontext */ ++#ifndef sv_setpvf_mg ++# ifdef PERL_IMPLICIT_CONTEXT ++# define sv_setpvf_mg Perl_sv_setpvf_mg_nocontext ++# else ++# define sv_setpvf_mg Perl_sv_setpvf_mg ++# endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_vsetpvf_mg) ++# define sv_vsetpvf_mg(sv, pat, args) \ ++ STMT_START { \ ++ sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ ++ SvSETMAGIC(sv); \ ++ } STMT_END ++#endif ++ ++/* Hint: newSVpvn_share ++ * The SVs created by this function only mimic the behaviour of ++ * shared PVs without really being shared. Only use if you know ++ * what you're doing. ++ */ ++ ++#ifndef newSVpvn_share ++ ++#if defined(NEED_newSVpvn_share) ++static SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); ++static ++#else ++extern SV * DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash); ++#endif ++ ++#ifdef newSVpvn_share ++# undef newSVpvn_share ++#endif ++#define newSVpvn_share(a,b,c) DPPP_(my_newSVpvn_share)(aTHX_ a,b,c) ++#define Perl_newSVpvn_share DPPP_(my_newSVpvn_share) ++ ++#if defined(NEED_newSVpvn_share) || defined(NEED_newSVpvn_share_GLOBAL) ++ ++SV * ++DPPP_(my_newSVpvn_share)(pTHX_ const char *src, I32 len, U32 hash) ++{ ++ SV *sv; ++ if (len < 0) ++ len = -len; ++ if (!hash) ++ PERL_HASH(hash, (char*) src, len); ++ sv = newSVpvn((char *) src, len); ++ sv_upgrade(sv, SVt_PVIV); ++ SvIVX(sv) = hash; ++ SvREADONLY_on(sv); ++ SvPOK_on(sv); ++ return sv; ++} ++ ++#endif ++ ++#endif ++#ifndef SvSHARED_HASH ++# define SvSHARED_HASH(sv) (0 + SvUVX(sv)) ++#endif ++#ifndef HvNAME_get ++# define HvNAME_get(hv) HvNAME(hv) ++#endif ++#ifndef HvNAMELEN_get ++# define HvNAMELEN_get(hv) (HvNAME_get(hv) ? (I32)strlen(HvNAME_get(hv)) : 0) ++#endif ++#ifndef GvSVn ++# define GvSVn(gv) GvSV(gv) ++#endif ++ ++#ifndef isGV_with_GP ++# define isGV_with_GP(gv) isGV(gv) ++#endif ++ ++#ifndef gv_fetchpvn_flags ++# define gv_fetchpvn_flags(name, len, flags, svt) gv_fetchpv(name, flags, svt) ++#endif ++ ++#ifndef gv_fetchsv ++# define gv_fetchsv(name, flags, svt) gv_fetchpv(SvPV_nolen_const(name), flags, svt) ++#endif ++#ifndef get_cvn_flags ++# define get_cvn_flags(name, namelen, flags) get_cv(name, flags) ++#endif ++#ifndef WARN_ALL ++# define WARN_ALL 0 ++#endif ++ ++#ifndef WARN_CLOSURE ++# define WARN_CLOSURE 1 ++#endif ++ ++#ifndef WARN_DEPRECATED ++# define WARN_DEPRECATED 2 ++#endif ++ ++#ifndef WARN_EXITING ++# define WARN_EXITING 3 ++#endif ++ ++#ifndef WARN_GLOB ++# define WARN_GLOB 4 ++#endif ++ ++#ifndef WARN_IO ++# define WARN_IO 5 ++#endif ++ ++#ifndef WARN_CLOSED ++# define WARN_CLOSED 6 ++#endif ++ ++#ifndef WARN_EXEC ++# define WARN_EXEC 7 ++#endif ++ ++#ifndef WARN_LAYER ++# define WARN_LAYER 8 ++#endif ++ ++#ifndef WARN_NEWLINE ++# define WARN_NEWLINE 9 ++#endif ++ ++#ifndef WARN_PIPE ++# define WARN_PIPE 10 ++#endif ++ ++#ifndef WARN_UNOPENED ++# define WARN_UNOPENED 11 ++#endif ++ ++#ifndef WARN_MISC ++# define WARN_MISC 12 ++#endif ++ ++#ifndef WARN_NUMERIC ++# define WARN_NUMERIC 13 ++#endif ++ ++#ifndef WARN_ONCE ++# define WARN_ONCE 14 ++#endif ++ ++#ifndef WARN_OVERFLOW ++# define WARN_OVERFLOW 15 ++#endif ++ ++#ifndef WARN_PACK ++# define WARN_PACK 16 ++#endif ++ ++#ifndef WARN_PORTABLE ++# define WARN_PORTABLE 17 ++#endif ++ ++#ifndef WARN_RECURSION ++# define WARN_RECURSION 18 ++#endif ++ ++#ifndef WARN_REDEFINE ++# define WARN_REDEFINE 19 ++#endif ++ ++#ifndef WARN_REGEXP ++# define WARN_REGEXP 20 ++#endif ++ ++#ifndef WARN_SEVERE ++# define WARN_SEVERE 21 ++#endif ++ ++#ifndef WARN_DEBUGGING ++# define WARN_DEBUGGING 22 ++#endif ++ ++#ifndef WARN_INPLACE ++# define WARN_INPLACE 23 ++#endif ++ ++#ifndef WARN_INTERNAL ++# define WARN_INTERNAL 24 ++#endif ++ ++#ifndef WARN_MALLOC ++# define WARN_MALLOC 25 ++#endif ++ ++#ifndef WARN_SIGNAL ++# define WARN_SIGNAL 26 ++#endif ++ ++#ifndef WARN_SUBSTR ++# define WARN_SUBSTR 27 ++#endif ++ ++#ifndef WARN_SYNTAX ++# define WARN_SYNTAX 28 ++#endif ++ ++#ifndef WARN_AMBIGUOUS ++# define WARN_AMBIGUOUS 29 ++#endif ++ ++#ifndef WARN_BAREWORD ++# define WARN_BAREWORD 30 ++#endif ++ ++#ifndef WARN_DIGIT ++# define WARN_DIGIT 31 ++#endif ++ ++#ifndef WARN_PARENTHESIS ++# define WARN_PARENTHESIS 32 ++#endif ++ ++#ifndef WARN_PRECEDENCE ++# define WARN_PRECEDENCE 33 ++#endif ++ ++#ifndef WARN_PRINTF ++# define WARN_PRINTF 34 ++#endif ++ ++#ifndef WARN_PROTOTYPE ++# define WARN_PROTOTYPE 35 ++#endif ++ ++#ifndef WARN_QW ++# define WARN_QW 36 ++#endif ++ ++#ifndef WARN_RESERVED ++# define WARN_RESERVED 37 ++#endif ++ ++#ifndef WARN_SEMICOLON ++# define WARN_SEMICOLON 38 ++#endif ++ ++#ifndef WARN_TAINT ++# define WARN_TAINT 39 ++#endif ++ ++#ifndef WARN_THREADS ++# define WARN_THREADS 40 ++#endif ++ ++#ifndef WARN_UNINITIALIZED ++# define WARN_UNINITIALIZED 41 ++#endif ++ ++#ifndef WARN_UNPACK ++# define WARN_UNPACK 42 ++#endif ++ ++#ifndef WARN_UNTIE ++# define WARN_UNTIE 43 ++#endif ++ ++#ifndef WARN_UTF8 ++# define WARN_UTF8 44 ++#endif ++ ++#ifndef WARN_VOID ++# define WARN_VOID 45 ++#endif ++ ++#ifndef WARN_ASSERTIONS ++# define WARN_ASSERTIONS 46 ++#endif ++#ifndef packWARN ++# define packWARN(a) (a) ++#endif ++ ++#ifndef ckWARN ++# ifdef G_WARN_ON ++# define ckWARN(a) (PL_dowarn & G_WARN_ON) ++# else ++# define ckWARN(a) PL_dowarn ++# endif ++#endif ++ ++#if (PERL_BCDVERSION >= 0x5004000) && !defined(warner) ++#if defined(NEED_warner) ++static void DPPP_(my_warner)(U32 err, const char *pat, ...); ++static ++#else ++extern void DPPP_(my_warner)(U32 err, const char *pat, ...); ++#endif ++ ++#define Perl_warner DPPP_(my_warner) ++ ++#if defined(NEED_warner) || defined(NEED_warner_GLOBAL) ++ ++void ++DPPP_(my_warner)(U32 err, const char *pat, ...) ++{ ++ SV *sv; ++ va_list args; ++ ++ PERL_UNUSED_ARG(err); ++ ++ va_start(args, pat); ++ sv = vnewSVpvf(pat, &args); ++ va_end(args); ++ sv_2mortal(sv); ++ warn("%s", SvPV_nolen(sv)); ++} ++ ++#define warner Perl_warner ++ ++#define Perl_warner_nocontext Perl_warner ++ ++#endif ++#endif ++ ++/* concatenating with "" ensures that only literal strings are accepted as argument ++ * note that STR_WITH_LEN() can't be used as argument to macros or functions that ++ * under some configurations might be macros ++ */ ++#ifndef STR_WITH_LEN ++# define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) ++#endif ++#ifndef newSVpvs ++# define newSVpvs(str) newSVpvn(str "", sizeof(str) - 1) ++#endif ++ ++#ifndef newSVpvs_flags ++# define newSVpvs_flags(str, flags) newSVpvn_flags(str "", sizeof(str) - 1, flags) ++#endif ++ ++#ifndef newSVpvs_share ++# define newSVpvs_share(str) newSVpvn_share(str "", sizeof(str) - 1, 0) ++#endif ++ ++#ifndef sv_catpvs ++# define sv_catpvs(sv, str) sv_catpvn(sv, str "", sizeof(str) - 1) ++#endif ++ ++#ifndef sv_setpvs ++# define sv_setpvs(sv, str) sv_setpvn(sv, str "", sizeof(str) - 1) ++#endif ++ ++#ifndef hv_fetchs ++# define hv_fetchs(hv, key, lval) hv_fetch(hv, key "", sizeof(key) - 1, lval) ++#endif ++ ++#ifndef hv_stores ++# define hv_stores(hv, key, val) hv_store(hv, key "", sizeof(key) - 1, val, 0) ++#endif ++#ifndef gv_fetchpvs ++# define gv_fetchpvs(name, flags, svt) gv_fetchpvn_flags(name "", sizeof(name) - 1, flags, svt) ++#endif ++ ++#ifndef gv_stashpvs ++# define gv_stashpvs(name, flags) gv_stashpvn(name "", sizeof(name) - 1, flags) ++#endif ++#ifndef get_cvs ++# define get_cvs(name, flags) get_cvn_flags(name "", sizeof(name)-1, flags) ++#endif ++#ifndef SvGETMAGIC ++# define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END ++#endif ++#ifndef PERL_MAGIC_sv ++# define PERL_MAGIC_sv '\0' ++#endif ++ ++#ifndef PERL_MAGIC_overload ++# define PERL_MAGIC_overload 'A' ++#endif ++ ++#ifndef PERL_MAGIC_overload_elem ++# define PERL_MAGIC_overload_elem 'a' ++#endif ++ ++#ifndef PERL_MAGIC_overload_table ++# define PERL_MAGIC_overload_table 'c' ++#endif ++ ++#ifndef PERL_MAGIC_bm ++# define PERL_MAGIC_bm 'B' ++#endif ++ ++#ifndef PERL_MAGIC_regdata ++# define PERL_MAGIC_regdata 'D' ++#endif ++ ++#ifndef PERL_MAGIC_regdatum ++# define PERL_MAGIC_regdatum 'd' ++#endif ++ ++#ifndef PERL_MAGIC_env ++# define PERL_MAGIC_env 'E' ++#endif ++ ++#ifndef PERL_MAGIC_envelem ++# define PERL_MAGIC_envelem 'e' ++#endif ++ ++#ifndef PERL_MAGIC_fm ++# define PERL_MAGIC_fm 'f' ++#endif ++ ++#ifndef PERL_MAGIC_regex_global ++# define PERL_MAGIC_regex_global 'g' ++#endif ++ ++#ifndef PERL_MAGIC_isa ++# define PERL_MAGIC_isa 'I' ++#endif ++ ++#ifndef PERL_MAGIC_isaelem ++# define PERL_MAGIC_isaelem 'i' ++#endif ++ ++#ifndef PERL_MAGIC_nkeys ++# define PERL_MAGIC_nkeys 'k' ++#endif ++ ++#ifndef PERL_MAGIC_dbfile ++# define PERL_MAGIC_dbfile 'L' ++#endif ++ ++#ifndef PERL_MAGIC_dbline ++# define PERL_MAGIC_dbline 'l' ++#endif ++ ++#ifndef PERL_MAGIC_mutex ++# define PERL_MAGIC_mutex 'm' ++#endif ++ ++#ifndef PERL_MAGIC_shared ++# define PERL_MAGIC_shared 'N' ++#endif ++ ++#ifndef PERL_MAGIC_shared_scalar ++# define PERL_MAGIC_shared_scalar 'n' ++#endif ++ ++#ifndef PERL_MAGIC_collxfrm ++# define PERL_MAGIC_collxfrm 'o' ++#endif ++ ++#ifndef PERL_MAGIC_tied ++# define PERL_MAGIC_tied 'P' ++#endif ++ ++#ifndef PERL_MAGIC_tiedelem ++# define PERL_MAGIC_tiedelem 'p' ++#endif ++ ++#ifndef PERL_MAGIC_tiedscalar ++# define PERL_MAGIC_tiedscalar 'q' ++#endif ++ ++#ifndef PERL_MAGIC_qr ++# define PERL_MAGIC_qr 'r' ++#endif ++ ++#ifndef PERL_MAGIC_sig ++# define PERL_MAGIC_sig 'S' ++#endif ++ ++#ifndef PERL_MAGIC_sigelem ++# define PERL_MAGIC_sigelem 's' ++#endif ++ ++#ifndef PERL_MAGIC_taint ++# define PERL_MAGIC_taint 't' ++#endif ++ ++#ifndef PERL_MAGIC_uvar ++# define PERL_MAGIC_uvar 'U' ++#endif ++ ++#ifndef PERL_MAGIC_uvar_elem ++# define PERL_MAGIC_uvar_elem 'u' ++#endif ++ ++#ifndef PERL_MAGIC_vstring ++# define PERL_MAGIC_vstring 'V' ++#endif ++ ++#ifndef PERL_MAGIC_vec ++# define PERL_MAGIC_vec 'v' ++#endif ++ ++#ifndef PERL_MAGIC_utf8 ++# define PERL_MAGIC_utf8 'w' ++#endif ++ ++#ifndef PERL_MAGIC_substr ++# define PERL_MAGIC_substr 'x' ++#endif ++ ++#ifndef PERL_MAGIC_defelem ++# define PERL_MAGIC_defelem 'y' ++#endif ++ ++#ifndef PERL_MAGIC_glob ++# define PERL_MAGIC_glob '*' ++#endif ++ ++#ifndef PERL_MAGIC_arylen ++# define PERL_MAGIC_arylen '#' ++#endif ++ ++#ifndef PERL_MAGIC_pos ++# define PERL_MAGIC_pos '.' ++#endif ++ ++#ifndef PERL_MAGIC_backref ++# define PERL_MAGIC_backref '<' ++#endif ++ ++#ifndef PERL_MAGIC_ext ++# define PERL_MAGIC_ext '~' ++#endif ++ ++/* That's the best we can do... */ ++#ifndef sv_catpvn_nomg ++# define sv_catpvn_nomg sv_catpvn ++#endif ++ ++#ifndef sv_catsv_nomg ++# define sv_catsv_nomg sv_catsv ++#endif ++ ++#ifndef sv_setsv_nomg ++# define sv_setsv_nomg sv_setsv ++#endif ++ ++#ifndef sv_pvn_nomg ++# define sv_pvn_nomg sv_pvn ++#endif ++ ++#ifndef SvIV_nomg ++# define SvIV_nomg SvIV ++#endif ++ ++#ifndef SvUV_nomg ++# define SvUV_nomg SvUV ++#endif ++ ++#ifndef sv_catpv_mg ++# define sv_catpv_mg(sv, ptr) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_catpv(TeMpSv,ptr); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_catpvn_mg ++# define sv_catpvn_mg(sv, ptr, len) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_catpvn(TeMpSv,ptr,len); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_catsv_mg ++# define sv_catsv_mg(dsv, ssv) \ ++ STMT_START { \ ++ SV *TeMpSv = dsv; \ ++ sv_catsv(TeMpSv,ssv); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setiv_mg ++# define sv_setiv_mg(sv, i) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setiv(TeMpSv,i); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setnv_mg ++# define sv_setnv_mg(sv, num) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setnv(TeMpSv,num); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setpv_mg ++# define sv_setpv_mg(sv, ptr) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setpv(TeMpSv,ptr); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setpvn_mg ++# define sv_setpvn_mg(sv, ptr, len) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setpvn(TeMpSv,ptr,len); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setsv_mg ++# define sv_setsv_mg(dsv, ssv) \ ++ STMT_START { \ ++ SV *TeMpSv = dsv; \ ++ sv_setsv(TeMpSv,ssv); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_setuv_mg ++# define sv_setuv_mg(sv, i) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_setuv(TeMpSv,i); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++ ++#ifndef sv_usepvn_mg ++# define sv_usepvn_mg(sv, ptr, len) \ ++ STMT_START { \ ++ SV *TeMpSv = sv; \ ++ sv_usepvn(TeMpSv,ptr,len); \ ++ SvSETMAGIC(TeMpSv); \ ++ } STMT_END ++#endif ++#ifndef SvVSTRING_mg ++# define SvVSTRING_mg(sv) (SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_vstring) : NULL) ++#endif ++ ++/* Hint: sv_magic_portable ++ * This is a compatibility function that is only available with ++ * Devel::PPPort. It is NOT in the perl core. ++ * Its purpose is to mimic the 5.8.0 behaviour of sv_magic() when ++ * it is being passed a name pointer with namlen == 0. In that ++ * case, perl 5.8.0 and later store the pointer, not a copy of it. ++ * The compatibility can be provided back to perl 5.004. With ++ * earlier versions, the code will not compile. ++ */ ++ ++#if (PERL_BCDVERSION < 0x5004000) ++ ++ /* code that uses sv_magic_portable will not compile */ ++ ++#elif (PERL_BCDVERSION < 0x5008000) ++ ++# define sv_magic_portable(sv, obj, how, name, namlen) \ ++ STMT_START { \ ++ SV *SvMp_sv = (sv); \ ++ char *SvMp_name = (char *) (name); \ ++ I32 SvMp_namlen = (namlen); \ ++ if (SvMp_name && SvMp_namlen == 0) \ ++ { \ ++ MAGIC *mg; \ ++ sv_magic(SvMp_sv, obj, how, 0, 0); \ ++ mg = SvMAGIC(SvMp_sv); \ ++ mg->mg_len = -42; /* XXX: this is the tricky part */ \ ++ mg->mg_ptr = SvMp_name; \ ++ } \ ++ else \ ++ { \ ++ sv_magic(SvMp_sv, obj, how, SvMp_name, SvMp_namlen); \ ++ } \ ++ } STMT_END ++ ++#else ++ ++# define sv_magic_portable(a, b, c, d, e) sv_magic(a, b, c, d, e) ++ ++#endif ++ ++#ifdef USE_ITHREADS ++#ifndef CopFILE ++# define CopFILE(c) ((c)->cop_file) ++#endif ++ ++#ifndef CopFILEGV ++# define CopFILEGV(c) (CopFILE(c) ? gv_fetchfile(CopFILE(c)) : Nullgv) ++#endif ++ ++#ifndef CopFILE_set ++# define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) ++#endif ++ ++#ifndef CopFILESV ++# define CopFILESV(c) (CopFILE(c) ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv) ++#endif ++ ++#ifndef CopFILEAV ++# define CopFILEAV(c) (CopFILE(c) ? GvAV(gv_fetchfile(CopFILE(c))) : Nullav) ++#endif ++ ++#ifndef CopSTASHPV ++# define CopSTASHPV(c) ((c)->cop_stashpv) ++#endif ++ ++#ifndef CopSTASHPV_set ++# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : Nullch)) ++#endif ++ ++#ifndef CopSTASH ++# define CopSTASH(c) (CopSTASHPV(c) ? gv_stashpv(CopSTASHPV(c),GV_ADD) : Nullhv) ++#endif ++ ++#ifndef CopSTASH_set ++# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME(hv) : Nullch) ++#endif ++ ++#ifndef CopSTASH_eq ++# define CopSTASH_eq(c,hv) ((hv) && (CopSTASHPV(c) == HvNAME(hv) \ ++ || (CopSTASHPV(c) && HvNAME(hv) \ ++ && strEQ(CopSTASHPV(c), HvNAME(hv))))) ++#endif ++ ++#else ++#ifndef CopFILEGV ++# define CopFILEGV(c) ((c)->cop_filegv) ++#endif ++ ++#ifndef CopFILEGV_set ++# define CopFILEGV_set(c,gv) ((c)->cop_filegv = (GV*)SvREFCNT_inc(gv)) ++#endif ++ ++#ifndef CopFILE_set ++# define CopFILE_set(c,pv) CopFILEGV_set((c), gv_fetchfile(pv)) ++#endif ++ ++#ifndef CopFILESV ++# define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv) ++#endif ++ ++#ifndef CopFILEAV ++# define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : Nullav) ++#endif ++ ++#ifndef CopFILE ++# define CopFILE(c) (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch) ++#endif ++ ++#ifndef CopSTASH ++# define CopSTASH(c) ((c)->cop_stash) ++#endif ++ ++#ifndef CopSTASH_set ++# define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) ++#endif ++ ++#ifndef CopSTASHPV ++# define CopSTASHPV(c) (CopSTASH(c) ? HvNAME(CopSTASH(c)) : Nullch) ++#endif ++ ++#ifndef CopSTASHPV_set ++# define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) ++#endif ++ ++#ifndef CopSTASH_eq ++# define CopSTASH_eq(c,hv) (CopSTASH(c) == (hv)) ++#endif ++ ++#endif /* USE_ITHREADS */ ++#ifndef IN_PERL_COMPILETIME ++# define IN_PERL_COMPILETIME (PL_curcop == &PL_compiling) ++#endif ++ ++#ifndef IN_LOCALE_RUNTIME ++# define IN_LOCALE_RUNTIME (PL_curcop->op_private & HINT_LOCALE) ++#endif ++ ++#ifndef IN_LOCALE_COMPILETIME ++# define IN_LOCALE_COMPILETIME (PL_hints & HINT_LOCALE) ++#endif ++ ++#ifndef IN_LOCALE ++# define IN_LOCALE (IN_PERL_COMPILETIME ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME) ++#endif ++#ifndef IS_NUMBER_IN_UV ++# define IS_NUMBER_IN_UV 0x01 ++#endif ++ ++#ifndef IS_NUMBER_GREATER_THAN_UV_MAX ++# define IS_NUMBER_GREATER_THAN_UV_MAX 0x02 ++#endif ++ ++#ifndef IS_NUMBER_NOT_INT ++# define IS_NUMBER_NOT_INT 0x04 ++#endif ++ ++#ifndef IS_NUMBER_NEG ++# define IS_NUMBER_NEG 0x08 ++#endif ++ ++#ifndef IS_NUMBER_INFINITY ++# define IS_NUMBER_INFINITY 0x10 ++#endif ++ ++#ifndef IS_NUMBER_NAN ++# define IS_NUMBER_NAN 0x20 ++#endif ++#ifndef GROK_NUMERIC_RADIX ++# define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(sp, send) ++#endif ++#ifndef PERL_SCAN_GREATER_THAN_UV_MAX ++# define PERL_SCAN_GREATER_THAN_UV_MAX 0x02 ++#endif ++ ++#ifndef PERL_SCAN_SILENT_ILLDIGIT ++# define PERL_SCAN_SILENT_ILLDIGIT 0x04 ++#endif ++ ++#ifndef PERL_SCAN_ALLOW_UNDERSCORES ++# define PERL_SCAN_ALLOW_UNDERSCORES 0x01 ++#endif ++ ++#ifndef PERL_SCAN_DISALLOW_PREFIX ++# define PERL_SCAN_DISALLOW_PREFIX 0x02 ++#endif ++ ++#ifndef grok_numeric_radix ++#if defined(NEED_grok_numeric_radix) ++static bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); ++static ++#else ++extern bool DPPP_(my_grok_numeric_radix)(pTHX_ const char ** sp, const char * send); ++#endif ++ ++#ifdef grok_numeric_radix ++# undef grok_numeric_radix ++#endif ++#define grok_numeric_radix(a,b) DPPP_(my_grok_numeric_radix)(aTHX_ a,b) ++#define Perl_grok_numeric_radix DPPP_(my_grok_numeric_radix) ++ ++#if defined(NEED_grok_numeric_radix) || defined(NEED_grok_numeric_radix_GLOBAL) ++bool ++DPPP_(my_grok_numeric_radix)(pTHX_ const char **sp, const char *send) ++{ ++#ifdef USE_LOCALE_NUMERIC ++#ifdef PL_numeric_radix_sv ++ if (PL_numeric_radix_sv && IN_LOCALE) { ++ STRLEN len; ++ char* radix = SvPV(PL_numeric_radix_sv, len); ++ if (*sp + len <= send && memEQ(*sp, radix, len)) { ++ *sp += len; ++ return TRUE; ++ } ++ } ++#else ++ /* older perls don't have PL_numeric_radix_sv so the radix ++ * must manually be requested from locale.h ++ */ ++#include ++ dTHR; /* needed for older threaded perls */ ++ struct lconv *lc = localeconv(); ++ char *radix = lc->decimal_point; ++ if (radix && IN_LOCALE) { ++ STRLEN len = strlen(radix); ++ if (*sp + len <= send && memEQ(*sp, radix, len)) { ++ *sp += len; ++ return TRUE; ++ } ++ } ++#endif ++#endif /* USE_LOCALE_NUMERIC */ ++ /* always try "." if numeric radix didn't match because ++ * we may have data from different locales mixed */ ++ if (*sp < send && **sp == '.') { ++ ++*sp; ++ return TRUE; ++ } ++ return FALSE; ++} ++#endif ++#endif ++ ++#ifndef grok_number ++#if defined(NEED_grok_number) ++static int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); ++static ++#else ++extern int DPPP_(my_grok_number)(pTHX_ const char * pv, STRLEN len, UV * valuep); ++#endif ++ ++#ifdef grok_number ++# undef grok_number ++#endif ++#define grok_number(a,b,c) DPPP_(my_grok_number)(aTHX_ a,b,c) ++#define Perl_grok_number DPPP_(my_grok_number) ++ ++#if defined(NEED_grok_number) || defined(NEED_grok_number_GLOBAL) ++int ++DPPP_(my_grok_number)(pTHX_ const char *pv, STRLEN len, UV *valuep) ++{ ++ const char *s = pv; ++ const char *send = pv + len; ++ const UV max_div_10 = UV_MAX / 10; ++ const char max_mod_10 = UV_MAX % 10; ++ int numtype = 0; ++ int sawinf = 0; ++ int sawnan = 0; ++ ++ while (s < send && isSPACE(*s)) ++ s++; ++ if (s == send) { ++ return 0; ++ } else if (*s == '-') { ++ s++; ++ numtype = IS_NUMBER_NEG; ++ } ++ else if (*s == '+') ++ s++; ++ ++ if (s == send) ++ return 0; ++ ++ /* next must be digit or the radix separator or beginning of infinity */ ++ if (isDIGIT(*s)) { ++ /* UVs are at least 32 bits, so the first 9 decimal digits cannot ++ overflow. */ ++ UV value = *s - '0'; ++ /* This construction seems to be more optimiser friendly. ++ (without it gcc does the isDIGIT test and the *s - '0' separately) ++ With it gcc on arm is managing 6 instructions (6 cycles) per digit. ++ In theory the optimiser could deduce how far to unroll the loop ++ before checking for overflow. */ ++ if (++s < send) { ++ int digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ digit = *s - '0'; ++ if (digit >= 0 && digit <= 9) { ++ value = value * 10 + digit; ++ if (++s < send) { ++ /* Now got 9 digits, so need to check ++ each time for overflow. */ ++ digit = *s - '0'; ++ while (digit >= 0 && digit <= 9 ++ && (value < max_div_10 ++ || (value == max_div_10 ++ && digit <= max_mod_10))) { ++ value = value * 10 + digit; ++ if (++s < send) ++ digit = *s - '0'; ++ else ++ break; ++ } ++ if (digit >= 0 && digit <= 9 ++ && (s < send)) { ++ /* value overflowed. ++ skip the remaining digits, don't ++ worry about setting *valuep. */ ++ do { ++ s++; ++ } while (s < send && isDIGIT(*s)); ++ numtype |= ++ IS_NUMBER_GREATER_THAN_UV_MAX; ++ goto skip_value; ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ } ++ numtype |= IS_NUMBER_IN_UV; ++ if (valuep) ++ *valuep = value; ++ ++ skip_value: ++ if (GROK_NUMERIC_RADIX(&s, send)) { ++ numtype |= IS_NUMBER_NOT_INT; ++ while (s < send && isDIGIT(*s)) /* optional digits after the radix */ ++ s++; ++ } ++ } ++ else if (GROK_NUMERIC_RADIX(&s, send)) { ++ numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */ ++ /* no digits before the radix means we need digits after it */ ++ if (s < send && isDIGIT(*s)) { ++ do { ++ s++; ++ } while (s < send && isDIGIT(*s)); ++ if (valuep) { ++ /* integer approximation is valid - it's 0. */ ++ *valuep = 0; ++ } ++ } ++ else ++ return 0; ++ } else if (*s == 'I' || *s == 'i') { ++ s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; ++ s++; if (s == send || (*s != 'F' && *s != 'f')) return 0; ++ s++; if (s < send && (*s == 'I' || *s == 'i')) { ++ s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; ++ s++; if (s == send || (*s != 'I' && *s != 'i')) return 0; ++ s++; if (s == send || (*s != 'T' && *s != 't')) return 0; ++ s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0; ++ s++; ++ } ++ sawinf = 1; ++ } else if (*s == 'N' || *s == 'n') { ++ /* XXX TODO: There are signaling NaNs and quiet NaNs. */ ++ s++; if (s == send || (*s != 'A' && *s != 'a')) return 0; ++ s++; if (s == send || (*s != 'N' && *s != 'n')) return 0; ++ s++; ++ sawnan = 1; ++ } else ++ return 0; ++ ++ if (sawinf) { ++ numtype &= IS_NUMBER_NEG; /* Keep track of sign */ ++ numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT; ++ } else if (sawnan) { ++ numtype &= IS_NUMBER_NEG; /* Keep track of sign */ ++ numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT; ++ } else if (s < send) { ++ /* we can have an optional exponent part */ ++ if (*s == 'e' || *s == 'E') { ++ /* The only flag we keep is sign. Blow away any "it's UV" */ ++ numtype &= IS_NUMBER_NEG; ++ numtype |= IS_NUMBER_NOT_INT; ++ s++; ++ if (s < send && (*s == '-' || *s == '+')) ++ s++; ++ if (s < send && isDIGIT(*s)) { ++ do { ++ s++; ++ } while (s < send && isDIGIT(*s)); ++ } ++ else ++ return 0; ++ } ++ } ++ while (s < send && isSPACE(*s)) ++ s++; ++ if (s >= send) ++ return numtype; ++ if (len == 10 && memEQ(pv, "0 but true", 10)) { ++ if (valuep) ++ *valuep = 0; ++ return IS_NUMBER_IN_UV; ++ } ++ return 0; ++} ++#endif ++#endif ++ ++/* ++ * The grok_* routines have been modified to use warn() instead of ++ * Perl_warner(). Also, 'hexdigit' was the former name of PL_hexdigit, ++ * which is why the stack variable has been renamed to 'xdigit'. ++ */ ++ ++#ifndef grok_bin ++#if defined(NEED_grok_bin) ++static UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++static ++#else ++extern UV DPPP_(my_grok_bin)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++#endif ++ ++#ifdef grok_bin ++# undef grok_bin ++#endif ++#define grok_bin(a,b,c,d) DPPP_(my_grok_bin)(aTHX_ a,b,c,d) ++#define Perl_grok_bin DPPP_(my_grok_bin) ++ ++#if defined(NEED_grok_bin) || defined(NEED_grok_bin_GLOBAL) ++UV ++DPPP_(my_grok_bin)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++{ ++ const char *s = start; ++ STRLEN len = *len_p; ++ UV value = 0; ++ NV value_nv = 0; ++ ++ const UV max_div_2 = UV_MAX / 2; ++ bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; ++ bool overflowed = FALSE; ++ ++ if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { ++ /* strip off leading b or 0b. ++ for compatibility silently suffer "b" and "0b" as valid binary ++ numbers. */ ++ if (len >= 1) { ++ if (s[0] == 'b') { ++ s++; ++ len--; ++ } ++ else if (len >= 2 && s[0] == '0' && s[1] == 'b') { ++ s+=2; ++ len-=2; ++ } ++ } ++ } ++ ++ for (; len-- && *s; s++) { ++ char bit = *s; ++ if (bit == '0' || bit == '1') { ++ /* Write it in this wonky order with a goto to attempt to get the ++ compiler to make the common case integer-only loop pretty tight. ++ With gcc seems to be much straighter code than old scan_bin. */ ++ redo: ++ if (!overflowed) { ++ if (value <= max_div_2) { ++ value = (value << 1) | (bit - '0'); ++ continue; ++ } ++ /* Bah. We're just overflowed. */ ++ warn("Integer overflow in binary number"); ++ overflowed = TRUE; ++ value_nv = (NV) value; ++ } ++ value_nv *= 2.0; ++ /* If an NV has not enough bits in its mantissa to ++ * represent a UV this summing of small low-order numbers ++ * is a waste of time (because the NV cannot preserve ++ * the low-order bits anyway): we could just remember when ++ * did we overflow and in the end just multiply value_nv by the ++ * right amount. */ ++ value_nv += (NV)(bit - '0'); ++ continue; ++ } ++ if (bit == '_' && len && allow_underscores && (bit = s[1]) ++ && (bit == '0' || bit == '1')) ++ { ++ --len; ++ ++s; ++ goto redo; ++ } ++ if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) ++ warn("Illegal binary digit '%c' ignored", *s); ++ break; ++ } ++ ++ if ( ( overflowed && value_nv > 4294967295.0) ++#if UVSIZE > 4 ++ || (!overflowed && value > 0xffffffff ) ++#endif ++ ) { ++ warn("Binary number > 0b11111111111111111111111111111111 non-portable"); ++ } ++ *len_p = s - start; ++ if (!overflowed) { ++ *flags = 0; ++ return value; ++ } ++ *flags = PERL_SCAN_GREATER_THAN_UV_MAX; ++ if (result) ++ *result = value_nv; ++ return UV_MAX; ++} ++#endif ++#endif ++ ++#ifndef grok_hex ++#if defined(NEED_grok_hex) ++static UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++static ++#else ++extern UV DPPP_(my_grok_hex)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++#endif ++ ++#ifdef grok_hex ++# undef grok_hex ++#endif ++#define grok_hex(a,b,c,d) DPPP_(my_grok_hex)(aTHX_ a,b,c,d) ++#define Perl_grok_hex DPPP_(my_grok_hex) ++ ++#if defined(NEED_grok_hex) || defined(NEED_grok_hex_GLOBAL) ++UV ++DPPP_(my_grok_hex)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++{ ++ const char *s = start; ++ STRLEN len = *len_p; ++ UV value = 0; ++ NV value_nv = 0; ++ ++ const UV max_div_16 = UV_MAX / 16; ++ bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; ++ bool overflowed = FALSE; ++ const char *xdigit; ++ ++ if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { ++ /* strip off leading x or 0x. ++ for compatibility silently suffer "x" and "0x" as valid hex numbers. ++ */ ++ if (len >= 1) { ++ if (s[0] == 'x') { ++ s++; ++ len--; ++ } ++ else if (len >= 2 && s[0] == '0' && s[1] == 'x') { ++ s+=2; ++ len-=2; ++ } ++ } ++ } ++ ++ for (; len-- && *s; s++) { ++ xdigit = strchr((char *) PL_hexdigit, *s); ++ if (xdigit) { ++ /* Write it in this wonky order with a goto to attempt to get the ++ compiler to make the common case integer-only loop pretty tight. ++ With gcc seems to be much straighter code than old scan_hex. */ ++ redo: ++ if (!overflowed) { ++ if (value <= max_div_16) { ++ value = (value << 4) | ((xdigit - PL_hexdigit) & 15); ++ continue; ++ } ++ warn("Integer overflow in hexadecimal number"); ++ overflowed = TRUE; ++ value_nv = (NV) value; ++ } ++ value_nv *= 16.0; ++ /* If an NV has not enough bits in its mantissa to ++ * represent a UV this summing of small low-order numbers ++ * is a waste of time (because the NV cannot preserve ++ * the low-order bits anyway): we could just remember when ++ * did we overflow and in the end just multiply value_nv by the ++ * right amount of 16-tuples. */ ++ value_nv += (NV)((xdigit - PL_hexdigit) & 15); ++ continue; ++ } ++ if (*s == '_' && len && allow_underscores && s[1] ++ && (xdigit = strchr((char *) PL_hexdigit, s[1]))) ++ { ++ --len; ++ ++s; ++ goto redo; ++ } ++ if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) ++ warn("Illegal hexadecimal digit '%c' ignored", *s); ++ break; ++ } ++ ++ if ( ( overflowed && value_nv > 4294967295.0) ++#if UVSIZE > 4 ++ || (!overflowed && value > 0xffffffff ) ++#endif ++ ) { ++ warn("Hexadecimal number > 0xffffffff non-portable"); ++ } ++ *len_p = s - start; ++ if (!overflowed) { ++ *flags = 0; ++ return value; ++ } ++ *flags = PERL_SCAN_GREATER_THAN_UV_MAX; ++ if (result) ++ *result = value_nv; ++ return UV_MAX; ++} ++#endif ++#endif ++ ++#ifndef grok_oct ++#if defined(NEED_grok_oct) ++static UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++static ++#else ++extern UV DPPP_(my_grok_oct)(pTHX_ const char * start, STRLEN * len_p, I32 * flags, NV * result); ++#endif ++ ++#ifdef grok_oct ++# undef grok_oct ++#endif ++#define grok_oct(a,b,c,d) DPPP_(my_grok_oct)(aTHX_ a,b,c,d) ++#define Perl_grok_oct DPPP_(my_grok_oct) ++ ++#if defined(NEED_grok_oct) || defined(NEED_grok_oct_GLOBAL) ++UV ++DPPP_(my_grok_oct)(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) ++{ ++ const char *s = start; ++ STRLEN len = *len_p; ++ UV value = 0; ++ NV value_nv = 0; ++ ++ const UV max_div_8 = UV_MAX / 8; ++ bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; ++ bool overflowed = FALSE; ++ ++ for (; len-- && *s; s++) { ++ /* gcc 2.95 optimiser not smart enough to figure that this subtraction ++ out front allows slicker code. */ ++ int digit = *s - '0'; ++ if (digit >= 0 && digit <= 7) { ++ /* Write it in this wonky order with a goto to attempt to get the ++ compiler to make the common case integer-only loop pretty tight. ++ */ ++ redo: ++ if (!overflowed) { ++ if (value <= max_div_8) { ++ value = (value << 3) | digit; ++ continue; ++ } ++ /* Bah. We're just overflowed. */ ++ warn("Integer overflow in octal number"); ++ overflowed = TRUE; ++ value_nv = (NV) value; ++ } ++ value_nv *= 8.0; ++ /* If an NV has not enough bits in its mantissa to ++ * represent a UV this summing of small low-order numbers ++ * is a waste of time (because the NV cannot preserve ++ * the low-order bits anyway): we could just remember when ++ * did we overflow and in the end just multiply value_nv by the ++ * right amount of 8-tuples. */ ++ value_nv += (NV)digit; ++ continue; ++ } ++ if (digit == ('_' - '0') && len && allow_underscores ++ && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) ++ { ++ --len; ++ ++s; ++ goto redo; ++ } ++ /* Allow \octal to work the DWIM way (that is, stop scanning ++ * as soon as non-octal characters are seen, complain only iff ++ * someone seems to want to use the digits eight and nine). */ ++ if (digit == 8 || digit == 9) { ++ if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) ++ warn("Illegal octal digit '%c' ignored", *s); ++ } ++ break; ++ } ++ ++ if ( ( overflowed && value_nv > 4294967295.0) ++#if UVSIZE > 4 ++ || (!overflowed && value > 0xffffffff ) ++#endif ++ ) { ++ warn("Octal number > 037777777777 non-portable"); ++ } ++ *len_p = s - start; ++ if (!overflowed) { ++ *flags = 0; ++ return value; ++ } ++ *flags = PERL_SCAN_GREATER_THAN_UV_MAX; ++ if (result) ++ *result = value_nv; ++ return UV_MAX; ++} ++#endif ++#endif ++ ++#if !defined(my_snprintf) ++#if defined(NEED_my_snprintf) ++static int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); ++static ++#else ++extern int DPPP_(my_my_snprintf)(char * buffer, const Size_t len, const char * format, ...); ++#endif ++ ++#define my_snprintf DPPP_(my_my_snprintf) ++#define Perl_my_snprintf DPPP_(my_my_snprintf) ++ ++#if defined(NEED_my_snprintf) || defined(NEED_my_snprintf_GLOBAL) ++ ++int ++DPPP_(my_my_snprintf)(char *buffer, const Size_t len, const char *format, ...) ++{ ++ dTHX; ++ int retval; ++ va_list ap; ++ va_start(ap, format); ++#ifdef HAS_VSNPRINTF ++ retval = vsnprintf(buffer, len, format, ap); ++#else ++ retval = vsprintf(buffer, format, ap); ++#endif ++ va_end(ap); ++ if (retval < 0 || (len > 0 && (Size_t)retval >= len)) ++ Perl_croak(aTHX_ "panic: my_snprintf buffer overflow"); ++ return retval; ++} ++ ++#endif ++#endif ++ ++#if !defined(my_sprintf) ++#if defined(NEED_my_sprintf) ++static int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); ++static ++#else ++extern int DPPP_(my_my_sprintf)(char * buffer, const char * pat, ...); ++#endif ++ ++#define my_sprintf DPPP_(my_my_sprintf) ++#define Perl_my_sprintf DPPP_(my_my_sprintf) ++ ++#if defined(NEED_my_sprintf) || defined(NEED_my_sprintf_GLOBAL) ++ ++int ++DPPP_(my_my_sprintf)(char *buffer, const char* pat, ...) ++{ ++ va_list args; ++ va_start(args, pat); ++ vsprintf(buffer, pat, args); ++ va_end(args); ++ return strlen(buffer); ++} ++ ++#endif ++#endif ++ ++#ifdef NO_XSLOCKS ++# ifdef dJMPENV ++# define dXCPT dJMPENV; int rEtV = 0 ++# define XCPT_TRY_START JMPENV_PUSH(rEtV); if (rEtV == 0) ++# define XCPT_TRY_END JMPENV_POP; ++# define XCPT_CATCH if (rEtV != 0) ++# define XCPT_RETHROW JMPENV_JUMP(rEtV) ++# else ++# define dXCPT Sigjmp_buf oldTOP; int rEtV = 0 ++# define XCPT_TRY_START Copy(top_env, oldTOP, 1, Sigjmp_buf); rEtV = Sigsetjmp(top_env, 1); if (rEtV == 0) ++# define XCPT_TRY_END Copy(oldTOP, top_env, 1, Sigjmp_buf); ++# define XCPT_CATCH if (rEtV != 0) ++# define XCPT_RETHROW Siglongjmp(top_env, rEtV) ++# endif ++#endif ++ ++#if !defined(my_strlcat) ++#if defined(NEED_my_strlcat) ++static Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); ++static ++#else ++extern Size_t DPPP_(my_my_strlcat)(char * dst, const char * src, Size_t size); ++#endif ++ ++#define my_strlcat DPPP_(my_my_strlcat) ++#define Perl_my_strlcat DPPP_(my_my_strlcat) ++ ++#if defined(NEED_my_strlcat) || defined(NEED_my_strlcat_GLOBAL) ++ ++Size_t ++DPPP_(my_my_strlcat)(char *dst, const char *src, Size_t size) ++{ ++ Size_t used, length, copy; ++ ++ used = strlen(dst); ++ length = strlen(src); ++ if (size > 0 && used < size - 1) { ++ copy = (length >= size - used) ? size - used - 1 : length; ++ memcpy(dst + used, src, copy); ++ dst[used + copy] = '\0'; ++ } ++ return used + length; ++} ++#endif ++#endif ++ ++#if !defined(my_strlcpy) ++#if defined(NEED_my_strlcpy) ++static Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); ++static ++#else ++extern Size_t DPPP_(my_my_strlcpy)(char * dst, const char * src, Size_t size); ++#endif ++ ++#define my_strlcpy DPPP_(my_my_strlcpy) ++#define Perl_my_strlcpy DPPP_(my_my_strlcpy) ++ ++#if defined(NEED_my_strlcpy) || defined(NEED_my_strlcpy_GLOBAL) ++ ++Size_t ++DPPP_(my_my_strlcpy)(char *dst, const char *src, Size_t size) ++{ ++ Size_t length, copy; ++ ++ length = strlen(src); ++ if (size > 0) { ++ copy = (length >= size) ? size - 1 : length; ++ memcpy(dst, src, copy); ++ dst[copy] = '\0'; ++ } ++ return length; ++} ++ ++#endif ++#endif ++#ifndef PERL_PV_ESCAPE_QUOTE ++# define PERL_PV_ESCAPE_QUOTE 0x0001 ++#endif ++ ++#ifndef PERL_PV_PRETTY_QUOTE ++# define PERL_PV_PRETTY_QUOTE PERL_PV_ESCAPE_QUOTE ++#endif ++ ++#ifndef PERL_PV_PRETTY_ELLIPSES ++# define PERL_PV_PRETTY_ELLIPSES 0x0002 ++#endif ++ ++#ifndef PERL_PV_PRETTY_LTGT ++# define PERL_PV_PRETTY_LTGT 0x0004 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_FIRSTCHAR ++# define PERL_PV_ESCAPE_FIRSTCHAR 0x0008 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_UNI ++# define PERL_PV_ESCAPE_UNI 0x0100 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_UNI_DETECT ++# define PERL_PV_ESCAPE_UNI_DETECT 0x0200 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_ALL ++# define PERL_PV_ESCAPE_ALL 0x1000 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_NOBACKSLASH ++# define PERL_PV_ESCAPE_NOBACKSLASH 0x2000 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_NOCLEAR ++# define PERL_PV_ESCAPE_NOCLEAR 0x4000 ++#endif ++ ++#ifndef PERL_PV_ESCAPE_RE ++# define PERL_PV_ESCAPE_RE 0x8000 ++#endif ++ ++#ifndef PERL_PV_PRETTY_NOCLEAR ++# define PERL_PV_PRETTY_NOCLEAR PERL_PV_ESCAPE_NOCLEAR ++#endif ++#ifndef PERL_PV_PRETTY_DUMP ++# define PERL_PV_PRETTY_DUMP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE ++#endif ++ ++#ifndef PERL_PV_PRETTY_REGPROP ++# define PERL_PV_PRETTY_REGPROP PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_LTGT|PERL_PV_ESCAPE_RE ++#endif ++ ++/* Hint: pv_escape ++ * Note that unicode functionality is only backported to ++ * those perl versions that support it. For older perl ++ * versions, the implementation will fall back to bytes. ++ */ ++ ++#ifndef pv_escape ++#if defined(NEED_pv_escape) ++static char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); ++static ++#else ++extern char * DPPP_(my_pv_escape)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags); ++#endif ++ ++#ifdef pv_escape ++# undef pv_escape ++#endif ++#define pv_escape(a,b,c,d,e,f) DPPP_(my_pv_escape)(aTHX_ a,b,c,d,e,f) ++#define Perl_pv_escape DPPP_(my_pv_escape) ++ ++#if defined(NEED_pv_escape) || defined(NEED_pv_escape_GLOBAL) ++ ++char * ++DPPP_(my_pv_escape)(pTHX_ SV *dsv, char const * const str, ++ const STRLEN count, const STRLEN max, ++ STRLEN * const escaped, const U32 flags) ++{ ++ const char esc = flags & PERL_PV_ESCAPE_RE ? '%' : '\\'; ++ const char dq = flags & PERL_PV_ESCAPE_QUOTE ? '"' : esc; ++ char octbuf[32] = "%123456789ABCDF"; ++ STRLEN wrote = 0; ++ STRLEN chsize = 0; ++ STRLEN readsize = 1; ++#if defined(is_utf8_string) && defined(utf8_to_uvchr) ++ bool isuni = flags & PERL_PV_ESCAPE_UNI ? 1 : 0; ++#endif ++ const char *pv = str; ++ const char * const end = pv + count; ++ octbuf[0] = esc; ++ ++ if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) ++ sv_setpvs(dsv, ""); ++ ++#if defined(is_utf8_string) && defined(utf8_to_uvchr) ++ if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count)) ++ isuni = 1; ++#endif ++ ++ for (; pv < end && (!max || wrote < max) ; pv += readsize) { ++ const UV u = ++#if defined(is_utf8_string) && defined(utf8_to_uvchr) ++ isuni ? utf8_to_uvchr((U8*)pv, &readsize) : ++#endif ++ (U8)*pv; ++ const U8 c = (U8)u & 0xFF; ++ ++ if (u > 255 || (flags & PERL_PV_ESCAPE_ALL)) { ++ if (flags & PERL_PV_ESCAPE_FIRSTCHAR) ++ chsize = my_snprintf(octbuf, sizeof octbuf, ++ "%"UVxf, u); ++ else ++ chsize = my_snprintf(octbuf, sizeof octbuf, ++ "%cx{%"UVxf"}", esc, u); ++ } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) { ++ chsize = 1; ++ } else { ++ if (c == dq || c == esc || !isPRINT(c)) { ++ chsize = 2; ++ switch (c) { ++ case '\\' : /* fallthrough */ ++ case '%' : if (c == esc) ++ octbuf[1] = esc; ++ else ++ chsize = 1; ++ break; ++ case '\v' : octbuf[1] = 'v'; break; ++ case '\t' : octbuf[1] = 't'; break; ++ case '\r' : octbuf[1] = 'r'; break; ++ case '\n' : octbuf[1] = 'n'; break; ++ case '\f' : octbuf[1] = 'f'; break; ++ case '"' : if (dq == '"') ++ octbuf[1] = '"'; ++ else ++ chsize = 1; ++ break; ++ default: chsize = my_snprintf(octbuf, sizeof octbuf, ++ pv < end && isDIGIT((U8)*(pv+readsize)) ++ ? "%c%03o" : "%c%o", esc, c); ++ } ++ } else { ++ chsize = 1; ++ } ++ } ++ if (max && wrote + chsize > max) { ++ break; ++ } else if (chsize > 1) { ++ sv_catpvn(dsv, octbuf, chsize); ++ wrote += chsize; ++ } else { ++ char tmp[2]; ++ my_snprintf(tmp, sizeof tmp, "%c", c); ++ sv_catpvn(dsv, tmp, 1); ++ wrote++; ++ } ++ if (flags & PERL_PV_ESCAPE_FIRSTCHAR) ++ break; ++ } ++ if (escaped != NULL) ++ *escaped= pv - str; ++ return SvPVX(dsv); ++} ++ ++#endif ++#endif ++ ++#ifndef pv_pretty ++#if defined(NEED_pv_pretty) ++static char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); ++static ++#else ++extern char * DPPP_(my_pv_pretty)(pTHX_ SV * dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags); ++#endif ++ ++#ifdef pv_pretty ++# undef pv_pretty ++#endif ++#define pv_pretty(a,b,c,d,e,f,g) DPPP_(my_pv_pretty)(aTHX_ a,b,c,d,e,f,g) ++#define Perl_pv_pretty DPPP_(my_pv_pretty) ++ ++#if defined(NEED_pv_pretty) || defined(NEED_pv_pretty_GLOBAL) ++ ++char * ++DPPP_(my_pv_pretty)(pTHX_ SV *dsv, char const * const str, const STRLEN count, ++ const STRLEN max, char const * const start_color, char const * const end_color, ++ const U32 flags) ++{ ++ const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%'; ++ STRLEN escaped; ++ ++ if (!(flags & PERL_PV_PRETTY_NOCLEAR)) ++ sv_setpvs(dsv, ""); ++ ++ if (dq == '"') ++ sv_catpvs(dsv, "\""); ++ else if (flags & PERL_PV_PRETTY_LTGT) ++ sv_catpvs(dsv, "<"); ++ ++ if (start_color != NULL) ++ sv_catpv(dsv, D_PPP_CONSTPV_ARG(start_color)); ++ ++ pv_escape(dsv, str, count, max, &escaped, flags | PERL_PV_ESCAPE_NOCLEAR); ++ ++ if (end_color != NULL) ++ sv_catpv(dsv, D_PPP_CONSTPV_ARG(end_color)); ++ ++ if (dq == '"') ++ sv_catpvs(dsv, "\""); ++ else if (flags & PERL_PV_PRETTY_LTGT) ++ sv_catpvs(dsv, ">"); ++ ++ if ((flags & PERL_PV_PRETTY_ELLIPSES) && escaped < count) ++ sv_catpvs(dsv, "..."); ++ ++ return SvPVX(dsv); ++} ++ ++#endif ++#endif ++ ++#ifndef pv_display ++#if defined(NEED_pv_display) ++static char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); ++static ++#else ++extern char * DPPP_(my_pv_display)(pTHX_ SV * dsv, const char * pv, STRLEN cur, STRLEN len, STRLEN pvlim); ++#endif ++ ++#ifdef pv_display ++# undef pv_display ++#endif ++#define pv_display(a,b,c,d,e) DPPP_(my_pv_display)(aTHX_ a,b,c,d,e) ++#define Perl_pv_display DPPP_(my_pv_display) ++ ++#if defined(NEED_pv_display) || defined(NEED_pv_display_GLOBAL) ++ ++char * ++DPPP_(my_pv_display)(pTHX_ SV *dsv, const char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) ++{ ++ pv_pretty(dsv, pv, cur, pvlim, NULL, NULL, PERL_PV_PRETTY_DUMP); ++ if (len > cur && pv[cur] == '\0') ++ sv_catpvs(dsv, "\\0"); ++ return SvPVX(dsv); ++} ++ ++#endif ++#endif ++ ++#endif /* _P_P_PORTABILITY_H_ */ ++ ++/* End of File ppport.h */ diff --git a/lang/perl-xml-parser/patches/020-xml-parser-expat-lib-inc-path-anchor.patch b/lang/perl-xml-parser/patches/020-xml-parser-expat-lib-inc-path-anchor.patch new file mode 100644 index 0000000..4e17daa --- /dev/null +++ b/lang/perl-xml-parser/patches/020-xml-parser-expat-lib-inc-path-anchor.patch @@ -0,0 +1,12 @@ +--- a/Expat/Makefile.PL ++++ b/Expat/Makefile.PL +@@ -2,6 +2,9 @@ use ExtUtils::MakeMaker; + use Config; + use English; + ++$expat_libpath = '%%EXPAT_LIBPATH%%'; ++$expat_incpath = '%%EXPAT_INCPATH%%'; ++ + my $libs = "-lexpat"; + my @extras = (); + diff --git a/lang/perl/Config.in b/lang/perl/Config.in new file mode 100644 index 0000000..14aedc2 --- /dev/null +++ b/lang/perl/Config.in @@ -0,0 +1,20 @@ +menu "Configuration" + depends on PACKAGE_perl + +config PERL_THREADS + bool "Enable threading support" + default y if (mips || mipsel || i386 || i686 || x86_64 || armeb || arm) + default n + +config PERL_TESTS + bool "Include perl tests" + default n + help + Include test suites for all perl packages. + + This will increase the size of perl and related packages + considerably. + Test support is still in development. Some tests will fail, + others are just missing completely. + +endmenu diff --git a/lang/perl/Makefile b/lang/perl/Makefile new file mode 100644 index 0000000..7c7f10d --- /dev/null +++ b/lang/perl/Makefile @@ -0,0 +1,184 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=perl +PKG_VERSION:=5.22.1 +PKG_RELEASE:=3 + +PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \ + http://www.cpan.org/src/5.0 \ + ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \ + http://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \ + ftp://ftp.gmd.de/mirrors/CPAN/src/5.0 \ + http://ftp5.gwdg.de/pub/languages/perl/CPAN/src/ \ + ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0 \ + http://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=19295bbb775a3c36123161b9bf4892f1 + +PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl +PKG_LICENSE_FILES:=Copying Artistic README +PKG_MAINTAINER:=Marcel Denia + +# Build settings +PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 +PKG_BUILD_DEPENDS:=perl/host +PKG_BUILD_PARALLEL:=1 +HOST_BUILD_PARALLEL:=1 + +# Variables used during configuration/build +HOST_PERL_PREFIX:=$(STAGING_DIR)/host/usr + +# Filter -g3, it will break Compress-Raw-Zlib +TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS)) +TARGET_CPPFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CPPFLAGS)) + +# A list of disabled tests +# ExtUtils tests are disabled for now as we don't support building +# native extensions on the target machine at the moment +PERL_DISABLEDTESTS:=cpan/ExtUtils-Constant cpan/ExtUtils-MakeMaker +# We're on Linux, so don't even package them +PERL_DISABLEDTESTS+=cpan/Win32API-File cpan/Win32 ext/VMS-DCLsym ext/VMS-Filespec ext/VMS-Stdio ext/Win32CORE os2/ +# NDBM and ODBM not supported +PERL_DISABLEDTESTS+=ext/NDBM_File ext/ODBM_File + + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk +include perlmod.mk + +define Package/perl + SUBMENU:=Perl + SECTION:=lang + CATEGORY:=Languages + TITLE:=The Perl intepreter + URL:=http://www.perl.com/ + DEPENDS:=+USE_GLIBC:libbsd +PERL_THREADS:libpthread +endef + +define Package/perl/description + Perl is a stable, cross platform programming language. + It is used for mission critical projects in the public and private sectors + and is widely used to program web applications of all needs. +endef + +define Package/perl/config + source "$(SOURCE)/Config.in" +endef + +# Static host perl +define Host/Configure + ( cd $(HOST_BUILD_DIR); ./Configure -der -Uusedl -Duserelocatableinc -Dprefix=$(HOST_PERL_PREFIX) $(if $(CONFIG_PERL_THREADS),-Dusethreads,)) +endef + +define Host/Install + ( cd $(HOST_BUILD_DIR); ./miniperl installperl ) + $(INSTALL_DIR) $(HOST_PERL_PREFIX)/bin/ + $(CP) $(HOST_BUILD_DIR)/generate_uudmap $(HOST_PERL_PREFIX)/bin/ + + # Link any possibly installed static extension in + $(MAKE) -C $(HOST_BUILD_DIR)/relink clean || true + ( cd $(HOST_BUILD_DIR)/relink && $(HOST_PERL_PREFIX)/bin/perl Makefile.PL ) + $(call perlmod/host/relink,$(HOST_BUILD_DIR)/relink) +endef + +# Target perl +define Build/Configure + $(PERL_CMD) files/perlconfig.pl -Dowrt:target_cc='$(TARGET_CC)' \ + -Dowrt:gccversion=$(CONFIG_GCC_VERSION) \ + -Dowrt:target_cross='$(TARGET_CROSS)' \ + -Dowrt:cflags='$(TARGET_CFLAGS_PERL) $(TARGET_CPPFLAGS_PERL)' \ + -Dowrt:ldflags='-rdynamic $(TARGET_LDFLAGS)' \ + -Dowrt:libc=$(subst uClibc,uclibc,$(CONFIG_LIBC)) \ + -Dowrt:ipv6=$(if $($(CONFIG_IPV6)),define,undef) \ + -Dowrt:threads=$(if $(CONFIG_PERL_THREADS),yes,no) \ + -Dowrt:staging_dir='$(STAGING_DIR)' \ + -Dowrt:host_perl_prefix='$(HOST_PERL_PREFIX)' \ + files/version.config \ + files/base.config \ + files/$(patsubst i386,i486,$(ARCH)).config \ + files/architecture.config \ + files/signal.config \ + files/threads.config \ + files/libc.config \ + files/misc.config \ + > $(PKG_BUILD_DIR)/config.sh + (cd $(PKG_BUILD_DIR) && ./Configure -S) + install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h +endef + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION) $(1)/usr/lib/perl5/ +endef + +define Package/perl/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin + ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl + + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE + $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/libperl.so $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE/ +endef + + +$(eval $(call RequireCommand,rsync, \ + $(PKG_NAME) requires rsync installed on the host-system. \ +)) + +$(eval $(call BuildPackage,perl)) +$(eval $(call HostBuild)) + +-include perlbase.mk + +# A helper package that includes all sort of supplementary files for tests +define Package/perl-tests-common +$(call Package/perlbase-template) +TITLE:=Common test support files +DEPENDS:=@PERL_TESTS +endef + +define Package/perl-tests-common/install + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR) + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/lib + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/XS + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/auto/XS + $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore + + $(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/ + $(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/auto + $(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/$(PERL_VERSION)/ + $(CP) $(PKG_BUILD_DIR)/lib/vmsish.t $(1)/$(PERL_TESTSDIR)/lib + $(CP) $(PKG_BUILD_DIR)/lib/Internals.t $(1)/$(PERL_TESTSDIR)/lib + $(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore + $(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh + sed \ + -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' \ + -e 's!%%PERL_VERSION%%!$(PERL_VERSION)!' \ + -i $(1)/$(PERL_TESTSDIR)/run_tests.sh + $(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR) + $(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR) +endef + +$(eval $(call BuildPackage,perl-tests-common)) diff --git a/lang/perl/README.patches b/lang/perl/README.patches new file mode 100644 index 0000000..5f3b595 --- /dev/null +++ b/lang/perl/README.patches @@ -0,0 +1,9 @@ +The patches in this package are loosely sorted into the following categories: + +0xx - Bugfixes +1xx - Cross-compile fixes +3xx - Workarounds +7xx - Testsuite fixes + +Feel free to add another one if your new patch doesn't seem to fit into an +existing category. \ No newline at end of file diff --git a/lang/perl/files/README.config b/lang/perl/files/README.config new file mode 100644 index 0000000..16bf058 --- /dev/null +++ b/lang/perl/files/README.config @@ -0,0 +1,59 @@ +-- Perl configuration -- + +Perl uses a huge configuration file, normally generated via the Configure script +at build-time. This fails when cross-compiling though, so we need to supply our +own. + +We're using perlconfig.pl to piece together the final configuration from a bunch +of configuration files(all ending in .config). Please refer to perlconfig.pl's +POD for information on usage and syntax. + +Throughout the files, you will see a bunch of references to private symbols with +the prefix "owrt". These are used to control output in an effort to both +simplify writing configuration files, as well as to provide switchable options +to select the feature set of the resulting perl installation. + +The following will be a summary/quick reference of all private symbols we're +currently using: + +Passed via architecture configuration file(mipsel.config, i486.config, ...) +--------------------------------------------------------------------------- +Symbol Values Description +owrt:bits 32/64 Target's native word length. +owrt:endian little/big Target's endianness. +owrt:arch mipsel, i486, ... Target's architecture name. +owrt:sig_count 64/128 Number of signals the target + provides(NSIG - 1). +owrt:sigs * Symbolic names of the first 32 signals + this architecture provides, in numeric + order. Separated by whitespaces. +owrt:sig_name_extra * Symbolic names of any additional signals + this architecture provides after + owrt:sig_count. Separated by + whitespaces. +owrt:sig_num_extra * Numeric values associated with the + signal names provided in + owrt:sig_name_extra. Separated by + whitespaces. + +Passed via command line +----------------------- +Symbol Values Description +owrt:libc glibc/uclibc/musl Which C library implementation is in + use. +owrt:threads yes/no Whether to enable threading support. +owrt:ipv6 define/undef Whether to enable IPv6 support. +owrt:target_cross * Target architecture's host triplet. +owrt:target_cc * C compiler to use. +owrt:gccversion * target_cc's version number. +owrt:cflags * Additional C compiler flags. +owrt:ldflags * Additional linker flags. +owrt:staging_dir * Same as OpenWRT buildroot's + $(STAGING_DIR). +owrt:host_perl_prefix * host-perl installation prefix. + +Passed via version.config +------------------------- +Symbol Values Description +owrt:perllibpath * Path to perl library files, from the + target's point of view. diff --git a/lang/perl/files/architecture.config b/lang/perl/files/architecture.config new file mode 100644 index 0000000..cc97281 --- /dev/null +++ b/lang/perl/files/architecture.config @@ -0,0 +1,121 @@ +alignbytes='8' + +($owrt:bits eq '32') { + ($owrt:endian eq 'little') { + byteorder='1234' + } + ($owrt:endian eq 'big') { + byteorder='4321' + } + + # Types + ivsize='4' + uvsize='4' + longsize='4' + longdblsize='8' + ptrsize='4' + + #quadkind='3' + #doublekind='3' + #longdblkind='0' + + i8type='signed char' + i16type='signed short' + i32type='signed long' + i64type='signed long long' + u32type='unsigned long' + u64type='unsigned long long' + quadtype='long long' + uquadtype='unsigned long long' + + sizesize='4' + + use64bitall='undef' + use64bitint='undef' + + uidformat='"lu"' + gidformat='"lu"' + + selectminbits='32' + + sGMTIME_max='2147483647' + sGMTIME_min='-2147483648' + sLOCALTIME_max='2147483647' + sLOCALTIME_min='-2147483648' + + sPRIi64='"Li"' + sPRIo64='"Lo"' + sPRIu64='"Lu"' + sPRIx64='"Lx"' + sPRId64='"Ld"' + + netdb_host_type='const void *' + nv_preserves_uv_bits='32' + d_nv_preserves_uv='define' + d_printf_format_null='define' + d_u32align='undef' +} +($owrt:bits eq '64') { + ($owrt:endian eq 'little') { + byteorder='12345678' + } + ($owrt:endian eq 'big') { + byteorder='87654321' + } + + # Types + ivsize='8' + uvsize='8' + longsize='8' + longdblsize='16' + ptrsize='8' + + quadtype='long' + + i16type='signed short' + i32type='signed int' + i64type='signed long' + i8type='signed char' + + u32type='unsigned int' + u64type='unsigned long' + uquadtype='unsigned long' + + sizesize='8' + + uidformat='"u"' + gidformat='"u"' + + selectminbits='64' + + sGMTIME_max='67768036191676799' + sGMTIME_min='-62167219200' + sLOCALTIME_max='67768036191673199' + sLOCALTIME_min='-62167222408' + + sPRIi64='"li"' + sPRIo64='"lo"' + sPRIu64='"lu"' + sPRIx64='"lx"' + sPRId64='"ld"' + + netdb_host_type='char *' + nv_preserves_uv_bits='53' + d_nv_preserves_uv='undef' + d_printf_format_null='undef' + d_u32align='define' + use64bitall='define' + use64bitint='define' +} + +# Only defined by i486 and x86_64. Provide defaults for all others +(!defined($sPRIEUldbl)) { + sPRIEUldbl='"E"' + sPRIFUldbl='"F"' + sPRIGUldbl='"G"' + sPRIXU64='"LX"' + sPRIeldbl='"e"' + sPRIfldbl='"f"' + sPRIgldbl='"g"' + sSCNfldbl='"f"' +} diff --git a/lang/perl/files/arm.config b/lang/perl/files/arm.config new file mode 100644 index 0000000..75fe254 --- /dev/null +++ b/lang/perl/files/arm.config @@ -0,0 +1,19 @@ +owrt:arch=arm +owrt:bits=32 +owrt:endian=little + +ccsymbols='__ARM_ARCH_3__=1' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='3' +fpossize='20' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/armeb.config b/lang/perl/files/armeb.config new file mode 100644 index 0000000..081300c --- /dev/null +++ b/lang/perl/files/armeb.config @@ -0,0 +1,19 @@ +owrt:arch=armeb +owrt:bits=32 +owrt:endian=big + +ccsymbols='__ARM_ARCH_3__=1' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='4' +fpossize='20' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/base.config b/lang/perl/files/base.config new file mode 100644 index 0000000..edc3bd4 --- /dev/null +++ b/lang/perl/files/base.config @@ -0,0 +1,1005 @@ +Author='' +Date='' +Header='' +Id='' +Locker='' +Log='' +PERL_CONFIG_SH=true +PERL_PATCHLEVEL= +RCSfile='' +Revision='' +Source='' +State='' +_a='.a' +_exe='' +_o='.o' +afs='false' +afsroot='/afs' +ansi2knr='' +aphostname='/bin/hostname' +ar='ar' +archname64='' +archobjs='' +awk='awk' +baserev='5.0' +bash='' +bin='/usr/bin' +bin_ELF='define' +binexp='/usr/bin' +bison='bison' +byacc='byacc' +c='' +castflags='0' +cat='cat' +ccname='gcc' +ccversion='' +cf_by='root' +charbits='8' +charsize='1' +chgrp='' +chmod='chmod' +chown='' +clocktype='clock_t' +comm='comm' +compress='' +config_arg0='./Configure' +config_arg1='-der' +contains='grep' +cp='cp' +cpio='' +cpp='cpp' +cpp_stuff='42' +cpplast='-' +cppminus='-' +cryptlib='' +csh='csh' +ctermid_r_proto='0' +d_Gconvert='sprintf((b),"%.*g",(n),(x))' +d_PRIEUldbl='define' +d_PRIFUldbl='define' +d_PRIGUldbl='define' +d_PRIXU64='define' +d_PRId64='define' +d_PRIeldbl='define' +d_PRIfldbl='define' +d_PRIgldbl='define' +d_PRIi64='define' +d_PRIo64='define' +d_PRIu64='define' +d_PRIx64='define' +d_SCNfldbl='define' +d__fwalk='undef' +d_access='define' +d_accessx='undef' +d_acosh='define' +d_aintl='undef' +d_alarm='define' +d_archlib='undef' +d_asctime64='undef' +d_asinh='define' +d_atanh='define' +d_atolf='undef' +d_atoll='define' +d_attribute_deprecated='define' +d_attribute_format='define' +d_attribute_malloc='define' +d_attribute_nonnull='define' +d_attribute_noreturn='define' +d_attribute_pure='define' +d_attribute_unused='define' +d_attribute_warn_unused_result='define' +d_backtrace='define' +d_bcmp='define' +d_bcopy='define' +d_bsd='undef' +d_bsdgetpgrp='undef' +d_bsdsetpgrp='undef' +d_builtin_choose_expr='define' +d_builtin_expect='undef' +d_bzero='define' +d_c99_variadic_macros='define' +d_castneg='define' +d_cbrt='define' +d_charvspr='undef' +d_chown='define' +d_chroot='define' +d_chsize='undef' +d_class='undef' +d_clearenv='define' +d_clock='define' +d_clock_getres='define' +d_clock_gettime='define' +d_clock_nanosleep='define' +d_closedir='define' +d_cmsghdr_s='define' +d_const='define' +d_copysign='define' +d_copysignl='undef' +d_cplusplus='undef' +d_csh='undef' +d_ctermid='define' +d_ctermid_r='undef' +d_ctime64='undef' +d_cuserid='define' +d_dbl_dig='define' +d_dbminitproto='undef' +d_difftime='define' +d_difftime64='undef' +d_dir_dd_fd='undef' +d_dirfd='define' +d_dirnamlen='undef' +d_dladdr='define' +d_dlerror='define' +d_dlopen='define' +d_dlsymun='undef' +d_dosuid='undef' +d_drand48proto='define' +d_dup2='define' +d_eaccess='undef' +d_endgrent='define' +d_endgrent_r='undef' +d_endhent='define' +d_endhostent_r='undef' +d_endnent='define' +d_endnetent_r='undef' +d_endpent='define' +d_endprotoent_r='undef' +d_endpwent='define' +d_endpwent_r='undef' +d_endsent='define' +d_endservent_r='undef' +d_eofnblk='define' +d_erf='define' +d_erfc='define' +d_eunice='undef' +d_exp2='define' +d_expm1='define' +d_faststdio='undef' +d_fchdir='define' +d_fchmod='define' +d_fchown='define' +d_fcntl='define' +d_fcntl_can_lock='define' +d_fd_macros='define' +d_fd_set='define' +d_fdim='define' +d_fgetpos='define' +d_finite='define' +d_finitel='undef' +d_flexfnam='define' +d_flock='define' +d_flockproto='define' +d_fma='define' +d_fmax='define' +d_fmin='define' +d_fork='define' +d_fp_class='undef' +d_fp_classify='undef' +d_fp_classl='undef' +d_fpathconf='define' +d_fpclass='undef' +d_fpclassify='define' +d_fpclassl='undef' +d_fpgetround='undef' +d_fpos64_t='undef' +d_frexpl='undef' +d_fs_data_s='undef' +d_fseeko='define' +d_fsetpos='define' +d_fstatfs='define' +d_fstatvfs='define' +d_fsync='define' +d_ftello='define' +d_ftime='undef' +d_futimes='undef' +d_gdbm_ndbm_h_uses_prototypes='undef' +d_gdbmndbm_h_uses_prototypes='undef' +d_getaddrinfo='define' +d_getcwd='define' +d_getespwnam='undef' +d_getfsstat='undef' +d_getgrent='define' +d_getgrps='define' +d_gethbyaddr='define' +d_gethbyname='define' +d_gethent='define' +d_gethname='define' +d_gethostprotos='define' +d_getitimer='define' +d_getlogin='define' +d_getmnt='undef' +d_getmntent='define' +d_getnameinfo='define' +d_getnbyaddr='define' +d_getnbyname='define' +d_getnent='define' +d_getnetprotos='define' +d_getpagsz='define' +d_getpbyname='define' +d_getpbynumber='define' +d_getpent='define' +d_getpgid='define' +d_getpgrp='define' +d_getpgrp2='undef' +d_getppid='define' +d_getprior='define' +d_getprotoprotos='define' +d_getprpwnam='undef' +d_getpwent='define' +d_getsbyname='define' +d_getsbyport='define' +d_getsent='define' +d_getservprotos='define' +d_getspnam='define' +d_gettimeod='define' +d_gmtime64='undef' +d_gnulibc='undef' +d_grpasswd='define' +d_hasmntopt='define' +d_htonl='define' +d_hypot='define' +d_ilogb='define' +d_ilogbl='undef' +d_inc_version_list='undef' +d_index='undef' +d_inetaton='define' +d_inetntop='define' +d_inetpton='define' +d_int64_t='define' +d_ip_mreq='define' +d_ip_mreq_source='define' +d_ipv6_mreq="$owrt:ipv6" +d_ipv6_mreq_source='undef' +d_isascii='define' +d_isblank='define' +d_isfinite='define' +d_isfinitel='undef' +d_isinf='define' +d_isinfl='define' +d_isless='undef' +d_isnan='define' +d_isnanl='undef' +d_isnormal='define' +d_killpg='define' +d_lc_monetary_2008='define' +d_lchown='define' +d_ldbl_dig='define' +d_ldexpl='define' +d_lgamma='define' +d_lgamma_r='define' +d_libm_lib_version='define' +d_libname_unique='undef' +d_link='define' +d_llrint='define' +d_llrintl='define' +d_llround='define' +d_llroundl='define' +d_localtime64='undef' +d_locconv='define' +d_lockf='define' +d_log1p='define' +d_log2='define' +d_logb='define' +d_longdbl='define' +d_longlong='define' +d_lrint='define' +d_lrintl='define' +d_lround='define' +d_lroundl='define' +d_lseekproto='define' +d_lstat='define' +d_madvise='define' +d_malloc_good_size='undef' +d_malloc_size='undef' +d_mblen='define' +d_mbstowcs='define' +d_mbtowc='define' +d_memchr='define' +d_memcmp='define' +d_memcpy='define' +d_memmove='define' +d_memset='define' +d_mkdir='define' +d_mkdtemp='define' +d_mkfifo='define' +d_mkstemp='define' +d_mkstemps='undef' +d_mktime='define' +d_mktime64='undef' +d_mmap='define' +d_modfl='undef' +d_modfl_pow32_bug='undef' +d_mprotect='define' +d_msg='define' +d_msg_ctrunc='define' +d_msg_dontroute='define' +d_msg_oob='define' +d_msg_peek='define' +d_msg_proxy='define' +d_msgctl='define' +d_msgget='define' +d_msghdr_s='define' +d_msgrcv='define' +d_msgsnd='define' +d_msync='define' +d_munmap='define' +d_mymalloc='undef' +d_nan='define' +d_nanosleep='define' +d_ndbm='undef' +d_ndbm_h_uses_prototypes='undef' +d_nearbyint='define' +d_nextafter='define' +d_nice='define' +d_nl_langinfo='define' +d_nv_zero_is_allbits_zero='define' +d_old_pthread_create_joinable='undef' +d_oldpthreads='undef' +d_oldsock='undef' +d_open3='define' +d_pathconf='define' +d_pause='define' +d_perl_otherlibdirs='undef' +d_phostname='undef' +d_pipe='define' +d_poll='define' +d_portable='define' +d_prctl='define' +d_prctl_set_name='define' +d_procselfexe='define' +d_pseudofork='undef' +d_pthread_attr_setscope='define' +d_ptrdiff_t='define' +d_pwage='undef' +d_pwchange='undef' +d_pwclass='undef' +d_pwcomment='undef' +d_pwexpire='undef' +d_pwgecos='define' +d_pwpasswd='define' +d_pwquota='undef' +d_qgcvt='undef' +d_quad='define' +d_re_comp='undef' +d_readdir='define' +d_readlink='define' +d_readv='define' +d_recvmsg='define' +d_regcmp='undef' +d_regcomp='define' +d_remainder='define' +d_remquo='define' +d_rename='define' +d_rewinddir='define' +d_rint='define' +d_rmdir='define' +d_round='define' +d_safebcpy='undef' +d_safemcpy='undef' +d_sanemcmp='define' +d_sbrkproto='define' +d_scalbn='define' +d_scalbnl='undef' +d_sched_yield='define' +d_scm_rights='define' +d_seekdir='define' +d_select='define' +d_sem='define' +d_semctl='define' +d_semctl_semid_ds='define' +d_semctl_semun='define' +d_semget='define' +d_semop='define' +d_sendmsg='define' +d_setegid='define' +d_seteuid='define' +d_setgrent='define' +d_setgrent_r='undef' +d_setgrps='define' +d_sethent='define' +d_sethostent_r='undef' +d_setitimer='define' +d_setlinebuf='define' +d_setlocale='define' +d_setlocale_r='undef' +d_setnent='define' +d_setnetent_r='undef' +d_setpent='define' +d_setpgid='define' +d_setpgrp='define' +d_setpgrp2='undef' +d_setprior='define' +d_setproctitle='undef' +d_setprotoent_r='undef' +d_setpwent='define' +d_setpwent_r='undef' +d_setregid='define' +d_setresgid='define' +d_setresuid='define' +d_setreuid='define' +d_setrgid='undef' +d_setruid='undef' +d_setsent='define' +d_setservent_r='undef' +d_setsid='define' +d_setvbuf='define' +d_sfio='undef' +d_shm='define' +d_shmat='define' +d_shmatprototype='define' +d_shmctl='define' +d_shmdt='define' +d_shmget='define' +d_sigaction='define' +d_signbit='undef' +d_sigprocmask='define' +d_sigsetjmp='define' +d_sin6_scope_id="$owrt:ipv6" +d_sitearch='define' +d_snprintf='define' +d_sockaddr_in6="$owrt:ipv6" +d_sockaddr_sa_len='undef' +d_sockatmark='undef' +d_sockatmarkproto='undef' +d_socket='define' +d_socklen_t='define' +d_sockpair='define' +d_socks5_init='undef' +d_sprintf_returns_strlen='define' +d_sqrtl='undef' +d_stat='define' +d_statblks='define' +d_statfs_f_flags='undef' +d_statfs_s='define' +d_static_inline='define' +d_statvfs='define' +d_stdio_cnt_lval='undef' +d_stdio_ptr_lval='undef' +d_stdio_ptr_lval_nochange_cnt='undef' +d_stdio_ptr_lval_sets_cnt='undef' +d_stdio_stream_array='undef' +d_stdiobase='undef' +d_stdstdio='undef' +d_strchr='define' +d_strcoll='define' +d_strctcpy='define' +d_strerrm='strerror(e)' +d_strerror='define' +d_strftime='define' +d_strlcat='define' +d_strlcpy='define' +d_strtod='define' +d_strtol='define' +d_strtold='define' +d_strtoll='define' +d_strtoq='define' +d_strtoul='define' +d_strtoull='define' +d_strtouq='define' +d_strxfrm='define' +d_suidsafe='undef' +d_symlink='define' +d_syscall='define' +d_syscallproto='define' +d_sysconf='define' +d_sysernlst='' +d_syserrlst='undef' +d_system='define' +d_tcgetpgrp='define' +d_tcsetpgrp='define' +d_telldir='define' +d_telldirproto='define' +d_tgamma='define' +d_time='define' +d_timegm='define' +d_times='define' +d_tm_tm_gmtoff='define' +d_tm_tm_zone='define' +d_trunc='define' +d_truncate='define' +d_truncl='define' +d_tzname='define' +d_ualarm='define' +d_umask='define' +d_uname='define' +d_union_semun='undef' +d_unordered='undef' +d_unsetenv='define' +d_usleep='define' +d_usleepproto='define' +d_ustat='define' +d_vendorarch='undef' +d_vendorbin='undef' +d_vendorlib='undef' +d_vendorscript='undef' +d_vfork='undef' +d_void_closedir='undef' +d_voidsig='define' +d_voidtty='' +d_volatile='define' +d_vprintf='define' +d_vsnprintf='define' +d_wait4='define' +d_waitpid='define' +d_wcscmp='define' +d_wcstombs='define' +d_wcsxfrm='define' +d_wctomb='define' +d_writev='define' +d_xenix='undef' +date='date' +db_hashtype='u_int32_t' +db_prefixtype='size_t' +db_version_major='' +db_version_minor='' +db_version_patch='' +defvoidused='15' +direntrytype='struct dirent' +dlext='so' +dlsrc='dl_dlopen.xs' +doublesize='8' +drand01='drand48()' +dtrace='' +eagain='EAGAIN' +ebcdic='undef' +echo='echo' +egrep='egrep' +emacs='' +endgrent_r_proto='0' +endhostent_r_proto='0' +endnetent_r_proto='0' +endprotoent_r_proto='0' +endpwent_r_proto='0' +endservent_r_proto='0' +eunicefix=':' +exe_ext='' +expr='expr' +extern_C='extern' +extras='' +fflushNULL='define' +fflushall='undef' +find='' +firstmakefile='makefile' +flex='' +fpostype='fpos_t' +freetype='void' +from=':' +full_csh='csh' +full_sed='sed' +gccansipedantic='' +gccosandvers='' +gidsign='1' +gidsize='4' +gidtype='gid_t' +glibpth='/usr/shlib /lib /usr/lib /usr/lib/386 /lib/386 /usr/ccs/lib /usr/ucblib /usr/local/lib ' +gmake='gmake' +gnulibc_version='' +grep='grep' +groupcat='cat /etc/group' +groupstype='gid_t' +gzip='gzip' +h_fcntl='false' +h_sysfile='true' +hint='recommended' +hostcat='cat /etc/hosts' +hostgenerate="$owrt:host_perl_prefix/bin/generate_uudmap" +hostosname='' +hostperl="$owrt:host_perl_prefix/bin/perl" +html1dir=' ' +html1direxp='' +html3dir=' ' +html3direxp='' +i16size='2' +i32size='4' +i64size='8' +i8size='1' +i_arpainet='define' +i_assert='define' +i_bfd='undef' +i_bsdioctl='' +i_db='define' +i_dbm='undef' +i_dirent='define' +i_dld='undef' +i_dlfcn='define' +i_execinfo='define' +i_fcntl='undef' +i_fenv='undef' +i_float='define' +i_fp='undef' +i_fp_class='undef' +i_gdbm='define' +i_gdbm_ndbm='undef' +i_gdbmndbm='undef' +i_grp='define' +i_ieeefp='undef' +i_inttypes='define' +i_langinfo='define' +i_libutil='undef' +i_limits='define' +i_locale='define' +i_machcthr='undef' +i_malloc='define' +i_mallocmalloc='undef' +i_math='define' +i_memory='undef' +i_mntent='define' +i_ndbm='undef' +i_netdb='define' +i_neterrno='undef' +i_netinettcp='define' +i_niin='define' +i_poll='define' +i_prot='undef' +i_pthread='define' +i_pwd='define' +i_quadmath='define' +i_rpcsvcdbm='undef' +i_sfio='undef' +i_sgtty='undef' +i_shadow='define' +i_socks='undef' +i_stdarg='define' +i_stdbool='define' +i_stddef='define' +i_stdint='define' +i_stdlib='define' +i_string='define' +i_sunmath='undef' +i_sysaccess='undef' +i_sysdir='define' +i_sysfile='define' +i_sysfilio='undef' +i_sysin='undef' +i_sysioctl='define' +i_syslog='define' +i_sysmman='define' +i_sysmode='undef' +i_sysmount='define' +i_sysndir='undef' +i_sysparam='define' +i_syspoll='define' +i_sysresrc='define' +i_syssecrt='undef' +i_sysselct='define' +i_syssockio='undef' +i_sysstat='define' +i_sysstatfs='define' +i_sysstatvfs='define' +i_systime='define' +i_systimek='undef' +i_systimes='define' +i_systypes='define' +i_sysuio='define' +i_sysun='define' +i_sysutsname='define' +i_sysvfs='define' +i_syswait='define' +i_termio='undef' +i_termios='define' +i_time='define' +i_unistd='define' +i_ustat='define' +i_utime='define' +i_values='define' +i_varargs='undef' +i_varhdr='stdarg.h' +i_vfork='undef' +ignore_versioned_solibs='y' +inc_version_list=' ' +inc_version_list_init='0' +incpath='' +inews='' +initialinstalllocation='/usr/bin' +installbin='/usr/bin' +installhtml1dir='' +installhtml3dir='' +installman1dir='' +installman3dir='' +installprefix='/usr' +installprefixexp='/usr' +installscript='/usr/bin' +installsitebin='/usr/bin' +installsitehtml1dir='' +installsitehtml3dir='' +installsiteman1dir='' +installsiteman3dir='' +installsitescript='/usr/bin' +installstyle='lib/perl5' +installusrbinperl='define' +installvendorarch='' +installvendorbin='' +installvendorhtml1dir='' +installvendorhtml3dir='' +installvendorlib='' +installvendorman1dir='' +installvendorman3dir='' +installvendorscript='' +intsize='4' +issymlink='test -h' +ivdformat='"ld"' +ivtype='long' +ksh='' +ld_can_script='define' +ldlibpthname='LD_LIBRARY_PATH' +less='less' +lib_ext='.a' +libc='' +libdb_needs_pthread='N' +libperl='libperl.so' +libpth="$owrt:staging_dir/lib $owrt:staging_dir/usr/lib" +libsdirs="$owrt:staging_dir/lib $owrt:staging_dir/usr/lib" +libspath="$owrt:staging_dir/lib $owrt:staging_dir/usr/lib" +libswanted_uselargefiles='' +line='' +lint='' +lkflags='' +ln='ln' +lns='/bin/ln -s' +locincpth=' ' +loclibpth=' ' +longlongsize='8' +lp='' +lpr='' +ls='ls' +lseeksize='8' +lseektype='off_t' +mail='' +mailx='' +make='make' +make_set_make='#' +mallocobj='' +mallocsrc='' +malloctype='void *' +man1dir=' ' +man1direxp='' +man1ext='0' +man3dir=' ' +man3direxp='' +man3ext='0' +mips_type='' +mistrustnm='' +mkdir='mkdir' +mmaptype='void *' +modetype='mode_t' +more='more' +multiarch='undef' +mv='' +mydomain='.dev.null' +n='-n' +netdb_hlen_type='size_t' +netdb_name_type='const char *' +netdb_net_type='in_addr_t' +nm='nm' +nm_opt='' +nm_so_opt='--dynamic' +nroff='nroff' +nvEUformat='"E"' +nvFUformat='"F"' +nvGUformat='"G"' +nv_overflows_integers_at='256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0' +nveformat='"e"' +nvfformat='"f"' +nvgformat='"g"' +nvsize='8' +nvtype='double' +o_nonblock='O_NONBLOCK' +obj_ext='.o' +old_pthread_create_joinable='' +optimize='-O2' +orderlib='false' +osname='linux' +otherlibdirs=' ' +package='perl5' +pager='/usr/bin/less' +passcat='cat /etc/passwd' +path_sep=':' +perl='' +perl5='' +perl_patchlevel='' +perl_static_inline='static __inline__' +perlpath='/usr/bin/perl' +pg='pg' +phostname='hostname' +pidtype='pid_t' +plibpth='' +pmake='' +pr='' +prefix='/usr' +prefixexp='/usr' +procselfexe='"/proc/self/exe"' +prototype='define' +randbits='48' +randfunc='drand48' +randseedtype='long' +ranlib=':' +rd_nodata='-1' +rm='rm' +rm_try='/bin/rm -f try try a.out .out try.[cho] try..o core core.try* try.core*' +rmail='' +run='' +runnm='false' +sched_yield='sched_yield()' +scriptdir='/usr/bin' +scriptdirexp='/usr/bin' +sed='sed' +seedfunc='srand48' +selecttype='fd_set *' +sendmail='' +setgrent_r_proto='0' +sethostent_r_proto='0' +setlocale_r_proto='0' +setnetent_r_proto='0' +setprotoent_r_proto='0' +setpwent_r_proto='0' +setservent_r_proto='0' +sh='/bin/sh' +shar='' +sharpbang='#!' +shmattype='void *' +shortsize='2' +shrpenv='' +shsharp='true' +signal_t='void' +sitearch='' +sitearchexp='' +sitebin='/usr/bin' +sitebinexp='/usr/bin' +sitehtml1dir='' +sitehtml1direxp='' +sitehtml3dir='' +sitehtml3direxp='' +sitelib='' +sitelibexp='' +siteman1dir='' +siteman1direxp='' +siteman3dir='' +siteman3direxp='' +siteprefix='/usr' +siteprefixexp='/usr' +sitescript='/usr/bin' +sitescriptexp='/usr/bin' +sizetype='size_t' +sleep='' +smail='' +so='so' +sockethdr='' +socketlib='' +socksizetype='socklen_t' +sort='sort' +spackage='Perl5' +spitshell='cat' +src='.' +ssizetype='ssize_t' +st_ino_sign='1' +st_ino_size='8' +startperl='#!/usr/bin/perl' +startsh='#!/bin/sh' +static_ext=' ' +stdchar='char' +stdio_base='((fp)->_base)' +stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)' +stdio_cnt='((fp)->_cnt)' +stdio_filbuf='' +stdio_ptr='((fp)->_ptr)' +stdio_stream_array='' +submit='' +sysman='/usr/share/man/man1' +sysroot='' +tail='' +tar='' +targetdir='' +targetenv='' +targethost='' +targetmkdir='' +targetport='' +targetsh='/bin/sh' +tbl='' +tee='' +test='test' +timetype='time_t' +to=':' +touch='touch' +tr='tr' +trnl='\n' +troff='' +u16size='2' +u16type='unsigned short' +u32size='4' +u64size='8' +u8size='1' +u8type='unsigned char' +uidsign='1' +uidsize='4' +uidtype='uid_t' +uname='uname' +uniq='uniq' +use5005threads='undef' +usecbacktrace='undef' +usecrosscompile='define' +usedevel='undef' +usedl='define' +usedtrace='undef' +usefaststdio='undef' +usekernprocpathname='undef' +uselargefiles='define' +uselongdouble='undef' +usemallocwrap='define' +usemorebits='undef' +usemymalloc='n' +usenm='true' +usensgetexecutablepath='undef' +useopcode='true' +useperlio='define' +useposix='true' +usequadmath='undef' +usereentrant='undef' +userelocatableinc='undef' +usesfio='false' +useshrplib='true' +usesitecustomize='undef' +usesocks='undef' +usevendorprefix='undef' +useversionedarchname='undef' +usevfork='false' +usrinc="$owrt:staging_dir/include $owrt:staging_dir/usr/include" +uuname='' +uvXUformat='"lX"' +uvoformat='"lo"' +uvtype='unsigned long' +uvuformat='"lu"' +uvxformat='"lx"' +vaproto='define' +vendorarch='' +vendorarchexp='' +vendorbin='' +vendorbinexp='' +vendorhtml1dir=' ' +vendorhtml1direxp='' +vendorhtml3dir=' ' +vendorhtml3direxp='' +vendorlib='' +vendorlib_stem='' +vendorlibexp='' +vendorman1dir=' ' +vendorman1direxp='' +vendorman3dir=' ' +vendorman3direxp='' +vendorprefix='' +vendorprefixexp='' +vendorscript='' +vendorscriptexp='' +versiononly='undef' +vi='' +voidflags='15' +xlibpth='/usr/lib/386 /lib/386' +yacc='yacc' +yaccflags='' +zcat='' +zip='zip' + +config_argc=1 +config_args='-der' + +# Tools +cpprun="$owrt:target_cc -E" +cppstdin="$owrt:target_cc -E" +cc="$owrt:target_cc" +ld="$cc" +full_ar="${owrt:target_cross}ar" + +# Tool flags +cppflags="$owrt:cflags" +ccflags="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $owrt:cflags" +ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' +ccdlflags="-fPIC -Wl,-rpath,$owrt:perllibpath/CORE" +cccdlflags='-fPIC' +ldflags='' +ldflags_uselargefiles='' +lddlflags="-shared $owrt:ldflags" + +# Libraries +perllibs='-ldl -lm -lcrypt -lutil -lc' +libs='-lgdbm -ldb -ldl -lm -lcrypt -lutil -lc' +libsfiles='libdl.so libm.so libcrypt.so libutil.so libc.so' +libswanted='sfio socket inet nm ndbm gdbm dbm db malloc dl dld ld sun m crypt sec util c cposix posix ucb BSD' diff --git a/lang/perl/files/i486.config b/lang/perl/files/i486.config new file mode 100644 index 0000000..b44c64e --- /dev/null +++ b/lang/perl/files/i486.config @@ -0,0 +1,28 @@ +owrt:arch=i486 +owrt:bits=32 +owrt:endian=little + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 i386=1 __i386=1 __i386__=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='undef' +d_modflproto='define' +doublekind='3' +fpossize='20' +longdblkind='3' +need_va_copy='undef' +quadkind='3' + +sPRIEUldbl='"LE"' +sPRIFUldbl='"LF"' +sPRIGUldbl='"LG"' +sPRIXU64='"LX"' +sPRIeldbl='"Le"' +sPRIfldbl='"Lf"' +sPRIgldbl='"Lg"' +sSCNfldbl='"Lf"' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/libc.config b/lang/perl/files/libc.config new file mode 100644 index 0000000..93d190c --- /dev/null +++ b/lang/perl/files/libc.config @@ -0,0 +1,47 @@ +($owrt:libc eq 'glibc') { + perllibs="$perllibs -lbsd" + ldflags="$ldflags -L$owrt:staging_dir/lib" +} + +# uclibc does not provide crypt_r(). +($owrt:libc eq 'uclibc') { + crypt_r_proto='0' + d_crypt_r='undef' +} + +($owrt:libc eq 'musl') { + # musl does not provide a working setlocale(). It accepts arbitrary locales + # and makes them act as if they were C.UTF-8. + d_setlocale='undef' + + d_stdio_ptr_lval='undef' + d_stdio_ptr_lval_sets_cnt='undef' + d_stdiobase='undef' + d_stdstdio='undef' + + d_getnetbyname_r='undef' + + d_getprotobyname_r='undef' + d_getpwent_r='undef' + d_getservent_r='undef' + d_gethostent_r='undef' + d_getnetent_r='undef' + d_getnetbyaddr_r='undef' + d_getprotoent_r='undef' + d_getprotobynumber_r='undef' + d_getgrent_r='undef' + + getprotobyname_r='undef' + getpwent_r='undef' + getservent_r='undef' + gethostent_r='undef' + getnetent_r='undef' + getnetbyaddr_r='undef' + getprotoent_r='undef' + getprotobynumber_r='undef' + getgrent_r='undef' + + i_fcntl='define' + h_fcntl='true' + d_strerror_r='undef' +} diff --git a/lang/perl/files/mips.config b/lang/perl/files/mips.config new file mode 100644 index 0000000..05e807b --- /dev/null +++ b/lang/perl/files/mips.config @@ -0,0 +1,19 @@ +owrt:arch=mips +owrt:bits=32 +owrt:endian=big + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 LANGUAGE_C=1 _LANGUAGE_C=1 __LANGUAGE_C=1 __LANGUAGE_C__=1 _LARGEFILE_SOURCE=1 MIPSEL=1 _MIPSEL=1 __MIPSEL=1 __MIPSEL__=1 _MIPS_FPSET=16 _MIPS_ISA=_MIPS_ISA_MIPS1 _MIPS_SIM=1 _MIPS_SZINT=32 _MIPS_SZLONG=32 _MIPS_SZPTR=32 __PIC__=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 R3000=1 _R3000=1 __R3000=1 __R3000__=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 mips=1 _mips=1 __mips=1 __mips__=1 __pic__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='4' +fpossize='24' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count=128 +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ' +owrt:sig_name_extra='IOT CLD POLL' +owrt:sig_num_extra='6 18 22' diff --git a/lang/perl/files/mips64.config b/lang/perl/files/mips64.config new file mode 100644 index 0000000..89875f7 --- /dev/null +++ b/lang/perl/files/mips64.config @@ -0,0 +1,19 @@ +owrt:arch=mips64 +owrt:bits=64 +owrt:endian=big + +ccsymbols='' +cppccsymbols='' +cppsymbols='' +d_casti32='define' +d_modflproto='undef' +doublekind='4' +fpossize='24' +longdblkind='6' +need_va_copy='define' +quadkind='2' + +owrt:sig_count=128 +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ' +owrt:sig_name_extra='IOT CLD POLL' +owrt:sig_num_extra='6 18 22' diff --git a/lang/perl/files/mipsel.config b/lang/perl/files/mipsel.config new file mode 100644 index 0000000..d209a0d --- /dev/null +++ b/lang/perl/files/mipsel.config @@ -0,0 +1,19 @@ +owrt:arch=mipsel +owrt:bits=32 +owrt:endian=little + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 LANGUAGE_C=1 _LANGUAGE_C=1 __LANGUAGE_C=1 __LANGUAGE_C__=1 _LARGEFILE_SOURCE=1 MIPSEL=1 _MIPSEL=1 __MIPSEL=1 __MIPSEL__=1 _MIPS_FPSET=16 _MIPS_ISA=_MIPS_ISA_MIPS1 _MIPS_SIM=1 _MIPS_SZINT=32 _MIPS_SZLONG=32 _MIPS_SZPTR=32 __PIC__=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 R3000=1 _R3000=1 __R3000=1 __R3000__=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 mips=1 _mips=1 __mips=1 __mips__=1 __pic__=1 unix=1 __unix=1 __unix__=1' +d_casti32='define' +d_modflproto='undef' +doublekind='3' +fpossize='24' +longdblkind='0' +need_va_copy='undef' +quadkind='3' + +owrt:sig_count=128 +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR WINCH URG IO STOP TSTP CONT TTIN TTOU VTALRM PROF XCPU XFSZ' +owrt:sig_name_extra='IOT CLD POLL' +owrt:sig_num_extra='6 18 22' diff --git a/lang/perl/files/misc.config b/lang/perl/files/misc.config new file mode 100644 index 0000000..3e8f6bd --- /dev/null +++ b/lang/perl/files/misc.config @@ -0,0 +1,11 @@ +cf_email='naoir@gmx.net' +osvers='3.18.19' +gccversion="$owrt:gccversion" +myhostname='OpenWrt' +cf_time='Thu Jan 1 12:00:00 CEST 2015' + +perladmin="$cf_email" +archname="$owrt:arch-linux-$owrt:libc" +targetarch="$archname" +myarchname="$archname" +myuname="Linux $myhostname $osvers #1 SMP $cf_time @{[$owrt:arch =~ s/(el|eb)$//r]} GNU/Linux" diff --git a/lang/perl/files/perl-run_tests.sh b/lang/perl/files/perl-run_tests.sh new file mode 100755 index 0000000..bf83c0a --- /dev/null +++ b/lang/perl/files/perl-run_tests.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +PERL_TESTSDIR="/usr/share/perl/perl-tests" +PERL_LIBDIR="/usr/lib/perl5/%%PERL_VERSION%%/" +PERL_DISABLEDTESTS="%%PERL_DISABLEDTESTS%%" + +no_run="" +manual_run="" +manual_run_no_base="" + +while [ ! -z "$1" ]; do + case $1 in + -n) + no_run="yes" + ;; + -m) + manual_run="yes" + ;; + -mb) + manual_run="yes" + manual_run_no_base="yes" + ;; + --help) + echo "run_tests.sh [-n|-m|-mb|--help]" + echo "" + echo "Options:" + echo " -n Just prepare the environment. Don't actually run any tests" + echo " -m Run tests manually according to MANIFEST, instead of whatever t/TEST chooses" + echo " -mb Don't run base tests. Implies -m" + echo " --help Print this help ;)" + echo "" + exit 0 + ;; + *) + echo "Invalid argument: $1" + ;; + esac + shift +done + +if [ ! -f "$PERL_TESTSDIR/__prepared" ]; then + # Many tests insist on having PERL5LIB in $PERL_TESTSDIR/lib. However, + # that directory may also contain tests. Some of them(FindBin.t in particular) + # also demand being located in a directory ending with "lib". So we can't do symlink + # trickery here. + # Our solution is to just copy PERL5LIB over. + if [ -d "$PERL_TESTSDIR/lib" ]; then + cp -a "$PERL_LIBDIR/"* "$PERL_TESTSDIR/lib/" + else + ln -s "$PERL_LIBDIR" "$PERL_TESTSDIR/lib" + fi + + ln -s /usr/bin/perl "$PERL_TESTSDIR/perl" + ln -s /usr/bin/perl "$PERL_TESTSDIR/t/perl" + touch "$PERL_TESTSDIR/__prepared" + + for i in $PERL_DISABLEDTESTS; do + echo "Disabling $i tests" + sed 's!^'$i'.*$!!' -i $PERL_TESTSDIR/MANIFEST + done + + cat $PERL_TESTSDIR/MANIFEST | grep -v '^$' > $PERL_TESTSDIR/MANIFEST_NEW + rm $PERL_TESTSDIR/MANIFEST + mv $PERL_TESTSDIR/MANIFEST_NEW $PERL_TESTSDIR/MANIFEST +fi + +if [ -z "$no_run" ]; then + cd "$PERL_TESTSDIR/t" + if [ ! -z "$manual_run" ]; then + for i in $(cat ../MANIFEST | sed 's/\t.*$//g' | grep '\.t$'); do + if [ ! -z "$manual_run_no_base" ] && [ ! -z "$(echo $i | grep '^t/')" ]; then + continue; + fi + echo "Running $i" + ./TEST ../$i + echo "" + done + else + ./perl TEST + fi +fi diff --git a/lang/perl/files/perlconfig.pl b/lang/perl/files/perlconfig.pl new file mode 100644 index 0000000..f169980 --- /dev/null +++ b/lang/perl/files/perlconfig.pl @@ -0,0 +1,313 @@ +#!/usr/bin/perl + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Copyright 2015 Marcel Denia + +=head1 NAME + +perlconfig.pl + +=head1 SYNOPSIS + +B [B<-Dsymbol>=I, ...] [B<-dsymbol>=I, ...] I<[files]> + +Generate a configuration file suitable for (cross-)compiling perl 5. + +=head1 OPTIONS + +=over + +=item B<-Dsymbol=value> + +The symbol identified by I will have the literal value I. +When generating the configuration file, it's value will be printed enclosed by +single quotation marks('). + +=item B<-dsymbol=value> + +The symbol identified by I will have the literal value I. + +=back + +=head1 DESCRIPTION + +B is a program to compile and generate configuration files ready +to be used as a "config.sh" file for compiling perl 5. It does so by processing +specially-made configuration files(usually called *.config), typically augmented +by command-line definitions. + +B's intent is to be used in place of perl 5's own Configure +script in situations where it can not be run, like cross-compiling. + +=head2 File syntax + +B's configuration files a consist of symbol definitions in +different variations, each one assigning a specific symbol identified by a name +some value, as well as conditional blocks in order to allow for some +flexibility. + +=head3 Symbol names + +A symbol name has to consist entirely of alphanumeric characters as well as +the underscore(_) character. In addition, symbol names may be prefixed with an +all-lowercase string, separated by a colon(:): + + my:name=value + +Having a zero-length prefix string is also valid: + + :name=value + +Symbols prefixed that way are called private symbols. They act exactly like +regular symbols, with the only difference being that they will B be written +to the final configuration file. + +=head3 Symbol definitions + +A symbol definition is in the form of a simple name/value pair, separated by +an equals sign(=): + + name=value + +I can be anything really. However, there are 3 notations, with +differences in quoting and interpolation: + +=over + +=item name=foo + +The symbol identified by I will have the literal value I. + +=item name='foo' + +The symbol identified by I will have the literal value I. +When generating the configuration file, it's value will be printed enclosed by +single quotation marks('). + +=item name="foo" + +The symbol identified by I will have the value of I +S>(as described in L). +When generating the configuration file, it's value will be printed enclosed by +single quotation marks('). + +=back + +=head3 Conditional blocks + +A conditional block is of the form + + (condition) { + ... + } + +B will execute everything enclosed in the curly braces({ and }), +or inside the BLOCK in Perl 5 terms, if I evaluates to any true +value. I will go through interpolation as described in +L. It may contain any valid Perl 5 expression. Some common +examples are: + +=over + +=item $name eq 'foo' + +Evaluates to true if configuration symbol I is literally equal to I. + +=item $name ne 'foo' + +Evaluates to true if configuration symbol I is B literally equal to +I. + +=item defined($name) + +Evaluates to true if configuration symbol I is defined(has any usable +value, see L). + +=back + +Conditional blocks may be nested inside conditional blocks. Note that the +opening curl brace({) has to be on the same line as your condition. + +=head3 Comments + +All lines starting with nothing or any number of whitespaces, followed by a +hash sign(#), are considered comments and will be completely ignored by +B. + +=head3 Interpolation + +In certain situations(see above), B will interpolate strings or +constructs in order to allow you to refer to configuration symbols or embed +code. + +Interpolated strings are subject to the following rules: + +=over + +=item You may not include any single(') or double(") quotation marks. + +You can use \qq in order to include double quotation marks(") in your string. + +=item $name and ${name} reference configuration symbols + +You can easily refer to existing configuration symbols using the commmon $name +or ${name} syntax. In case you want to refer to the perl variable named $name, +write \$name. This is useful for embedding code. + +=item Perl 5 interpolation rules apply + +Aside from the above, you may include anything that is also valid for an +interpolated(qq//) string in Perl 5. For instance, it's perfectly valid to +execute code using the @{[]} construct. + +=back + +=head1 EXAMPLES + +As a simple example, consider the following configuration file, named +"example.config": + + recommendation='The Perl you want is' + ($:maturity eq 'stable') { + recommendation="$recommendation Perl 5" + } + ($:maturity eq 'experimental') { + recommendation="$recommendation Perl 6(try Rakudo!)" + } + +Executing it using these command-lines will yield the following results: + +=over + +=item $ perlconfig.pl -D:maturity=stable example.config + + recommendation='The Perl you want is Perl 5' + +=item $ perlconfig.pl -D:maturity=experimental example.config + + recommendation='The Perl you want is Perl 6(try Rakudo!)' + +=back + +=head1 AUTHOR + +Marcel Denia + +=head1 COPYRIGHT AND LICENSE + +Copyright 2015 Marcel Denia + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +=cut + +use strict; +use warnings; +use List::Util qw/all/; +my $symbol_name_prefix_regex = '(?:[a-z]*:)'; +my $symbol_name_regex = "($symbol_name_prefix_regex?(?:[a-zA-Z0-9_]+))"; + +my %config; + +sub interpolate { + my $string = shift; + my %options = @_; + + # First, convert $foo into ${foo} + $string =~ s/(?{value} + $string =~ s/\$\{$symbol_name_regex\}/\$config{\'$1\'}->{value}/g; + + # Un-escape \$foo + $string =~ s/\\\$/\$/g; + + # Turn \qq into " + $string =~ s/\\qq/\\"/g; + + return $string; +} + +# Parse command-line symbol definitions +while ($ARGV[0]) { + if ($ARGV[0] =~ /^-([D|d])$symbol_name_regex=(.*)$/) { + $config{$2} = { value => $3, quoted => $1 eq 'D' }; + shift(@ARGV); + } + else { + last; + } +} + +# Process configuration files +my @condition_stack = ( 1 ); +for my $file (@ARGV) { + open(my $fh, '<', $file) or die "Can't open $file: $!\n"; + while (my $line = <$fh>) { + chomp($line); + + if ($line =~ /^\s*$symbol_name_regex=(.*)$/) { # A symbol definition + if (all {$_ == 1} @condition_stack) { + my $symbol = $1; + (my $quote_begin, my $value, my $quote_end) = $2 =~ /^(['|"])?([^'"]*)(['|"])?$/; + + $quote_begin = '' unless defined $quote_begin; + $quote_end = '' unless defined $quote_end; + die "$file:$.: Unmatched quotes in \"$line\"\n" unless $quote_begin eq $quote_end; + + if ($quote_begin eq '"') { + $config{$symbol} = { value => eval('"' . interpolate($2) . '"'), quoted => 1 }; + } + else { + $config{$symbol} = { value => $2, quoted => $quote_begin eq '\'' }; + } + } + } + elsif ($line =~ /^\s*\((.*)\)\s?{$/) { # A conditional block + if (eval(interpolate($1))) { + push(@condition_stack, 1); + } + else { + push(@condition_stack, 0); + } + } + elsif ($line =~ /^\s*}$/) { # Closing a conditional block + pop(@condition_stack); + die "$file:$.: Closing non-existent block\n" unless @condition_stack; + } + elsif ($line =~ (/^\s*$/) || ($line =~ /^\s*#/)) { # An empty line or comment + } + else { + die "$file:$.: Malformed line: \"$line\"\n"; + } + } +} + +# Output +for (sort(keys(%config))) { + my $quote = $config{$_}->{quoted} ? '\'' : ''; + print("$_=$quote$config{$_}->{value}$quote\n") unless $_ =~ /^$symbol_name_prefix_regex/; +} \ No newline at end of file diff --git a/lang/perl/files/powerpc.config b/lang/perl/files/powerpc.config new file mode 100644 index 0000000..33af767 --- /dev/null +++ b/lang/perl/files/powerpc.config @@ -0,0 +1,19 @@ +owrt:arch=powerpc +owrt:bits=32 +owrt:endian=big + +ccsymbols='__gnu_linux__=1 __linux=1 __linux__=1 __unix=1 __unix__=1 system=linux system=posix system=unix' +cppccsymbols='linux=1 unix=1' +cppsymbols='_BIG_ENDIAN=1 __BIG_ENDIAN__=1 __ELF__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 __linux=1 __linux__=1 __unix=1 __unix__=1' +d_casti32='undef' +d_modflproto='undef' +doublekind='4' +fpossize='24' +longdblkind='0' +need_va_copy='define' +quadkind='3' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/files/signal.config b/lang/perl/files/signal.config new file mode 100644 index 0000000..183d3b9 --- /dev/null +++ b/lang/perl/files/signal.config @@ -0,0 +1,18 @@ +# Signal table helper + +(defined($owrt:sigs)) { + sig_name="$owrt:sigs" + (($owrt:libc eq 'glibc') || ($owrt:libc eq 'uclibc')) { + sig_name="$sig_name NUM32 NUM33 RTMIN NUM35 NUM36" + } + ($owrt:libc eq 'musl') { + sig_name="$sig_name NUM32 NUM33 NUM34 RTMIN NUM36" + } + + sig_name="$sig_name @{[map({qq/NUM\$_/} 37..$owrt:sig_count - 2)]} RTMAX $owrt:sig_name_extra" + sig_num="@{[0..$owrt:sig_count - 1]} $owrt:sig_num_extra " + sig_count="$owrt:sig_count" + sig_size="@{[scalar(split(q/ /, $sig_name))]}" + sig_name_init="@{[join(q/, /, map({qq/\qq\$_\qq/} split(q/ /, $sig_name)))]}, 0" + sig_num_init="@{[join(q/, /, split(q/ /, $sig_num))]}, 0" +} diff --git a/lang/perl/files/threads.config b/lang/perl/files/threads.config new file mode 100644 index 0000000..e0a2f82 --- /dev/null +++ b/lang/perl/files/threads.config @@ -0,0 +1,197 @@ +($owrt:threads eq 'yes') { + # Configure arguments + config_args="$config_args -Dusethreads" + config_arg2='-Dusethreads' + config_argc=2 + + # Options + useithreads='define' + usemultiplicity='define' + usethreads='define' + + # Flags and related + ccflags="-D_REENTRANT -D_GNU_SOURCE $ccflags" + cppflags="-D_REENTRANT -D_GNU_SOURCE $cppflags" + perllibs="-lpthread $perllibs" + libs="-lpthread $libs" + libsfiles="libpthread.so $libsfiles" + libswanted="pthread $libswanted" + + + crypt_r_proto='REENTRANT_PROTO_B_CCS' + i_crypt='define' + d_crypt='define' + d_crypt_r='define' + + # Prototypes + asctime_r_proto='REENTRANT_PROTO_B_SB' + ctime_r_proto='REENTRANT_PROTO_B_SB' + drand48_r_proto='REENTRANT_PROTO_I_ST' + getgrent_r_proto='REENTRANT_PROTO_I_SBWR' + getgrgid_r_proto='REENTRANT_PROTO_I_TSBWR' + getgrnam_r_proto='REENTRANT_PROTO_I_CSBWR' + gethostbyaddr_r_proto='REENTRANT_PROTO_I_TsISBWRE' + gethostbyname_r_proto='REENTRANT_PROTO_I_CSBWRE' + gethostent_r_proto='REENTRANT_PROTO_I_SBWRE' + getlogin_r_proto='REENTRANT_PROTO_I_BW' + getnetbyaddr_r_proto='REENTRANT_PROTO_I_uISBWRE' + getnetbyname_r_proto='REENTRANT_PROTO_I_CSBWRE' + getnetent_r_proto='REENTRANT_PROTO_I_SBWRE' + getprotobyname_r_proto='REENTRANT_PROTO_I_CSBWR' + getprotobynumber_r_proto='REENTRANT_PROTO_I_ISBWR' + getprotoent_r_proto='REENTRANT_PROTO_I_SBWR' + getpwent_r_proto='REENTRANT_PROTO_I_SBWR' + getpwnam_r_proto='REENTRANT_PROTO_I_CSBWR' + getpwuid_r_proto='REENTRANT_PROTO_I_TSBWR' + getservbyname_r_proto='REENTRANT_PROTO_I_CCSBWR' + getservbyport_r_proto='REENTRANT_PROTO_I_ICSBWR' + getservent_r_proto='REENTRANT_PROTO_I_SBWR' + getspnam_r_proto='REENTRANT_PROTO_I_CSBWR' + gmtime_r_proto='REENTRANT_PROTO_S_TS' + localtime_r_proto='REENTRANT_PROTO_S_TS' + random_r_proto='REENTRANT_PROTO_I_St' + readdir64_r_proto='REENTRANT_PROTO_I_TSR' + readdir_r_proto='REENTRANT_PROTO_I_TSR' + srand48_r_proto='REENTRANT_PROTO_I_LS' + srandom_r_proto='REENTRANT_PROTO_I_TS' + strerror_r_proto='REENTRANT_PROTO_B_IBW' + tmpnam_r_proto='REENTRANT_PROTO_B_B' + ttyname_r_proto='REENTRANT_PROTO_I_IBW' + + # Defines + d_asctime_r='define' + d_ctime_r='define' + d_drand48_r='define' + d_fds_bits='define' + d_fegetround='undef' + d_getgrent_r='define' + d_getgrgid_r='define' + d_getgrnam_r='define' + d_gethostbyaddr_r='define' + d_gethostbyname_r='define' + d_gethostent_r='define' + d_getlogin_r='define' + d_getnetbyaddr_r='define' + d_getnetbyname_r='define' + d_getnetent_r='define' + d_getprotobyname_r='define' + d_getprotobynumber_r='define' + d_getprotoent_r='define' + d_getpwent_r='define' + d_getpwnam_r='define' + d_getpwuid_r='define' + d_getservbyname_r='define' + d_getservbyport_r='define' + d_getservent_r='define' + d_getspnam_r='define' + d_gmtime_r='define' + d_j0='undef' + d_j0l='undef' + d_localtime_r='define' + d_localtime_r_needs_tzset='define' + d_nexttoward='undef' + d_off64_t='define' + d_pthread_atfork='define' + d_pthread_yield='define' + d_random_r='define' + d_readdir64_r='define' + d_readdir_r='define' + d_srand48_r='define' + d_srandom_r='define' + d_sresgproto='define' + d_sresuproto='define' + d_strerror_r='define' + d_tmpnam_r='define' + d_ttyname_r='define' +} +($owrt:threads eq 'no') { + # Options + useithreads='undef' + usemultiplicity='undef' + usethreads='undef' + + # Prototyypes + asctime_r_proto='0' + crypt_r_proto='0' + ctime_r_proto='0' + drand48_r_proto='0' + getgrent_r_proto='0' + getgrgid_r_proto='0' + getgrnam_r_proto='0' + gethostbyaddr_r_proto='0' + gethostbyname_r_proto='0' + gethostent_r_proto='0' + getlogin_r_proto='0' + getnetbyaddr_r_proto='0' + getnetbyname_r_proto='0' + getnetent_r_proto='0' + getprotobyname_r_proto='0' + getprotobynumber_r_proto='0' + getprotoent_r_proto='0' + getpwent_r_proto='0' + getpwnam_r_proto='0' + getpwuid_r_proto='0' + getservbyname_r_proto='0' + getservbyport_r_proto='0' + getservent_r_proto='0' + getspnam_r_proto='0' + gmtime_r_proto='0' + + # Defines + d_asctime_r='undef' + d_crypt='define' + d_crypt_r='undef' + d_ctime_r='undef' + d_drand48_r='undef' + d_fds_bits='undef' + d_fegetround='define' + d_getgrent_r='undef' + d_getgrgid_r='undef' + d_getgrnam_r='undef' + d_gethostbyaddr_r='undef' + d_gethostbyname_r='undef' + d_gethostent_r='undef' + d_getlogin_r='undef' + d_getnetbyaddr_r='undef' + d_getnetbyname_r='undef' + d_getnetent_r='undef' + d_getprotobyname_r='undef' + d_getprotobynumber_r='undef' + d_getprotoent_r='undef' + d_getpwent_r='undef' + d_getpwnam_r='undef' + d_getpwuid_r='undef' + d_getservbyname_r='undef' + d_getservbyport_r='undef' + d_getservent_r='undef' + d_getspnam_r='undef' + d_gmtime_r='undef' + d_j0='define' + d_j0l='define' + d_localtime_r='undef' + d_localtime_r_needs_tzset='undef' + d_nexttoward='define' + d_off64_t='undef' + d_pthread_atfork='undef' + d_pthread_yield='undef' + d_random_r='undef' + d_readdir64_r='undef' + d_readdir_r='undef' + d_srand48_r='undef' + d_srandom_r='undef' + d_sresgproto='undef' + d_sresuproto='undef' + d_strerror_r='undef' + d_tmpnam_r='undef' + d_ttyname_r='undef' + i_crypt='define' + localtime_r_proto='0' + random_r_proto='0' + readdir64_r_proto='0' + readdir_r_proto='0' + srand48_r_proto='0' + srandom_r_proto='0' + strerror_r_proto='0' + tmpnam_r_proto='0' + ttyname_r_proto='0' +} diff --git a/lang/perl/files/version.config b/lang/perl/files/version.config new file mode 100644 index 0000000..98cd2a5 --- /dev/null +++ b/lang/perl/files/version.config @@ -0,0 +1,38 @@ +# Set the version here +PERL_REVISION=5 +PERL_VERSION=22 +PERL_SUBVERSION=1 + +# (api_revison, api_version, api_subversion) = (revision, version, 0) usually +PERL_API_REVISION=5 +PERL_API_VERSION=22 +PERL_API_SUBVERSION=0 + +known_extensions='B Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call GDBM_File Hash/Util I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Time/HiRes Time/Piece Unicode/Normalize Win32 Win32API/File Win32CORE XS/APItest XS/Typemap attrs re threads threads/shared Hash/Util/FieldHash' +extensions='B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/DosGlob File/Glob Filter/Util/Call GDBM_File Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate XS/APItest XS/Typemap arybase attributes mro re threads threads/shared Archive/Tar Attribute/Handlers AutoLoader B/Debug CPAN CPAN/Meta CPAN/Meta/Requirements CPAN/Meta/YAML Carp Config/Perl/V Devel/SelfStubber Digest Dumpvalue Env Errno Exporter ExtUtils/CBuilder ExtUtils/Command ExtUtils/Constant ExtUtils/Install ExtUtils/MakeMaker ExtUtils/Manifest ExtUtils/Miniperl ExtUtils/ParseXS File/Fetch File/Find File/Path File/Temp FileCache Filter/Simple Getopt/Long HTTP/Tiny I18N/Collate I18N/LangTags IO/Compress IO/Socket/IP IO/Zlib IPC/Cmd IPC/Open3 JSON/PP Locale/Codes Locale/Maketext Locale/Maketext/Simple Math/BigInt Math/BigRat Math/Complex Memoize Module/CoreList Module/Load Module/Load/Conditional Module/Loaded Module/Metadata NEXT Net/Ping Params/Check Parse/CPAN/Meta Perl/OSType PerlIO/via/QuotedPrint Pod/Checker Pod/Escapes Pod/Functions Pod/Html Pod/Parser Pod/Perldoc Pod/Simple Pod/Usage Safe Search/Dict SelfLoader Term/ANSIColor Term/Cap Term/Complete Term/ReadLine Test Test/Harness Test/Simple Text/Abbrev Text/Balanced Text/ParseWords Text/Tabs Thread/Queue Thread/Semaphore Tie/File Tie/Memoize Tie/RefHash Time/Local XSLoader autodie autouse base bignum constant encoding/warnings experimental if lib libnet parent perlfaq podlators Unicode/Normalize version' +nonxs_ext='Archive/Tar Attribute/Handlers AutoLoader B/Debug CPAN CPAN/Meta CPAN/Meta/Requirements CPAN/Meta/YAML Carp Config/Perl/V Devel/SelfStubber Digest Dumpvalue Env Errno Exporter ExtUtils/CBuilder ExtUtils/Command ExtUtils/Constant ExtUtils/Install ExtUtils/MakeMaker ExtUtils/Manifest ExtUtils/Miniperl ExtUtils/ParseXS File/Fetch File/Find File/Path File/Temp FileCache Filter/Simple Getopt/Long HTTP/Tiny I18N/Collate I18N/LangTags IO/Compress IO/Socket/IP IO/Zlib IPC/Cmd IPC/Open3 JSON/PP Locale/Codes Locale/Maketext Locale/Maketext/Simple Math/BigInt Math/BigRat Math/Complex Memoize Module/CoreList Module/Load Module/Load/Conditional Module/Loaded Module/Metadata NEXT Net/Ping Params/Check Parse/CPAN/Meta Perl/OSType PerlIO/via/QuotedPrint Pod/Checker Pod/Escapes Pod/Functions Pod/Html Pod/Parser Pod/Perldoc Pod/Simple Pod/Usage Safe Search/Dict SelfLoader Term/ANSIColor Term/Cap Term/Complete Term/ReadLine Test Test/Harness Test/Simple Text/Abbrev Text/Balanced Text/ParseWords Text/Tabs Thread/Queue Thread/Semaphore Tie/File Tie/Memoize Tie/RefHash Time/Local XSLoader autodie autouse base bignum constant encoding/warnings experimental if lib libnet parent perlfaq podlators Unicode/Normalize version' +dynamic_ext='B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/DosGlob File/Glob Filter/Util/Call GDBM_File Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate XS/APItest XS/Typemap arybase attributes mro re threads threads/shared' + +# No need to change anything from here on +owrt:perllibpath="/usr/lib/perl5/$PERL_REVISION.$PERL_VERSION" + +revision="$PERL_REVISION" +patchlevel="$PERL_VERSION" +subversion="$PERL_SUBVERSION" +version_patchlevel_string="version $PERL_VERSION subversion $PERL_SUBVERSION" +version="$PERL_REVISION.$PERL_VERSION.$PERL_SUBVERSION" + +api_revision="$PERL_API_REVISION" +api_version="$PERL_API_VERSION" +api_subversion="$PERL_API_SUBVERSION" +api_versionstring="$PERL_API_REVISION.$PERL_API_VERSION.$PERL_API_SUBVERSION" + +privlib="$owrt:perllibpath" +privlibexp="$privlib" +archlib="$owrt:perllibpath" +archlibexp="$archlib" + +installarchlib="$owrt:perllibpath" +installprivlib="$owrt:perllibpath" +installsitearch="$owrt:perllibpath" +installsitelib="$owrt:perllibpath" diff --git a/lang/perl/files/x86_64.config b/lang/perl/files/x86_64.config new file mode 100644 index 0000000..a9cb581 --- /dev/null +++ b/lang/perl/files/x86_64.config @@ -0,0 +1,28 @@ +owrt:arch=x86_64 +owrt:bits=64 +owrt:endian=little + +ccsymbols='' +cppccsymbols='' +cppsymbols='__ELF__=1 _LP64=1 __FLT_EVAL_METHOD__=0 __FXSR__=1 __GCC_ATOMIC_LLONG_LOCK_FREE=2 __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1 __INT64_MAX__=9223372036854775807L __INT64_TYPE__=long\ int __INTMAX_MAX__=9223372036854775807L __INTMAX_TYPE__=long\ int __INTPTR_MAX__=9223372036854775807L __INTPTR_TYPE__=long\ int __INT_FAST16_MAX__=9223372036854775807L __INT_FAST16_TYPE__=long\ int __INT_FAST32_MAX__=9223372036854775807L __INT_FAST32_TYPE__=long\ int __INT_FAST64_MAX__=9223372036854775807L __INT_FAST64_TYPE__=long\ int __INT_LEAST64_MAX__=9223372036854775807L __INT_LEAST64_TYPE__=long\ int __LONG_MAX__=9223372036854775807L __LP64__=1 __MMX__=1 __PTRDIFF_MAX__=9223372036854775807L __PTRDIFF_TYPE__=long\ int __SIZEOF_INT128__=16 __SIZEOF_LONG_DOUBLE__=16 __SIZEOF_LONG__=8 __SIZEOF_POINTER__=8 __SIZEOF_PTRDIFF_T__=8 __SIZEOF_SIZE_T__=8 __SIZE_MAX__=18446744073709551615UL __SIZE_TYPE__=long\ unsigned\ int __SSE2_MATH__=1 __SSE2__=1 __SSE_MATH__=1 __SSE__=1 __UINT64_MAX__=18446744073709551615UL __UINT64_TYPE__=long\ unsigned\ int __UINTMAX_MAX__=18446744073709551615UL __UINTMAX_TYPE__=long\ unsigned\ int __UINTPTR_MAX__=18446744073709551615UL __UINTPTR_TYPE__=long\ unsigned\ int __UINT_FAST16_MAX__=18446744073709551615UL __UINT_FAST16_TYPE__=long\ unsigned\ int __UINT_FAST32_MAX__=18446744073709551615UL __UINT_FAST32_TYPE__=long\ unsigned\ int __UINT_FAST64_MAX__=18446744073709551615UL __UINT_FAST64_TYPE__=long\ unsigned\ int __UINT_LEAST64_MAX__=18446744073709551615UL __UINT_LEAST64_TYPE__=long\ unsigned\ int __WCHAR_MAX__=2147483647 __WCHAR_MIN__=(-2147483647\ -\ 1) __WCHAR_TYPE__=int __amd64=1 __amd64__=1 __code_model_small__=1 __k8=1 __k8__=1 __x86_64=1 __x86_64__=1 _FILE_OFFSET_BITS=64 __GLIBC__=2 __GLIBC_MINOR__=2 __GNUC__=3 __GNUC_MINOR__=4 __GNU_LIBRARY__=6 _LARGEFILE_SOURCE=1 _POSIX_C_SOURCE=199506L _POSIX_SOURCE=1 __STDC__=1 __USE_BSD=1 __USE_FILE_OFFSET64=1 __USE_LARGEFILE=1 __USE_MISC=1 __USE_POSIX=1 __USE_POSIX199309=1 __USE_POSIX199506=1 __USE_POSIX2=1 __USE_SVID=1 linux=1 __linux=1 __linux__=1 unix=1 __unix=1 __unix__=1' +d_casti32='undef' +d_modflproto='define' +doublekind='3' +fpossize='16' +longdblkind='3' +need_va_copy='define' +quadkind='2' + +sPRIEUldbl='"LE"' +sPRIFUldbl='"LF"' +sPRIGUldbl='"LG"' +sPRIXU64='"lX"' +sPRIeldbl='"Le"' +sPRIfldbl='"Lf"' +sPRIgldbl='"Lg"' +sSCNfldbl='"Lf"' + +owrt:sig_count='64' +owrt:sigs='ZERO HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH IO PWR SYS' +owrt:sig_name_extra='IOT CLD POLL UNUSED' +owrt:sig_num_extra='6 17 29 31' diff --git a/lang/perl/patches/010-musl-compat.patch b/lang/perl/patches/010-musl-compat.patch new file mode 100644 index 0000000..8dbad78 --- /dev/null +++ b/lang/perl/patches/010-musl-compat.patch @@ -0,0 +1,11 @@ +--- a/pp.c ++++ b/pp.c +@@ -43,7 +43,7 @@ extern Pid_t getpid (void); + * Some BSDs and Cygwin default to POSIX math instead of IEEE. + * This switches them over to IEEE. + */ +-#if defined(LIBM_LIB_VERSION) ++#if defined(LIBM_LIB_VERSION) && (defined(__GLIBC__) || defined(__UCLIBC__)) + _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_; + #endif + diff --git a/lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch b/lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch new file mode 100644 index 0000000..956466d --- /dev/null +++ b/lang/perl/patches/020-host-libc-dir-moved-debian+derivatives.patch @@ -0,0 +1,27 @@ +--- a/hints/linux.sh ++++ b/hints/linux.sh +@@ -221,6 +221,24 @@ case "$libc" in + ;; + esac + ++# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries ++# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us ++# where to look. We don't want gcc's own libraries, however, so we ++# filter those out. ++# This could be conditional on Unbuntu, but other distributions may ++# follow suit, and this scheme seems to work even on rather old gcc's. ++# This unconditionally uses gcc because even if the user is using another ++# compiler, we still need to find the math library and friends, and I don't ++# know how other compilers will cope with that situation. ++# Still, as an escape hatch, allow Configure command line overrides to ++# plibpth to bypass this check. ++case "$plibpth" in ++'') plibpth=`gcc -print-search-dirs | grep libraries | ++ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc'` ++ plibpth="$plibpth" # Collapse all entries on one line ++ ;; ++esac ++ + # Are we using ELF? Thanks to Kenneth Albanowski + # for this test. + cat >try.c <<'EOM' diff --git a/lang/perl/patches/100-fix-cross-compile-endianness-detection.patch b/lang/perl/patches/100-fix-cross-compile-endianness-detection.patch new file mode 100644 index 0000000..e187941 --- /dev/null +++ b/lang/perl/patches/100-fix-cross-compile-endianness-detection.patch @@ -0,0 +1,22 @@ +--- a/config_h.SH ++++ b/config_h.SH +@@ -52,6 +52,19 @@ sed <$CONFIG_H -e 's!^#und + #ifndef _config_h_ + #define _config_h_ + ++#if defined(USE_CROSS_COMPILE) && !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) ++# include ++# if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN) ++# if (__BYTE_ORDER == __LITTLE_ENDIAN) ++# define __LITTLE_ENDIAN__ ++# elif (__BYTE_ORDER == __BIG_ENDIAN) ++# define __BIG_ENDIAN__ ++# else ++# error Unknown endianness ++# endif ++# endif ++#endif ++ + /* LOC_SED: + * This symbol holds the complete pathname to the sed program. + */ diff --git a/lang/perl/patches/110-always_use_miniperl.patch b/lang/perl/patches/110-always_use_miniperl.patch new file mode 100644 index 0000000..9f9f812 --- /dev/null +++ b/lang/perl/patches/110-always_use_miniperl.patch @@ -0,0 +1,27 @@ +--- a/Makefile.SH ++++ b/Makefile.SH +@@ -316,22 +316,11 @@ MANIFEST_SRT = MANIFEST.srt + + !GROK!THIS! + +-case "$usecrosscompile$perl" in +-define?*) +- $spitshell >>$Makefile <>$Makefile <>$Makefile <>$Makefile < "relink"); diff --git a/lang/perl/patches/310-recompile-hack.patch b/lang/perl/patches/310-recompile-hack.patch new file mode 100644 index 0000000..05a8e9b --- /dev/null +++ b/lang/perl/patches/310-recompile-hack.patch @@ -0,0 +1,16 @@ +perl: Work around recompile failures + +Apparently, recompiling/relinking fails under some circumstances. This +patch has been reported to work around that issue. + +--- a/Makefile.SH ++++ b/Makefile.SH +@@ -818,7 +818,7 @@ $(LIBPERL): $& $(obj) $(DYNALOADER) $(LI + true) + $spitshell >>$Makefile <<'!NO!SUBS!' + rm -f $@ +- $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs) ++ $(CC) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs) + !NO!SUBS! + case "$osname" in + aix) diff --git a/lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch b/lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch new file mode 100644 index 0000000..f90e5d9 --- /dev/null +++ b/lang/perl/patches/700-tie_fetch_count_t-handle_missing_crypt.patch @@ -0,0 +1,26 @@ +--- a/t/op/tie_fetch_count.t ++++ b/t/op/tie_fetch_count.t +@@ -250,12 +250,17 @@ for ([chdir=>''],[chmod=>'0,'],[chown=>' + check_count "$op $args\\\$tied_glob$postargs"; + } + +-$dummy = crypt $var,0; check_count 'crypt $tied, ...'; +-$dummy = crypt 0,$var; check_count 'crypt ..., $tied'; +-$var = substr(chr 256,0,0); +-$dummy = crypt $var,0; check_count 'crypt $tied_utf8, ...'; +-$var = substr(chr 256,0,0); +-$dummy = crypt 0,$var; check_count 'crypt ..., $tied_utf8'; ++SKIP: { ++ use Config; ++ skip "crypt() is unavailable", 4, unless defined $Config{'d_crypt'}; ++ ++ $dummy = crypt $var,0; check_count 'crypt $tied, ...'; ++ $dummy = crypt 0,$var; check_count 'crypt ..., $tied'; ++ $var = substr(chr 256,0,0); ++ $dummy = crypt $var,0; check_count 'crypt $tied_utf8, ...'; ++ $var = substr(chr 256,0,0); ++ $dummy = crypt 0,$var; check_count 'crypt ..., $tied_utf8'; ++} + + SKIP: + { diff --git a/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch b/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch new file mode 100644 index 0000000..e60ee8c --- /dev/null +++ b/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch @@ -0,0 +1,81 @@ +perl: Skip $0 test on busybox + +This test requires a ps which provides the -f option, as well as suitable output. +We can't provide either with busybox. Just skip it for now. + +Signed-off-by: Marcel Denia + +--- a/dist/threads/t/join.t ++++ b/dist/threads/t/join.t +@@ -110,36 +110,41 @@ sub skip { + + # We parse ps output so this is OS-dependent. + if ($^O eq 'linux') { +- # First modify $0 in a subthread. +- #print "# mainthread: \$0 = $0\n"; +- threads->create(sub{ #print "# subthread: \$0 = $0\n"; +- $0 = "foobar"; +- #print "# subthread: \$0 = $0\n" +- })->join; +- #print "# mainthread: \$0 = $0\n"; +- #print "# pid = $$\n"; +- if (open PS, "ps -f |") { # Note: must work in (all) systems. +- my ($sawpid, $sawexe); +- while () { +- chomp; +- #print "# [$_]\n"; +- if (/^\s*\S+\s+$$\s/) { +- $sawpid++; +- if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces. +- $sawexe++; +- } +- last; +- } +- } +- close PS or die; +- if ($sawpid) { +- ok($sawpid && $sawexe, 'altering $0 is effective'); +- } else { +- skip("\$0 check: did not see pid $$ in 'ps -f |'"); +- } +- } else { +- skip("\$0 check: opening 'ps -f |' failed: $!"); +- } ++ if (readlink('/bin/ps') ne 'busybox') { ++ # First modify $0 in a subthread. ++ #print "# mainthread: \$0 = $0\n"; ++ threads->create(sub{ #print "# subthread: \$0 = $0\n"; ++ $0 = "foobar"; ++ #print "# subthread: \$0 = $0\n" ++ })->join; ++ #print "# mainthread: \$0 = $0\n"; ++ #print "# pid = $$\n"; ++ if (open PS, "ps -f |") { # Note: must work in (all) systems. ++ my ($sawpid, $sawexe); ++ while () { ++ chomp; ++ #print "# [$_]\n"; ++ if (/^\s*\S+\s+$$\s/) { ++ $sawpid++; ++ if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces. ++ $sawexe++; ++ } ++ last; ++ } ++ } ++ close PS or die; ++ if ($sawpid) { ++ ok($sawpid && $sawexe, 'altering $0 is effective'); ++ } else { ++ skip("\$0 check: did not see pid $$ in 'ps -f |'"); ++ } ++ } else { ++ skip("\$0 check: opening 'ps -f |' failed: $!"); ++ } ++ } ++ else { ++ skip("\$0 check: incompatible with busybox"); ++ } + } else { + skip("\$0 check: only on Linux"); + } diff --git a/lang/perl/patches/900-CVE-2015-8607.patch b/lang/perl/patches/900-CVE-2015-8607.patch new file mode 100644 index 0000000..5f1c1cb --- /dev/null +++ b/lang/perl/patches/900-CVE-2015-8607.patch @@ -0,0 +1,57 @@ +From b6307f728a4f842a54ea96959e386c7daa92ece1 Mon Sep 17 00:00:00 2001 +From: Tony Cook +Date: Tue, 15 Dec 2015 10:56:54 +1100 +Subject: [perl #126862] ensure File::Spec::canonpath() preserves taint + +Previously the unix specific XS implementation of canonpath() would +return an untainted path when supplied a tainted path. + +For the empty string case, newSVpvs() already sets taint as needed on +its result. +--- + dist/PathTools/Cwd.xs | 1 + + dist/PathTools/t/taint.t | 19 ++++++++++++++++++- + 2 files changed, 19 insertions(+), 1 deletion(-) + +--- a/dist/PathTools/Cwd.xs ++++ b/dist/PathTools/Cwd.xs +@@ -535,6 +535,7 @@ THX_unix_canonpath(pTHX_ SV *path) + *o = 0; + SvPOK_on(retval); + SvCUR_set(retval, o - SvPVX(retval)); ++ SvTAINT(retval); + return retval; + } + +--- a/dist/PathTools/t/taint.t ++++ b/dist/PathTools/t/taint.t +@@ -12,7 +12,7 @@ use Test::More; + BEGIN { + plan( + ${^TAINT} +- ? (tests => 17) ++ ? (tests => 21) + : (skip_all => "A perl without taint support") + ); + } +@@ -34,3 +34,20 @@ foreach my $func (@Functions) { + + # Previous versions of Cwd tainted $^O + is !tainted($^O), 1, "\$^O should not be tainted"; ++ ++{ ++ # [perl #126862] canonpath() loses taint ++ my $tainted = substr($ENV{PATH}, 0, 0); ++ # yes, getcwd()'s result should be tainted, and is tested above ++ # but be sure ++ ok tainted(File::Spec->canonpath($tainted . Cwd::getcwd)), ++ "canonpath() keeps taint on non-empty string"; ++ ok tainted(File::Spec->canonpath($tainted)), ++ "canonpath() keeps taint on empty string"; ++ ++ (Cwd::getcwd() =~ /^(.*)/); ++ my $untainted = $1; ++ ok !tainted($untainted), "make sure our untainted value is untainted"; ++ ok !tainted(File::Spec->canonpath($untainted)), ++ "canonpath() doesn't add taint to untainted string"; ++} diff --git a/lang/perl/patches/901-CVE-2016-2381.patch b/lang/perl/patches/901-CVE-2016-2381.patch new file mode 100644 index 0000000..ee5db6c --- /dev/null +++ b/lang/perl/patches/901-CVE-2016-2381.patch @@ -0,0 +1,102 @@ +From: Tony Cook +Date: Wed, 27 Jan 2016 00:52:15 +0000 (+1100) +Subject: remove duplicate environment variables from environ +X-Git-Url: http://perl5.git.perl.org/perl.git/commitdiff_plain/ae37b791a73a9e78dedb89fb2429d2628cf58076 + +remove duplicate environment variables from environ + +If we see duplicate environment variables while iterating over +environ[]: + +a) make sure we use the same value in %ENV that getenv() returns. + +Previously on a duplicate, %ENV would have the last entry for the name +from environ[], but a typical getenv() would return the first entry. + +Rather than assuming all getenv() implementations return the first entry +explicitly call getenv() to ensure they agree. + +b) remove duplicate entries from environ + +Previously if there was a duplicate definition for a name in environ[] +setting that name in %ENV could result in an unsafe value being passed +to a child process, so ensure environ[] has no duplicates. + +CVE-2016-2381 +--- + +--- a/perl.c ++++ b/perl.c +@@ -4298,23 +4298,70 @@ S_init_postdump_symbols(pTHX_ int argc, + } + if (env) { + char *s, *old_var; ++ STRLEN nlen; + SV *sv; ++ HV *dups = newHV(); ++ + for (; *env; env++) { + old_var = *env; + + if (!(s = strchr(old_var,'=')) || s == old_var) + continue; ++ nlen = s - old_var; + + #if defined(MSDOS) && !defined(DJGPP) + *s = '\0'; + (void)strupr(old_var); + *s = '='; + #endif +- sv = newSVpv(s+1, 0); +- (void)hv_store(hv, old_var, s - old_var, sv, 0); ++ if (hv_exists(hv, old_var, nlen)) { ++ const char *name = savepvn(old_var, nlen); ++ ++ /* make sure we use the same value as getenv(), otherwise code that ++ uses getenv() (like setlocale()) might see a different value to %ENV ++ */ ++ sv = newSVpv(PerlEnv_getenv(name), 0); ++ ++ /* keep a count of the dups of this name so we can de-dup environ later */ ++ if (hv_exists(dups, name, nlen)) ++ ++SvIVX(*hv_fetch(dups, name, nlen, 0)); ++ else ++ (void)hv_store(dups, name, nlen, newSViv(1), 0); ++ ++ Safefree(name); ++ } ++ else { ++ sv = newSVpv(s+1, 0); ++ } ++ (void)hv_store(hv, old_var, nlen, sv, 0); + if (env_is_not_environ) + mg_set(sv); + } ++ if (HvKEYS(dups)) { ++ /* environ has some duplicate definitions, remove them */ ++ HE *entry; ++ hv_iterinit(dups); ++ while ((entry = hv_iternext_flags(dups, 0))) { ++ STRLEN nlen; ++ const char *name = HePV(entry, nlen); ++ IV count = SvIV(HeVAL(entry)); ++ IV i; ++ SV **valp = hv_fetch(hv, name, nlen, 0); ++ ++ assert(valp); ++ ++ /* try to remove any duplicate names, depending on the ++ * implementation used in my_setenv() the iteration might ++ * not be necessary, but let's be safe. ++ */ ++ for (i = 0; i < count; ++i) ++ my_setenv(name, 0); ++ ++ /* and set it back to the value we set $ENV{name} to */ ++ my_setenv(name, SvPV_nolen(*valp)); ++ } ++ } ++ SvREFCNT_dec_NN(dups); + } + #endif /* USE_ENVIRON_ARRAY */ + #endif /* !PERL_MICRO */ diff --git a/lang/perl/perlbase.mk b/lang/perl/perlbase.mk new file mode 100644 index 0000000..9ad9d77 --- /dev/null +++ b/lang/perl/perlbase.mk @@ -0,0 +1,1559 @@ +define Package/perlbase-template +SUBMENU:=Perl +SECTION:=lang +CATEGORY:=Languages +URL:=http://www.cpan.org/ +DEPENDS:=perl +endef + +define Package/perlbase-anydbm-file +$(call Package/perlbase-template) +TITLE:=AnyDBM_File perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-anydbm-file/install +$(call perlmod/Install,$(1),AnyDBM_File.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/AnyDBM_File.t) +endef + +$(eval $(call BuildPackage,perlbase-anydbm-file)) + + +define Package/perlbase-app +$(call Package/perlbase-template) +TITLE:=app perl module +DEPENDS+=+perlbase-autouse +perlbase-base +perlbase-config +perlbase-cpan +perlbase-essential +perlbase-file +perlbase-getopt +perlbase-if +perlbase-tap +perlbase-text +endef + +define Package/perlbase-app/install +$(call perlmod/Install,$(1),App,) +endef + +$(eval $(call BuildPackage,perlbase-app)) + + +define Package/perlbase-archive +$(call Package/perlbase-template) +TITLE:=Archive perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +perlbase-file +perlbase-io +endef + +define Package/perlbase-archive/install +$(call perlmod/Install,$(1),Archive,) +$(call perlmod/InstallBaseTests,$(1),cpan/Archive-Tar/bin cpan/Archive-Tar/t) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ptar $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ptardiff $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/ptargrep $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,perlbase-archive)) + + +define Package/perlbase-arybase +$(call Package/perlbase-template) +TITLE:=arybase perl module +DEPENDS+=+perlbase-xsloader +endef + +define Package/perlbase-arybase/install +$(call perlmod/Install,$(1),arybase.pm auto/arybase,) +$(call perlmod/InstallBaseTests,$(1),ext/arybase/t) +endef + +$(eval $(call BuildPackage,perlbase-arybase)) + + +define Package/perlbase-attribute +$(call Package/perlbase-template) +TITLE:=Attribute perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-attribute/install +$(call perlmod/Install,$(1),Attribute,) +$(call perlmod/InstallBaseTests,$(1),dist/Attribute-Handlers/t) +endef + +$(eval $(call BuildPackage,perlbase-attribute)) + + +define Package/perlbase-attributes +$(call Package/perlbase-template) +TITLE:=attributes perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-attributes/install +$(call perlmod/Install,$(1),attributes.pm auto/attributes,) +endef + +$(eval $(call BuildPackage,perlbase-attributes)) + + +define Package/perlbase-autodie +$(call Package/perlbase-template) +TITLE:=autodie perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-autodie/install +$(call perlmod/Install,$(1),autodie autodie.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/autodie/t) +endef + +$(eval $(call BuildPackage,perlbase-autodie)) + + +define Package/perlbase-autoloader +$(call Package/perlbase-template) +TITLE:=AutoLoader perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-autoloader/install +$(call perlmod/Install,$(1),AutoLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/AutoLoader/t) +endef + +$(eval $(call BuildPackage,perlbase-autoloader)) + + +define Package/perlbase-autosplit +$(call Package/perlbase-template) +TITLE:=AutoSplit perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-file +endef + +define Package/perlbase-autosplit/install +$(call perlmod/Install/NoStrip,$(1),AutoSplit.pm,) +endef + +$(eval $(call BuildPackage,perlbase-autosplit)) + + +define Package/perlbase-autouse +$(call Package/perlbase-template) +TITLE:=autouse perl module +endef + +define Package/perlbase-autouse/install +$(call perlmod/Install,$(1),autouse.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/autouse/t) +endef + +$(eval $(call BuildPackage,perlbase-autouse)) + + +define Package/perlbase-b +$(call Package/perlbase-template) +TITLE:=B perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-feature +endef + +define Package/perlbase-b/install +$(call perlmod/Install,$(1),B B.pm auto/B,) +$(call perlmod/InstallBaseTests,$(1),cpan/B-Debug/t ext/B/t lib/B/Deparse-core.t lib/B/Deparse-subclass.t lib/B/Deparse.t) +endef + +$(eval $(call BuildPackage,perlbase-b)) + + +define Package/perlbase-base +$(call Package/perlbase-template) +TITLE:=base perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-base/install +$(call perlmod/Install,$(1),base.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/base/t) +endef + +$(eval $(call BuildPackage,perlbase-base)) + + +define Package/perlbase-benchmark +$(call Package/perlbase-template) +TITLE:=Benchmark perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-benchmark/install +$(call perlmod/Install,$(1),Benchmark.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/Benchmark.t) +endef + +$(eval $(call BuildPackage,perlbase-benchmark)) + + +define Package/perlbase-bigint +$(call Package/perlbase-template) +TITLE:=bigint perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-bigint/install +$(call perlmod/Install,$(1),bigint.pm,) +endef + +$(eval $(call BuildPackage,perlbase-bigint)) + + +define Package/perlbase-bignum +$(call Package/perlbase-template) +TITLE:=bignum perl module +DEPENDS+=+perlbase-bigint +perlbase-essential +endef + +define Package/perlbase-bignum/install +$(call perlmod/Install,$(1),bignum.pm bigrat.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/bignum/t) +endef + +$(eval $(call BuildPackage,perlbase-bignum)) + + +define Package/perlbase-blib +$(call Package/perlbase-template) +TITLE:=blib perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +perlbase-file +endef + +define Package/perlbase-blib/install +$(call perlmod/Install,$(1),blib.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/blib.t) +endef + +$(eval $(call BuildPackage,perlbase-blib)) + + +define Package/perlbase-bytes +$(call Package/perlbase-template) +TITLE:=bytes perl module +endef + +define Package/perlbase-bytes/install +$(call perlmod/Install,$(1),bytes.pm bytes_heavy.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/bytes.t) +endef + +$(eval $(call BuildPackage,perlbase-bytes)) + + +define Package/perlbase-charnames +$(call Package/perlbase-template) +TITLE:=charnames perl module +DEPENDS+=+perlbase-bytes +perlbase-essential +perlbase-re +perlbase-unicore +endef + +define Package/perlbase-charnames/install +$(call perlmod/Install,$(1),_charnames.pm charnames.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/charnames.t) +endef + +$(eval $(call BuildPackage,perlbase-charnames)) + + +define Package/perlbase-class +$(call Package/perlbase-template) +TITLE:=Class perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-class/install +$(call perlmod/Install,$(1),Class,) +$(call perlmod/InstallBaseTests,$(1),lib/Class/Struct.t) +endef + +$(eval $(call BuildPackage,perlbase-class)) + + +define Package/perlbase-compress +$(call Package/perlbase-template) +TITLE:=Compress perl module +DEPENDS+=+perlbase-bytes +perlbase-essential +perlbase-io +perlbase-scalar +endef + +define Package/perlbase-compress/install +$(call perlmod/Install,$(1),Compress auto/Compress,) +$(call perlmod/InstallBaseTests,$(1),cpan/Compress-Raw-Bzip2/t cpan/Compress-Raw-Zlib/t) +endef + +$(eval $(call BuildPackage,perlbase-compress)) + + +define Package/perlbase-config +$(call Package/perlbase-template) +TITLE:=Config perl module +endef + +define Package/perlbase-config/install +$(call perlmod/Install,$(1),Config Config.pm Config_git.pl Config_heavy.pl,) +$(call perlmod/InstallBaseTests,$(1),cpan/Config-Perl-V/t lib/Config.t lib/Config/Extensions.t) +endef + +$(eval $(call BuildPackage,perlbase-config)) + + +define Package/perlbase-cpan +$(call Package/perlbase-template) +TITLE:=CPAN perl module +DEPENDS+=+perlbase-b +perlbase-config +perlbase-cwd +perlbase-dirhandle +perlbase-essential +perlbase-extutils +perlbase-fcntl +perlbase-file +perlbase-filehandle +perlbase-http-tiny +perlbase-net +perlbase-safe +perlbase-scalar +perlbase-sys +perlbase-text +endef + +define Package/perlbase-cpan/install +$(call perlmod/Install,$(1),CPAN CPAN.pm Parse/CPAN/Meta.pm,CPAN/FirstTime.pm) +$(call perlmod/Install/NoStrip,$(1),CPAN/FirstTime.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/CPAN-Meta-Requirements/t cpan/CPAN-Meta-YAML/t cpan/CPAN-Meta/t cpan/CPAN/t cpan/Parse-CPAN-Meta/t) +endef + +$(eval $(call BuildPackage,perlbase-cpan)) + + +define Package/perlbase-cwd +$(call Package/perlbase-template) +TITLE:=Cwd perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-cwd/install +$(call perlmod/Install,$(1),Cwd.pm auto/Cwd,) +endef + +$(eval $(call BuildPackage,perlbase-cwd)) + + +define Package/perlbase-data +$(call Package/perlbase-template) +TITLE:=Data perl module +DEPENDS+=+perlbase-bytes +perlbase-essential +endef + +define Package/perlbase-data/install +$(call perlmod/Install,$(1),Data auto/Data,) +$(call perlmod/InstallBaseTests,$(1),dist/Data-Dumper/t) +endef + +$(eval $(call BuildPackage,perlbase-data)) + + +define Package/perlbase-db +$(call Package/perlbase-template) +TITLE:=DB perl module +DEPENDS+=+libdb47 +perlbase-essential +perlbase-meta-notation +endef + +define Package/perlbase-db/install +$(call perlmod/Install,$(1),DB.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/DB.t) +endef + +$(eval $(call BuildPackage,perlbase-db)) + + +define Package/perlbase-db-file +$(call Package/perlbase-template) +TITLE:=DB_File perl module +DEPENDS+=+libdb47 +perlbase-essential +perlbase-tie +endef + +define Package/perlbase-db-file/install +$(call perlmod/Install,$(1),DB_File.pm auto/DB_File,) +$(call perlmod/InstallBaseTests,$(1),cpan/DB_File/t) +endef + +$(eval $(call BuildPackage,perlbase-db-file)) + + +define Package/perlbase-dbm-filter +$(call Package/perlbase-template) +TITLE:=DBM_Filter perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-dbm-filter/install +$(call perlmod/Install,$(1),DBM_Filter DBM_Filter.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/DBM_Filter/t lib/dbm_filter_util.pl) +endef + +$(eval $(call BuildPackage,perlbase-dbm-filter)) + + +define Package/perlbase-devel +$(call Package/perlbase-template) +TITLE:=Devel perl module +DEPENDS+=+perlbase-essential +perlbase-file +perlbase-selfloader +perlbase-xsloader +endef + +define Package/perlbase-devel/install +$(call perlmod/Install,$(1),Devel auto/Devel,Devel/PPPort.pm) +$(call perlmod/Install/NoStrip,$(1),Devel/PPPort.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Devel-PPPort/t dist/Devel-SelfStubber/t ext/Devel-Peek/t) +endef + +$(eval $(call BuildPackage,perlbase-devel)) + + +define Package/perlbase-diagnostics +$(call Package/perlbase-template) +TITLE:=diagnostics perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-text +endef + +define Package/perlbase-diagnostics/install +$(call perlmod/Install,$(1),diagnostics.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/diagnostics.t pod/perldiag.pod) +endef + +$(eval $(call BuildPackage,perlbase-diagnostics)) + + +define Package/perlbase-digest +$(call Package/perlbase-template) +TITLE:=Digest perl module +DEPENDS+=+perlbase-dynaloader +perlbase-essential +perlbase-fcntl +perlbase-integer +endef + +define Package/perlbase-digest/install +$(call perlmod/Install,$(1),Digest Digest.pm auto/Digest,) +$(call perlmod/InstallBaseTests,$(1),cpan/Digest-MD5/MD5.xs cpan/Digest-MD5/t cpan/Digest-SHA/t cpan/Digest/t) + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/cpan/Digest-SHA/src +endef + +$(eval $(call BuildPackage,perlbase-digest)) + + +define Package/perlbase-dirhandle +$(call Package/perlbase-template) +TITLE:=DirHandle perl module +DEPENDS+=+perlbase-essential +perlbase-symbol +endef + +define Package/perlbase-dirhandle/install +$(call perlmod/Install,$(1),DirHandle.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/DirHandle.t) +endef + +$(eval $(call BuildPackage,perlbase-dirhandle)) + + +define Package/perlbase-dumpvalue +$(call Package/perlbase-template) +TITLE:=Dumpvalue perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-dumpvalue/install +$(call perlmod/Install,$(1),Dumpvalue.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Dumpvalue/t) +endef + +$(eval $(call BuildPackage,perlbase-dumpvalue)) + + +define Package/perlbase-dumpvar +$(call Package/perlbase-template) +TITLE:=dumpvar perl module +endef + +define Package/perlbase-dumpvar/install +$(call perlmod/Install,$(1),dumpvar.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/dumpvar.t) +endef + +$(eval $(call BuildPackage,perlbase-dumpvar)) + + +define Package/perlbase-dynaloader +$(call Package/perlbase-template) +TITLE:=DynaLoader perl module +DEPENDS+=+perlbase-config +endef + +define Package/perlbase-dynaloader/install +$(call perlmod/Install,$(1),DynaLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/DynaLoader/t) +endef + +$(eval $(call BuildPackage,perlbase-dynaloader)) + + +define Package/perlbase-encode +$(call Package/perlbase-template) +TITLE:=Encode perl module +DEPENDS+=+perlbase-essential +perlbase-mime +perlbase-utf8 +perlbase-xsloader +endef + +define Package/perlbase-encode/install +$(call perlmod/Install,$(1),Encode Encode.pm auto/Encode,Encode/PerlIO.pod Encode/Supported.pod) +$(call perlmod/InstallBaseTests,$(1),cpan/Encode/t) +endef + +$(eval $(call BuildPackage,perlbase-encode)) + + +define Package/perlbase-encoding +$(call Package/perlbase-template) +TITLE:=encoding perl module +DEPENDS+=+perlbase-encode +perlbase-essential +endef + +define Package/perlbase-encoding/install +$(call perlmod/Install,$(1),encoding encoding.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/encoding-warnings/t) +endef + +$(eval $(call BuildPackage,perlbase-encoding)) + + +define Package/perlbase-english +$(call Package/perlbase-template) +TITLE:=English perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-english/install +$(call perlmod/Install,$(1),English.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/English.t) +endef + +$(eval $(call BuildPackage,perlbase-english)) + + +define Package/perlbase-env +$(call Package/perlbase-template) +TITLE:=Env perl module +DEPENDS+=+perlbase-config +perlbase-tie +endef + +define Package/perlbase-env/install +$(call perlmod/Install,$(1),Env.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Env/t) +endef + +$(eval $(call BuildPackage,perlbase-env)) + + +define Package/perlbase-errno +$(call Package/perlbase-template) +TITLE:=Errno perl module +DEPENDS+=+perlbase-config +perlbase-essential +endef + +define Package/perlbase-errno/install +$(call perlmod/Install,$(1),Errno.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/Errno/t) +endef + +$(eval $(call BuildPackage,perlbase-errno)) + + +define Package/perlbase-essential +$(call Package/perlbase-template) +TITLE:=essential perl module +DEPENDS+=+perlbase-config +endef + +define Package/perlbase-essential/install +$(call perlmod/Install,$(1),Carp Carp.pm Exporter Exporter.pm constant.pm deprecate.pm lib.pm locale.pm overload.pm overloading.pm parent.pm strict.pm subs.pm vars.pm warnings warnings.pm,) +$(call perlmod/Install/NoStrip,$(1),overload/numbers.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/parent/t dist/Carp/t dist/Exporter/t dist/constant/t dist/lib/t lib/locale.t lib/overload.t lib/overload64.t lib/overloading.t lib/strict.t lib/subs.t lib/vars.t lib/vars_carp.t lib/warnings.t) +endef + +$(eval $(call BuildPackage,perlbase-essential)) + + +define Package/perlbase-experimental +$(call Package/perlbase-template) +TITLE:=experimental perl module +DEPENDS+=+perlbase-essential +perlbase-feature +perlbase-version +endef + +define Package/perlbase-experimental/install +$(call perlmod/Install,$(1),experimental.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/experimental/t) +endef + +$(eval $(call BuildPackage,perlbase-experimental)) + + +define Package/perlbase-extutils +$(call Package/perlbase-template) +TITLE:=ExtUtils perl module +DEPENDS+=+perlbase-autosplit +perlbase-base +perlbase-config +perlbase-cwd +perlbase-dirhandle +perlbase-encode +perlbase-essential +perlbase-file +perlbase-io +perlbase-ipc +perlbase-ostype +perlbase-symbol +perlbase-text +endef + +define Package/perlbase-extutils/install +$(call perlmod/Install,$(1),ExtUtils,ExtUtils/MakeMaker/FAQ.pod ExtUtils/MakeMaker/Tutorial.pod ExtUtils/ParseXS.pm ExtUtils/ParseXS/Utilities.pm) +$(call perlmod/Install/NoStrip,$(1),ExtUtils/ParseXS.pm ExtUtils/ParseXS/Utilities.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/ExtUtils-Command/t cpan/ExtUtils-Constant/t cpan/ExtUtils-Install/t cpan/ExtUtils-MakeMaker/t cpan/ExtUtils-Manifest/t dist/ExtUtils-CBuilder/t dist/ExtUtils-ParseXS/t lib/ExtUtils/t lib/h2ph.t lib/h2xs.t utils/h2ph utils/h2xs) +endef + +$(eval $(call BuildPackage,perlbase-extutils)) + + +define Package/perlbase-fatal +$(call Package/perlbase-template) +TITLE:=Fatal perl module +DEPENDS+=+perlbase-autodie +perlbase-config +perlbase-essential +perlbase-scalar +perlbase-tie +endef + +define Package/perlbase-fatal/install +$(call perlmod/Install,$(1),Fatal.pm,) +endef + +$(eval $(call BuildPackage,perlbase-fatal)) + + +define Package/perlbase-fcntl +$(call Package/perlbase-template) +TITLE:=Fcntl perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-fcntl/install +$(call perlmod/Install,$(1),Fcntl.pm auto/Fcntl,) +$(call perlmod/InstallBaseTests,$(1),ext/Fcntl/t) +endef + +$(eval $(call BuildPackage,perlbase-fcntl)) + + +define Package/perlbase-feature +$(call Package/perlbase-template) +TITLE:=feature perl module +endef + +define Package/perlbase-feature/install +$(call perlmod/Install,$(1),feature.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/feature.t lib/feature/unicode_strings.t) +endef + +$(eval $(call BuildPackage,perlbase-feature)) + + +define Package/perlbase-fields +$(call Package/perlbase-template) +TITLE:=fields perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-fields/install +$(call perlmod/Install,$(1),fields.pm,) +endef + +$(eval $(call BuildPackage,perlbase-fields)) + + +define Package/perlbase-file +$(call Package/perlbase-template) +TITLE:=File perl module +DEPENDS+=+perlbase-class +perlbase-config +perlbase-cwd +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-filehandle +perlbase-io +perlbase-locale +perlbase-params +perlbase-scalar +perlbase-symbol +perlbase-xsloader +endef + +define Package/perlbase-file/install +$(call perlmod/Install,$(1),File auto/File,File/Find.pm) +$(call perlmod/Install/NoStrip,$(1),File/Find.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/File-Fetch/t cpan/File-Path/t cpan/File-Temp/t dist/PathTools/t ext/File-DosGlob/t ext/File-Find/t ext/File-Glob/t lib/File/Basename.t lib/File/Compare.t lib/File/Copy.t lib/File/stat-7896.t lib/File/stat.t) +endef + +$(eval $(call BuildPackage,perlbase-file)) + + +define Package/perlbase-filecache +$(call Package/perlbase-template) +TITLE:=FileCache perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-filecache/install +$(call perlmod/Install,$(1),FileCache.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/FileCache/t) +endef + +$(eval $(call BuildPackage,perlbase-filecache)) + + +define Package/perlbase-filehandle +$(call Package/perlbase-template) +TITLE:=FileHandle perl module +DEPENDS+=+perlbase-essential +perlbase-io +endef + +define Package/perlbase-filehandle/install +$(call perlmod/Install,$(1),FileHandle.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/FileHandle.t) +endef + +$(eval $(call BuildPackage,perlbase-filehandle)) + + +define Package/perlbase-filetest +$(call Package/perlbase-template) +TITLE:=filetest perl module +endef + +define Package/perlbase-filetest/install +$(call perlmod/Install,$(1),filetest.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/filetest.t) +endef + +$(eval $(call BuildPackage,perlbase-filetest)) + + +define Package/perlbase-filter +$(call Package/perlbase-template) +TITLE:=Filter perl module +DEPENDS+=+perlbase-dynaloader +perlbase-essential +perlbase-text +endef + +define Package/perlbase-filter/install +$(call perlmod/Install,$(1),Filter auto/Filter,) +$(call perlmod/InstallBaseTests,$(1),cpan/Filter-Util-Call/filter-util.pl cpan/Filter-Util-Call/t dist/Filter-Simple/t) +endef + +$(eval $(call BuildPackage,perlbase-filter)) + + +define Package/perlbase-findbin +$(call Package/perlbase-template) +TITLE:=FindBin perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +perlbase-file +endef + +define Package/perlbase-findbin/install +$(call perlmod/Install,$(1),FindBin.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/FindBin.t) +endef + +$(eval $(call BuildPackage,perlbase-findbin)) + + +define Package/perlbase-gdbm-file +$(call Package/perlbase-template) +TITLE:=GDBM_File perl module +DEPENDS+=+libgdbm +perlbase-essential +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-gdbm-file/install +$(call perlmod/Install,$(1),GDBM_File.pm auto/GDBM_File,) +$(call perlmod/InstallBaseTests,$(1),ext/GDBM_File/t) +endef + +$(eval $(call BuildPackage,perlbase-gdbm-file)) + + +define Package/perlbase-getopt +$(call Package/perlbase-template) +TITLE:=Getopt perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-getopt/install +$(call perlmod/Install,$(1),Getopt,) +$(call perlmod/InstallBaseTests,$(1),cpan/Getopt-Long/t lib/Getopt/Std.t) +endef + +$(eval $(call BuildPackage,perlbase-getopt)) + + +define Package/perlbase-hash +$(call Package/perlbase-template) +TITLE:=Hash perl module +DEPENDS+=+perlbase-essential +perlbase-scalar +perlbase-xsloader +endef + +define Package/perlbase-hash/install +$(call perlmod/Install,$(1),Hash auto/Hash,) +$(call perlmod/InstallBaseTests,$(1),ext/Hash-Util-FieldHash/t ext/Hash-Util/t) +endef + +$(eval $(call BuildPackage,perlbase-hash)) + + +define Package/perlbase-http-tiny +$(call Package/perlbase-template) +TITLE:=http-tiny perl module +DEPENDS+=+perlbase-errno +perlbase-essential +perlbase-io +endef + +define Package/perlbase-http-tiny/install +$(call perlmod/Install,$(1),HTTP/Tiny.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/HTTP-Tiny/corpus cpan/HTTP-Tiny/t) +endef + +$(eval $(call BuildPackage,perlbase-http-tiny)) + + +define Package/perlbase-i18n +$(call Package/perlbase-template) +TITLE:=I18N perl module +DEPENDS+=+perlbase-essential +perlbase-posix +perlbase-xsloader +endef + +define Package/perlbase-i18n/install +$(call perlmod/Install,$(1),I18N auto/I18N,I18N/LangTags/List.pm) +$(call perlmod/InstallBaseTests,$(1),dist/I18N-Collate/t dist/I18N-LangTags/t ext/I18N-Langinfo/t) +$(call perlmod/Install/NoStrip,$(1),I18N/LangTags/List.pm) +endef + +$(eval $(call BuildPackage,perlbase-i18n)) + + +define Package/perlbase-if +$(call Package/perlbase-template) +TITLE:=if perl module +endef + +define Package/perlbase-if/install +$(call perlmod/Install,$(1),if.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/if/t) +endef + +$(eval $(call BuildPackage,perlbase-if)) + + +define Package/perlbase-integer +$(call Package/perlbase-template) +TITLE:=integer perl module +endef + +define Package/perlbase-integer/install +$(call perlmod/Install,$(1),integer.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/integer.t) +endef + +$(eval $(call BuildPackage,perlbase-integer)) + + +define Package/perlbase-io +$(call Package/perlbase-template) +TITLE:=IO perl module +DEPENDS+=+perlbase-base +perlbase-bytes +perlbase-config +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-list +perlbase-posix +perlbase-scalar +perlbase-selectsaver +perlbase-socket +perlbase-symbol +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-io/install +$(call perlmod/Install,$(1),IO IO.pm auto/IO,) +$(call perlmod/InstallBaseTests,$(1),cpan/IO-Compress/t cpan/IO-Socket-IP/t cpan/IO-Zlib/t dist/IO/Makefile.PL dist/IO/t) +endef + +$(eval $(call BuildPackage,perlbase-io)) + + +define Package/perlbase-ipc +$(call Package/perlbase-template) +TITLE:=IPC perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-file +perlbase-locale +perlbase-params +perlbase-symbol +perlbase-text +endef + +define Package/perlbase-ipc/install +$(call perlmod/Install,$(1),IPC auto/IPC,) +$(call perlmod/InstallBaseTests,$(1),cpan/IPC-Cmd/t cpan/IPC-SysV/t ext/IPC-Open3/t) +endef + +$(eval $(call BuildPackage,perlbase-ipc)) + + +define Package/perlbase-json-pp +$(call Package/perlbase-template) +TITLE:=json-pp perl module +DEPENDS+=+perlbase-b +perlbase-base +perlbase-essential +endef + +define Package/perlbase-json-pp/install +$(call perlmod/Install,$(1),JSON/PP JSON/PP.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/JSON-PP/t) +endef + +$(eval $(call BuildPackage,perlbase-json-pp)) + + +define Package/perlbase-less +$(call Package/perlbase-template) +TITLE:=less perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-less/install +$(call perlmod/Install,$(1),less.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/less.t) +endef + +$(eval $(call BuildPackage,perlbase-less)) + + +define Package/perlbase-list +$(call Package/perlbase-template) +TITLE:=List perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-list/install +$(call perlmod/Install,$(1),List auto/List,) +endef + +$(eval $(call BuildPackage,perlbase-list)) + + +define Package/perlbase-locale +$(call Package/perlbase-template) +TITLE:=Locale perl module +DEPENDS+=+perlbase-essential +perlbase-i18n +perlbase-integer +perlbase-utf8 +endef + +define Package/perlbase-locale/install +$(call perlmod/Install,$(1),Locale,Locale/Constants.pod Locale/Country.pod Locale/Currency.pod Locale/Language.pod Locale/Maketext.pod Locale/Maketext/TPJ13.pod Locale/Script.pod) +$(call perlmod/InstallBaseTests,$(1),cpan/Locale-Codes/t cpan/Locale-Maketext-Simple/t dist/Locale-Maketext/t) +endef + +$(eval $(call BuildPackage,perlbase-locale)) + + +define Package/perlbase-math +$(call Package/perlbase-template) +TITLE:=Math perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-scalar +perlbase-xsloader +endef + +define Package/perlbase-math/install +$(call perlmod/Install,$(1),Math auto/Math,) +$(call perlmod/InstallBaseTests,$(1),cpan/Math-Complex/t dist/Math-BigInt-FastCalc/t dist/Math-BigInt/t dist/Math-BigRat/t) +endef + +$(eval $(call BuildPackage,perlbase-math)) + + +define Package/perlbase-memoize +$(call Package/perlbase-template) +TITLE:=Memoize perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-storable +endef + +define Package/perlbase-memoize/install +$(call perlmod/Install,$(1),Memoize Memoize.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Memoize/t) +endef + +$(eval $(call BuildPackage,perlbase-memoize)) + + +define Package/perlbase-meta-notation +$(call Package/perlbase-template) +TITLE:=meta_notation module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-meta-notation/install +$(call perlmod/Install,$(1),meta_notation.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/meta_notation.t) +endef + +$(eval $(call BuildPackage,perlbase-meta-notation)) + + +define Package/perlbase-mime +$(call Package/perlbase-template) +TITLE:=MIME perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-mime/install +$(call perlmod/Install,$(1),MIME auto/MIME,) +$(call perlmod/InstallBaseTests,$(1),cpan/MIME-Base64/t) +endef + +$(eval $(call BuildPackage,perlbase-mime)) + + +define Package/perlbase-module +$(call Package/perlbase-template) +TITLE:=Module perl module +DEPENDS+=+perlbase-essential +perlbase-file +perlbase-filehandle +perlbase-locale +perlbase-params +perlbase-version +endef + +define Package/perlbase-module/install +$(call perlmod/Install,$(1),Module,) +$(call perlmod/InstallBaseTests,$(1),cpan/Module-Load-Conditional/t cpan/Module-Load/t cpan/Module-Loaded/t cpan/Module-Metadata/corpus cpan/Module-Metadata/lib cpan/Module-Metadata/t dist/Module-CoreList/t) +endef + +$(eval $(call BuildPackage,perlbase-module)) + + +define Package/perlbase-mro +$(call Package/perlbase-template) +TITLE:=mro perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-mro/install +$(call perlmod/Install,$(1),auto/mro mro.pm,) +endef + +$(eval $(call BuildPackage,perlbase-mro)) + + +define Package/perlbase-net +$(call Package/perlbase-template) +TITLE:=Net perl module +DEPENDS+=+perlbase-class +perlbase-errno +perlbase-essential +perlbase-fcntl +perlbase-filehandle +perlbase-io +perlbase-posix +perlbase-socket +perlbase-symbol +perlbase-time +endef + +define Package/perlbase-net/install +$(call perlmod/Install,$(1),Net,Net/libnetFAQ.pod) +$(call perlmod/InstallBaseTests,$(1),cpan/libnet/t dist/Net-Ping/t lib/Net/hostent.t lib/Net/netent.t lib/Net/protoent.t lib/Net/servent.t) +endef + +$(eval $(call BuildPackage,perlbase-net)) + + +define Package/perlbase-next +$(call Package/perlbase-template) +TITLE:=NEXT perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-next/install +$(call perlmod/Install,$(1),NEXT.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/NEXT/t) +endef + +$(eval $(call BuildPackage,perlbase-next)) + + +define Package/perlbase-o +$(call Package/perlbase-template) +TITLE:=O perl module +DEPENDS+=+perlbase-b +perlbase-essential +endef + +define Package/perlbase-o/install +$(call perlmod/Install,$(1),O.pm,) +endef + +$(eval $(call BuildPackage,perlbase-o)) + + +define Package/perlbase-opcode +$(call Package/perlbase-template) +TITLE:=Opcode perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-opcode/install +$(call perlmod/Install,$(1),auto/Opcode,) +$(call perlmod/Install/NoStrip,$(1),Opcode.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/Opcode/t) +endef + +$(eval $(call BuildPackage,perlbase-opcode)) + + +define Package/perlbase-open +$(call Package/perlbase-template) +TITLE:=open perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-open/install +$(call perlmod/Install,$(1),open.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/open.t) +endef + +$(eval $(call BuildPackage,perlbase-open)) + + +define Package/perlbase-ops +$(call Package/perlbase-template) +TITLE:=ops perl module +DEPENDS+=+perlbase-opcode +endef + +define Package/perlbase-ops/install +$(call perlmod/Install,$(1),ops.pm,) +endef + +$(eval $(call BuildPackage,perlbase-ops)) + + +define Package/perlbase-ostype +$(call Package/perlbase-template) +TITLE:=OSType perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-ostype/install +$(call perlmod/Install,$(1),Perl/OSType.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Perl-OSType/t) +endef + +$(eval $(call BuildPackage,perlbase-ostype)) + + +define Package/perlbase-params +$(call Package/perlbase-template) +TITLE:=Params perl module +DEPENDS+=+perlbase-essential +perlbase-locale +endef + +define Package/perlbase-params/install +$(call perlmod/Install,$(1),Params,) +$(call perlmod/InstallBaseTests,$(1),cpan/Params-Check/t) +endef + +$(eval $(call BuildPackage,perlbase-params)) + + +define Package/perlbase-perl5db +$(call Package/perlbase-template) +TITLE:=perl5db perl module +DEPENDS+=+perlbase-cwd +perlbase-essential +endef + +define Package/perlbase-perl5db/install +$(call perlmod/Install,$(1),perl5db.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/perl5db.t lib/perl5db/t) +endef + +$(eval $(call BuildPackage,perlbase-perl5db)) + + +define Package/perlbase-perlio +$(call Package/perlbase-template) +TITLE:=PerlIO perl module +DEPENDS+=+perlbase-essential +perlbase-mime +perlbase-xsloader +endef + +define Package/perlbase-perlio/install +$(call perlmod/Install,$(1),PerlIO PerlIO.pm auto/PerlIO,) +$(call perlmod/InstallBaseTests,$(1),cpan/PerlIO-via-QuotedPrint/t ext/PerlIO-encoding/t ext/PerlIO-scalar/t ext/PerlIO-via/t) +endef + +$(eval $(call BuildPackage,perlbase-perlio)) + + +define Package/perlbase-pod +$(call Package/perlbase-template) +TITLE:=Pod perl module +DEPENDS+=+perlbase-config +perlbase-cwd +perlbase-encode +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-getopt +perlbase-integer +perlbase-posix +perlbase-symbol +perlbase-term +perlbase-text +endef + +define Package/perlbase-pod/install +$(call perlmod/Install,$(1),Pod,Pod/Usage.pm) +$(call perlmod/Install/NoStrip,$(1),Pod/Usage.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Pod-Checker/t cpan/Pod-Escapes/t cpan/Pod-Parser/lib cpan/Pod-Parser/scripts cpan/Pod-Parser/t cpan/Pod-Perldoc/t cpan/Pod-Simple/t cpan/Pod-Usage/scripts cpan/Pod-Usage/t cpan/podlators/t ext/Pod-Functions/Functions.pm ext/Pod-Functions/t ext/Pod-Html/t lib/Pod/t) + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/pod2man $(1)/usr/bin/ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/pod2text $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,perlbase-pod)) + + +define Package/perlbase-posix +$(call Package/perlbase-template) +TITLE:=POSIX perl module +DEPENDS+=+perlbase-essential +perlbase-fcntl +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-posix/install +$(call perlmod/Install,$(1),POSIX.pm auto/POSIX,) +$(call perlmod/InstallBaseTests,$(1),ext/POSIX/Makefile.PL ext/POSIX/POSIX.xs ext/POSIX/t) +endef + +$(eval $(call BuildPackage,perlbase-posix)) + + +define Package/perlbase-re +$(call Package/perlbase-template) +TITLE:=re perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-re/install +$(call perlmod/Install,$(1),auto/re re.pm,) +$(call perlmod/InstallBaseTests,$(1),ext/re/t) +endef + +$(eval $(call BuildPackage,perlbase-re)) + + +define Package/perlbase-safe +$(call Package/perlbase-template) +TITLE:=Safe perl module +DEPENDS+=+perlbase-b +perlbase-essential +perlbase-opcode +perlbase-scalar +perlbase-utf8 +endef + +define Package/perlbase-safe/install +$(call perlmod/Install,$(1),Safe.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Safe/t) +endef + +$(eval $(call BuildPackage,perlbase-safe)) + + +define Package/perlbase-scalar +$(call Package/perlbase-template) +TITLE:=Scalar perl module +DEPENDS+=+perlbase-essential +perlbase-list +endef + +define Package/perlbase-scalar/install +$(call perlmod/Install,$(1),Scalar Sub,) +$(call perlmod/InstallBaseTests,$(1),cpan/Scalar-List-Utils/t) + $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/cpan/Scalar-List-Utils/blib +endef + +$(eval $(call BuildPackage,perlbase-scalar)) + + +define Package/perlbase-sdbm-file +$(call Package/perlbase-template) +TITLE:=SDBM_File perl module +DEPENDS+=+perlbase-essential +perlbase-tie +perlbase-xsloader +endef + +define Package/perlbase-sdbm-file/install +$(call perlmod/Install,$(1),SDBM_File.pm auto/SDBM_File,) +$(call perlmod/InstallBaseTests,$(1),ext/SDBM_File/t) +endef + +$(eval $(call BuildPackage,perlbase-sdbm-file)) + + +define Package/perlbase-search +$(call Package/perlbase-template) +TITLE:=Search perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-search/install +$(call perlmod/Install,$(1),Search,) +$(call perlmod/InstallBaseTests,$(1),dist/Search-Dict/t) +endef + +$(eval $(call BuildPackage,perlbase-search)) + + +define Package/perlbase-selectsaver +$(call Package/perlbase-template) +TITLE:=SelectSaver perl module +DEPENDS+=+perlbase-essential +perlbase-symbol +endef + +define Package/perlbase-selectsaver/install +$(call perlmod/Install,$(1),SelectSaver.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/SelectSaver.t) +endef + +$(eval $(call BuildPackage,perlbase-selectsaver)) + + +define Package/perlbase-selfloader +$(call Package/perlbase-template) +TITLE:=SelfLoader perl module +DEPENDS+=+perlbase-essential +perlbase-io +endef + +define Package/perlbase-selfloader/install +$(call perlmod/Install,$(1),SelfLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/SelfLoader/t) +endef + +$(eval $(call BuildPackage,perlbase-selfloader)) + + +define Package/perlbase-sigtrap +$(call Package/perlbase-template) +TITLE:=sigtrap perl module +DEPENDS+=+perlbase-essential +perlbase-meta-notation +endef + +define Package/perlbase-sigtrap/install +$(call perlmod/Install,$(1),sigtrap.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/sigtrap.t) +endef + +$(eval $(call BuildPackage,perlbase-sigtrap)) + + +define Package/perlbase-socket +$(call Package/perlbase-template) +TITLE:=Socket perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-socket/install +$(call perlmod/Install,$(1),Socket.pm auto/Socket,) +$(call perlmod/InstallBaseTests,$(1),cpan/Socket/t) +endef + +$(eval $(call BuildPackage,perlbase-socket)) + + +define Package/perlbase-sort +$(call Package/perlbase-template) +TITLE:=sort perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-sort/install +$(call perlmod/Install,$(1),sort.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/sort.t) +endef + +$(eval $(call BuildPackage,perlbase-sort)) + + +define Package/perlbase-storable +$(call Package/perlbase-template) +TITLE:=Storable perl module +DEPENDS+=+perlbase-essential +perlbase-xsloader +endef + +define Package/perlbase-storable/install +$(call perlmod/Install,$(1),Storable.pm auto/Storable,) +$(call perlmod/InstallBaseTests,$(1),dist/Storable/t) +endef + +$(eval $(call BuildPackage,perlbase-storable)) + + +define Package/perlbase-symbol +$(call Package/perlbase-template) +TITLE:=Symbol perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-symbol/install +$(call perlmod/Install,$(1),Symbol.pm,) +$(call perlmod/InstallBaseTests,$(1),lib/Symbol.t) +endef + +$(eval $(call BuildPackage,perlbase-symbol)) + + +define Package/perlbase-sys +$(call Package/perlbase-template) +TITLE:=Sys perl module +DEPENDS+=+perlbase-essential +perlbase-file +perlbase-posix +perlbase-socket +endef + +define Package/perlbase-sys/install +$(call perlmod/Install,$(1),Sys auto/Sys,) +$(call perlmod/InstallBaseTests,$(1),cpan/Sys-Syslog/t ext/Sys-Hostname/t) +endef + +$(eval $(call BuildPackage,perlbase-sys)) + + +define Package/perlbase-tap +$(call Package/perlbase-template) +TITLE:=TAP perl module +DEPENDS+=+perlbase-base +perlbase-benchmark +perlbase-config +perlbase-essential +perlbase-file +perlbase-io +perlbase-posix +perlbase-text +endef + +define Package/perlbase-tap/install +$(call perlmod/Install,$(1),TAP,) +endef + +$(eval $(call BuildPackage,perlbase-tap)) + + +define Package/perlbase-term +$(call Package/perlbase-template) +TITLE:=Term perl module +DEPENDS+=+perlbase-essential +endef + +define Package/perlbase-term/install +$(call perlmod/Install,$(1),Term,) +$(call perlmod/InstallBaseTests,$(1),cpan/Term-ANSIColor/t cpan/Term-Cap/test.pl dist/Term-Complete/t dist/Term-ReadLine/t) +endef + +$(eval $(call BuildPackage,perlbase-term)) + + +define Package/perlbase-test +$(call Package/perlbase-template) +TITLE:=Test perl module +DEPENDS+=+perlbase-base +perlbase-config +perlbase-essential +perlbase-io +perlbase-symbol +perlbase-tap +perlbase-text +endef + +define Package/perlbase-test/install +$(call perlmod/Install,$(1),Test Test.pm ok.pm,Test/Builder.pm Test/Harness/TAP.pod Test/More.pm Test/Tutorial.pod) +$(call perlmod/Install/NoStrip,$(1),Test/Builder.pm Test/More.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/Test-Harness/t cpan/Test-Simple/t cpan/Test/t) + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/prove $(1)/usr/bin +endef + +$(eval $(call BuildPackage,perlbase-test)) + + +define Package/perlbase-text +$(call Package/perlbase-template) +TITLE:=Text perl module +DEPENDS+=+perlbase-essential +perlbase-selfloader +endef + +define Package/perlbase-text/install +$(call perlmod/Install,$(1),Text,) +$(call perlmod/InstallBaseTests,$(1),cpan/Text-Balanced/t cpan/Text-ParseWords/t cpan/Text-Tabs/t dist/Text-Abbrev/t) +endef + +$(eval $(call BuildPackage,perlbase-text)) + + +define Package/perlbase-thread +$(call Package/perlbase-template) +TITLE:=Thread perl module +DEPENDS+=+perlbase-essential +perlbase-scalar +perlbase-threads +endef + +define Package/perlbase-thread/install +$(call perlmod/Install,$(1),Thread Thread.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/Thread-Queue/t dist/Thread-Semaphore/t lib/Thread.t) +endef + +$(eval $(call BuildPackage,perlbase-thread)) + + +define Package/perlbase-threads +$(call Package/perlbase-template) +TITLE:=threads perl module +DEPENDS+=+perlbase-config +perlbase-essential +perlbase-scalar +perlbase-xsloader +endef + +define Package/perlbase-threads/install +$(call perlmod/Install,$(1),auto/threads threads threads.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/threads-shared/t dist/threads/t) +endef + +$(eval $(call BuildPackage,perlbase-threads)) + + +define Package/perlbase-tie +$(call Package/perlbase-template) +TITLE:=Tie perl module +DEPENDS+=+perlbase-essential +perlbase-fcntl +perlbase-xsloader +endef + +define Package/perlbase-tie/install +$(call perlmod/Install,$(1),Tie auto/Tie,) +$(call perlmod/InstallBaseTests,$(1),cpan/Tie-RefHash/t dist/Tie-File/t ext/Tie-Hash-NamedCapture/t ext/Tie-Memoize/lib/Tie/Memoize.pm ext/Tie-Memoize/t lib/Tie/Array/push.t lib/Tie/Array/splice.t lib/Tie/Array/std.t lib/Tie/Array/stdpush.t lib/Tie/ExtraHash.t lib/Tie/Handle/stdhandle.t lib/Tie/Handle/stdhandle_from_handle.t lib/Tie/Hash.t lib/Tie/Scalar.t lib/Tie/SubstrHash.t) +endef + +$(eval $(call BuildPackage,perlbase-tie)) + + +define Package/perlbase-time +$(call Package/perlbase-template) +TITLE:=Time perl module +DEPENDS+=+perlbase-class +perlbase-config +perlbase-dynaloader +perlbase-essential +endef + +define Package/perlbase-time/install +$(call perlmod/Install,$(1),Time auto/Time,) +$(call perlmod/InstallBaseTests,$(1),cpan/Time-HiRes/t cpan/Time-Local/t cpan/Time-Piece/t lib/Time/gmtime.t lib/Time/localtime.t) +endef + +$(eval $(call BuildPackage,perlbase-time)) + + +define Package/perlbase-unicode +$(call Package/perlbase-template) +TITLE:=Unicode perl module +DEPENDS+=+perlbase-base +perlbase-charnames +perlbase-dynaloader +perlbase-essential +perlbase-file +endef + +define Package/perlbase-unicode/install +$(call perlmod/Install,$(1),Unicode auto/Unicode,) +$(call perlmod/InstallBaseTests,$(1),cpan/Unicode-Collate/t cpan/Unicode-Normalize/t lib/Unicode/UCD.t) +endef + +$(eval $(call BuildPackage,perlbase-unicode)) + + +define Package/perlbase-unicore +$(call Package/perlbase-template) +TITLE:=unicore perl module +endef + +define Package/perlbase-unicore/install +$(call perlmod/Install,$(1),unicore,) +$(call perlmod/InstallBaseTests,$(1),lib/unicore/NameAliases.txt lib/unicore/PropValueAliases.txt lib/unicore/PropertyAliases.txt lib/unicore/UnicodeData.txt) +endef + +$(eval $(call BuildPackage,perlbase-unicore)) + + +define Package/perlbase-universal +$(call Package/perlbase-template) +TITLE:=UNIVERSAL perl module +endef + +define Package/perlbase-universal/install +$(call perlmod/Install,$(1),UNIVERSAL.pm,) +endef + +$(eval $(call BuildPackage,perlbase-universal)) + + +define Package/perlbase-user +$(call Package/perlbase-template) +TITLE:=User perl module +DEPENDS+=+perlbase-class +perlbase-config +perlbase-essential +endef + +define Package/perlbase-user/install +$(call perlmod/Install,$(1),User,) +$(call perlmod/InstallBaseTests,$(1),lib/User/grent.t lib/User/pwent.t) +endef + +$(eval $(call BuildPackage,perlbase-user)) + + +define Package/perlbase-utf8 +$(call Package/perlbase-template) +TITLE:=utf8 perl module +DEPENDS+=+perlbase-essential +perlbase-re +perlbase-unicore +endef + +define Package/perlbase-utf8/install +$(call perlmod/Install,$(1),utf8.pm utf8_heavy.pl,) +$(call perlmod/InstallBaseTests,$(1),lib/utf8.t) +endef + +$(eval $(call BuildPackage,perlbase-utf8)) + + +define Package/perlbase-version +$(call Package/perlbase-template) +TITLE:=version perl module +DEPENDS+=+perlbase-config +perlbase-essential +endef + +define Package/perlbase-version/install +$(call perlmod/Install,$(1),version version.pm,) +$(call perlmod/InstallBaseTests,$(1),cpan/version/t) +endef + +$(eval $(call BuildPackage,perlbase-version)) + + +define Package/perlbase-xsloader +$(call Package/perlbase-template) +TITLE:=XSLoader perl module +endef + +define Package/perlbase-xsloader/install +$(call perlmod/Install,$(1),XSLoader.pm,) +$(call perlmod/InstallBaseTests,$(1),dist/XSLoader/t ext/XS-APItest/t ext/XS-Typemap/t) +endef + +$(eval $(call BuildPackage,perlbase-xsloader)) + + +# Generated Fri Sep 25 07:47:59 2015 diff --git a/lang/perl/perlmod.mk b/lang/perl/perlmod.mk new file mode 100644 index 0000000..c64942f --- /dev/null +++ b/lang/perl/perlmod.mk @@ -0,0 +1,162 @@ +# This makefile simplifies perl module builds. +# + +PERL_VERSION:=5.22 + +# Build environment +HOST_PERL_PREFIX:=$(STAGING_DIR)/host/usr +ifneq ($(CONFIG_USE_GLIBC),) + EXTRA_LIBS:=bsd + EXTRA_LIBDIRS:=$(STAGING_DIR)/lib +endif +PERL_CMD:=$(STAGING_DIR)/host/usr/bin/perl$(PERL_VERSION).0 + +MOD_CFLAGS_PERL:=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) +ifdef CONFIG_PERL_THREADS + MOD_CFLAGS_PERL+= -D_REENTRANT -D_GNU_SOURCE +endif + +# Module install prefix +PERL_SITELIB:=/usr/lib/perl5/$(PERL_VERSION) +PERL_TESTSDIR:=/usr/share/perl/perl-tests +PERLBASE_TESTSDIR:=/usr/share/perl/perlbase-tests +PERLMOD_TESTSDIR:=/usr/share/perl/perlmod-tests + +define perlmod/host/relink + rm -f $(1)/Makefile.aperl + $(MAKE) -C $(1) perl + $(CP) $(1)/perl $(PERL_CMD) + $(CP) $(1)/perl $(STAGING_DIR)/host/usr/bin/perl +endef + +define perlmod/host/Configure + (cd $(HOST_BUILD_DIR); \ + PERL_MM_USE_DEFAULT=1 \ + $(2) \ + $(PERL_CMD) Makefile.PL \ + $(1) \ + ); +endef + +define perlmod/host/Compile + $(2) \ + $(MAKE) -C $(HOST_BUILD_DIR) \ + $(1) \ + install +endef + +define perlmod/host/Install + $(2) \ + $(MAKE) -C $(HOST_BUILD_DIR) \ + $(1) \ + install + $(call perlmod/host/relink,$(HOST_BUILD_DIR)) +endef + +define perlmod/Configure + (cd $(if $(3),$(3),$(PKG_BUILD_DIR)); \ + PERL_MM_USE_DEFAULT=1 \ + $(2) \ + $(PERL_CMD) -MConfig -e '$$$${tied %Config::Config}{cpprun}="$(GNU_TARGET_NAME)-cpp -E"; do "Makefile.PL"' \ + $(1) \ + AR=ar \ + CC=$(GNU_TARGET_NAME)-gcc \ + CCFLAGS="$(MOD_CFLAGS_PERL)" \ + CCCDLFLAGS=-fPIC \ + CCDLFLAGS=-Wl,-E \ + DLEXT=so \ + DLSRC=dl_dlopen.xs \ + EXE_EXT=" " \ + FULL_AR=$(GNU_TARGET_NAME)-ar \ + LD=$(GNU_TARGET_NAME)-gcc \ + LDDLFLAGS="-shared -rdynamic $(TARGET_LDFLAGS)" \ + LDFLAGS="$(EXTRA_LIBDIRS:%=-L%) $(EXTRA_LIBS:%=-l%) " \ + LIBC=" " \ + LIB_EXT=.a \ + OBJ_EXT=.o \ + OSNAME=linux \ + OSVERS=2.4.30 \ + RANLIB=: \ + SITELIBEXP=" " \ + SITEARCHEXP=" " \ + SO=so \ + VENDORARCHEXP=" " \ + VENDORLIBEXP=" " \ + SITEPREFIX=/usr \ + INSTALLPRIVLIB=$(PERL_SITELIB) \ + INSTALLSITELIB=$(PERL_SITELIB) \ + INSTALLVENDORLIB=" " \ + INSTALLARCHLIB=$(PERL_SITELIB) \ + INSTALLSITEARCH=$(PERL_SITELIB) \ + INSTALLVENDORARCH=" " \ + INSTALLBIN=/usr/bin \ + INSTALLSITEBIN=/usr/bin \ + INSTALLVENDORBIN=" " \ + INSTALLSCRIPT=/usr/bin \ + INSTALLSITESCRIPT=/usr/bin \ + INSTALLVENDORSCRIPT=" " \ + INSTALLMAN1DIR=/usr/man/man1 \ + INSTALLSITEMAN1DIR=/usr/man/man1 \ + INSTALLVENDORMAN1DIR=" " \ + INSTALLMAN3DIR=/usr/man/man3 \ + INSTALLSITEMAN3DIR=/usr/man/man3 \ + INSTALLVENDORMAN3DIR=" " \ + LINKTYPE=dynamic \ + DESTDIR=$(PKG_INSTALL_DIR) \ + ); + sed 's!^PERL_INC = .*!PERL_INC = $(STAGING_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/!' -i $(if $(3),$(3),$(PKG_BUILD_DIR))/Makefile +endef + +define perlmod/Compile + PERL5LIB=$(PERL_LIB) \ + $(2) \ + $(MAKE) -C $(if $(3),$(3),$(PKG_BUILD_DIR)) \ + $(1) \ + install +endef + +define perlmod/Install/NoStrip + $(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB) + (cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \ + rsync --relative -rlHp --itemize-changes \ + --exclude=\*.pod \ + --exclude=.packlist \ + $(addprefix --exclude=/,$(strip $(3))) \ + --prune-empty-dirs \ + $(strip $(2)) $(strip $(1))$(PERL_SITELIB)) + + chmod -R u+w $(strip $(1))$(PERL_SITELIB) +endef + + +define perlmod/Install + $(call perlmod/Install/NoStrip,$(1),$(2),$(3)) + + @echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)" + find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \ + xargs -r sed -i \ + -e '/^=\(head\|pod\|item\|over\|back\|encoding\|begin\|end\|for\)/,/^=cut/d' \ + -e '/^=\(head\|pod\|item\|over\|back\|encoding\|begin\|end\|for\)/,$$$$d' \ + -e '/^#$$$$/d' \ + -e '/^#[^!"'"'"']/d' +endef + +# You probably don't want to use this directly. Look at perlmod/InstallTests +define perlmod/_InstallTests + $(INSTALL_DIR) $(strip $(1)) + (cd $(PKG_BUILD_DIR)/$(2) && \ + rsync --relative -rlHp --itemize-changes \ + --exclude=.packlist \ + --prune-empty-dirs \ + $(strip $(3)) $(strip $(1))) + + chmod -R u+w $(strip $(1)) +endef + +define perlmod/InstallBaseTests + $(if $(CONFIG_PERL_TESTS),$(call perlmod/_InstallTests,$(1)$(PERL_TESTSDIR),,$(2))) +endef + +define perlmod/InstallTests + $(if $(CONFIG_PERL_TESTS),$(call perlmod/_InstallTests,$(1)$(PERL_TESTSDIR),$(2),$(3))) +endef diff --git a/lang/php7-pecl-dio/Makefile b/lang/php7-pecl-dio/Makefile new file mode 100644 index 0000000..bcf32a1 --- /dev/null +++ b/lang/php7-pecl-dio/Makefile @@ -0,0 +1,34 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=dio +PECL_LONGNAME:=Direct I/O functions + +PKG_VERSION:=0.0.7 +PKG_RELEASE:=2 +PKG_MD5SUM:=a1a4df428a17dbe1ab4277b492dfa052 + +PKG_NAME:=php7-pecl-$(PECL_NAME) +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=PHPv3.01 +PKG_LICENSE_FILES:= + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME))) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-dio/patches/0000-unify-line-endings.patch b/lang/php7-pecl-dio/patches/0000-unify-line-endings.patch new file mode 100644 index 0000000..b6c2750 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0000-unify-line-endings.patch @@ -0,0 +1,3110 @@ +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -1,659 +1,659 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifdef HAVE_CONFIG_H +-#include "config.h" +-#endif +- +-#include "php.h" +- +-#include "php_dio_common.h" +- +-/* {{{ dio_stream_mode_to_flags +- * Convert an fopen() mode string to open() flags +- */ +-static int dio_stream_mode_to_flags(const char *mode) { +- int flags = 0, ch = 0, bin = 1; +- +- switch(mode[ch++]) { +- case 'r': +- flags = 0; +- break; +- case 'w': +- flags = O_TRUNC | O_CREAT; +- break; +- case 'a': +- flags = O_APPEND | O_CREAT; +- break; +- case 'x': +- flags = O_EXCL | O_CREAT; +- break; +- } +- +- if (mode[ch] != '+') { +- bin = (mode[ch++] == 'b'); +- } +- +- if (mode[ch] == '+') { +- flags |= O_RDWR; +- } else if (flags) { +- flags |= O_WRONLY; +- } else { +- flags |= O_RDONLY; +- } +- +-#if defined(_O_TEXT) && defined(O_BINARY) +- if (bin) { +- flags |= O_BINARY; +- } else { +- flags |= _O_TEXT; +- } +-#endif +- +- return flags; +-} +-/* }}} */ +- +-/* {{{ dio_data_rate_to_define +- * Converts a numeric data rate to a termios define +- */ +-static int dio_data_rate_to_define(long rate, speed_t *def) { +- speed_t val; +- +- switch (rate) { +- case 0: +- val = 0; +- break; +- case 50: +- val = B50; +- break; +- case 75: +- val = B75; +- break; +- case 110: +- val = B110; +- break; +- case 134: +- val = B134; +- break; +- case 150: +- val = B150; +- break; +- case 200: +- val = B200; +- break; +- case 300: +- val = B300; +- break; +- case 600: +- val = B600; +- break; +- case 1200: +- val = B1200; +- break; +- case 1800: +- val = B1800; +- break; +- case 2400: +- val = B2400; +- break; +- case 4800: +- val = B4800; +- break; +- case 9600: +- val = B9600; +- break; +- case 19200: +- val = B19200; +- break; +- case 38400: +- val = B38400; +- break; +-#ifdef B57600 +- case 57600: +- val = B57600; +- break; +-#endif +-#ifdef B115200 +- case 115200: +- val = B115200; +- break; +-#endif +-#ifdef B230400 +- case 230400: +- val = B230400; +- break; +-#endif +-#ifdef B460800 +- case 460800: +- val = B460800; +- break; +-#endif +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +- +-/* {{{ dio_data_bits_to_define +- * Converts a number of data bits to a termios define +- */ +-static int dio_data_bits_to_define(int data_bits, int *def) { +- int val; +- +- switch (data_bits) { +- case 8: +- val = CS8; +- break; +- case 7: +- val = CS7; +- break; +- case 6: +- val = CS6; +- break; +- case 5: +- val = CS5; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_stop_bits_to_define +- * Converts a number of stop bits to a termios define +- */ +-static int dio_stop_bits_to_define(int stop_bits, int *def) { +- int val; +- +- switch (stop_bits) { +- case 1: +- val = 0; +- break; +- case 2: +- val = CSTOPB; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_parity_to_define +- * Converts a parity type to a termios define +- */ +-static int dio_parity_to_define(int parity, int *def) { +- int val; +- +- switch (parity) { +- case 0: +- val = 0; +- break; +- case 1: +- val = PARENB | PARODD; +- break; +- case 2: +- val = PARENB; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_create_stream_data +- * Creates an initialised stream data structure. Free with efree(). +- */ +-php_dio_stream_data * dio_create_stream_data(void) { +- php_dio_posix_stream_data * data = emalloc(sizeof(php_dio_posix_stream_data)); +- dio_init_stream_data(&(data->common)); +- data->fd = -1; +- data->flags = 0; +- +- return (php_dio_stream_data *)data; +-} +-/* }}} */ +- +-/* {{{ dio_common_write +- * Writes count chars from the buffer to the stream described by the stream data. +- */ +-size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { +- size_t ret; +- +- /* Blocking writes can be interrupted by signals etc. If +- * interrupted try again. Not sure about non-blocking +- * writes but it doesn't hurt to check. */ +- do { +- ret = write(((php_dio_posix_stream_data*)data)->fd, buf, count); +- if (ret > 0) { +- return ret; +- } +- } while (errno == EINTR); +- return 0; +-} +-/* }}} */ +- +-#ifdef DIO_NONBLOCK +-/* {{{ dio_timeval_subtract +- * Calculates the difference between two timevals returning the result in the +- * structure pointed to by diffptr. Returns -1 as error if late time is +- * earlier than early time. +- */ +-static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) { +- struct timeval *tmp; +- +- /* Handle negatives */ +- if (late->tv_sec < early->tv_sec) { +- return 0; +- } +- +- if ((late->tv_sec == early->tv_sec) && (late->tv_usec < early->tv_usec)) { +- return 0; +- } +- +- /* Handle any carry. If later usec is smaller than earlier usec simple +- * subtraction will result in negative value. Since usec has a maximum +- * of one second by adding another second before the subtraction the +- * result will always be positive. */ +- if (late->tv_usec < early->tv_usec) { +- late->tv_usec += 1000000; +- late->tv_sec--; +- } +- +- /* Once adjusted can just subtract values. */ +- diff->tv_sec = late->tv_sec - early->tv_sec; +- diff->tv_usec = late->tv_usec - early->tv_usec; +- +- return 1; +-} +-#endif +- +-/* {{{ dio_common_read +- * Reads count chars to the buffer to the stream described by the stream data. +- */ +-size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { +- int fd = ((php_dio_posix_stream_data*)data)->fd; +- size_t ret, total = 0; +- char *ptr = (char*)buf; +- +- struct timeval timeout, timeouttmp, before, after, diff; +- fd_set rfds; +- +- if (!data->has_timeout) { +- /* Blocking reads can be interrupted by signals etc. If +- * interrupted try again. Not sure about non-blocking +- * reads but it doesn't hurt to check. */ +- do { +- ret = read(fd, (char*)ptr, count); +- if (ret > 0) { +- return ret; +- } else if (!ret) { +- data->end_of_file = 1; +- } +- } while ((errno == EINTR) && !data->end_of_file); +- return 0; +- } +-#ifdef DIO_NONBLOCK +- else { +- /* Clear timed out flag */ +- data->timed_out = 0; +- +- /* The initial timeout value */ +- timeout.tv_sec = data->timeout_sec; +- timeout.tv_usec = data->timeout_usec; +- +- do { +- /* The semantics of select() are that you cannot guarantee +- * that the timeval structure passed in has not been changed by +- * the select call. So you keep a copy. */ +- timeouttmp = timeout; +- +- /* The time before we wait for data. */ +- (void) gettimeofday(&before, NULL); +- +- /* Wait for an event on our file descriptor. */ +- FD_ZERO(&rfds); +- FD_SET(fd, &rfds); +- +- ret = select(fd + 1, &rfds, NULL, NULL, &timeouttmp); +- /* An error. */ +- if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { +- return 0; +- } +- +- /* We have data to read. */ +- if ((ret > 0) && FD_ISSET(fd, &rfds)) { +- ret = read(fd, ptr, count); +- /* Another error */ +- if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { +- return 0; +- } +- +- if (ret > 0) { +- /* Got data, add it to the buffer. */ +- ptr += ret; +- total += ret; +- count -= ret; +- } else if (!ret) { +- /* This should never happen since how can we have +- * data to read at an end of file, but still +- * just in case! */ +- data->end_of_file = 1; +- break; +- } +- } +- +- /* If not timed out and not end of file and not all data read +- * calculate how long it took us and loop if we still have time +- * out time left. */ +- if (count) { +- (void) gettimeofday(&after, NULL); +- +- /* Diff the timevals */ +- (void) dio_timeval_subtract(&after, &before, &diff); +- +- /* Now adjust the timeout. */ +- if (!dio_timeval_subtract(&timeout, &diff, &timeout)) { +- /* If it errors we've run out of time. */ +- data->timed_out = 1; +- break; +- } else if (!timeout.tv_sec && !(timeout.tv_usec / 1000)) { +- /* Check for rounding issues (millisecond accuracy) */ +- data->timed_out = 1; +- break; +- } +- } +- } while (count); /* Until time out or end of file or all data read. */ +- +- return total; +- } +-#endif +-} +-/* }}} */ +- +-/* {{{ php_dio_stream_data +- * Closes the php_stream. +- */ +-int dio_common_close(php_dio_stream_data *data) { +- if (close(((php_dio_posix_stream_data*)data)->fd) < 0) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_common_set_option +- * Sets/gets stream options +- */ +-int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { +- int fd = ((php_dio_posix_stream_data*)data)->fd; +- int old_is_blocking; +- int flags; +- +- switch (option) { +-#ifdef DIO_NONBLOCK +- case PHP_STREAM_OPTION_READ_TIMEOUT: +- if (ptrparam) { +- struct timeval *tv = (struct timeval*)ptrparam; +- +- flags = fcntl(fd, F_GETFL, 0); +- +- /* A timeout of zero seconds and zero microseconds disables +- any existing timeout. */ +- if (tv->tv_sec || tv->tv_usec) { +- data->timeout_sec = tv->tv_sec; +- data->timeout_usec = tv->tv_usec; +- data->has_timeout = -1; +- (void) fcntl(fd, F_SETFL, flags & ~DIO_NONBLOCK); +- } else { +- data->timeout_sec = 0; +- data->timeout_usec = 0; +- data->has_timeout = 0; +- data->timed_out = 0; +- (void) fcntl(fd, F_SETFL, flags | DIO_NONBLOCK); +- } +- +- return PHP_STREAM_OPTION_RETURN_OK; +- } else { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } +- +- case PHP_STREAM_OPTION_BLOCKING: +- flags = fcntl(fd, F_GETFL, 0); +- if (value) { +- flags &= ~DIO_NONBLOCK; +- } else { +- flags |= DIO_NONBLOCK; +- } +- (void) fcntl(fd, F_SETFL, flags); +- +- old_is_blocking = data->is_blocking; +- data->is_blocking = value; +- return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; +-#endif /* O_NONBLOCK */ +- +- default: +- break; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_raw_open_stream +- * Opens the underlying stream. +- */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- pdata->flags = dio_stream_mode_to_flags(mode); +- +-#ifdef DIO_NONBLOCK +- if (!data->is_blocking || data->has_timeout) { +- pdata->flags |= DIO_NONBLOCK; +- } +-#endif +- +- /* Open the file and handle any errors. */ +-#ifdef DIO_HAS_FILEPERMS +- if (data->has_perms) { +- pdata->fd = open(filename, pdata->flags, (mode_t)data->perms); +- } else { +- pdata->fd = open(filename, pdata->flags); +- } +-#else +- pdata->fd = open(filename, pdata->flags); +-#endif +- +- if (pdata->fd < 0) { +- switch (errno) { +- case EEXIST: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); +- return 0; +- default: +- return 0; +- } +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_init +- * Initialises the serial settings storing the original settings before hand. +- */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- int ret = 0, data_bits_def, stop_bits_def, parity_def; +- struct termios tio; +- speed_t rate_def; +- +- if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); +- return 0; +- } +- +- if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); +- return 0; +- } +- +- if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); +- return 0; +- } +- +- if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); +- return 0; +- } +- +- ret = tcgetattr(pdata->fd, &(pdata->oldtio)); +- if (ret < 0) { +- if ((errno == ENOTTY) || (errno == ENODEV)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!"); +- } +- return 0; +- } +- +- ret = tcgetattr(pdata->fd, &tio); +- if (ret < 0) { +- return 0; +- } +- +- if (data->canonical) { +- tio.c_iflag = IGNPAR | ICRNL; +- tio.c_oflag = 0; +- tio.c_lflag = ICANON; +- } else { +- cfmakeraw(&tio); +- } +- +- cfsetispeed(&tio, rate_def); +- cfsetospeed(&tio, rate_def); +- +- tio.c_cflag &= ~CSIZE; +- tio.c_cflag |= data_bits_def; +- tio.c_cflag &= ~CSTOPB; +- tio.c_cflag |= stop_bits_def; +- tio.c_cflag &= ~(PARENB|PARODD); +- tio.c_cflag |= parity_def; +- +-#ifdef CRTSCTS +- tio.c_cflag &= ~(CLOCAL | CRTSCTS); +-#else +- tio.c_cflag &= ~CLOCAL; +-#endif +- if (!data->flow_control) { +- tio.c_cflag |= CLOCAL; +-#ifdef CRTSCTS +- } else { +- tio.c_cflag |= CRTSCTS; +-#endif +- } +- +- ret = tcsetattr(pdata->fd, TCSANOW, &tio); +- if (ret < 0) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_uninit +- * Restores the serial settings back to their original state. +- */ +-int dio_serial_uninit(php_dio_stream_data *data) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- int ret; +- +- do { +- ret = tcsetattr(pdata->fd, TCSANOW, &(pdata->oldtio)); +- } while ((ret < 0) && (errno == EINTR)); +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_flush +- * Purges the serial buffers of data. +- */ +-int dio_serial_purge(php_dio_stream_data *data) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- int ret; +- +- if ((pdata->flags & O_RDWR) == O_RDWR) { +- ret = tcflush(pdata->fd, TCIOFLUSH); +- } else if ((pdata->flags & O_WRONLY) == O_WRONLY) { +- ret = tcflush(pdata->fd, TCOFLUSH); +- } else if ((pdata->flags & O_RDONLY) == O_RDONLY) { +- ret = tcflush(pdata->fd, TCIFLUSH); +- } +- +- if (ret < 0) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_open_stream +- * Opens the underlying stream. +- */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; +- +-#ifdef O_NOCTTY +- /* We don't want a controlling TTY */ +- pdata->flags |= O_NOCTTY; +-#endif +- +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { +- return 0; +- } +- +- if (!dio_serial_init(data TSRMLS_CC)) { +- close(pdata->fd); +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "php.h" ++ ++#include "php_dio_common.h" ++ ++/* {{{ dio_stream_mode_to_flags ++ * Convert an fopen() mode string to open() flags ++ */ ++static int dio_stream_mode_to_flags(const char *mode) { ++ int flags = 0, ch = 0, bin = 1; ++ ++ switch(mode[ch++]) { ++ case 'r': ++ flags = 0; ++ break; ++ case 'w': ++ flags = O_TRUNC | O_CREAT; ++ break; ++ case 'a': ++ flags = O_APPEND | O_CREAT; ++ break; ++ case 'x': ++ flags = O_EXCL | O_CREAT; ++ break; ++ } ++ ++ if (mode[ch] != '+') { ++ bin = (mode[ch++] == 'b'); ++ } ++ ++ if (mode[ch] == '+') { ++ flags |= O_RDWR; ++ } else if (flags) { ++ flags |= O_WRONLY; ++ } else { ++ flags |= O_RDONLY; ++ } ++ ++#if defined(_O_TEXT) && defined(O_BINARY) ++ if (bin) { ++ flags |= O_BINARY; ++ } else { ++ flags |= _O_TEXT; ++ } ++#endif ++ ++ return flags; ++} ++/* }}} */ ++ ++/* {{{ dio_data_rate_to_define ++ * Converts a numeric data rate to a termios define ++ */ ++static int dio_data_rate_to_define(long rate, speed_t *def) { ++ speed_t val; ++ ++ switch (rate) { ++ case 0: ++ val = 0; ++ break; ++ case 50: ++ val = B50; ++ break; ++ case 75: ++ val = B75; ++ break; ++ case 110: ++ val = B110; ++ break; ++ case 134: ++ val = B134; ++ break; ++ case 150: ++ val = B150; ++ break; ++ case 200: ++ val = B200; ++ break; ++ case 300: ++ val = B300; ++ break; ++ case 600: ++ val = B600; ++ break; ++ case 1200: ++ val = B1200; ++ break; ++ case 1800: ++ val = B1800; ++ break; ++ case 2400: ++ val = B2400; ++ break; ++ case 4800: ++ val = B4800; ++ break; ++ case 9600: ++ val = B9600; ++ break; ++ case 19200: ++ val = B19200; ++ break; ++ case 38400: ++ val = B38400; ++ break; ++#ifdef B57600 ++ case 57600: ++ val = B57600; ++ break; ++#endif ++#ifdef B115200 ++ case 115200: ++ val = B115200; ++ break; ++#endif ++#ifdef B230400 ++ case 230400: ++ val = B230400; ++ break; ++#endif ++#ifdef B460800 ++ case 460800: ++ val = B460800; ++ break; ++#endif ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++ ++/* {{{ dio_data_bits_to_define ++ * Converts a number of data bits to a termios define ++ */ ++static int dio_data_bits_to_define(int data_bits, int *def) { ++ int val; ++ ++ switch (data_bits) { ++ case 8: ++ val = CS8; ++ break; ++ case 7: ++ val = CS7; ++ break; ++ case 6: ++ val = CS6; ++ break; ++ case 5: ++ val = CS5; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_stop_bits_to_define ++ * Converts a number of stop bits to a termios define ++ */ ++static int dio_stop_bits_to_define(int stop_bits, int *def) { ++ int val; ++ ++ switch (stop_bits) { ++ case 1: ++ val = 0; ++ break; ++ case 2: ++ val = CSTOPB; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_parity_to_define ++ * Converts a parity type to a termios define ++ */ ++static int dio_parity_to_define(int parity, int *def) { ++ int val; ++ ++ switch (parity) { ++ case 0: ++ val = 0; ++ break; ++ case 1: ++ val = PARENB | PARODD; ++ break; ++ case 2: ++ val = PARENB; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_create_stream_data ++ * Creates an initialised stream data structure. Free with efree(). ++ */ ++php_dio_stream_data * dio_create_stream_data(void) { ++ php_dio_posix_stream_data * data = emalloc(sizeof(php_dio_posix_stream_data)); ++ dio_init_stream_data(&(data->common)); ++ data->fd = -1; ++ data->flags = 0; ++ ++ return (php_dio_stream_data *)data; ++} ++/* }}} */ ++ ++/* {{{ dio_common_write ++ * Writes count chars from the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { ++ size_t ret; ++ ++ /* Blocking writes can be interrupted by signals etc. If ++ * interrupted try again. Not sure about non-blocking ++ * writes but it doesn't hurt to check. */ ++ do { ++ ret = write(((php_dio_posix_stream_data*)data)->fd, buf, count); ++ if (ret > 0) { ++ return ret; ++ } ++ } while (errno == EINTR); ++ return 0; ++} ++/* }}} */ ++ ++#ifdef DIO_NONBLOCK ++/* {{{ dio_timeval_subtract ++ * Calculates the difference between two timevals returning the result in the ++ * structure pointed to by diffptr. Returns -1 as error if late time is ++ * earlier than early time. ++ */ ++static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) { ++ struct timeval *tmp; ++ ++ /* Handle negatives */ ++ if (late->tv_sec < early->tv_sec) { ++ return 0; ++ } ++ ++ if ((late->tv_sec == early->tv_sec) && (late->tv_usec < early->tv_usec)) { ++ return 0; ++ } ++ ++ /* Handle any carry. If later usec is smaller than earlier usec simple ++ * subtraction will result in negative value. Since usec has a maximum ++ * of one second by adding another second before the subtraction the ++ * result will always be positive. */ ++ if (late->tv_usec < early->tv_usec) { ++ late->tv_usec += 1000000; ++ late->tv_sec--; ++ } ++ ++ /* Once adjusted can just subtract values. */ ++ diff->tv_sec = late->tv_sec - early->tv_sec; ++ diff->tv_usec = late->tv_usec - early->tv_usec; ++ ++ return 1; ++} ++#endif ++ ++/* {{{ dio_common_read ++ * Reads count chars to the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { ++ int fd = ((php_dio_posix_stream_data*)data)->fd; ++ size_t ret, total = 0; ++ char *ptr = (char*)buf; ++ ++ struct timeval timeout, timeouttmp, before, after, diff; ++ fd_set rfds; ++ ++ if (!data->has_timeout) { ++ /* Blocking reads can be interrupted by signals etc. If ++ * interrupted try again. Not sure about non-blocking ++ * reads but it doesn't hurt to check. */ ++ do { ++ ret = read(fd, (char*)ptr, count); ++ if (ret > 0) { ++ return ret; ++ } else if (!ret) { ++ data->end_of_file = 1; ++ } ++ } while ((errno == EINTR) && !data->end_of_file); ++ return 0; ++ } ++#ifdef DIO_NONBLOCK ++ else { ++ /* Clear timed out flag */ ++ data->timed_out = 0; ++ ++ /* The initial timeout value */ ++ timeout.tv_sec = data->timeout_sec; ++ timeout.tv_usec = data->timeout_usec; ++ ++ do { ++ /* The semantics of select() are that you cannot guarantee ++ * that the timeval structure passed in has not been changed by ++ * the select call. So you keep a copy. */ ++ timeouttmp = timeout; ++ ++ /* The time before we wait for data. */ ++ (void) gettimeofday(&before, NULL); ++ ++ /* Wait for an event on our file descriptor. */ ++ FD_ZERO(&rfds); ++ FD_SET(fd, &rfds); ++ ++ ret = select(fd + 1, &rfds, NULL, NULL, &timeouttmp); ++ /* An error. */ ++ if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { ++ return 0; ++ } ++ ++ /* We have data to read. */ ++ if ((ret > 0) && FD_ISSET(fd, &rfds)) { ++ ret = read(fd, ptr, count); ++ /* Another error */ ++ if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) { ++ return 0; ++ } ++ ++ if (ret > 0) { ++ /* Got data, add it to the buffer. */ ++ ptr += ret; ++ total += ret; ++ count -= ret; ++ } else if (!ret) { ++ /* This should never happen since how can we have ++ * data to read at an end of file, but still ++ * just in case! */ ++ data->end_of_file = 1; ++ break; ++ } ++ } ++ ++ /* If not timed out and not end of file and not all data read ++ * calculate how long it took us and loop if we still have time ++ * out time left. */ ++ if (count) { ++ (void) gettimeofday(&after, NULL); ++ ++ /* Diff the timevals */ ++ (void) dio_timeval_subtract(&after, &before, &diff); ++ ++ /* Now adjust the timeout. */ ++ if (!dio_timeval_subtract(&timeout, &diff, &timeout)) { ++ /* If it errors we've run out of time. */ ++ data->timed_out = 1; ++ break; ++ } else if (!timeout.tv_sec && !(timeout.tv_usec / 1000)) { ++ /* Check for rounding issues (millisecond accuracy) */ ++ data->timed_out = 1; ++ break; ++ } ++ } ++ } while (count); /* Until time out or end of file or all data read. */ ++ ++ return total; ++ } ++#endif ++} ++/* }}} */ ++ ++/* {{{ php_dio_stream_data ++ * Closes the php_stream. ++ */ ++int dio_common_close(php_dio_stream_data *data) { ++ if (close(((php_dio_posix_stream_data*)data)->fd) < 0) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_common_set_option ++ * Sets/gets stream options ++ */ ++int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { ++ int fd = ((php_dio_posix_stream_data*)data)->fd; ++ int old_is_blocking; ++ int flags; ++ ++ switch (option) { ++#ifdef DIO_NONBLOCK ++ case PHP_STREAM_OPTION_READ_TIMEOUT: ++ if (ptrparam) { ++ struct timeval *tv = (struct timeval*)ptrparam; ++ ++ flags = fcntl(fd, F_GETFL, 0); ++ ++ /* A timeout of zero seconds and zero microseconds disables ++ any existing timeout. */ ++ if (tv->tv_sec || tv->tv_usec) { ++ data->timeout_sec = tv->tv_sec; ++ data->timeout_usec = tv->tv_usec; ++ data->has_timeout = -1; ++ (void) fcntl(fd, F_SETFL, flags & ~DIO_NONBLOCK); ++ } else { ++ data->timeout_sec = 0; ++ data->timeout_usec = 0; ++ data->has_timeout = 0; ++ data->timed_out = 0; ++ (void) fcntl(fd, F_SETFL, flags | DIO_NONBLOCK); ++ } ++ ++ return PHP_STREAM_OPTION_RETURN_OK; ++ } else { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } ++ ++ case PHP_STREAM_OPTION_BLOCKING: ++ flags = fcntl(fd, F_GETFL, 0); ++ if (value) { ++ flags &= ~DIO_NONBLOCK; ++ } else { ++ flags |= DIO_NONBLOCK; ++ } ++ (void) fcntl(fd, F_SETFL, flags); ++ ++ old_is_blocking = data->is_blocking; ++ data->is_blocking = value; ++ return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; ++#endif /* O_NONBLOCK */ ++ ++ default: ++ break; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_raw_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ pdata->flags = dio_stream_mode_to_flags(mode); ++ ++#ifdef DIO_NONBLOCK ++ if (!data->is_blocking || data->has_timeout) { ++ pdata->flags |= DIO_NONBLOCK; ++ } ++#endif ++ ++ /* Open the file and handle any errors. */ ++#ifdef DIO_HAS_FILEPERMS ++ if (data->has_perms) { ++ pdata->fd = open(filename, pdata->flags, (mode_t)data->perms); ++ } else { ++ pdata->fd = open(filename, pdata->flags); ++ } ++#else ++ pdata->fd = open(filename, pdata->flags); ++#endif ++ ++ if (pdata->fd < 0) { ++ switch (errno) { ++ case EEXIST: ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ return 0; ++ default: ++ return 0; ++ } ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_init ++ * Initialises the serial settings storing the original settings before hand. ++ */ ++static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ int ret = 0, data_bits_def, stop_bits_def, parity_def; ++ struct termios tio; ++ speed_t rate_def; ++ ++ if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); ++ return 0; ++ } ++ ++ if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ return 0; ++ } ++ ++ if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ return 0; ++ } ++ ++ if (!dio_parity_to_define(data->parity, &parity_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ return 0; ++ } ++ ++ ret = tcgetattr(pdata->fd, &(pdata->oldtio)); ++ if (ret < 0) { ++ if ((errno == ENOTTY) || (errno == ENODEV)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!"); ++ } ++ return 0; ++ } ++ ++ ret = tcgetattr(pdata->fd, &tio); ++ if (ret < 0) { ++ return 0; ++ } ++ ++ if (data->canonical) { ++ tio.c_iflag = IGNPAR | ICRNL; ++ tio.c_oflag = 0; ++ tio.c_lflag = ICANON; ++ } else { ++ cfmakeraw(&tio); ++ } ++ ++ cfsetispeed(&tio, rate_def); ++ cfsetospeed(&tio, rate_def); ++ ++ tio.c_cflag &= ~CSIZE; ++ tio.c_cflag |= data_bits_def; ++ tio.c_cflag &= ~CSTOPB; ++ tio.c_cflag |= stop_bits_def; ++ tio.c_cflag &= ~(PARENB|PARODD); ++ tio.c_cflag |= parity_def; ++ ++#ifdef CRTSCTS ++ tio.c_cflag &= ~(CLOCAL | CRTSCTS); ++#else ++ tio.c_cflag &= ~CLOCAL; ++#endif ++ if (!data->flow_control) { ++ tio.c_cflag |= CLOCAL; ++#ifdef CRTSCTS ++ } else { ++ tio.c_cflag |= CRTSCTS; ++#endif ++ } ++ ++ ret = tcsetattr(pdata->fd, TCSANOW, &tio); ++ if (ret < 0) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_uninit ++ * Restores the serial settings back to their original state. ++ */ ++int dio_serial_uninit(php_dio_stream_data *data) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ int ret; ++ ++ do { ++ ret = tcsetattr(pdata->fd, TCSANOW, &(pdata->oldtio)); ++ } while ((ret < 0) && (errno == EINTR)); ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_flush ++ * Purges the serial buffers of data. ++ */ ++int dio_serial_purge(php_dio_stream_data *data) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ int ret; ++ ++ if ((pdata->flags & O_RDWR) == O_RDWR) { ++ ret = tcflush(pdata->fd, TCIOFLUSH); ++ } else if ((pdata->flags & O_WRONLY) == O_WRONLY) { ++ ret = tcflush(pdata->fd, TCOFLUSH); ++ } else if ((pdata->flags & O_RDONLY) == O_RDONLY) { ++ ret = tcflush(pdata->fd, TCIFLUSH); ++ } ++ ++ if (ret < 0) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; ++ ++#ifdef O_NOCTTY ++ /* We don't want a controlling TTY */ ++ pdata->flags |= O_NOCTTY; ++#endif ++ ++ if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ return 0; ++ } ++ ++ if (!dio_serial_init(data TSRMLS_CC)) { ++ close(pdata->fd); ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ +--- a/dio_win32.c ++++ b/dio_win32.c +@@ -1,759 +1,759 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifdef HAVE_CONFIG_H +-#include "config.h" +-#endif +- +-#include "php.h" +-#include "php_dio_common.h" +- +-#ifndef ZEND_WIN32 +-#error ZEND_WIN32 not defined! +-#endif +- +-/* {{{ dio_last_error_php_error +- * Generates a PHP error message based upon the last Windows error. +- */ +-static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { +- LPVOID msgbuf; +- DWORD msgbuflen; +- char * errmsg; +- DWORD err; +- +-#ifdef UNICODE +- DWORD errmsglen; +-#endif +- +- err = GetLastError(); +- msgbuflen = FormatMessage( +- FORMAT_MESSAGE_ALLOCATE_BUFFER| +- FORMAT_MESSAGE_FROM_SYSTEM| +- FORMAT_MESSAGE_IGNORE_INSERTS, +- NULL, +- err, +- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), +- (LPTSTR)&msgbuf, +- 0, +- NULL); +- +-#ifdef UNICODE +- +- /* Get the length of the converted message */ +- errmsglen = WideCharToMultibyte( +- CP_ACP, +- 0 +- (LPCWSTR)msgbuf, +- -1, +- (LPSTR)errmsg, +- 0, +- NULL, +- NULL); +- +- /* Allocate a buffer */ +- errmsg = emalloc(errmsglen); +- if (!errmsg) { +- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!"); +- LocalFree(msgbuf); +- return; +- } +- +- /* Convert the message */ +- errmsglen = WideCharToMultibyte( +- CP_ACP, +- 0 +- (LPCWSTR)msgbuf, +- -1, +- (LPSTR)errmsg, +- errmsglen, +- NULL, +- NULL); +- +-#else +- errmsg = (char *)msgbuf; +-#endif +- +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); +- +- LocalFree(msgbuf); +-#ifdef UNICODE +- efree(errmsg); +-#endif +-} +- +-/* {{{ dio_data_rate_to_define +- * Converts a numeric data rate to a termios define +- */ +-static int dio_data_rate_to_define(long rate, DWORD *def) { +- switch (rate) { +- case 75: +- case 110: +- case 134: +- case 150: +- case 300: +- case 600: +- case 1200: +- case 1800: +- case 2400: +- case 4800: +- case 7200: +- case 9600: +- case 14400: +- case 19200: +- case 38400: +- case 57600: +- case 115200: +- case 56000: +- case 128000: +- case 256000: +- break; +- default: +- return 0; +- } +- +- *def = (DWORD)rate; +- return 1; +-} +-/* }}} */ +- +- +-/* {{{ dio_data_bits_to_define +- * Converts a number of data bits to a termios define +- */ +-static int dio_data_bits_to_define(int data_bits, DWORD *def) { +- switch (data_bits) { +- case 8: +- case 7: +- case 6: +- case 5: +- case 4: +- break; +- default: +- return 0; +- } +- +- *def = (DWORD)data_bits; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_stop_bits_to_define +- * Converts a number of stop bits to a termios define +- */ +-static int dio_stop_bits_to_define(int stop_bits, DWORD *def) { +- DWORD val; +- +- switch (stop_bits) { +- case 1: +- val = ONESTOPBIT; +- break; +- case 2: +- val = TWOSTOPBITS; +- break; +- case 3: +- val = ONE5STOPBITS; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_parity_to_define +- * Converts a parity type to a termios define +- */ +-static int dio_parity_to_define(int parity, DWORD *def) { +- DWORD val; +- +- switch (parity) { +- case 0: +- val = NOPARITY; +- break; +- case 1: +- val = ODDPARITY; +- break; +- case 2: +- val = EVENPARITY; +- break; +- default: +- return 0; +- } +- +- *def = val; +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_create_stream_data +- * Creates an initialised stream data structure. Free with efree(). +- */ +-php_dio_stream_data * dio_create_stream_data(void) { +- php_dio_win32_stream_data * data = emalloc(sizeof(php_dio_win32_stream_data)); +- memset(data, 0, sizeof(php_dio_win32_stream_data)); +- dio_init_stream_data(&(data->common)); +- data->handle = INVALID_HANDLE_VALUE; +- data->desired_access = 0; +- data->creation_disposition = 0; +- data->olddcb.DCBlength = sizeof(DCB); +- +- return (php_dio_stream_data *)data; +-} +-/* }}} */ +- +-/* {{{ dio_common_write +- * Writes count chars from the buffer to the stream described by the stream data. +- */ +-size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD total = 0; +- +- if (WriteFile(wdata->handle, buf, (DWORD)count, &total, NULL)) { +- return (size_t)total; +- } +- +- return 0; +-} +-/* }}} */ +- +-/* {{{ dio_buffer_read +- * Reads any available chars from the canonical buffer. +- */ +-static size_t dio_buffer_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { +- php_dio_win32_canon_data *canon_data = wdata->canon_data; +- size_t total = 0; +- +- /* Read always follows write. I.e. if read ptr > write ptr buffer has +- wrapped and so we need to copy two blocks of data. */ +- if (canon_data->read_pos > canon_data->write_pos) { +- +- /* Check we actually need to copy both blocks */ +- if ((canon_data->size - canon_data->read_pos) > count) { +- +- /* No we don't. Just copy as much as we were asked for. */ +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- count); +- /* Update the read pointer. */ +- canon_data->read_pos += count; +- +- /* Return the amount read. */ +- return count; +- } else { +- +- /* We need to copy both blocks so copy data up to the end of +- the buffer. */ +- total = canon_data->size - canon_data->read_pos; +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- total); +- canon_data->read_pos = 0; +- count -= total; +- +- /* Now copy the data from the start of the buffer either up +- count or the number of bytes in the buffer. */ +- +- if (canon_data->write_pos > count) { +- memcpy((char*)buf, canon_data->buf, count); +- canon_data->read_pos = count; +- total += count; +- +- return total; +- } else { +- memcpy((char*)buf, canon_data->buf, canon_data->write_pos); +- canon_data->read_pos = canon_data->write_pos; +- total += canon_data->write_pos; +- +- return total; +- } +- } +- +- /* Else if write follows read. This is a simpler case. We just copy +- either all the data buffered or count, which ever is smaller. */ +- } else if (canon_data->write_pos > canon_data->read_pos) { +- if ((canon_data->write_pos - canon_data->read_pos) > count) { +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- count); +- canon_data->read_pos += count; +- +- return count; +- } else { +- total = canon_data->write_pos - canon_data->read_pos; +- memcpy((char*)buf, +- &(canon_data->buf[canon_data->read_pos]), +- total); +- canon_data->read_pos += total; +- +- return total; +- } +- } +- +- /* Else we need to read more data from the data port. */ +- return 0; +-} +- +-/* {{{ dio_com_read +- * Read chars from the data port. +- */ +-static size_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD err, total = 0; +- +- if (ReadFile(wdata->handle, (void*)buf, (DWORD)count, &total, NULL)) { +- +- if (total) { +- return (size_t)total; +- } +- +- data->end_of_file = 1; +- } +- +- if (!data->end_of_file) { +- err = GetLastError(); +- +- if (ERROR_HANDLE_EOF == err) { +- data->end_of_file = 1; +- } +- } +- +- return 0; +-} +- +-/* {{{ dio_canonical_read +- * Reads chars from the input stream until the internal buffer is full or a new +- * line is reached. +- */ +-static size_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { +- php_dio_win32_canon_data *canon_data = wdata->canon_data; +- size_t total = 0; +- char ch; +- +- /* See if there's any buffered data and copy it. */ +- total = dio_buffer_read(wdata, buf, count); +- if (total) { +- return total; +- } +- +- /* Need to read more data from the data port. Buffer should be empty(er) +- by now. */ +- do { +- /* Is the buffer full? */ +- if (((canon_data->write_pos + 1) % canon_data->size) == +- canon_data->read_pos) { +- break; +- } +- +- /* Read a byte from the input checking for EOF. */ +- if (!dio_com_read((php_dio_stream_data*)wdata, &ch, 1)) { +- break; +- } +- +- /* Translate CR to newlines (same as ICRNL in POSIX) */ +- ch = (ch != '\r') ? ch : '\n'; +- +- /* We read a character! So buffer it. */ +- canon_data->buf[canon_data->write_pos++] = ch; +- if (canon_data->write_pos >= canon_data->size) { +- canon_data->write_pos = 0; +- } +- +- /* End of line/input (^D)? */ +- } while ((ch != '\n') && (ch != 0x04)); +- +- return dio_buffer_read(wdata, buf, count); +-} +-/* }}} */ +- +-/* {{{ dio_common_read +- * Reads count chars to the buffer to the stream described by the stream data. +- */ +-size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { +- +- /* You ask for no bytes you'll get none :-) */ +- if (!count) { +- return 0; +- } +- +- if (data->canonical) { +- return dio_canonical_read((php_dio_win32_stream_data*)data, buf, count); +- } else { +- return dio_com_read(data, buf, count); +- } +-} +-/* }}} */ +- +-/* {{{ php_dio_stream_data +- * Closes the php_stream. +- */ +-int dio_common_close(php_dio_stream_data *data) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- +- if (data->canonical) { +- efree(wdata->canon_data); +- } +- +- if (!CloseHandle(wdata->handle)) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_common_set_option +- * Sets/gets stream options +- */ +-int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { +- COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; +- int old_is_blocking = 0; +- +- /* Can't do timeouts or non blocking with raw windows streams :-( */ +- if (DIO_STREAM_TYPE_SERIAL == data->stream_type) { +- switch (option) { +- case PHP_STREAM_OPTION_BLOCKING: +- old_is_blocking = data->is_blocking; +- data->is_blocking = value ? 1 : 0; +- +- /* Only change values if we need to change them. */ +- if (data->is_blocking != old_is_blocking) { +- /* If we're not blocking but don't have a timeout +- set to return immediately */ +- if (!data->is_blocking && !data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- } +- +- /* If we have a timeout ignore the blocking and set +- the total time in which to read the data */ +- if (data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- cto.ReadTotalTimeoutMultiplier = MAXDWORD; +- cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + +- (data->timeout_sec * 1000); +- } +- +- if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } +- } +- return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; +- +- case PHP_STREAM_OPTION_READ_TIMEOUT: +- if (ptrparam) { +- /* struct timeval is supported with PHP_WIN32 defined. */ +- struct timeval *tv = (struct timeval*)ptrparam; +- +- /* A timeout of zero seconds and zero microseconds disables +- any existing timeout. */ +- if (tv->tv_sec || tv->tv_usec) { +- data->timeout_sec = tv->tv_sec; +- data->timeout_usec = tv->tv_usec; +- data->has_timeout = -1; +- +- cto.ReadIntervalTimeout = MAXDWORD; +- cto.ReadTotalTimeoutMultiplier = MAXDWORD; +- cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + +- (data->timeout_sec * 1000); +- } else { +- data->timeout_sec = 0; +- data->timeout_usec = 0; +- data->has_timeout = 0; +- data->timed_out = 0; +- +- /* If we're not blocking but don't have a timeout +- set to return immediately */ +- if (!data->is_blocking) { +- cto.ReadIntervalTimeout = MAXDWORD; +- } +- } +- +- if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } else { +- return PHP_STREAM_OPTION_RETURN_OK; +- } +- } else { +- return PHP_STREAM_OPTION_RETURN_ERR; +- } +- +- default: +- break; +- } +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_raw_open_stream +- * Opens the underlying stream. +- */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD err; +- +- switch(*mode) { +- case 'r': +- wdata->creation_disposition = OPEN_EXISTING; +- break; +- case 'w': +- wdata->creation_disposition = TRUNCATE_EXISTING; +- break; +- case 'a': +- wdata->creation_disposition = OPEN_ALWAYS; +- break; +- case 'x': +- wdata->creation_disposition = CREATE_NEW; +- break; +- } +- mode ++; +- +- if (*mode && (*mode != '+')) { +- mode++; +- } +- +- if (*mode && (*mode == '+')) { +- wdata->desired_access = GENERIC_READ | GENERIC_WRITE; +- } else if (OPEN_EXISTING == wdata->creation_disposition) { +- wdata->desired_access = GENERIC_READ; +- } else { +- wdata->desired_access = GENERIC_WRITE; +- } +- +- wdata->handle = CreateFile(filename, wdata->desired_access, 0, +- NULL, wdata->creation_disposition, FILE_ATTRIBUTE_NORMAL, NULL); +- if (INVALID_HANDLE_VALUE == wdata->handle) { +- err = GetLastError(); +- switch (err) { +- case ERROR_FILE_EXISTS: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); +- return 0; +- +- case ERROR_FILE_NOT_FOUND: +- /* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that +- * the file doesn't exist so now try to create it. */ +- if (TRUNCATE_EXISTING == wdata->creation_disposition) { +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!"); +- +- wdata->handle = CreateFile(filename, wdata->desired_access, 0, +- NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); +- if (INVALID_HANDLE_VALUE == wdata->handle) { +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); +- return 0; +- } +- } else { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!"); +- return 0; +- } +- break; +- +- default: +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); +- return 0; +- } +- } +- +- /* If canonical allocate the canonical buffer. */ +- if (data->canonical) { +- wdata->canon_data = emalloc(sizeof(php_dio_win32_canon_data)); +- memset(wdata->canon_data, 0, sizeof(php_dio_win32_canon_data)); +- wdata->canon_data->size = DIO_WIN32_CANON_BUF_SIZE; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_init +- * Initialises the serial port +- */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- DWORD rate_def, data_bits_def, stop_bits_def, parity_def; +- DCB dcb; +- +- if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate); +- return 0; +- } +- +- if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); +- return 0; +- } +- +- if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); +- return 0; +- } +- +- if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); +- return 0; +- } +- +- if (!GetCommState(wdata->handle, &(wdata->olddcb))) { +- dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC); +- return 0; +- } +- +- /* Init the DCB structure */ +- memset(&dcb, 0, sizeof(DCB)); +- dcb.DCBlength = sizeof(DCB); +- +- /* Set the communication parameters */ +- dcb.fBinary = 1; +- dcb.BaudRate = rate_def; +- dcb.ByteSize = (BYTE)data_bits_def; +- dcb.StopBits = (BYTE)stop_bits_def; +- dcb.Parity = (BYTE)parity_def; +- +- /* Set the control line parameters */ +- dcb.fDtrControl = DTR_CONTROL_DISABLE; +- dcb.fDsrSensitivity = FALSE; +- dcb.fOutxDsrFlow = FALSE; +- dcb.fTXContinueOnXoff = FALSE; +- dcb.fOutX = FALSE; +- dcb.fInX = FALSE; +- dcb.fErrorChar = FALSE; +- dcb.fNull = FALSE; +- dcb.fAbortOnError = FALSE; +- +- /* Hardware flow control */ +- if (data->flow_control) { +- dcb.fOutxCtsFlow = TRUE; +- dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; +- } else { +- dcb.fOutxCtsFlow = FALSE; +- dcb.fRtsControl = RTS_CONTROL_DISABLE; +- } +- +- if (!SetCommState(wdata->handle, &dcb)) { +- dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC); +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +- +-/* {{{ dio_serial_uninit +- * Restores the serial settings back to their original state. +- */ +-int dio_serial_uninit(php_dio_stream_data *data) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- +- if (!SetCommState(wdata->handle, &(wdata->olddcb))) { +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* {{{ dio_serial_flush +- * Purges the serial buffers of data. +- */ +-int dio_serial_purge(php_dio_stream_data *data) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- BOOL ret; +- +- /* Purge the canonical buffer if required */ +- if (data->canonical && ((wdata->desired_access & GENERIC_READ) == GENERIC_READ)) { +- wdata->canon_data->read_pos = 0; +- wdata->canon_data->write_pos = 0; +- } +- +- /* Purge the com port */ +- if ((wdata->desired_access & (GENERIC_READ|GENERIC_WRITE)) == (GENERIC_READ|GENERIC_WRITE)) { +- ret = PurgeComm(wdata->handle, PURGE_RXCLEAR|PURGE_TXCLEAR); +- } else if ((wdata->desired_access & GENERIC_WRITE) == GENERIC_WRITE) { +- ret = PurgeComm(wdata->handle, PURGE_TXCLEAR); +- } else if ((wdata->desired_access & GENERIC_READ) == GENERIC_READ) { +- ret = PurgeComm(wdata->handle, PURGE_RXCLEAR); +- } +- +- return ret; +-} +-/* }}} */ +- +-/* {{{ dio_serial_open_stream +- * Opens the underlying stream. +- */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { +- php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; +- COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; +- +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); +- +- if (*mode != 'r') { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!"); +- return 0; +- } +- +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { +- return 0; +- } +- +- if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) { +- dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC); +- CloseHandle(wdata->handle); +- return 0; +- } +- +- /* If we're not blocking but don't have a timeout +- set to return immediately */ +- if (!data->is_blocking && !data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- } +- +- /* If we have a timeout ignore the blocking and set +- the total time in which to read the data */ +- if (data->has_timeout) { +- cto.ReadIntervalTimeout = MAXDWORD; +- cto.ReadTotalTimeoutMultiplier = MAXDWORD; +- cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + +- (data->timeout_sec * 1000); +- } +- +- if (!SetCommTimeouts(wdata->handle, &cto)) { +- dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC); +- CloseHandle(wdata->handle); +- return 0; +- } +- +- if (!dio_serial_init(data TSRMLS_CC)) { +- CloseHandle(wdata->handle); +- return 0; +- } +- +- return 1; +-} +-/* }}} */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "php.h" ++#include "php_dio_common.h" ++ ++#ifndef ZEND_WIN32 ++#error ZEND_WIN32 not defined! ++#endif ++ ++/* {{{ dio_last_error_php_error ++ * Generates a PHP error message based upon the last Windows error. ++ */ ++static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { ++ LPVOID msgbuf; ++ DWORD msgbuflen; ++ char * errmsg; ++ DWORD err; ++ ++#ifdef UNICODE ++ DWORD errmsglen; ++#endif ++ ++ err = GetLastError(); ++ msgbuflen = FormatMessage( ++ FORMAT_MESSAGE_ALLOCATE_BUFFER| ++ FORMAT_MESSAGE_FROM_SYSTEM| ++ FORMAT_MESSAGE_IGNORE_INSERTS, ++ NULL, ++ err, ++ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), ++ (LPTSTR)&msgbuf, ++ 0, ++ NULL); ++ ++#ifdef UNICODE ++ ++ /* Get the length of the converted message */ ++ errmsglen = WideCharToMultibyte( ++ CP_ACP, ++ 0 ++ (LPCWSTR)msgbuf, ++ -1, ++ (LPSTR)errmsg, ++ 0, ++ NULL, ++ NULL); ++ ++ /* Allocate a buffer */ ++ errmsg = emalloc(errmsglen); ++ if (!errmsg) { ++ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!"); ++ LocalFree(msgbuf); ++ return; ++ } ++ ++ /* Convert the message */ ++ errmsglen = WideCharToMultibyte( ++ CP_ACP, ++ 0 ++ (LPCWSTR)msgbuf, ++ -1, ++ (LPSTR)errmsg, ++ errmsglen, ++ NULL, ++ NULL); ++ ++#else ++ errmsg = (char *)msgbuf; ++#endif ++ ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); ++ ++ LocalFree(msgbuf); ++#ifdef UNICODE ++ efree(errmsg); ++#endif ++} ++ ++/* {{{ dio_data_rate_to_define ++ * Converts a numeric data rate to a termios define ++ */ ++static int dio_data_rate_to_define(long rate, DWORD *def) { ++ switch (rate) { ++ case 75: ++ case 110: ++ case 134: ++ case 150: ++ case 300: ++ case 600: ++ case 1200: ++ case 1800: ++ case 2400: ++ case 4800: ++ case 7200: ++ case 9600: ++ case 14400: ++ case 19200: ++ case 38400: ++ case 57600: ++ case 115200: ++ case 56000: ++ case 128000: ++ case 256000: ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = (DWORD)rate; ++ return 1; ++} ++/* }}} */ ++ ++ ++/* {{{ dio_data_bits_to_define ++ * Converts a number of data bits to a termios define ++ */ ++static int dio_data_bits_to_define(int data_bits, DWORD *def) { ++ switch (data_bits) { ++ case 8: ++ case 7: ++ case 6: ++ case 5: ++ case 4: ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = (DWORD)data_bits; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_stop_bits_to_define ++ * Converts a number of stop bits to a termios define ++ */ ++static int dio_stop_bits_to_define(int stop_bits, DWORD *def) { ++ DWORD val; ++ ++ switch (stop_bits) { ++ case 1: ++ val = ONESTOPBIT; ++ break; ++ case 2: ++ val = TWOSTOPBITS; ++ break; ++ case 3: ++ val = ONE5STOPBITS; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_parity_to_define ++ * Converts a parity type to a termios define ++ */ ++static int dio_parity_to_define(int parity, DWORD *def) { ++ DWORD val; ++ ++ switch (parity) { ++ case 0: ++ val = NOPARITY; ++ break; ++ case 1: ++ val = ODDPARITY; ++ break; ++ case 2: ++ val = EVENPARITY; ++ break; ++ default: ++ return 0; ++ } ++ ++ *def = val; ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_create_stream_data ++ * Creates an initialised stream data structure. Free with efree(). ++ */ ++php_dio_stream_data * dio_create_stream_data(void) { ++ php_dio_win32_stream_data * data = emalloc(sizeof(php_dio_win32_stream_data)); ++ memset(data, 0, sizeof(php_dio_win32_stream_data)); ++ dio_init_stream_data(&(data->common)); ++ data->handle = INVALID_HANDLE_VALUE; ++ data->desired_access = 0; ++ data->creation_disposition = 0; ++ data->olddcb.DCBlength = sizeof(DCB); ++ ++ return (php_dio_stream_data *)data; ++} ++/* }}} */ ++ ++/* {{{ dio_common_write ++ * Writes count chars from the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD total = 0; ++ ++ if (WriteFile(wdata->handle, buf, (DWORD)count, &total, NULL)) { ++ return (size_t)total; ++ } ++ ++ return 0; ++} ++/* }}} */ ++ ++/* {{{ dio_buffer_read ++ * Reads any available chars from the canonical buffer. ++ */ ++static size_t dio_buffer_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { ++ php_dio_win32_canon_data *canon_data = wdata->canon_data; ++ size_t total = 0; ++ ++ /* Read always follows write. I.e. if read ptr > write ptr buffer has ++ wrapped and so we need to copy two blocks of data. */ ++ if (canon_data->read_pos > canon_data->write_pos) { ++ ++ /* Check we actually need to copy both blocks */ ++ if ((canon_data->size - canon_data->read_pos) > count) { ++ ++ /* No we don't. Just copy as much as we were asked for. */ ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ count); ++ /* Update the read pointer. */ ++ canon_data->read_pos += count; ++ ++ /* Return the amount read. */ ++ return count; ++ } else { ++ ++ /* We need to copy both blocks so copy data up to the end of ++ the buffer. */ ++ total = canon_data->size - canon_data->read_pos; ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ total); ++ canon_data->read_pos = 0; ++ count -= total; ++ ++ /* Now copy the data from the start of the buffer either up ++ count or the number of bytes in the buffer. */ ++ ++ if (canon_data->write_pos > count) { ++ memcpy((char*)buf, canon_data->buf, count); ++ canon_data->read_pos = count; ++ total += count; ++ ++ return total; ++ } else { ++ memcpy((char*)buf, canon_data->buf, canon_data->write_pos); ++ canon_data->read_pos = canon_data->write_pos; ++ total += canon_data->write_pos; ++ ++ return total; ++ } ++ } ++ ++ /* Else if write follows read. This is a simpler case. We just copy ++ either all the data buffered or count, which ever is smaller. */ ++ } else if (canon_data->write_pos > canon_data->read_pos) { ++ if ((canon_data->write_pos - canon_data->read_pos) > count) { ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ count); ++ canon_data->read_pos += count; ++ ++ return count; ++ } else { ++ total = canon_data->write_pos - canon_data->read_pos; ++ memcpy((char*)buf, ++ &(canon_data->buf[canon_data->read_pos]), ++ total); ++ canon_data->read_pos += total; ++ ++ return total; ++ } ++ } ++ ++ /* Else we need to read more data from the data port. */ ++ return 0; ++} ++ ++/* {{{ dio_com_read ++ * Read chars from the data port. ++ */ ++static size_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD err, total = 0; ++ ++ if (ReadFile(wdata->handle, (void*)buf, (DWORD)count, &total, NULL)) { ++ ++ if (total) { ++ return (size_t)total; ++ } ++ ++ data->end_of_file = 1; ++ } ++ ++ if (!data->end_of_file) { ++ err = GetLastError(); ++ ++ if (ERROR_HANDLE_EOF == err) { ++ data->end_of_file = 1; ++ } ++ } ++ ++ return 0; ++} ++ ++/* {{{ dio_canonical_read ++ * Reads chars from the input stream until the internal buffer is full or a new ++ * line is reached. ++ */ ++static size_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) { ++ php_dio_win32_canon_data *canon_data = wdata->canon_data; ++ size_t total = 0; ++ char ch; ++ ++ /* See if there's any buffered data and copy it. */ ++ total = dio_buffer_read(wdata, buf, count); ++ if (total) { ++ return total; ++ } ++ ++ /* Need to read more data from the data port. Buffer should be empty(er) ++ by now. */ ++ do { ++ /* Is the buffer full? */ ++ if (((canon_data->write_pos + 1) % canon_data->size) == ++ canon_data->read_pos) { ++ break; ++ } ++ ++ /* Read a byte from the input checking for EOF. */ ++ if (!dio_com_read((php_dio_stream_data*)wdata, &ch, 1)) { ++ break; ++ } ++ ++ /* Translate CR to newlines (same as ICRNL in POSIX) */ ++ ch = (ch != '\r') ? ch : '\n'; ++ ++ /* We read a character! So buffer it. */ ++ canon_data->buf[canon_data->write_pos++] = ch; ++ if (canon_data->write_pos >= canon_data->size) { ++ canon_data->write_pos = 0; ++ } ++ ++ /* End of line/input (^D)? */ ++ } while ((ch != '\n') && (ch != 0x04)); ++ ++ return dio_buffer_read(wdata, buf, count); ++} ++/* }}} */ ++ ++/* {{{ dio_common_read ++ * Reads count chars to the buffer to the stream described by the stream data. ++ */ ++size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) { ++ ++ /* You ask for no bytes you'll get none :-) */ ++ if (!count) { ++ return 0; ++ } ++ ++ if (data->canonical) { ++ return dio_canonical_read((php_dio_win32_stream_data*)data, buf, count); ++ } else { ++ return dio_com_read(data, buf, count); ++ } ++} ++/* }}} */ ++ ++/* {{{ php_dio_stream_data ++ * Closes the php_stream. ++ */ ++int dio_common_close(php_dio_stream_data *data) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ ++ if (data->canonical) { ++ efree(wdata->canon_data); ++ } ++ ++ if (!CloseHandle(wdata->handle)) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_common_set_option ++ * Sets/gets stream options ++ */ ++int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) { ++ COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; ++ int old_is_blocking = 0; ++ ++ /* Can't do timeouts or non blocking with raw windows streams :-( */ ++ if (DIO_STREAM_TYPE_SERIAL == data->stream_type) { ++ switch (option) { ++ case PHP_STREAM_OPTION_BLOCKING: ++ old_is_blocking = data->is_blocking; ++ data->is_blocking = value ? 1 : 0; ++ ++ /* Only change values if we need to change them. */ ++ if (data->is_blocking != old_is_blocking) { ++ /* If we're not blocking but don't have a timeout ++ set to return immediately */ ++ if (!data->is_blocking && !data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ } ++ ++ /* If we have a timeout ignore the blocking and set ++ the total time in which to read the data */ ++ if (data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ cto.ReadTotalTimeoutMultiplier = MAXDWORD; ++ cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + ++ (data->timeout_sec * 1000); ++ } ++ ++ if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } ++ } ++ return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; ++ ++ case PHP_STREAM_OPTION_READ_TIMEOUT: ++ if (ptrparam) { ++ /* struct timeval is supported with PHP_WIN32 defined. */ ++ struct timeval *tv = (struct timeval*)ptrparam; ++ ++ /* A timeout of zero seconds and zero microseconds disables ++ any existing timeout. */ ++ if (tv->tv_sec || tv->tv_usec) { ++ data->timeout_sec = tv->tv_sec; ++ data->timeout_usec = tv->tv_usec; ++ data->has_timeout = -1; ++ ++ cto.ReadIntervalTimeout = MAXDWORD; ++ cto.ReadTotalTimeoutMultiplier = MAXDWORD; ++ cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + ++ (data->timeout_sec * 1000); ++ } else { ++ data->timeout_sec = 0; ++ data->timeout_usec = 0; ++ data->has_timeout = 0; ++ data->timed_out = 0; ++ ++ /* If we're not blocking but don't have a timeout ++ set to return immediately */ ++ if (!data->is_blocking) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ } ++ } ++ ++ if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } else { ++ return PHP_STREAM_OPTION_RETURN_OK; ++ } ++ } else { ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ } ++ ++ default: ++ break; ++ } ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_raw_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD err; ++ ++ switch(*mode) { ++ case 'r': ++ wdata->creation_disposition = OPEN_EXISTING; ++ break; ++ case 'w': ++ wdata->creation_disposition = TRUNCATE_EXISTING; ++ break; ++ case 'a': ++ wdata->creation_disposition = OPEN_ALWAYS; ++ break; ++ case 'x': ++ wdata->creation_disposition = CREATE_NEW; ++ break; ++ } ++ mode ++; ++ ++ if (*mode && (*mode != '+')) { ++ mode++; ++ } ++ ++ if (*mode && (*mode == '+')) { ++ wdata->desired_access = GENERIC_READ | GENERIC_WRITE; ++ } else if (OPEN_EXISTING == wdata->creation_disposition) { ++ wdata->desired_access = GENERIC_READ; ++ } else { ++ wdata->desired_access = GENERIC_WRITE; ++ } ++ ++ wdata->handle = CreateFile(filename, wdata->desired_access, 0, ++ NULL, wdata->creation_disposition, FILE_ATTRIBUTE_NORMAL, NULL); ++ if (INVALID_HANDLE_VALUE == wdata->handle) { ++ err = GetLastError(); ++ switch (err) { ++ case ERROR_FILE_EXISTS: ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ return 0; ++ ++ case ERROR_FILE_NOT_FOUND: ++ /* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that ++ * the file doesn't exist so now try to create it. */ ++ if (TRUNCATE_EXISTING == wdata->creation_disposition) { ++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!"); ++ ++ wdata->handle = CreateFile(filename, wdata->desired_access, 0, ++ NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ++ if (INVALID_HANDLE_VALUE == wdata->handle) { ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ return 0; ++ } ++ } else { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!"); ++ return 0; ++ } ++ break; ++ ++ default: ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ return 0; ++ } ++ } ++ ++ /* If canonical allocate the canonical buffer. */ ++ if (data->canonical) { ++ wdata->canon_data = emalloc(sizeof(php_dio_win32_canon_data)); ++ memset(wdata->canon_data, 0, sizeof(php_dio_win32_canon_data)); ++ wdata->canon_data->size = DIO_WIN32_CANON_BUF_SIZE; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_init ++ * Initialises the serial port ++ */ ++static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ DWORD rate_def, data_bits_def, stop_bits_def, parity_def; ++ DCB dcb; ++ ++ if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate); ++ return 0; ++ } ++ ++ if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ return 0; ++ } ++ ++ if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ return 0; ++ } ++ ++ if (!dio_parity_to_define(data->parity, &parity_def)) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ return 0; ++ } ++ ++ if (!GetCommState(wdata->handle, &(wdata->olddcb))) { ++ dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC); ++ return 0; ++ } ++ ++ /* Init the DCB structure */ ++ memset(&dcb, 0, sizeof(DCB)); ++ dcb.DCBlength = sizeof(DCB); ++ ++ /* Set the communication parameters */ ++ dcb.fBinary = 1; ++ dcb.BaudRate = rate_def; ++ dcb.ByteSize = (BYTE)data_bits_def; ++ dcb.StopBits = (BYTE)stop_bits_def; ++ dcb.Parity = (BYTE)parity_def; ++ ++ /* Set the control line parameters */ ++ dcb.fDtrControl = DTR_CONTROL_DISABLE; ++ dcb.fDsrSensitivity = FALSE; ++ dcb.fOutxDsrFlow = FALSE; ++ dcb.fTXContinueOnXoff = FALSE; ++ dcb.fOutX = FALSE; ++ dcb.fInX = FALSE; ++ dcb.fErrorChar = FALSE; ++ dcb.fNull = FALSE; ++ dcb.fAbortOnError = FALSE; ++ ++ /* Hardware flow control */ ++ if (data->flow_control) { ++ dcb.fOutxCtsFlow = TRUE; ++ dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; ++ } else { ++ dcb.fOutxCtsFlow = FALSE; ++ dcb.fRtsControl = RTS_CONTROL_DISABLE; ++ } ++ ++ if (!SetCommState(wdata->handle, &dcb)) { ++ dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC); ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++ ++/* {{{ dio_serial_uninit ++ * Restores the serial settings back to their original state. ++ */ ++int dio_serial_uninit(php_dio_stream_data *data) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ ++ if (!SetCommState(wdata->handle, &(wdata->olddcb))) { ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_flush ++ * Purges the serial buffers of data. ++ */ ++int dio_serial_purge(php_dio_stream_data *data) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ BOOL ret; ++ ++ /* Purge the canonical buffer if required */ ++ if (data->canonical && ((wdata->desired_access & GENERIC_READ) == GENERIC_READ)) { ++ wdata->canon_data->read_pos = 0; ++ wdata->canon_data->write_pos = 0; ++ } ++ ++ /* Purge the com port */ ++ if ((wdata->desired_access & (GENERIC_READ|GENERIC_WRITE)) == (GENERIC_READ|GENERIC_WRITE)) { ++ ret = PurgeComm(wdata->handle, PURGE_RXCLEAR|PURGE_TXCLEAR); ++ } else if ((wdata->desired_access & GENERIC_WRITE) == GENERIC_WRITE) { ++ ret = PurgeComm(wdata->handle, PURGE_TXCLEAR); ++ } else if ((wdata->desired_access & GENERIC_READ) == GENERIC_READ) { ++ ret = PurgeComm(wdata->handle, PURGE_RXCLEAR); ++ } ++ ++ return ret; ++} ++/* }}} */ ++ ++/* {{{ dio_serial_open_stream ++ * Opens the underlying stream. ++ */ ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++ php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; ++ COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; ++ ++ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); ++ ++ if (*mode != 'r') { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!"); ++ return 0; ++ } ++ ++ if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ return 0; ++ } ++ ++ if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) { ++ dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC); ++ CloseHandle(wdata->handle); ++ return 0; ++ } ++ ++ /* If we're not blocking but don't have a timeout ++ set to return immediately */ ++ if (!data->is_blocking && !data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ } ++ ++ /* If we have a timeout ignore the blocking and set ++ the total time in which to read the data */ ++ if (data->has_timeout) { ++ cto.ReadIntervalTimeout = MAXDWORD; ++ cto.ReadTotalTimeoutMultiplier = MAXDWORD; ++ cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + ++ (data->timeout_sec * 1000); ++ } ++ ++ if (!SetCommTimeouts(wdata->handle, &cto)) { ++ dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC); ++ CloseHandle(wdata->handle); ++ return 0; ++ } ++ ++ if (!dio_serial_init(data TSRMLS_CC)) { ++ CloseHandle(wdata->handle); ++ return 0; ++ } ++ ++ return 1; ++} ++/* }}} */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ +--- a/php_dio_posix.h ++++ b/php_dio_posix.h +@@ -1,70 +1,70 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifndef PHP_DIO_POSIX_H_ +-#define PHP_DIO_POSIX_H_ +- +-#include +-#include +-#include +-#include +- +-#ifdef HAVE_UNISTD_H +-#include +-#endif +- +-#include +-#include +- +- +-/** ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifndef PHP_DIO_POSIX_H_ ++#define PHP_DIO_POSIX_H_ ++ ++#include ++#include ++#include ++#include ++ ++#ifdef HAVE_UNISTD_H ++#include ++#endif ++ ++#include ++#include ++ ++ ++/** + * Detect if we can support non blocking IO. +- */ +-#ifdef O_NONBLOCK +-#define DIO_NONBLOCK O_NONBLOCK +-#else +-#ifdef O_NDELAY +-#define DIO_NONBLOCK O_NDELAY +-#endif +-#endif +- +-/** ++ */ ++#ifdef O_NONBLOCK ++#define DIO_NONBLOCK O_NONBLOCK ++#else ++#ifdef O_NDELAY ++#define DIO_NONBLOCK O_NDELAY ++#endif ++#endif ++ ++/** + * POSIXy platforms have file permissions +- */ +-#define DIO_HAS_FILEPERMS +- +-#include "php_dio_common_data.h" +- +-typedef struct _php_dio_posix_stream_data { +- php_dio_stream_data common; +- int fd; +- int flags; +- /* Serial options */ +- struct termios oldtio; +-} php_dio_posix_stream_data ; +- +-#endif /* PHP_DIO_POSIX_H_ */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++ */ ++#define DIO_HAS_FILEPERMS ++ ++#include "php_dio_common_data.h" ++ ++typedef struct _php_dio_posix_stream_data { ++ php_dio_stream_data common; ++ int fd; ++ int flags; ++ /* Serial options */ ++ struct termios oldtio; ++} php_dio_posix_stream_data ; ++ ++#endif /* PHP_DIO_POSIX_H_ */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ +--- a/php_dio_win32.h ++++ b/php_dio_win32.h +@@ -1,62 +1,62 @@ +-/* +- +----------------------------------------------------------------------+ +- | PHP Version 5 | +- +----------------------------------------------------------------------+ +- | Copyright (c) 2009 Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- | This source file is subject to version 3.0 of the PHP license, | +- | that is bundled with this package in the file LICENSE, and is | +- | available through the world-wide-web at the following url: | +- | http://www.php.net/license/3_0.txt. | +- | If you did not receive a copy of the PHP license and are unable to | +- | obtain it through the world-wide-web, please send a note to | +- | license@php.net so we can mail you a copy immediately. | +- +----------------------------------------------------------------------+ +- | Author: Melanie Rhianna Lewis | +- +----------------------------------------------------------------------+ +- */ +- +-#ifndef PHP_DIO_WIN32_H_ +-#define PHP_DIO_WIN32_H_ +- +-#include +- +-/* Windows platform can do non blocking. */ +-#define DIO_NONBLOCK +- +-#include "php_dio_common_data.h" +- +-#define DIO_WIN32_CANON_BUF_SIZE 8192 +- +-/* This is the buffer information when reading in canonical mode. Data is +- read right up to either buffer being full or a newline being read. Excess +- data will be retained in the buffer until the next read. */ +-typedef struct _php_dio_win32_canon_data { +- size_t size; +- size_t read_pos; +- size_t write_pos; +- char buf[DIO_WIN32_CANON_BUF_SIZE]; +- +-} php_dio_win32_canon_data; +- +-typedef struct _php_dio_win32_stream_data { +- php_dio_stream_data common; +- HANDLE handle; +- DWORD desired_access; +- DWORD creation_disposition; +- DCB olddcb; +- COMMTIMEOUTS oldcto; +- php_dio_win32_canon_data *canon_data; +- +-} php_dio_win32_stream_data ; +- +-#endif /* PHP_DIO_WIN32_H_ */ +- +-/* +- * Local variables: +- * c-basic-offset: 4 +- * tab-width: 4 +- * End: +- * vim600: fdm=marker +- * vim: sw=4 ts=4 noet +- */ ++/* ++ +----------------------------------------------------------------------+ ++ | PHP Version 5 | ++ +----------------------------------------------------------------------+ ++ | Copyright (c) 2009 Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ | This source file is subject to version 3.0 of the PHP license, | ++ | that is bundled with this package in the file LICENSE, and is | ++ | available through the world-wide-web at the following url: | ++ | http://www.php.net/license/3_0.txt. | ++ | If you did not receive a copy of the PHP license and are unable to | ++ | obtain it through the world-wide-web, please send a note to | ++ | license@php.net so we can mail you a copy immediately. | ++ +----------------------------------------------------------------------+ ++ | Author: Melanie Rhianna Lewis | ++ +----------------------------------------------------------------------+ ++ */ ++ ++#ifndef PHP_DIO_WIN32_H_ ++#define PHP_DIO_WIN32_H_ ++ ++#include ++ ++/* Windows platform can do non blocking. */ ++#define DIO_NONBLOCK ++ ++#include "php_dio_common_data.h" ++ ++#define DIO_WIN32_CANON_BUF_SIZE 8192 ++ ++/* This is the buffer information when reading in canonical mode. Data is ++ read right up to either buffer being full or a newline being read. Excess ++ data will be retained in the buffer until the next read. */ ++typedef struct _php_dio_win32_canon_data { ++ size_t size; ++ size_t read_pos; ++ size_t write_pos; ++ char buf[DIO_WIN32_CANON_BUF_SIZE]; ++ ++} php_dio_win32_canon_data; ++ ++typedef struct _php_dio_win32_stream_data { ++ php_dio_stream_data common; ++ HANDLE handle; ++ DWORD desired_access; ++ DWORD creation_disposition; ++ DCB olddcb; ++ COMMTIMEOUTS oldcto; ++ php_dio_win32_canon_data *canon_data; ++ ++} php_dio_win32_stream_data ; ++ ++#endif /* PHP_DIO_WIN32_H_ */ ++ ++/* ++ * Local variables: ++ * c-basic-offset: 4 ++ * tab-width: 4 ++ * End: ++ * vim600: fdm=marker ++ * vim: sw=4 ts=4 noet ++ */ diff --git a/lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch b/lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch new file mode 100644 index 0000000..e8a56fb --- /dev/null +++ b/lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch @@ -0,0 +1,32 @@ +From 46d3a1ff2c6e316cf0928a9fd403cb5284bfe863 Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:04:16 +0000 +Subject: [PATCH 01/16] fix svn prop + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331748 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio_posix.c | 0 + dio_win32.c | 0 + php_dio_posix.h | 0 + php_dio_win32.h | 0 + 4 files changed, 0 insertions(+), 0 deletions(-) + mode change 100755 => 100644 dio_posix.c + mode change 100755 => 100644 dio_win32.c + mode change 100755 => 100644 php_dio_posix.h + mode change 100755 => 100644 php_dio_win32.h + +diff --git a/dio_posix.c b/dio_posix.c +old mode 100755 +new mode 100644 +diff --git a/dio_win32.c b/dio_win32.c +old mode 100755 +new mode 100644 +diff --git a/php_dio_posix.h b/php_dio_posix.h +old mode 100755 +new mode 100644 +diff --git a/php_dio_win32.h b/php_dio_win32.h +old mode 100755 +new mode 100644 +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch b/lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch new file mode 100644 index 0000000..6624174 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch @@ -0,0 +1,39 @@ +From e9261081d447492e7eff3a22601b1de4f1ae550f Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:15:51 +0000 +Subject: [PATCH 02/16] fix [-Wunused-variable] + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331749 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio.c | 2 +- + dio_posix.c | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/dio.c b/dio.c +index e400cf0..408a171 100644 +--- a/dio.c ++++ b/dio.c +@@ -775,7 +775,7 @@ ZEND_BEGIN_ARG_INFO_EX(dio_serial_args, 0, 0, 2) + ZEND_ARG_INFO(0, options) + ZEND_END_ARG_INFO() + +-static zend_object_handlers dio_raw_object_handlers; ++// not used static zend_object_handlers dio_raw_object_handlers; + + static zend_function_entry dio_functions[] = { + /* Class functions. */ +diff --git a/dio_posix.c b/dio_posix.c +index 16fb3d6..01e1109 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -266,7 +266,6 @@ size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count + * earlier than early time. + */ + static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) { +- struct timeval *tmp; + + /* Handle negatives */ + if (late->tv_sec < early->tv_sec) { +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch b/lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch new file mode 100644 index 0000000..21f4cff --- /dev/null +++ b/lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch @@ -0,0 +1,39 @@ +From 6cbc1651b6b6f865f9aae1e9adff73743298666f Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:18:34 +0000 +Subject: [PATCH 03/16] Fix [-Wmaybe-uninitialized] + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331750 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio_stream_wrappers.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index 844b006..811bc07 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -228,9 +228,8 @@ PHP_FUNCTION(dio_raw) { + efree(data); + RETURN_FALSE; + } ++ php_stream_to_zval(stream, return_value); + } +- +- php_stream_to_zval(stream, return_value); + } + /* }}} */ + +@@ -390,9 +389,8 @@ PHP_FUNCTION(dio_serial) { + efree(data); + RETURN_FALSE; + } ++ php_stream_to_zval(stream, return_value); + } +- +- php_stream_to_zval(stream, return_value); + } + /* }}} */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch b/lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch new file mode 100644 index 0000000..ba69d22 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch @@ -0,0 +1,42 @@ +From 1e6f98d9fb65b9c052e6d555eab573d7e5073dae Mon Sep 17 00:00:00 2001 +From: remi +Date: Wed, 9 Oct 2013 12:24:28 +0000 +Subject: [PATCH 04/16] Fix last build warning [-Wunused-but-set-variable] + (sorry for legibility...) + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331751 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + dio_posix.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/dio_posix.c b/dio_posix.c +index 01e1109..6ed8630 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -28,7 +28,10 @@ + * Convert an fopen() mode string to open() flags + */ + static int dio_stream_mode_to_flags(const char *mode) { +- int flags = 0, ch = 0, bin = 1; ++ int flags = 0, ch = 0; ++#if defined(_O_TEXT) && defined(O_BINARY) ++ int bin = 1; ++#endif + + switch(mode[ch++]) { + case 'r': +@@ -45,9 +48,11 @@ static int dio_stream_mode_to_flags(const char *mode) { + break; + } + ++#if defined(_O_TEXT) && defined(O_BINARY) + if (mode[ch] != '+') { + bin = (mode[ch++] == 'b'); + } ++#endif + + if (mode[ch] == '+') { + flags |= O_RDWR; +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch b/lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch new file mode 100644 index 0000000..fc9961a --- /dev/null +++ b/lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch @@ -0,0 +1,91 @@ +From 7c85a44880d9d748e7554f8fe7448505fa86aa28 Mon Sep 17 00:00:00 2001 +From: cyberspice +Date: Sat, 12 Oct 2013 22:20:19 +0000 +Subject: [PATCH 05/16] Added LICENCE file as requested in Request #65869 + +Files added: + LICENCE + +git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331788 c90b9560-bf6c-de11-be94-00142212c4b1 +--- + LICENSE | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 68 insertions(+) + create mode 100644 LICENSE + +diff --git a/LICENSE b/LICENSE +new file mode 100644 +index 0000000..d376afe +--- /dev/null ++++ b/LICENSE +@@ -0,0 +1,68 @@ ++-------------------------------------------------------------------- ++ The PHP License, version 3.01 ++Copyright (c) 2008 - 2013 The PHP Group. All rights reserved. ++-------------------------------------------------------------------- ++ ++Redistribution and use in source and binary forms, with or without ++modification, is permitted provided that the following conditions ++are met: ++ ++ 1. Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ ++ 2. Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in ++ the documentation and/or other materials provided with the ++ distribution. ++ ++ 3. The name "PHP" must not be used to endorse or promote products ++ derived from this software without prior written permission. For ++ written permission, please contact group@php.net. ++ ++ 4. Products derived from this software may not be called "PHP", nor ++ may "PHP" appear in their name, without prior written permission ++ from group@php.net. You may indicate that your software works in ++ conjunction with PHP by saying "Foo for PHP" instead of calling ++ it "PHP Foo" or "phpfoo" ++ ++ 5. The PHP Group may publish revised and/or new versions of the ++ license from time to time. Each version will be given a ++ distinguishing version number. ++ Once covered code has been published under a particular version ++ of the license, you may always continue to use it under the terms ++ of that version. You may also choose to use such covered code ++ under the terms of any subsequent version of the license ++ published by the PHP Group. No one other than the PHP Group has ++ the right to modify the terms applicable to covered code created ++ under this License. ++ ++ 6. Redistributions of any form whatsoever must retain the following ++ acknowledgment: ++ "This product includes PHP software, freely available from ++ ". ++ ++THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ++ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP ++DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, ++INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED ++OF THE POSSIBILITY OF SUCH DAMAGE. ++ ++-------------------------------------------------------------------- ++ ++This software consists of voluntary contributions made by many ++individuals on behalf of the PHP Group. ++ ++The PHP Group can be contacted via Email at group@php.net. ++ ++For more information on the PHP Group and the PHP project, ++please see . ++ ++PHP includes the Zend Engine, freely available at ++. +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch b/lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch new file mode 100644 index 0000000..6d9c483 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch @@ -0,0 +1,117 @@ +From b69e1067f70ef293587b72979193e68b01d90902 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 00:23:29 +0200 +Subject: [PATCH 06/16] Replace ZEND_FETCH_RESOURCE macro with + zend_fetch_resource + +Signed-off-by: Michael Heimpold +--- + dio.c | 36 +++++++++++++++++++++++++++--------- + 1 file changed, 27 insertions(+), 9 deletions(-) + +diff --git a/dio.c b/dio.c +index 408a171..6b687ac 100644 +--- a/dio.c ++++ b/dio.c +@@ -161,7 +161,9 @@ PHP_FUNCTION(dio_dup) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + dfd = dup(f->fd); + if (dfd == -1) { +@@ -192,7 +194,9 @@ PHP_FUNCTION(dio_read) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (bytes <= 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0."); +@@ -233,7 +237,9 @@ PHP_FUNCTION(dio_write) + RETURN_FALSE; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + res = write(f->fd, data, trunc_len ? trunc_len : data_len); + if (res == -1) { +@@ -258,7 +264,9 @@ PHP_FUNCTION(dio_truncate) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (ftruncate(f->fd, offset) == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno)); +@@ -284,7 +292,9 @@ PHP_FUNCTION(dio_stat) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (fstat(f->fd, &s) == -1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno)); +@@ -323,7 +333,9 @@ PHP_FUNCTION(dio_seek) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + RETURN_LONG(lseek(f->fd, offset, whence)); + } +@@ -344,7 +356,9 @@ PHP_FUNCTION(dio_fcntl) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + switch (cmd) { + case F_SETLK: +@@ -454,7 +468,9 @@ PHP_FUNCTION(dio_tcsetattr) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + if (Z_TYPE_P(arg) != IS_ARRAY) { + php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array"); +@@ -639,7 +655,9 @@ PHP_FUNCTION(dio_close) + return; + } + +- ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd); ++ if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) { ++ RETURN_FALSE; ++ } + + zend_list_delete(Z_LVAL_P(r_fd)); + } +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch b/lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch new file mode 100644 index 0000000..c676a25 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch @@ -0,0 +1,66 @@ +From dbf03eb09bf1a41bcd140c4edba351121ac24729 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 00:36:46 +0200 +Subject: [PATCH 07/16] Replace ZEND_REGISTER_RESOURCE with + zend_register_resource + +Signed-off-by: Michael Heimpold +--- + dio.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/dio.c b/dio.c +index 6b687ac..6f2d58c 100644 +--- a/dio.c ++++ b/dio.c +@@ -72,9 +72,9 @@ static int new_php_fd(php_fd_t **f, int fd) + return 1; + } + +-static void _dio_close_fd(zend_rsrc_list_entry *rsrc TSRMLS_DC) ++static void _dio_close_fd(zend_resource *res) + { +- php_fd_t *f = (php_fd_t *) rsrc->ptr; ++ php_fd_t *f = (php_fd_t *)zend_fetch_resource(res, NULL, le_fd); + if (f) { + close(f->fd); + free(f); +@@ -115,7 +115,7 @@ PHP_FUNCTION(dio_open) + RETURN_FALSE; + } + +- ZEND_REGISTER_RESOURCE(return_value, f, le_fd); ++ RETVAL_RES(zend_register_resource(f, le_fd)); + } + /* }}} */ + +@@ -144,7 +144,7 @@ PHP_FUNCTION(dio_fdopen) + RETURN_FALSE; + } + +- ZEND_REGISTER_RESOURCE(return_value, f, le_fd); ++ RETVAL_RES(zend_register_resource(f, le_fd)); + } + /* }}} */ + +@@ -175,7 +175,7 @@ PHP_FUNCTION(dio_dup) + RETURN_FALSE; + } + +- ZEND_REGISTER_RESOURCE(return_value, df, le_fd); ++ RETVAL_RES(zend_register_resource(f, le_fd)); + } + /* }}} */ + #endif +@@ -434,7 +434,7 @@ PHP_FUNCTION(dio_fcntl) + if (!new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)))) { + RETURN_FALSE; + } +- ZEND_REGISTER_RESOURCE(return_value, new_f, le_fd); ++ RETVAL_RES(zend_register_resource(new_f, le_fd)); + break; + } + default: +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch b/lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch new file mode 100644 index 0000000..2197d12 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch @@ -0,0 +1,34 @@ +From 47422cf01f0a352c3f5f015585a28c99dba79862 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 00:40:08 +0200 +Subject: [PATCH 08/16] RETURN_STRINGL takes only 2 arguments + +Signed-off-by: Michael Heimpold +--- + dio.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dio.c b/dio.c +index 6f2d58c..e8660f8 100644 +--- a/dio.c ++++ b/dio.c +@@ -24,6 +24,7 @@ + #include "php.h" + #include "php_ini.h" + #include "ext/standard/info.h" ++#include "ext/standard/php_string.h" + + #include "php_dio.h" + #include "php_dio_stream_wrappers.h" +@@ -213,7 +214,7 @@ PHP_FUNCTION(dio_read) + data = erealloc(data, res + 1); + data[res] = 0; + +- RETURN_STRINGL(data, res, 0); ++ RETURN_STRINGL(data, res); + } + /* }}} */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch b/lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch new file mode 100644 index 0000000..85a8a07 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch @@ -0,0 +1,125 @@ +From 7533f64b19006262fae7c6a4769392c67078166b Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Wed, 13 Jul 2016 01:07:22 +0200 +Subject: [PATCH 09/16] Replace zend_hash_find with zend_hash_str_find + +Signed-off-by: Michael Heimpold +--- + dio.c | 44 ++++++++++++++++++++++---------------------- + 1 file changed, 22 insertions(+), 22 deletions(-) + +diff --git a/dio.c b/dio.c +index e8660f8..b489747 100644 +--- a/dio.c ++++ b/dio.c +@@ -364,7 +364,7 @@ PHP_FUNCTION(dio_fcntl) + switch (cmd) { + case F_SETLK: + case F_SETLKW: { +- zval **element; ++ zval *element; + struct flock lk = {0}; + HashTable *fh; + +@@ -374,28 +374,28 @@ PHP_FUNCTION(dio_fcntl) + } + if (Z_TYPE_P(arg) == IS_ARRAY) { + fh = HASH_OF(arg); +- if (zend_hash_find(fh, "start", sizeof("start"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "start", sizeof("start"))) == NULL) { + lk.l_start = 0; + } else { +- lk.l_start = Z_LVAL_PP(element); ++ lk.l_start = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "length", sizeof("length"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "length", sizeof("length"))) == NULL) { + lk.l_len = 0; + } else { +- lk.l_len = Z_LVAL_PP(element); ++ lk.l_len = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "whence", sizeof("whence"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "whence", sizeof("whence"))) == NULL) { + lk.l_whence = 0; + } else { +- lk.l_whence = Z_LVAL_PP(element); ++ lk.l_whence = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "type", sizeof("type"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "type", sizeof("type"))) == NULL) { + lk.l_type = 0; + } else { +- lk.l_type = Z_LVAL_PP(element); ++ lk.l_type = Z_LVAL_P(element); + } + } else if (Z_TYPE_P(arg) == IS_LONG) { + lk.l_start = 0; +@@ -463,7 +463,7 @@ PHP_FUNCTION(dio_tcsetattr) + int Baud_Rate, Data_Bits=8, Stop_Bits=1, Parity=0, Flow_Control=1, Is_Canonical=1; + long BAUD,DATABITS,STOPBITS,PARITYON,PARITY; + HashTable *fh; +- zval **element; ++ zval *element; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) { + return; +@@ -480,40 +480,40 @@ PHP_FUNCTION(dio_tcsetattr) + + fh = HASH_OF(arg); + +- if (zend_hash_find(fh, "baud", sizeof("baud"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "baud", sizeof("baud"))) == NULL) { + Baud_Rate = 9600; + } else { +- Baud_Rate = Z_LVAL_PP(element); ++ Baud_Rate = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "bits", sizeof("bits"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "bits", sizeof("bits"))) == NULL) { + Data_Bits = 8; + } else { +- Data_Bits = Z_LVAL_PP(element); ++ Data_Bits = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "stop", sizeof("stop"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "stop", sizeof("stop"))) == NULL) { + Stop_Bits = 1; + } else { +- Stop_Bits = Z_LVAL_PP(element); ++ Stop_Bits = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "parity", sizeof("parity"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "parity", sizeof("parity"))) == NULL) { + Parity = 0; + } else { +- Parity = Z_LVAL_PP(element); ++ Parity = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "flow_control", sizeof("flow_control"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "flow_control", sizeof("flow_control"))) == NULL) { + Flow_Control = 1; + } else { +- Flow_Control = Z_LVAL_PP(element); ++ Flow_Control = Z_LVAL_P(element); + } + +- if (zend_hash_find(fh, "is_canonical", sizeof("is_canonical"), (void **) &element) == FAILURE) { ++ if ((element = zend_hash_str_find(fh, "is_canonical", sizeof("is_canonical"))) == NULL) { + Is_Canonical = 0; + } else { +- Is_Canonical = Z_LVAL_PP(element); ++ Is_Canonical = Z_LVAL_P(element); + } + + /* assign to correct values... */ +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch b/lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch new file mode 100644 index 0000000..b5d7b61 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch @@ -0,0 +1,240 @@ +From fb31b1cf4da2bfd0830d0a83754f5ecb125d1c4a Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 00:38:52 +0200 +Subject: [PATCH 10/16] Replace dio_convert_to_long + +Signed-off-by: Michael Heimpold +--- + dio_common.c | 106 +++++++++++++++++++++++-------------------------------- + php_dio_common.h | 2 -- + 2 files changed, 44 insertions(+), 64 deletions(-) + +diff --git a/dio_common.c b/dio_common.c +index c50f56d..a5f4c63 100644 +--- a/dio_common.c ++++ b/dio_common.c +@@ -52,29 +52,12 @@ void dio_init_stream_data(php_dio_stream_data *data) { + } + /* }}} */ + +-/* {{{ dio_convert_to_long +- * Returns as a long, the value of the zval regardless of its type. +- */ +-long dio_convert_to_long(zval *val) { +- zval *copyval; +- long longval; +- +- ALLOC_INIT_ZVAL(copyval); +- *copyval = *val; +- convert_to_long(copyval); +- longval = Z_LVAL_P(copyval); +- zval_ptr_dtor(©val); +- +- return longval; +-} +-/* }}} */ +- + /* {{{ dio_assoc_array_get_basic_options + * Retrieves the basic open option values from an associative array + */ + void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) +- zval **tmpzval; ++ zval *tmpzval; + HashTable *opthash; + + opthash = HASH_OF(options); +@@ -82,8 +65,8 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + + #ifdef DIO_HAS_FILEPERMS + /* This is the file mode flags used by open(). */ +- if (zend_hash_find(opthash, "perms", sizeof("perms"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->perms = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "perms", sizeof("perms"))) != NULL) { ++ data->perms = (int)zval_get_long(tmpzval); + data->has_perms = 1; + } + #endif +@@ -91,20 +74,20 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + #ifdef DIO_NONBLOCK + /* This sets the underlying stream to be blocking/non + block (i.e. O_NONBLOCK) */ +- if (zend_hash_find(opthash, "is_blocking", sizeof("is_blocking"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->is_blocking = dio_convert_to_long(*tmpzval) ? 1 : 0; ++ if ((tmpzval = zend_hash_str_find(opthash, "is_blocking", sizeof("is_blocking"))) != NULL) { ++ data->is_blocking = zval_get_long(tmpzval) ? 1 : 0; + } + + /* This is the timeout value for reads in seconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (zend_hash_find(opthash, "timeout_secs", sizeof("timeout_secs"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_sec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "timeout_secs", sizeof("timeout_secs"))) != NULL) { ++ data->timeout_sec = zval_get_long(tmpzval); + } + + /* This is the timeout value for reads in microseconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (zend_hash_find(opthash, "timeout_usecs", sizeof("timeout_usecs"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_usec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "timeout_usecs", sizeof("timeout_usecs"))) != NULL) { ++ data->timeout_usec = zval_get_long(tmpzval); + } + + data->has_timeout = (data->timeout_sec | data->timeout_usec) ? 1 : 0; +@@ -116,33 +99,33 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + * Retrieves the serial open option values from an associative array + */ + void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { +- zval **tmpzval; ++ zval *tmpzval; + HashTable *opthash; + + opthash = HASH_OF(options); + +- if (zend_hash_find(opthash, "data_rate", sizeof("data_rate"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_rate = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "data_rate", sizeof("data_rate"))) != NULL) { ++ data->data_rate = zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "data_bits", sizeof("data_bits"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "data_bits", sizeof("data_bits"))) != NULL) { ++ data->data_bits = (int)zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "stop_bits", sizeof("stop_bits"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->stop_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "stop_bits", sizeof("stop_bits"))) != NULL) { ++ data->stop_bits = (int)zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "parity", sizeof("parity"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->parity = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = zend_hash_str_find(opthash, "parity", sizeof("parity"))) != NULL) { ++ data->parity = (int)zval_get_long(tmpzval); + } + +- if (zend_hash_find(opthash, "flow_control", sizeof("flow_control"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->flow_control = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = zend_hash_str_find(opthash, "flow_control", sizeof("flow_control"))) != NULL) { ++ data->flow_control = zval_get_long(tmpzval) ? 1 : 0; + } + +- if (zend_hash_find(opthash, "is_canonical", sizeof("is_canonical"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->canonical = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = zend_hash_str_find(opthash, "is_canonical", sizeof("is_canonical"))) != NULL) { ++ data->canonical = zval_get_long(tmpzval) ? 1 : 0; + } + } + /* }}} */ +@@ -152,13 +135,13 @@ void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data + */ + void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) +- zval **tmpzval; ++ zval *tmpzval; + #endif + + #ifdef DIO_HAS_FILEPERMS + /* This is the file mode flags used by open(). */ +- if (php_stream_context_get_option(context, "dio", "perms", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->perms = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "perms")) != NULL) { ++ data->perms = (int)zval_get_long(tmpzval); + data->has_perms = 1; + } + #endif +@@ -166,20 +149,20 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s + #ifdef DIO_NONBLOCK + /* This sets the underlying stream to be blocking/non + block (i.e. O_NONBLOCK) */ +- if (php_stream_context_get_option(context, "dio", "is_blocking", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->is_blocking = dio_convert_to_long(*tmpzval) ? 1 : 0; ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "is_blocking")) != NULL) { ++ data->is_blocking = zval_get_long(tmpzval) ? 1 : 0; + } + + /* This is the timeout value for reads in seconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (php_stream_context_get_option(context, "dio", "timeout_secs", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_sec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "timeout_secs")) != NULL) { ++ data->timeout_sec = zval_get_long(tmpzval); + } + + /* This is the timeout value for reads in microseconds. Only one of + timeout_secs or timeout_usecs need be defined to define a timeout. */ +- if (php_stream_context_get_option(context, "dio", "timeout_usecs", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->timeout_usec = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "timeout_usecs")) != NULL) { ++ data->timeout_usec = zval_get_long(tmpzval); + } + + data->has_timeout = (data->timeout_sec | data->timeout_usec) ? 1 : 0; +@@ -191,30 +174,30 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s + * Extracts the option values for dio.serial mode from a context + */ + void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { +- zval **tmpzval; ++ zval *tmpzval; + +- if (php_stream_context_get_option(context, "dio", "data_rate", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_rate = dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "data_rate")) != NULL) { ++ data->data_rate = zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "data_bits", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->data_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "data_bits")) != NULL) { ++ data->data_bits = (int)zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "stop_bits", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->stop_bits = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "stop_bits")) != NULL) { ++ data->stop_bits = (int)zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "parity", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->parity = (int)dio_convert_to_long(*tmpzval); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "parity")) != NULL) { ++ data->parity = (int)zval_get_long(tmpzval); + } + +- if (php_stream_context_get_option(context, "dio", "flow_control", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->flow_control = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "flow_control")) != NULL) { ++ data->flow_control = zval_get_long(tmpzval) ? 1 : 0; + } + +- if (php_stream_context_get_option(context, "dio", "is_canonical", &tmpzval) == SUCCESS && tmpzval && *tmpzval) { +- data->canonical = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0); ++ if ((tmpzval = php_stream_context_get_option(context, "dio", "is_canonical")) != NULL) { ++ data->canonical = zval_get_long(tmpzval) ? 1 : 0; + } + } + /* }}} */ +@@ -227,4 +210,3 @@ void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_ + * vim600: fdm=marker + * vim: sw=4 ts=4 noet + */ +- +diff --git a/php_dio_common.h b/php_dio_common.h +index f6e4d98..6b14040 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -35,8 +35,6 @@ + #define DIO_STREAM_TYPE_RAW 1 + #define DIO_STREAM_TYPE_SERIAL 2 + +-long dio_convert_to_long(zval *val); +- + php_dio_stream_data * dio_create_stream_data(void); + + void dio_init_stream_data(php_dio_stream_data *data); +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch b/lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch new file mode 100644 index 0000000..dde8565 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch @@ -0,0 +1,89 @@ +From 3d71063ada4f1a4ef90611d263aa8e1d4f275359 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 00:50:12 +0200 +Subject: [PATCH 11/16] Adopt to changed stream API interface + +Signed-off-by: Michael Heimpold +--- + dio_posix.c | 2 +- + dio_stream_wrappers.c | 14 +++++++------- + dio_win32.c | 2 +- + php_dio_common.h | 2 +- + 4 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/dio_posix.c b/dio_posix.c +index 6ed8630..527d683 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -474,7 +474,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + pdata->flags = dio_stream_mode_to_flags(mode); + +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index 811bc07..817b0d1 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -126,12 +126,12 @@ php_stream_ops dio_raw_stream_ops = { + * fopen for the dio.raw stream. + */ + static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper, +- char *path, char *mode, +- int options, char **opened_path, +- php_stream_context *context STREAMS_DC TSRMLS_DC) { ++ const char *path, const char *mode, int options, ++ zend_string **opened_path, php_stream_context *context STREAMS_DC) ++{ + php_dio_stream_data *data; + php_stream *stream; +- char *filename; ++ const char *filename; + + /* Check it was actually for us (not a corrupted function pointer + somewhere!). */ +@@ -287,9 +287,9 @@ php_stream_ops dio_serial_stream_ops = { + * fopen for the dio.raw stream. + */ + static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, +- char *path, char *mode, +- int options, char **opened_path, +- php_stream_context *context STREAMS_DC TSRMLS_DC) { ++ const char *path, const char *mode, int options, ++ zend_string **opened_path, php_stream_context *context STREAMS_DC) ++{ + php_dio_stream_data *data; + php_stream *stream; + char *filename; +diff --git a/dio_win32.c b/dio_win32.c +index e7ccedd..1023d36 100644 +--- a/dio_win32.c ++++ b/dio_win32.c +@@ -505,7 +505,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + DWORD err; + +diff --git a/php_dio_common.h b/php_dio_common.h +index 6b14040..7a75370 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -55,7 +55,7 @@ int dio_common_close(php_dio_stream_data *data); + + int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam); + +-int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); ++int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); + + int dio_serial_uninit(php_dio_stream_data *data); + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch b/lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch new file mode 100644 index 0000000..c15fd89 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch @@ -0,0 +1,829 @@ +From 760ec7072cbba2cbbb6e4e17b0c54ee3c7b661a8 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 00:59:42 +0200 +Subject: [PATCH 12/16] Remove ancient macros TSRMLS_CC and TSRMLS_DC + +Signed-off-by: Michael Heimpold +--- + dio.c | 70 +++++++++++++++++++++++++-------------------------- + dio_common.c | 8 +++--- + dio_posix.c | 22 ++++++++-------- + dio_stream_wrappers.c | 48 +++++++++++++++++------------------ + dio_win32.c | 46 ++++++++++++++++----------------- + php_dio_common.h | 12 ++++----- + 6 files changed, 103 insertions(+), 103 deletions(-) + +diff --git a/dio.c b/dio.c +index b489747..7bad575 100644 +--- a/dio.c ++++ b/dio.c +@@ -93,11 +93,11 @@ PHP_FUNCTION(dio_open) + long mode = 0; + int fd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) { + return; + } + +- if (php_check_open_basedir(file_name TSRMLS_CC) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) { ++ if (php_check_open_basedir(file_name) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) { + RETURN_FALSE; + } + +@@ -108,7 +108,7 @@ PHP_FUNCTION(dio_open) + } + + if (fd == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno)); + RETURN_FALSE; + } + +@@ -130,14 +130,14 @@ PHP_FUNCTION(dio_fdopen) + long lfd; + int fd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lfd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &lfd) == FAILURE) { + return; + } + + fd = (int)lfd; + + if ((fcntl(fd, F_GETFL, 0) == -1) && (errno == EBADF)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad file descriptor %d", fd); ++ php_error_docref(NULL, E_WARNING, "Bad file descriptor %d", fd); + RETURN_FALSE; + } + +@@ -158,7 +158,7 @@ PHP_FUNCTION(dio_dup) + php_fd_t *f, *df; + int dfd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) { + return; + } + +@@ -168,7 +168,7 @@ PHP_FUNCTION(dio_dup) + + dfd = dup(f->fd); + if (dfd == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno)); + RETURN_FALSE; + } + +@@ -191,7 +191,7 @@ PHP_FUNCTION(dio_read) + long bytes = 1024; + ssize_t res; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &r_fd, &bytes) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &r_fd, &bytes) == FAILURE) { + return; + } + +@@ -200,7 +200,7 @@ PHP_FUNCTION(dio_read) + } + + if (bytes <= 0) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0."); ++ php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0."); + RETURN_FALSE; + } + +@@ -229,12 +229,12 @@ PHP_FUNCTION(dio_write) + long trunc_len = 0; + ssize_t res; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) { + return; + } + + if (trunc_len < 0 || trunc_len > data_len) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string."); ++ php_error_docref(NULL, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string."); + RETURN_FALSE; + } + +@@ -244,7 +244,7 @@ PHP_FUNCTION(dio_write) + + res = write(f->fd, data, trunc_len ? trunc_len : data_len); + if (res == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno)); + } + + RETURN_LONG(res); +@@ -261,7 +261,7 @@ PHP_FUNCTION(dio_truncate) + php_fd_t *f; + long offset; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &r_fd, &offset) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &r_fd, &offset) == FAILURE) { + return; + } + +@@ -270,7 +270,7 @@ PHP_FUNCTION(dio_truncate) + } + + if (ftruncate(f->fd, offset) == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno)); + RETURN_FALSE; + } + +@@ -289,7 +289,7 @@ PHP_FUNCTION(dio_stat) + php_fd_t *f; + struct stat s; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) { + return; + } + +@@ -298,7 +298,7 @@ PHP_FUNCTION(dio_stat) + } + + if (fstat(f->fd, &s) == -1) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno)); ++ php_error_docref(NULL, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno)); + RETURN_FALSE; + } + +@@ -330,7 +330,7 @@ PHP_FUNCTION(dio_seek) + long offset; + long whence = SEEK_SET; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &r_fd, &offset, &whence) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &r_fd, &offset, &whence) == FAILURE) { + return; + } + +@@ -353,7 +353,7 @@ PHP_FUNCTION(dio_fcntl) + php_fd_t *f; + long cmd; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &r_fd, &cmd, &arg) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z", &r_fd, &cmd, &arg) == FAILURE) { + return; + } + +@@ -369,7 +369,7 @@ PHP_FUNCTION(dio_fcntl) + HashTable *fh; + + if (!arg) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, none given"); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, none given"); + RETURN_FALSE; + } + if (Z_TYPE_P(arg) == IS_ARRAY) { +@@ -403,7 +403,7 @@ PHP_FUNCTION(dio_fcntl) + lk.l_whence = SEEK_SET; + lk.l_type = Z_LVAL_P(arg); + } else { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg)); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg)); + RETURN_FALSE; + } + +@@ -428,7 +428,7 @@ PHP_FUNCTION(dio_fcntl) + php_fd_t *new_f; + + if (!arg || Z_TYPE_P(arg) != IS_LONG) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int"); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be int"); + RETURN_FALSE; + } + +@@ -440,7 +440,7 @@ PHP_FUNCTION(dio_fcntl) + } + default: + if (!arg || Z_TYPE_P(arg) != IS_LONG) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int"); ++ php_error_docref(NULL, E_WARNING, "expects argument 3 to be int"); + RETURN_FALSE; + } + +@@ -465,7 +465,7 @@ PHP_FUNCTION(dio_tcsetattr) + HashTable *fh; + zval *element; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &r_fd, &arg) == FAILURE) { + return; + } + +@@ -474,7 +474,7 @@ PHP_FUNCTION(dio_tcsetattr) + } + + if (Z_TYPE_P(arg) != IS_ARRAY) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array"); ++ php_error_docref(NULL, E_WARNING,"tcsetattr, third argument should be an associative array"); + return; + } + +@@ -564,7 +564,7 @@ PHP_FUNCTION(dio_tcsetattr) + BAUD = B50; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid baud rate %d", Baud_Rate); ++ php_error_docref(NULL, E_WARNING, "invalid baud rate %d", Baud_Rate); + RETURN_FALSE; + } + switch (Data_Bits) { +@@ -581,7 +581,7 @@ PHP_FUNCTION(dio_tcsetattr) + DATABITS = CS5; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data bits %d", Data_Bits); ++ php_error_docref(NULL, E_WARNING, "invalid data bits %d", Data_Bits); + RETURN_FALSE; + } + switch (Stop_Bits) { +@@ -592,7 +592,7 @@ PHP_FUNCTION(dio_tcsetattr) + STOPBITS = CSTOPB; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop bits %d", Stop_Bits); ++ php_error_docref(NULL, E_WARNING, "invalid stop bits %d", Stop_Bits); + RETURN_FALSE; + } + +@@ -610,7 +610,7 @@ PHP_FUNCTION(dio_tcsetattr) + PARITY = 0; + break; + default: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity %d", Parity); ++ php_error_docref(NULL, E_WARNING, "invalid parity %d", Parity); + RETURN_FALSE; + } + +@@ -652,7 +652,7 @@ PHP_FUNCTION(dio_close) + zval *r_fd; + php_fd_t *f; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) { + return; + } + +@@ -669,7 +669,7 @@ PHP_FUNCTION(dio_close) + /* {{{ dio_init_legacy_defines + * Initialises the legacy PHP defines + */ +-static void dio_init_legacy_defines(int module_number TSRMLS_DC) { ++static void dio_init_legacy_defines(int module_number) { + RDIOC(O_RDONLY); + RDIOC(O_WRONLY); + RDIOC(O_RDWR); +@@ -852,11 +852,11 @@ PHP_MINIT_FUNCTION(dio) + /* Legacy resource destructor. */ + le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number); + +- dio_init_legacy_defines(module_number TSRMLS_CC); ++ dio_init_legacy_defines(module_number); + + /* Register the stream wrappers */ +- return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper TSRMLS_CC) == SUCCESS && +- php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE; ++ return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper) == SUCCESS && ++ php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper) == SUCCESS) ? SUCCESS : FAILURE; + } + /* }}} */ + +@@ -864,8 +864,8 @@ PHP_MINIT_FUNCTION(dio) + */ + PHP_MSHUTDOWN_FUNCTION(dio) + { +- return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME TSRMLS_CC) == SUCCESS && +- php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE; ++ return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME) == SUCCESS && ++ php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME) == SUCCESS) ? SUCCESS : FAILURE; + } + /* }}} */ + +diff --git a/dio_common.c b/dio_common.c +index a5f4c63..d09c0ec 100644 +--- a/dio_common.c ++++ b/dio_common.c +@@ -55,7 +55,7 @@ void dio_init_stream_data(php_dio_stream_data *data) { + /* {{{ dio_assoc_array_get_basic_options + * Retrieves the basic open option values from an associative array + */ +-void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { ++void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) + zval *tmpzval; + HashTable *opthash; +@@ -98,7 +98,7 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data + /* {{{ dio_assoc_array_get_serial_options + * Retrieves the serial open option values from an associative array + */ +-void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC) { ++void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data) { + zval *tmpzval; + HashTable *opthash; + +@@ -133,7 +133,7 @@ void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data + /* {{{ dio_stream_context_get_raw_options + * Extracts the option values for dio.raw mode from a context + */ +-void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { ++void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data) { + #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK) + zval *tmpzval; + #endif +@@ -173,7 +173,7 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s + /* {{{ dio_stream_context_get_serial_options + * Extracts the option values for dio.serial mode from a context + */ +-void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) { ++void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data) { + zval *tmpzval; + + if ((tmpzval = php_stream_context_get_option(context, "dio", "data_rate")) != NULL) { +diff --git a/dio_posix.c b/dio_posix.c +index 527d683..843e234 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -474,7 +474,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + pdata->flags = dio_stream_mode_to_flags(mode); + +@@ -498,7 +498,7 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + if (pdata->fd < 0) { + switch (errno) { + case EEXIST: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ php_error_docref(NULL, E_WARNING, "File exists!"); + return 0; + default: + return 0; +@@ -512,36 +512,36 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + /* {{{ dio_serial_init + * Initialises the serial settings storing the original settings before hand. + */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++static int dio_serial_init(php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + int ret = 0, data_bits_def, stop_bits_def, parity_def; + struct termios tio; + speed_t rate_def; + + if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); ++ php_error_docref(NULL, E_WARNING, "invalid data_rate value (%ld)", data->data_rate); + return 0; + } + + if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits); + return 0; + } + + if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); + return 0; + } + + if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity); + return 0; + } + + ret = tcgetattr(pdata->fd, &(pdata->oldtio)); + if (ret < 0) { + if ((errno == ENOTTY) || (errno == ENODEV)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!"); ++ php_error_docref(NULL, E_WARNING, "Not a serial port or terminal!"); + } + return 0; + } +@@ -632,7 +632,7 @@ int dio_serial_purge(php_dio_stream_data *data) { + /* {{{ dio_serial_open_stream + * Opens the underlying stream. + */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + + #ifdef O_NOCTTY +@@ -640,11 +640,11 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data + pdata->flags |= O_NOCTTY; + #endif + +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_raw_open_stream(filename, mode, data)) { + return 0; + } + +- if (!dio_serial_init(data TSRMLS_CC)) { ++ if (!dio_serial_init(data)) { + close(pdata->fd); + return 0; + } +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index 817b0d1..eb23752 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -36,7 +36,7 @@ + /* {{{ dio_stream_write + * Write to the stream + */ +-static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) ++static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count) + { + return dio_common_write((php_dio_stream_data*)stream->abstract, buf, count); + } +@@ -45,7 +45,7 @@ static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count + /* {{{ dio_stream_read + * Read from the stream + */ +-static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) ++static size_t dio_stream_read(php_stream *stream, char *buf, size_t count) + { + php_dio_stream_data* data = (php_dio_stream_data*)stream->abstract; + size_t bytes = dio_common_read(data, buf, count); +@@ -58,7 +58,7 @@ static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS + /* {{{ dio_stream_flush + * Flush the stream. For raw streams this does nothing. + */ +-static int dio_stream_flush(php_stream *stream TSRMLS_DC) ++static int dio_stream_flush(php_stream *stream) + { + return 1; + } +@@ -67,7 +67,7 @@ static int dio_stream_flush(php_stream *stream TSRMLS_DC) + /* {{{ dio_stream_close + * Close the stream + */ +-static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC) ++static int dio_stream_close(php_stream *stream, int close_handle) + { + php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract; + +@@ -83,7 +83,7 @@ static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC) + /* {{{ dio_stream_set_option + * Set the stream options. + */ +-static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) ++static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam) + { + php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract; + +@@ -143,7 +143,7 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper, + filename = path + sizeof(DIO_RAW_STREAM_PROTOCOL) - 1; + + /* Check we can actually access it. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + return NULL; + } + +@@ -152,11 +152,11 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper, + + /* Parse the context. */ + if (context) { +- dio_stream_context_get_basic_options(context, data TSRMLS_CC); ++ dio_stream_context_get_basic_options(context, data); + } + + /* Try and open a raw stream. */ +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_raw_open_stream(filename, mode, data)) { + return NULL; + } + +@@ -199,7 +199,7 @@ PHP_FUNCTION(dio_raw) { + char *mode; + int mode_len; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { + RETURN_FALSE; + } + +@@ -209,7 +209,7 @@ PHP_FUNCTION(dio_raw) { + } + + /* Check we can actually access the file. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + RETURN_FALSE; + } + +@@ -217,11 +217,11 @@ PHP_FUNCTION(dio_raw) { + data->stream_type = DIO_STREAM_TYPE_RAW; + + if (options) { +- dio_assoc_array_get_basic_options(options, data TSRMLS_CC); ++ dio_assoc_array_get_basic_options(options, data); + } + + /* Try and open a raw stream. */ +- if (dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (dio_raw_open_stream(filename, mode, data)) { + stream = php_stream_alloc(&dio_raw_stream_ops, data, 0, mode); + if (!stream) { + (void) dio_common_close(data); +@@ -244,7 +244,7 @@ PHP_FUNCTION(dio_raw) { + * stream, if it is write only it flushes the write, otherwise it flushes + * both. + */ +-static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC) ++static int dio_serial_stream_flush(php_stream *stream) + { + return dio_serial_purge((php_dio_stream_data*)stream->abstract); + } +@@ -254,7 +254,7 @@ static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC) + * Close the stream. Restores the serial settings to their value before + * the stream was open. + */ +-static int dio_serial_stream_close(php_stream *stream, int close_handle TSRMLS_DC) ++static int dio_serial_stream_close(php_stream *stream, int close_handle) + { + php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract; + +@@ -304,7 +304,7 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, + filename = path + sizeof(DIO_SERIAL_STREAM_PROTOCOL) - 1; + + /* Check we can actually access it. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + return NULL; + } + +@@ -313,12 +313,12 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, + + /* Parse the context. */ + if (context) { +- dio_stream_context_get_basic_options(context, data TSRMLS_CC); +- dio_stream_context_get_serial_options(context, data TSRMLS_CC); ++ dio_stream_context_get_basic_options(context, data); ++ dio_stream_context_get_serial_options(context, data); + } + + /* Try and open a serial stream. */ +- if (!dio_serial_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_serial_open_stream(filename, mode, data)) { + return NULL; + } + +@@ -359,18 +359,18 @@ PHP_FUNCTION(dio_serial) { + char *mode; + int mode_len; + +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) { + RETURN_FALSE; + } + + /* Check the third argument is an array. */ + if (options && (Z_TYPE_P(options) != IS_ARRAY)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING,"dio_serial, the third argument should be an array of options"); ++ php_error_docref(NULL, E_WARNING,"dio_serial, the third argument should be an array of options"); + RETURN_FALSE; + } + + /* Check we can actually access the file. */ +- if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) { ++ if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) { + RETURN_FALSE; + } + +@@ -378,12 +378,12 @@ PHP_FUNCTION(dio_serial) { + data->stream_type = DIO_STREAM_TYPE_SERIAL; + + if (options) { +- dio_assoc_array_get_basic_options(options, data TSRMLS_CC); +- dio_assoc_array_get_serial_options(options, data TSRMLS_CC); ++ dio_assoc_array_get_basic_options(options, data); ++ dio_assoc_array_get_serial_options(options, data); + } + + /* Try and open a serial stream. */ +- if (dio_serial_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (dio_serial_open_stream(filename, mode, data)) { + stream = php_stream_alloc(&dio_serial_stream_ops, data, 0, mode); + if (!stream) { + efree(data); +diff --git a/dio_win32.c b/dio_win32.c +index 1023d36..25c838a 100644 +--- a/dio_win32.c ++++ b/dio_win32.c +@@ -30,7 +30,7 @@ + /* {{{ dio_last_error_php_error + * Generates a PHP error message based upon the last Windows error. + */ +-static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { ++static void dio_last_error_php_error(int level, char * message) { + LPVOID msgbuf; + DWORD msgbuflen; + char * errmsg; +@@ -68,7 +68,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { + /* Allocate a buffer */ + errmsg = emalloc(errmsglen); + if (!errmsg) { +- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!"); ++ php_error_docref(NULL, E_ERROR, "Out of memory in dio_last_error_php_error()!"); + LocalFree(msgbuf); + return; + } +@@ -88,7 +88,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) { + errmsg = (char *)msgbuf; + #endif + +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); ++ php_error_docref(NULL, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg); + + LocalFree(msgbuf); + #ifdef UNICODE +@@ -505,7 +505,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void + /* {{{ dio_raw_open_stream + * Opens the underlying stream. + */ +-int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + DWORD err; + +@@ -543,29 +543,29 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + err = GetLastError(); + switch (err) { + case ERROR_FILE_EXISTS: +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!"); ++ php_error_docref(NULL, E_WARNING, "File exists!"); + return 0; + + case ERROR_FILE_NOT_FOUND: + /* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that + * the file doesn't exist so now try to create it. */ + if (TRUNCATE_EXISTING == wdata->creation_disposition) { +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!"); ++ php_error_docref(NULL, E_NOTICE, "File does not exist, creating new file!"); + + wdata->handle = CreateFile(filename, wdata->desired_access, 0, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (INVALID_HANDLE_VALUE == wdata->handle) { +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:"); + return 0; + } + } else { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!"); ++ php_error_docref(NULL, E_WARNING, "File not found!"); + return 0; + } + break; + + default: +- dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "CreateFile() failed:"); + return 0; + } + } +@@ -584,33 +584,33 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d + /* {{{ dio_serial_init + * Initialises the serial port + */ +-static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { ++static int dio_serial_init(php_dio_stream_data *data) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + DWORD rate_def, data_bits_def, stop_bits_def, parity_def; + DCB dcb; + + if (!dio_data_rate_to_define(data->data_rate, &rate_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate); ++ php_error_docref(NULL, E_WARNING, "invalid data_rate value (%d)", data->data_rate); + return 0; + } + + if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits); ++ php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits); + return 0; + } + + if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); ++ php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits); + return 0; + } + + if (!dio_parity_to_define(data->parity, &parity_def)) { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity); ++ php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity); + return 0; + } + + if (!GetCommState(wdata->handle, &(wdata->olddcb))) { +- dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "GetCommState() failed:"); + return 0; + } + +@@ -646,7 +646,7 @@ static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) { + } + + if (!SetCommState(wdata->handle, &dcb)) { +- dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "SetCommState() failed:"); + return 0; + } + +@@ -698,23 +698,23 @@ int dio_serial_purge(php_dio_stream_data *data) { + /* {{{ dio_serial_open_stream + * Opens the underlying stream. + */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) { ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) { + php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data; + COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 }; + +- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); ++ php_error_docref(NULL, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode); + + if (*mode != 'r') { +- php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!"); ++ php_error_docref(NULL, E_WARNING, "You must open serial ports in read or read/write mode!"); + return 0; + } + +- if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) { ++ if (!dio_raw_open_stream(filename, mode, data)) { + return 0; + } + + if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) { +- dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):"); + CloseHandle(wdata->handle); + return 0; + } +@@ -735,12 +735,12 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data + } + + if (!SetCommTimeouts(wdata->handle, &cto)) { +- dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC); ++ dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:"); + CloseHandle(wdata->handle); + return 0; + } + +- if (!dio_serial_init(data TSRMLS_CC)) { ++ if (!dio_serial_init(data)) { + CloseHandle(wdata->handle); + return 0; + } +diff --git a/php_dio_common.h b/php_dio_common.h +index 7a75370..6af202f 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -39,13 +39,13 @@ php_dio_stream_data * dio_create_stream_data(void); + + void dio_init_stream_data(php_dio_stream_data *data); + +-void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC); ++void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data); + +-void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC); ++void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data); + +-void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC); ++void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data); + +-void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC); ++void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data); + + size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count); + +@@ -55,13 +55,13 @@ int dio_common_close(php_dio_stream_data *data); + + int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam); + +-int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); ++int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data); + + int dio_serial_uninit(php_dio_stream_data *data); + + int dio_serial_purge(php_dio_stream_data *data); + +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC); ++int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data); + + #endif /* PHP_DIO_COMMON_H_ */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch b/lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch new file mode 100644 index 0000000..e632552 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch @@ -0,0 +1,69 @@ +From 942b77d84417298fb9e99c216029f22fbd1e2d98 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 01:47:05 +0200 +Subject: [PATCH 13/16] Fix tests for legacy interface + +Signed-off-by: Michael Heimpold +--- + dio.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/dio.c b/dio.c +index 7bad575..1a130a2 100644 +--- a/dio.c ++++ b/dio.c +@@ -73,9 +73,9 @@ static int new_php_fd(php_fd_t **f, int fd) + return 1; + } + +-static void _dio_close_fd(zend_resource *res) ++static void _dio_close_fd(zend_resource *rsrc) + { +- php_fd_t *f = (php_fd_t *)zend_fetch_resource(res, NULL, le_fd); ++ php_fd_t *f = (php_fd_t *)rsrc->ptr; + if (f) { + close(f->fd); + free(f); +@@ -87,8 +87,8 @@ static void _dio_close_fd(zend_resource *res) + PHP_FUNCTION(dio_open) + { + php_fd_t *f; +- char *file_name; +- int file_name_length; ++ char *file_name = NULL; ++ size_t file_name_length = 0; + long flags; + long mode = 0; + int fd; +@@ -97,6 +97,10 @@ PHP_FUNCTION(dio_open) + return; + } + ++ if (!file_name || file_name[0] == '\0') { ++ RETURN_FALSE; ++ } ++ + if (php_check_open_basedir(file_name) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) { + RETURN_FALSE; + } +@@ -176,7 +180,7 @@ PHP_FUNCTION(dio_dup) + RETURN_FALSE; + } + +- RETVAL_RES(zend_register_resource(f, le_fd)); ++ RETVAL_RES(zend_register_resource(df, le_fd)); + } + /* }}} */ + #endif +@@ -660,7 +664,7 @@ PHP_FUNCTION(dio_close) + RETURN_FALSE; + } + +- zend_list_delete(Z_LVAL_P(r_fd)); ++ zend_list_delete(Z_RES_P(r_fd)); + } + /* }}} */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch b/lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch new file mode 100644 index 0000000..b9e2e00 --- /dev/null +++ b/lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch @@ -0,0 +1,54 @@ +From ff469d3a11409e9b043dc10ddfc44792c5359ff1 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Thu, 14 Jul 2016 01:47:05 +0200 +Subject: [PATCH 14/16] Add missing changes from changed stream API interface + +Signed-off-by: Michael Heimpold +--- + dio_posix.c | 2 +- + dio_stream_wrappers.c | 2 +- + php_dio_common.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/dio_posix.c b/dio_posix.c +index 843e234..b2aa228 100644 +--- a/dio_posix.c ++++ b/dio_posix.c +@@ -632,7 +632,7 @@ int dio_serial_purge(php_dio_stream_data *data) { + /* {{{ dio_serial_open_stream + * Opens the underlying stream. + */ +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) { ++int dio_serial_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) { + php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data; + + #ifdef O_NOCTTY +diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c +index eb23752..0a00daa 100644 +--- a/dio_stream_wrappers.c ++++ b/dio_stream_wrappers.c +@@ -292,7 +292,7 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper, + { + php_dio_stream_data *data; + php_stream *stream; +- char *filename; ++ const char *filename; + + /* Check it was actually for us (not a corrupted function pointer + somewhere!). */ +diff --git a/php_dio_common.h b/php_dio_common.h +index 6af202f..7068ea7 100644 +--- a/php_dio_common.h ++++ b/php_dio_common.h +@@ -61,7 +61,7 @@ int dio_serial_uninit(php_dio_stream_data *data); + + int dio_serial_purge(php_dio_stream_data *data); + +-int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data); ++int dio_serial_open_stream(const char *filename, const char *mode, php_dio_stream_data *data); + + #endif /* PHP_DIO_COMMON_H_ */ + +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch b/lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch new file mode 100644 index 0000000..ef675de --- /dev/null +++ b/lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch @@ -0,0 +1,48 @@ +From def92a2db269d4ea6d2e8b7f8fe9dd473886a6b1 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Sun, 17 Jul 2016 01:08:47 +0200 +Subject: [PATCH 15/16] Add .gitignore + +Signed-off-by: Michael Heimpold +--- + .gitignore | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + create mode 100644 .gitignore + +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..dae52e8 +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,28 @@ ++.deps ++.libs ++Makefile ++Makefile.fragments ++Makefile.global ++Makefile.objects ++acinclude.m4 ++aclocal.m4 ++autom4te.cache ++build ++config.guess ++config.h ++config.h.in ++config.log ++config.nice ++config.status ++config.sub ++configure ++configure.in ++*.la ++*.lo ++install-sh ++libtool ++ltmain.sh ++missing ++mkinstalldirs ++modules ++run-tests.php +-- +2.5.0 + diff --git a/lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch b/lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch new file mode 100644 index 0000000..16cceea --- /dev/null +++ b/lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch @@ -0,0 +1,44 @@ +From 0f8df09a8008eed8a7ac0c6400bce523014ff770 Mon Sep 17 00:00:00 2001 +From: Michael Heimpold +Date: Mon, 18 Jul 2016 22:45:04 +0200 +Subject: [PATCH 16/16] Add additional baudrates + +Signed-off-by: Michael Heimpold +--- + dio.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/dio.c b/dio.c +index 1a130a2..a4e8e7d 100644 +--- a/dio.c ++++ b/dio.c +@@ -522,6 +522,26 @@ PHP_FUNCTION(dio_tcsetattr) + + /* assign to correct values... */ + switch (Baud_Rate) { ++#ifdef B460800 ++ case 460800: ++ BAUD = B460800; ++ break; ++#endif ++#ifdef B230400 ++ case 230400: ++ BAUD = B230400; ++ break; ++#endif ++#ifdef B115200 ++ case 115200: ++ BAUD = B115200; ++ break; ++#endif ++#ifdef B57600 ++ case 57600: ++ BAUD = B57600; ++ break; ++#endif + case 38400: + BAUD = B38400; + break; +-- +2.5.0 + diff --git a/lang/php7-pecl-http/Makefile b/lang/php7-pecl-http/Makefile new file mode 100644 index 0000000..4166d2c --- /dev/null +++ b/lang/php7-pecl-http/Makefile @@ -0,0 +1,46 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=pecl_http +PECL_LONGNAME:=Extended HTTP Support + +PKG_VERSION:=3.0.1 +PKG_RELEASE:=2 +PKG_MD5SUM:=042c97314c180f6473338f0c5d35fabd + +PKG_NAME:=php7-pecl-http +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DEPENDS:=php7 php7-pecl-propro php7-pecl-raphf +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_VARS+= \ + PHP_PROPRO=yes \ + PHP_RAPHF=yes \ + +CONFIGURE_ARGS+= \ + --with-http \ + --without-http-shared-deps \ + --with-http-libcurl-dir="$(STAGING_DIR)/usr" \ + --with-http-libevent-dir="$(STAGING_DIR)/usr" \ + --with-http-libidn-dir="$(STAGING_DIR)/usr" + +$(eval $(call PECLPackage,http,$(PECL_LONGNAME),+libcurl +librt +libevent2 +libidn +php7-mod-iconv +php7-mod-session +php7-pecl-raphf +php7-pecl-propro,30)) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-http/patches/100_config9-m4.patch b/lang/php7-pecl-http/patches/100_config9-m4.patch new file mode 100644 index 0000000..304a1df --- /dev/null +++ b/lang/php7-pecl-http/patches/100_config9-m4.patch @@ -0,0 +1,22 @@ +--- a/config9.m4 2016-09-08 21:39:18.000000000 +0200 ++++ b/config9.m4 2016-09-08 21:42:35.066903251 +0200 +@@ -71,18 +71,7 @@ + extname=$1 + haveext=$[PHP_]translit($1,a-z_-,A-Z__) + AC_MSG_CHECKING([for ext/$extname support]) +- if test -x "$PHP_EXECUTABLE"; then +- grepext=`$PHP_EXECUTABLE -m | $EGREP ^$extname\$` +- if test "$grepext" = "$extname"; then +- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1 +- AC_MSG_RESULT([yes]) +- $2 +- else +- [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)= +- AC_MSG_RESULT([no]) +- $3 +- fi +- elif test "$haveext" != "no" && test "x$haveext" != "x"; then ++ if test "$haveext" != "no" && test "x$haveext" != "x"; then + [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1 + AC_MSG_RESULT([yes]) + $2 diff --git a/lang/php7-pecl-libevent/Makefile b/lang/php7-pecl-libevent/Makefile new file mode 100644 index 0000000..272b34a --- /dev/null +++ b/lang/php7-pecl-libevent/Makefile @@ -0,0 +1,38 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=libevent +PECL_LONGNAME:=Libevent - event notification + +PKG_NAME:=php7-pecl-$(PECL_NAME) +PKG_VERSION=2016-08-30-$(PKG_SOURCE_VERSION) +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/expressif/pecl-event-libevent.git +PKG_SOURCE_VERSION:=9e72744ce6224beafc7b54ce2a3a990f1c552a5a +PKG_SOURCE_SUBDIR:=$(PECL_NAME)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PECL_NAME)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=PHPv3.01 +PKG_LICENSE_FILES:= + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_SOURCE_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_ARGS+= --with-libevent=shared,"$(STAGING_DIR)/usr" + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME),+libevent2 +php7-mod-sockets,25)) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-libevent/patches/010-libevent2.patch b/lang/php7-pecl-libevent/patches/010-libevent2.patch new file mode 100644 index 0000000..961fb36 --- /dev/null +++ b/lang/php7-pecl-libevent/patches/010-libevent2.patch @@ -0,0 +1,16 @@ +--- a/libevent.c ++++ b/libevent.c +@@ -42,10 +42,12 @@ + (rsrc = (rsrc_type) zend_fetch_resource(passed_id TSRMLS_CC, default_id, resource_type_name, NULL, 1, resource_type)) + #endif + +-#ifdef PHP_WIN32 ++//#ifdef PHP_WIN32 + /* XXX compiling with 2.x on Windows. Luckily the ext code works thanks to the + compat exports from the libevent. However it might need to be adapted to the + never version, so this ifdefs would go away. */ ++#if 1 ++/* force use of libevent2 on OpenWrt and by-pass compat event.h */ + # include + # include + # include diff --git a/lang/php7-pecl-propro/Makefile b/lang/php7-pecl-propro/Makefile new file mode 100644 index 0000000..3bfe535 --- /dev/null +++ b/lang/php7-pecl-propro/Makefile @@ -0,0 +1,43 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=propro +PECL_LONGNAME:=Property proxy + +PKG_VERSION:=2.0.1 +PKG_RELEASE:=2 +PKG_MD5SUM:=19f9517210a87e18cc09faed262e1522 + +PKG_NAME:=php7-pecl-propro +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_ARGS+= \ + --enable-propro + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME) + $(CP) $(PKG_BUILD_DIR)/php_propro.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ + $(CP) $(PKG_BUILD_DIR)/php_propro_api.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ +endef + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME))) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7-pecl-raphf/Makefile b/lang/php7-pecl-raphf/Makefile new file mode 100644 index 0000000..4ce09f9 --- /dev/null +++ b/lang/php7-pecl-raphf/Makefile @@ -0,0 +1,43 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PECL_NAME:=raphf +PECL_LONGNAME:=Resource and persistent handles factory + +PKG_VERSION:=2.0.0 +PKG_RELEASE:=2 +PKG_MD5SUM:=bc465eb5caa9d0f09cced121a8ac2e8e + +PKG_NAME:=php7-pecl-raphf +PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://pecl.php.net/get/ + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 + +PKG_FIXUP:=autoreconf + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk +include ../php7/pecl.mk + +CONFIGURE_ARGS+= \ + --enable-raphf + +define Build/InstallDev + mkdir -p $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME) + cp $(PKG_BUILD_DIR)/php_raphf.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ + cp $(PKG_BUILD_DIR)/php_raphf_api.h $(STAGING_DIR)/usr/include/php7/ext/$(PECL_NAME)/ +endef + +$(eval $(call PECLPackage,$(PECL_NAME),$(PECL_LONGNAME))) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/lang/php7/Makefile b/lang/php7/Makefile new file mode 100644 index 0000000..d311a7b --- /dev/null +++ b/lang/php7/Makefile @@ -0,0 +1,593 @@ +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=php +PKG_VERSION:=7.0.13 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Michael Heimpold + +PKG_LICENSE:=PHPv3.01 +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=http://www.php.net/distributions/ +PKG_MD5SUM:=eb117bf1d1efc99c522f132b265a3402 + +PKG_FIXUP:=libtool autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +PHP7_MODULES = \ + calendar ctype curl \ + fileinfo \ + dom \ + exif \ + ftp \ + gettext gd gmp \ + hash \ + iconv intl \ + json \ + ldap \ + mbstring mcrypt mysqli \ + opcache openssl \ + pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql phar \ + session shmop simplexml soap sockets sqlite3 sysvmsg sysvsem sysvshm \ + tokenizer \ + xml xmlreader xmlwriter zip \ + +PKG_CONFIG_DEPENDS:= \ + $(patsubst %,CONFIG_PACKAGE_php7-mod-%,$(PHP7_MODULES)) \ + CONFIG_PHP7_FILTER CONFIG_PHP7_LIBXML CONFIG_PHP7_SYSTEMTZDATA + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/php7/Default + SUBMENU:=PHP + SECTION:=lang + CATEGORY:=Languages + TITLE:=PHP7 Hypertext preprocessor + URL:=http://www.php.net/ + DEPENDS:=php7 +endef + +define Package/php7/Default/description + PHP is a widely-used general-purpose scripting language that is especially + suited for Web development and can be embedded into HTML. +endef + +define Package/php7/config + config PHP7_FILTER + bool "PHP7 Filter support" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + + config PHP7_LIBXML + bool "PHP7 LIBXML support" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + + config PHP7_SYSTEMTZDATA + bool "Use system timezone data instead of php's built-in database" + depends on PACKAGE_php7-cli || PACKAGE_php7-cgi + select PACKAGE_zoneinfo-core + default y + help + Enabling this feature automatically selects the zoneinfo-core package + which contains data for UTC timezone. To use other timezones you have + to install the corresponding zoneinfo-... package(s). +endef + +define Package/php7 + $(call Package/php7/Default) + + DEPENDS:=+libpcre +zlib \ + +PHP7_LIBXML:libxml2 +endef + +define Package/php7/description + $(call Package/php7/Default/description) + This package contains only the PHP config file. You must actually choose + your PHP flavour (cli, cgi or fastcgi). + + Please note, that installing php5 and php7 in parallel on the same target + is not supported in OpenWrt/LEDE. +endef + +define Package/php7-cli + $(call Package/php7/Default) + DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp + TITLE+= (CLI) +endef + +define Package/php7-cli/description + $(call Package/php7/Default/description) + This package contains the CLI version of the PHP7 interpreter. +endef + +define Package/php7-cgi + $(call Package/php7/Default) + DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp + TITLE+= (CGI & FastCGI) +endef + +define Package/php7-cgi/description + $(call Package/php7/Default/description) + This package contains the CGI version of the PHP7 interpreter. +endef + +define Package/php7-fastcgi + $(call Package/php7/Default) + DEPENDS+= +php7-cgi + TITLE:=FastCGI startup script +endef + +define Package/php7-fastcgi/description + As FastCGI support is now a core feature the php7-fastcgi package now depends + on the php7-cgi package, containing just the startup script. +endef + +define Package/php7-fpm + $(call Package/php7/Default) + DEPENDS+= +php7-cgi + TITLE+= (FPM) +endef + +define Package/php7-fpm/description + $(call Package/php7/Default/description) + This package contains the FastCGI Process Manager of the PHP7 interpreter. +endef + +CONFIGURE_ARGS+= \ + --enable-cli \ + --enable-cgi \ + --enable-fpm \ + --enable-shared \ + --disable-static \ + --disable-rpath \ + --disable-debug \ + --disable-phpdbg \ + --without-pear \ + \ + --with-config-file-path=/etc \ + --with-config-file-scan-dir=/etc/php7 \ + --disable-short-tags \ + \ + --with-zlib="$(STAGING_DIR)/usr" \ + --with-zlib-dir="$(STAGING_DIR)/usr" + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-calendar),) + CONFIGURE_ARGS+= --enable-calendar=shared +else + CONFIGURE_ARGS+= --disable-calendar +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ctype),) + CONFIGURE_ARGS+= --enable-ctype=shared +else + CONFIGURE_ARGS+= --disable-ctype +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-curl),) + CONFIGURE_ARGS+= --with-curl=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-curl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-fileinfo),) + CONFIGURE_ARGS+= --enable-fileinfo=shared +else + CONFIGURE_ARGS+= --disable-fileinfo +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gettext),) + CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full" +else + CONFIGURE_ARGS+= --without-gettext +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-dom),) + CONFIGURE_ARGS+= --enable-dom=shared +else + CONFIGURE_ARGS+= --disable-dom +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-exif),) + CONFIGURE_ARGS+= --enable-exif=shared +else + CONFIGURE_ARGS+= --disable-exif +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ftp),) + CONFIGURE_ARGS+= --enable-ftp=shared +else + CONFIGURE_ARGS+= --disable-ftp +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gd),) + CONFIGURE_ARGS+= \ + --with-gd=shared \ + --without-freetype-dir \ + --with-jpeg-dir="$(STAGING_DIR)/usr" \ + --with-png-dir="$(STAGING_DIR)/usr" \ + --without-xpm-dir \ + --without-t1lib \ + --enable-gd-native-ttf \ + --disable-gd-jis-conv +else + CONFIGURE_ARGS+= --without-gd +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gmp),) + CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-gmp +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-hash),) + CONFIGURE_ARGS+= --enable-hash=shared +else + CONFIGURE_ARGS+= --disable-hash +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-iconv),) + CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)" +else + CONFIGURE_ARGS+= --without-iconv +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-intl),) + CONFIGURE_ARGS+= --enable-intl=shared +else + CONFIGURE_ARGS+= --disable-intl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-json),) + CONFIGURE_ARGS+= --enable-json=shared +else + CONFIGURE_ARGS+= --disable-json +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ldap),) + CONFIGURE_ARGS+= \ + --with-ldap=shared,"$(STAGING_DIR)/usr" \ + --with-ldap-sasl="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-ldap +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mbstring),) + CONFIGURE_ARGS+= --enable-mbstring=shared --enable-mbregex +else + CONFIGURE_ARGS+= --disable-mbstring +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mcrypt),) + CONFIGURE_ARGS+= --with-mcrypt=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-mcrypt +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mysqli),) + CONFIGURE_ARGS+= --with-mysqli=shared,"$(STAGING_DIR)/usr/bin/mysql_config" +else + CONFIGURE_ARGS+= --without-mysqli +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-opcache),) + CONFIGURE_ARGS+= --enable-opcache=shared +else + CONFIGURE_ARGS+= --disable-opcache +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-openssl),) + CONFIGURE_ARGS+= \ + --with-openssl=shared,"$(STAGING_DIR)/usr" \ + --with-kerberos=no \ + --with-openssl-dir="$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-openssl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pcntl),) + CONFIGURE_ARGS+= --enable-pcntl=shared +else + CONFIGURE_ARGS+= --disable-pcntl +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo),) + CONFIGURE_ARGS+= --enable-pdo=shared + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-mysql),) + CONFIGURE_ARGS+= --with-pdo-mysql=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-mysql + endif + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-pgsql),) + CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-pgsql + endif + ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-sqlite),) + CONFIGURE_ARGS+= --with-pdo-sqlite=shared,"$(STAGING_DIR)/usr" + else + CONFIGURE_ARGS+= --without-pdo-sqlite + endif +else + CONFIGURE_ARGS+= --disable-pdo +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pgsql),) + CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-pgsql +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-phar),) + CONFIGURE_ARGS+= --enable-phar=shared +else + CONFIGURE_ARGS+= --disable-phar +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-session),) + CONFIGURE_ARGS+= --enable-session=shared +else + CONFIGURE_ARGS+= --disable-session +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-shmop),) + CONFIGURE_ARGS+= --enable-shmop=shared +else + CONFIGURE_ARGS+= --disable-shmop +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-simplexml),) + CONFIGURE_ARGS+= --enable-simplexml=shared +else + CONFIGURE_ARGS+= --disable-simplexml +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-soap),) + CONFIGURE_ARGS+= --enable-soap=shared +else + CONFIGURE_ARGS+= --disable-soap +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sockets),) + CONFIGURE_ARGS+= --enable-sockets=shared +else + CONFIGURE_ARGS+= --disable-sockets +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sqlite3),) + CONFIGURE_ARGS+= --with-sqlite3=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --without-sqlite3 +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvmsg),) + CONFIGURE_ARGS+= --enable-sysvmsg=shared +else + CONFIGURE_ARGS+= --disable-sysvmsg +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvsem),) + CONFIGURE_ARGS+= --enable-sysvsem=shared +else + CONFIGURE_ARGS+= --disable-sysvsem +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvshm),) + CONFIGURE_ARGS+= --enable-sysvshm=shared +else + CONFIGURE_ARGS+= --disable-sysvshm +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-tokenizer),) + CONFIGURE_ARGS+= --enable-tokenizer=shared +else + CONFIGURE_ARGS+= --disable-tokenizer +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xml),) + CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr" + ifneq ($(CONFIG_PHP7_LIBXML),) + CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2" + else + CONFIGURE_ARGS+= --with-libexpat-dir="$(STAGING_DIR)/usr" + endif +else + CONFIGURE_ARGS+= --disable-xml +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xmlreader),) + CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --disable-xmlreader +endif + +ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xmlwriter),) + CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr" +else + CONFIGURE_ARGS+= --disable-xmlwriter +endif + +ifneq ($(CONFIG_PACKAGE_php7-mod-zip),) + CONFIGURE_ARGS+= --enable-zip=shared +else + CONFIGURE_ARGS+= --disable-zip +endif + +ifneq ($(SDK)$(CONFIG_PHP7_FILTER),) + CONFIGURE_ARGS+= --enable-filter +else + CONFIGURE_ARGS+= --disable-filter +endif + +ifneq ($(SDK)$(CONFIG_PHP7_LIBXML),) + CONFIGURE_ARGS+= --enable-libxml + CONFIGURE_ARGS+= --with-libxml-dir="$(STAGING_DIR)/usr/include/libxml2" +else + CONFIGURE_ARGS+= --disable-libxml +endif + +#ifneq ($(CONFIG_PHP7_SYSTEMTZDATA),) +# CONFIGURE_ARGS+= --with-system-tzdata +#else +# CONFIGURE_ARGS+= --without-system-tzdata +#endif + +CONFIGURE_VARS+= \ + ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \ + php_cv_cc_rpath="no" \ + iconv_impl_name="gnu_libiconv" \ + ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \ + +define Package/php7/conffiles +/etc/php.ini +endef + +define Package/php7/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/php.ini $(1)/etc/ +endef + +define Package/php7-cli/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli +endef + +define Package/php7-cgi/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi + ln -sf php-cgi $(1)/usr/bin/php-fcgi +endef + +define Package/php7-fastcgi/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/php7-fastcgi.config $(1)/etc/config/php7-fastcgi + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/php7-fastcgi.init $(1)/etc/init.d/php7-fastcgi +endef + +define Package/php7-fpm/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sapi/fpm/php-fpm $(1)/usr/bin/php-fpm + + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) ./files/php7-fpm.conf $(1)/etc/php7-fpm.conf + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/php7-fpm.config $(1)/etc/config/php7-fpm + + $(INSTALL_DIR) $(1)/etc/php7-fpm.d + $(INSTALL_DATA) ./files/php7-fpm-www.conf $(1)/etc/php7-fpm.d/www.conf + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/php7-fpm.init $(1)/etc/init.d/php7-fpm +endef + +define Build/Prepare + $(call Build/Prepare/Default) + ( cd $(PKG_BUILD_DIR); touch configure.in; ./buildconf --force ) +endef + +define Build/InstallDev + rm -rf $(PKG_BUILD_DIR)/staging + make -C $(PKG_BUILD_DIR) install INSTALL_ROOT=$(PKG_BUILD_DIR)/staging + rm -rf $(PKG_BUILD_DIR)/staging/usr/{share,man,sbin} + rm -f $(PKG_BUILD_DIR)/staging/usr/bin/{php,php-cgi,php-cli} + mv $(PKG_BUILD_DIR)/staging/usr/bin/phpize $(PKG_BUILD_DIR)/staging/usr/bin/phpize7 + mv $(PKG_BUILD_DIR)/staging/usr/bin/php-config $(PKG_BUILD_DIR)/staging/usr/bin/php7-config + mv $(PKG_BUILD_DIR)/staging/usr/include/php $(PKG_BUILD_DIR)/staging/usr/include/php7 + mv $(PKG_BUILD_DIR)/staging/usr/lib/php $(PKG_BUILD_DIR)/staging/usr/lib/php7 + + $(CP) $(PKG_BUILD_DIR)/staging/usr $(STAGING_DIR)/ + + sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#exec_prefix=\"\`eval echo /usr\`\"#exec_prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#/include\`/php\"#/include\`/php7\"#" $(STAGING_DIR)/usr/bin/phpize7 + sed -i -e "s#/lib/php\`/build\"#/lib/php7\`/build\"#" $(STAGING_DIR)/usr/bin/phpize7 + + sed -i -e "s#prefix=\"/usr\"#prefix=\"$(STAGING_DIR)/usr\"#" $(STAGING_DIR)/usr/bin/php7-config + sed -i -e "s#/include/php\"#/include/php7\"#" $(STAGING_DIR)/usr/bin/php7-config +endef + +define BuildModule + + define Package/php7-mod-$(1) + $(call Package/php7/Default) + + ifneq ($(3),) + DEPENDS+=$(3) + endif + + TITLE:=$(2) shared module + endef + + define Package/php7-mod-$(1)/install + $(INSTALL_DIR) $$(1)/usr/lib/php + $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so $$(1)/usr/lib/php/ + $(INSTALL_DIR) $$(1)/etc/php7 + ifeq ($(5),zend) + echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini + else + echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini + endif + endef + + $$(eval $$(call BuildPackage,php7-mod-$(1))) + +endef + +$(eval $(call BuildPackage,php7)) +$(eval $(call BuildPackage,php7-cgi)) +$(eval $(call BuildPackage,php7-cli)) +$(eval $(call BuildPackage,php7-fastcgi)) +$(eval $(call BuildPackage,php7-fpm)) + +#$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS])) +$(eval $(call BuildModule,calendar,Calendar)) +$(eval $(call BuildModule,ctype,Ctype)) +$(eval $(call BuildModule,curl,cURL,+PACKAGE_php7-mod-curl:libcurl)) +$(eval $(call BuildModule,dom,DOM,+@PHP7_LIBXML +PACKAGE_php7-mod-dom:libxml2)) +$(eval $(call BuildModule,exif,EXIF)) +$(eval $(call BuildModule,fileinfo,Fileinfo)) +$(eval $(call BuildModule,ftp,FTP,+PACKAGE_php7-mod-ftp:libopenssl)) +$(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php7-mod-gd:libjpeg +PACKAGE_php7-mod-gd:libpng)) +$(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php7-mod-gettext:libintl-full)) +$(eval $(call BuildModule,gmp,GMP,+PACKAGE_php7-mod-gmp:libgmp)) +$(eval $(call BuildModule,hash,Hash)) +$(eval $(call BuildModule,iconv,iConv,$(ICONV_DEPENDS))) +$(eval $(call BuildModule,intl,Internationalization Functions,+PACKAGE_php7-mod-intl:icu)) +$(eval $(call BuildModule,json,JSON)) +$(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php7-mod-ldap:libopenldap +PACKAGE_php7-mod-ldap:libsasl2)) +$(eval $(call BuildModule,mbstring,MBString)) +$(eval $(call BuildModule,mcrypt,Mcrypt,+PACKAGE_php7-mod-mcrypt:libmcrypt +PACKAGE_php7-mod-mcrypt:libltdl)) +$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php7-mod-mysqli:libmysqlclient)) +$(eval $(call BuildModule,opcache,OPcache,,,zend)) +$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php7-mod-openssl:libopenssl)) +$(eval $(call BuildModule,pcntl,PCNTL)) +$(eval $(call BuildModule,pdo,PHP Data Objects)) +$(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-mysql:libmysqlclient)) +$(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-pgsql:libpq)) +$(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,+php7-mod-pdo +PACKAGE_php7-mod-pdo-sqlite:libsqlite3 +PACKAGE_php7-mod-pdo-sqlite:librt)) +$(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php7-mod-pgsql:libpq)) +$(eval $(call BuildModule,phar,Phar Archives,+php7-mod-hash)) +$(eval $(call BuildModule,session,Session)) +$(eval $(call BuildModule,shmop,Shared Memory)) +$(eval $(call BuildModule,simplexml,SimpleXML,+@PHP7_LIBXML +PACKAGE_php7-mod-simplexml:libxml2)) +$(eval $(call BuildModule,soap,SOAP,+@PHP7_LIBXML +PACKAGE_php7-mod-soap:libxml2)) +$(eval $(call BuildModule,sockets,Sockets)) +$(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php7-mod-sqlite3:libsqlite3)) +$(eval $(call BuildModule,sysvmsg,System V messages)) +$(eval $(call BuildModule,sysvsem,System V shared memory)) +$(eval $(call BuildModule,sysvshm,System V semaphore)) +$(eval $(call BuildModule,tokenizer,Tokenizer)) +$(eval $(call BuildModule,xml,XML,+PHP7_LIBXML:libxml2 +!PHP7_LIBXML:libexpat)) +$(eval $(call BuildModule,xmlreader,XMLReader,+@PHP7_LIBXML +PACKAGE_php7-mod-xmlreader:libxml2)) +$(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP7_LIBXML +PACKAGE_php7-mod-xmlwriter:libxml2)) +$(eval $(call BuildModule,zip,ZIP,+PACKAGE_php7-mod-zip:zlib)) diff --git a/lang/php7/files/php.ini b/lang/php7/files/php.ini new file mode 100644 index 0000000..c88ab0a --- /dev/null +++ b/lang/php7/files/php.ini @@ -0,0 +1,152 @@ +[PHP] +zend.ze1_compatibility_mode = Off + +; Language Options + +engine = On +;short_open_tag = Off +precision = 12 +y2k_compliance = On +output_buffering = Off +;output_handler = +zlib.output_compression = Off +;zlib.output_compression_level = -1 +;zlib.output_handler = +implicit_flush = Off +unserialize_callback_func = +serialize_precision = 100 + +;open_basedir = +disable_functions = +disable_classes = + +; Colors for Syntax Highlighting mode. Anything that's acceptable in +; would work. +;highlight.string = #DD0000 +;highlight.comment = #FF9900 +;highlight.keyword = #007700 +;highlight.bg = #FFFFFF +;highlight.default = #0000BB +;highlight.html = #000000 + +;ignore_user_abort = On +;realpath_cache_size = 16k +;realpath_cache_ttl = 120 + +; Miscellaneous + +expose_php = On + +; Resource Limits + +max_execution_time = 30 ; Maximum execution time of each script, in seconds. +max_input_time = 60 ; Maximum amount of time each script may spend parsing request data. +;max_input_nesting_level = 64 +memory_limit = 8M ; Maximum amount of memory a script may consume. + +; Error handling and logging + +; Error Level Constants: +; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0) +; E_ERROR - fatal run-time errors +; E_RECOVERABLE_ERROR - almost fatal run-time errors +; E_WARNING - run-time warnings (non-fatal errors) +; E_PARSE - compile-time parse errors +; E_NOTICE - run-time notices (these are warnings which often result +; from a bug in your code, but it's possible that it was +; intentional (e.g., using an uninitialized variable and +; relying on the fact it's automatically initialized to an +; empty string) +; E_STRICT - run-time notices, enable to have PHP suggest changes +; to your code which will ensure the best interoperability +; and forward compatibility of your code +; E_CORE_ERROR - fatal errors that occur during PHP's initial startup +; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's +; initial startup +; E_COMPILE_ERROR - fatal compile-time errors +; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) +; E_USER_ERROR - user-generated error message +; E_USER_WARNING - user-generated warning message +; E_USER_NOTICE - user-generated notice message +; E_DEPRECATED - warn about code that will not work in future versions +; of PHP +; E_USER_DEPRECATED - user-generated deprecation warnings +; +; Common Values: +; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) +; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) +; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) +; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) +; Default Value: E_ALL & ~E_NOTICE +error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT + +display_errors = On +display_startup_errors = Off +log_errors = Off +log_errors_max_len = 1024 +ignore_repeated_errors = Off +ignore_repeated_source = Off +report_memleaks = On +;report_zend_debug = 0 +track_errors = Off +;html_errors = Off +;docref_root = "/phpmanual/" +;docref_ext = .html +;error_prepend_string = "" +;error_append_string = "" +; Log errors to specified file. +;error_log = /var/log/php_errors.log +; Log errors to syslog. +;error_log = syslog + +; Data Handling + +;arg_separator.output = "&" +;arg_separator.input = ";&" +variables_order = "EGPCS" +request_order = "GP" +register_globals = Off +register_long_arrays = Off +register_argc_argv = On +auto_globals_jit = On +post_max_size = 8M +;magic_quotes_gpc = Off +magic_quotes_runtime = Off +magic_quotes_sybase = Off +auto_prepend_file = +auto_append_file = +default_mimetype = "text/html" +;default_charset = "iso-8859-1" +;always_populate_raw_post_data = On + +; Paths and Directories + +; UNIX: "/path1:/path2" +;include_path = ".:/php/includes" +doc_root = "/www" +user_dir = +extension_dir = "/usr/lib/php" +enable_dl = On +;cgi.force_redirect = 1 +;cgi.nph = 1 +;cgi.redirect_status_env = ; +cgi.fix_pathinfo=1 +;fastcgi.impersonate = 1; +;fastcgi.logging = 0 +;cgi.rfc2616_headers = 0 + +; File Uploads + +file_uploads = On +upload_tmp_dir = "/tmp" +upload_max_filesize = 2M +max_file_uploads = 20 + +; Fopen wrappers + +allow_url_fopen = On +allow_url_include = Off +;from="john@doe.com" +;user_agent="PHP" +default_socket_timeout = 60 +;auto_detect_line_endings = Off diff --git a/lang/php7/files/php7-fastcgi.config b/lang/php7/files/php7-fastcgi.config new file mode 100644 index 0000000..22e9998 --- /dev/null +++ b/lang/php7/files/php7-fastcgi.config @@ -0,0 +1,3 @@ +config php7-fastcgi + option enabled 1 + option port '1026' diff --git a/lang/php7/files/php7-fastcgi.init b/lang/php7/files/php7-fastcgi.init new file mode 100644 index 0000000..21f5b09 --- /dev/null +++ b/lang/php7/files/php7-fastcgi.init @@ -0,0 +1,29 @@ +#!/bin/sh /etc/rc.common + +START=50 + +SERVICE_DAEMONIZE=1 +SERVICE_WRITE_PID=1 + +start_instance() { + local section="$1" + local enabled + local port + + config_get_bool enabled "$section" 'enabled' 0 + config_get port "$section" 'port' 1026 + + [ $enabled -gt 0 ] || return 1 + + PHP_FCGI_CHILDREN='' \ + service_start /usr/bin/php-fcgi -b $port +} + +start() { + config_load 'php7-fastcgi' + config_foreach start_instance 'php7-fastcgi' +} + +stop() { + service_stop /usr/bin/php-fcgi +} diff --git a/lang/php7/files/php7-fpm-www.conf b/lang/php7/files/php7-fpm-www.conf new file mode 100644 index 0000000..d3a3222 --- /dev/null +++ b/lang/php7/files/php7-fpm-www.conf @@ -0,0 +1,392 @@ +; Start a new pool named 'www'. +; the variable $pool can we used in any directive and will be replaced by the +; pool name ('www' here) +[www] + +; Per pool prefix +; It only applies on the following directives: +; - 'slowlog' +; - 'listen' (unixsocket) +; - 'chroot' +; - 'chdir' +; - 'php_values' +; - 'php_admin_values' +; When not set, the global prefix (or /usr) applies instead. +; Note: This directive can also be relative to the global prefix. +; Default Value: none +;prefix = /path/to/pools/$pool + +; Unix user/group of processes +; Note: The user is mandatory. If the group is not set, the default user's group +; will be used. +user = nobody +;group = + +; The address on which to accept FastCGI requests. +; Valid syntaxes are: +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses on a +; specific port; +; '/path/to/unix/socket' - to listen on a unix socket. +; Note: This value is mandatory. +listen = /var/run/php7-fpm.sock + +; Set listen(2) backlog. +; Default Value: 128 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 128 + +; Set permissions for unix socket, if one is used. In Linux, read/write +; permissions must be set in order to allow connections from a web server. Many +; BSD-derived systems allow connections regardless of permissions. +; Default Values: user and group are set as the running user +; mode is set to 0666 +;listen.owner = www-data +;listen.group = www-data +;listen.mode = 0666 + +; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original +; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address +; must be separated by a comma. If this value is left blank, connections will be +; accepted from any ip address. +; Default Value: any +;listen.allowed_clients = 127.0.0.1 + +; Specify the nice(2) priority to apply to the pool processes (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool processes will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; priority = -19 + +; Choose how the process manager will control the number of child processes. +; Possible Values: +; static - a fixed number (pm.max_children) of child processes; +; dynamic - the number of child processes are set dynamically based on the +; following directives. With this process management, there will be +; always at least 1 children. +; pm.max_children - the maximum number of children that can +; be alive at the same time. +; pm.start_servers - the number of children created on startup. +; pm.min_spare_servers - the minimum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is less than this +; number then some children will be created. +; pm.max_spare_servers - the maximum number of children in 'idle' +; state (waiting to process). If the number +; of 'idle' processes is greater than this +; number then some children will be killed. +; ondemand - no children are created at startup. Children will be forked when +; new requests will connect. The following parameter are used: +; pm.max_children - the maximum number of children that +; can be alive at the same time. +; pm.process_idle_timeout - The number of seconds after which +; an idle process will be killed. +; Note: This value is mandatory. +pm = dynamic + +; The number of child processes to be created when pm is set to 'static' and the +; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. +; This value sets the limit on the number of simultaneous requests that will be +; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. +; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP +; CGI. The below defaults are based on a server without much resources. Don't +; forget to tweak pm.* to fit your needs. +; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' +; Note: This value is mandatory. +pm.max_children = 5 + +; The number of child processes created on startup. +; Note: Used only when pm is set to 'dynamic' +; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 +pm.start_servers = 2 + +; The desired minimum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.min_spare_servers = 1 + +; The desired maximum number of idle server processes. +; Note: Used only when pm is set to 'dynamic' +; Note: Mandatory when pm is set to 'dynamic' +pm.max_spare_servers = 3 + +; The number of seconds after which an idle process will be killed. +; Note: Used only when pm is set to 'ondemand' +; Default Value: 10s +;pm.process_idle_timeout = 10s; + +; The number of requests each child process should execute before respawning. +; This can be useful to work around memory leaks in 3rd party libraries. For +; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. +; Default Value: 0 +;pm.max_requests = 500 + +; The URI to view the FPM status page. If this value is not set, no URI will be +; recognized as a status page. It shows the following informations: +; pool - the name of the pool; +; process manager - static, dynamic or ondemand; +; start time - the date and time FPM has started; +; start since - number of seconds since FPM has started; +; accepted conn - the number of request accepted by the pool; +; listen queue - the number of request in the queue of pending +; connections (see backlog in listen(2)); +; max listen queue - the maximum number of requests in the queue +; of pending connections since FPM has started; +; listen queue len - the size of the socket queue of pending connections; +; idle processes - the number of idle processes; +; active processes - the number of active processes; +; total processes - the number of idle + active processes; +; max active processes - the maximum number of active processes since FPM +; has started; +; max children reached - number of times, the process limit has been reached, +; when pm tries to start more children (works only for +; pm 'dynamic' and 'ondemand'); +; Value are updated in real time. +; Example output: +; pool: www +; process manager: static +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 62636 +; accepted conn: 190460 +; listen queue: 0 +; max listen queue: 1 +; listen queue len: 42 +; idle processes: 4 +; active processes: 11 +; total processes: 15 +; max active processes: 12 +; max children reached: 0 +; +; By default the status page output is formatted as text/plain. Passing either +; 'html', 'xml' or 'json' in the query string will return the corresponding +; output syntax. Example: +; http://www.foo.bar/status +; http://www.foo.bar/status?json +; http://www.foo.bar/status?html +; http://www.foo.bar/status?xml +; +; By default the status page only outputs short status. Passing 'full' in the +; query string will also return status for each pool process. +; Example: +; http://www.foo.bar/status?full +; http://www.foo.bar/status?json&full +; http://www.foo.bar/status?html&full +; http://www.foo.bar/status?xml&full +; The Full status returns for each process: +; pid - the PID of the process; +; state - the state of the process (Idle, Running, ...); +; start time - the date and time the process has started; +; start since - the number of seconds since the process has started; +; requests - the number of requests the process has served; +; request duration - the duration in µs of the requests; +; request method - the request method (GET, POST, ...); +; request URI - the request URI with the query string; +; content length - the content length of the request (only with POST); +; user - the user (PHP_AUTH_USER) (or '-' if not set); +; script - the main script called (or '-' if not set); +; last request cpu - the %cpu the last request consumed +; it's always 0 if the process is not in Idle state +; because CPU calculation is done when the request +; processing has terminated; +; last request memory - the max amount of memory the last request consumed +; it's always 0 if the process is not in Idle state +; because memory calculation is done when the request +; processing has terminated; +; If the process is in Idle state, then informations are related to the +; last request the process has served. Otherwise informations are related to +; the current request being served. +; Example output: +; ************************ +; pid: 31330 +; state: Running +; start time: 01/Jul/2011:17:53:49 +0200 +; start since: 63087 +; requests: 12808 +; request duration: 1250261 +; request method: GET +; request URI: /test_mem.php?N=10000 +; content length: 0 +; user: - +; script: /home/fat/web/docs/php/test_mem.php +; last request cpu: 0.00 +; last request memory: 0 +; +; Note: There is a real-time FPM status monitoring sample web page available +; It's available in: ${prefix}/share/fpm/status.html +; +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;pm.status_path = /status + +; The ping URI to call the monitoring page of FPM. If this value is not set, no +; URI will be recognized as a ping page. This could be used to test from outside +; that FPM is alive and responding, or to +; - create a graph of FPM availability (rrd or such); +; - remove a server from a group if it is not responding (load balancing); +; - trigger alerts for the operating team (24/7). +; Note: The value must start with a leading slash (/). The value can be +; anything, but it may not be a good idea to use the .php extension or it +; may conflict with a real PHP file. +; Default Value: not set +;ping.path = /ping + +; This directive may be used to customize the response of a ping request. The +; response is formatted as text/plain with a 200 response code. +; Default Value: pong +;ping.response = pong + +; The access log file +; Default: not set +;access.log = log/$pool.access.log + +; The access log format. +; The following syntax is allowed +; %%: the '%' character +; %C: %CPU used by the request +; it can accept the following format: +; - %{user}C for user CPU only +; - %{system}C for system CPU only +; - %{total}C for user + system CPU (default) +; %d: time taken to serve the request +; it can accept the following format: +; - %{seconds}d (default) +; - %{miliseconds}d +; - %{mili}d +; - %{microseconds}d +; - %{micro}d +; %e: an environment variable (same as $_ENV or $_SERVER) +; it must be associated with embraces to specify the name of the env +; variable. Some exemples: +; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e +; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e +; %f: script filename +; %l: content-length of the request (for POST request only) +; %m: request method +; %M: peak of memory allocated by PHP +; it can accept the following format: +; - %{bytes}M (default) +; - %{kilobytes}M +; - %{kilo}M +; - %{megabytes}M +; - %{mega}M +; %n: pool name +; %o: ouput header +; it must be associated with embraces to specify the name of the header: +; - %{Content-Type}o +; - %{X-Powered-By}o +; - %{Transfert-Encoding}o +; - .... +; %p: PID of the child that serviced the request +; %P: PID of the parent of the child that serviced the request +; %q: the query string +; %Q: the '?' character if query string exists +; %r: the request URI (without the query string, see %q and %Q) +; %R: remote IP address +; %s: status (response code) +; %t: server time the request was received +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %T: time the log has been written (the request has finished) +; it can accept a strftime(3) format: +; %d/%b/%Y:%H:%M:%S %z (default) +; %u: remote user +; +; Default: "%R - %u %t \"%m %r\" %s" +;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" + +; The log file for slow requests +; Default Value: not set +; Note: slowlog is mandatory if request_slowlog_timeout is set +;slowlog = log/$pool.log.slow + +; The timeout for serving a single request after which a PHP backtrace will be +; dumped to the 'slowlog' file. A value of '0s' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_slowlog_timeout = 0 + +; The timeout for serving a single request after which the worker process will +; be killed. This option should be used when the 'max_execution_time' ini option +; does not stop script execution for some reason. A value of '0' means 'off'. +; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) +; Default Value: 0 +;request_terminate_timeout = 0 + +; Set open file descriptor rlimit. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Chroot to this directory at the start. This value must be defined as an +; absolute path. When this value is not set, chroot is not used. +; Note: you can prefix with '$prefix' to chroot to the pool prefix or one +; of its subdirectories. If the pool prefix is not set, the global prefix +; will be used instead. +; Note: chrooting is a great security feature and should be used whenever +; possible. However, all PHP paths will be relative to the chroot +; (error_log, sessions.save_path, ...). +; Default Value: not set +;chroot = + +; Chdir to this directory at the start. +; Note: relative path can be used. +; Default Value: current directory or / when chroot +chdir = / + +; Redirect worker stdout and stderr into main error log. If not set, stdout and +; stderr will be redirected to /dev/null according to FastCGI specs. +; Note: on highloaded environement, this can cause some delay in the page +; process time (several ms). +; Default Value: no +;catch_workers_output = yes + +; Limits the extensions of the main script FPM will allow to parse. This can +; prevent configuration mistakes on the web server side. You should only limit +; FPM to .php extensions to prevent malicious users to use other extensions to +; exectute php code. +; Note: set an empty value to allow all extensions. +; Default Value: .php +;security.limit_extensions = .php .php3 .php4 .php5 + +; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from +; the current environment. +; Default Value: clean env +;env[HOSTNAME] = $HOSTNAME +;env[PATH] = /usr/local/bin:/usr/bin:/bin +;env[TMP] = /tmp +;env[TMPDIR] = /tmp +;env[TEMP] = /tmp + +; Additional php.ini defines, specific to this pool of workers. These settings +; overwrite the values previously defined in the php.ini. The directives are the +; same as the PHP SAPI: +; php_value/php_flag - you can set classic ini defines which can +; be overwritten from PHP call 'ini_set'. +; php_admin_value/php_admin_flag - these directives won't be overwritten by +; PHP call 'ini_set' +; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. + +; Defining 'extension' will load the corresponding shared extension from +; extension_dir. Defining 'disable_functions' or 'disable_classes' will not +; overwrite previously defined php.ini values, but will append the new value +; instead. + +; Note: path INI options can be relative and will be expanded with the prefix +; (pool, global or /usr) + +; Default Value: nothing is defined by default except the values in php.ini and +; specified at startup with the -d argument +;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com +;php_flag[display_errors] = off +;php_admin_value[error_log] = /var/log/fpm-php.www.log +;php_admin_flag[log_errors] = on +;php_admin_value[memory_limit] = 32M diff --git a/lang/php7/files/php7-fpm.conf b/lang/php7/files/php7-fpm.conf new file mode 100644 index 0000000..c980b21 --- /dev/null +++ b/lang/php7/files/php7-fpm.conf @@ -0,0 +1,121 @@ +;;;;;;;;;;;;;;;;;;;;; +; FPM Configuration ; +;;;;;;;;;;;;;;;;;;;;; + +; All relative paths in this configuration file are relative to PHP's install +; prefix (/usr). This prefix can be dynamically changed by using the +; '-p' argument from the command line. + +; Include one or more files. If glob(3) exists, it is used to include a bunch of +; files from a glob(3) pattern. This directive can be used everywhere in the +; file. +; Relative path can also be used. They will be prefixed by: +; - the global prefix if it's been set (-p argument) +; - /usr otherwise +;include=/etc/php7/fpm/*.conf + +;;;;;;;;;;;;;;;;;; +; Global Options ; +;;;;;;;;;;;;;;;;;; + +[global] +; Pid file +; Note: the default prefix is /var +; Default Value: none +pid = /var/run/php7-fpm.pid + +; Error log file +; If it's set to "syslog", log is sent to syslogd instead of being written +; in a local file. +; Note: the default prefix is /var +; Default Value: log/php-fpm.log +error_log = /var/log/php7-fpm.log + +; syslog_facility is used to specify what type of program is logging the +; message. This lets syslogd specify that messages from different facilities +; will be handled differently. +; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) +; Default Value: daemon +;syslog.facility = daemon + +; syslog_ident is prepended to every message. If you have multiple FPM +; instances running on the same server, you can change the default value +; which must suit common needs. +; Default Value: php-fpm +;syslog.ident = php-fpm + +; Log level +; Possible Values: alert, error, warning, notice, debug +; Default Value: notice +;log_level = notice + +; If this number of child processes exit with SIGSEGV or SIGBUS within the time +; interval set by emergency_restart_interval then FPM will restart. A value +; of '0' means 'Off'. +; Default Value: 0 +;emergency_restart_threshold = 0 + +; Interval of time used by emergency_restart_interval to determine when +; a graceful restart will be initiated. This can be useful to work around +; accidental corruptions in an accelerator's shared memory. +; Available Units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;emergency_restart_interval = 0 + +; Time limit for child processes to wait for a reaction on signals from master. +; Available units: s(econds), m(inutes), h(ours), or d(ays) +; Default Unit: seconds +; Default Value: 0 +;process_control_timeout = 0 + +; The maximum number of processes FPM will fork. This has been design to control +; the global number of processes when using dynamic PM within a lot of pools. +; Use it with caution. +; Note: A value of 0 indicates no limit +; Default Value: 0 +; process.max = 128 + +; Specify the nice(2) priority to apply to the master process (only if set) +; The value can vary from -19 (highest priority) to 20 (lower priority) +; Note: - It will only work if the FPM master process is launched as root +; - The pool process will inherit the master process priority +; unless it specified otherwise +; Default Value: no set +; process.priority = -19 + +; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. +; Default Value: yes +;daemonize = yes + +; Set open file descriptor rlimit for the master process. +; Default Value: system defined value +;rlimit_files = 1024 + +; Set max core size rlimit for the master process. +; Possible Values: 'unlimited' or an integer greater or equal to 0 +; Default Value: system defined value +;rlimit_core = 0 + +; Specify the event mechanism FPM will use. The following is available: +; - select (any POSIX os) +; - poll (any POSIX os) +; - epoll (linux >= 2.5.44) +; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) +; - /dev/poll (Solaris >= 7) +; - port (Solaris >= 10) +; Default Value: not set (auto detection) +; events.mechanism = epoll + +;;;;;;;;;;;;;;;;;;;; +; Pool Definitions ; +;;;;;;;;;;;;;;;;;;;; + +; Multiple pools of child processes may be started with different listening +; ports and different management options. The name of the pool will be +; used in logs and stats. There is no limitation on the number of pools which +; FPM can handle. Your system will tell you anyway :) + +; To configure the pools it is recommended to have one .conf file per +; pool in the following directory: +include=/etc/php7-fpm.d/*.conf diff --git a/lang/php7/files/php7-fpm.config b/lang/php7/files/php7-fpm.config new file mode 100644 index 0000000..3a893c6 --- /dev/null +++ b/lang/php7/files/php7-fpm.config @@ -0,0 +1,2 @@ +config php7-fpm + option enabled 1 diff --git a/lang/php7/files/php7-fpm.init b/lang/php7/files/php7-fpm.init new file mode 100644 index 0000000..c913a2b --- /dev/null +++ b/lang/php7/files/php7-fpm.init @@ -0,0 +1,28 @@ +#!/bin/sh /etc/rc.common + +START=50 + +PROG=/usr/bin/php-fpm +CONFIG=/etc/php7-fpm.conf + +SERVICE_PID_FILE=/var/run/php7-fpm.pid + +start_instance() { + local section="$1" + local enabled + + config_get_bool enabled "$section" 'enabled' 0 + + [ $enabled -gt 0 ] || return 1 + + service_start $PROG -y $CONFIG -g $SERVICE_PID_FILE +} + +start() { + config_load 'php7-fpm' + config_foreach start_instance 'php7-fpm' +} + +stop() { + service_stop $PROG +} diff --git a/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch b/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch new file mode 100644 index 0000000..9d8f989 --- /dev/null +++ b/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch @@ -0,0 +1,673 @@ +From: Joe Orton +Date: Sun, 18 Oct 2015 02:15:17 +0200 +Subject: Add support for use of the system timezone database + +Add support for use of the system timezone database, rather +than embedding a copy. Discussed upstream but was not desired. + +History: +r13: adapt for upstream changes to use PHP allocator +r12: adapt for upstream changes for new zic +r11: use canonical names to avoid more case sensitivity issues + round lat/long from zone.tab towards zero per builtin db +r10: make timezone case insensitive +r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold) +r8: fix compile error without --with-system-tzdata configured +r7: improve check for valid timezone id to exclude directories +r6: fix fd leak in r5, fix country code/BC flag use in + timezone_identifiers_list() using system db, + fix use of PECL timezonedb to override system db, +r5: reverts addition of "System/Localtime" fake tzname. + updated for 5.3.0, parses zone.tab to pick up mapping between + timezone name, country code and long/lat coords +r4: added "System/Localtime" tzname which uses /etc/localtime +r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) +r2: add filesystem trawl to set up name alias index +r1: initial revision +--- + ext/date/lib/parse_tz.c | 549 +++++++++++++++++++++++++++++++++++++++++++++++- + ext/date/lib/timelib.m4 | 14 ++ + 2 files changed, 552 insertions(+), 11 deletions(-) + +diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c +index 20d7eea..6301dc5 100644 +--- a/ext/date/lib/parse_tz.c ++++ b/ext/date/lib/parse_tz.c +@@ -24,6 +24,16 @@ + + #include "timelib.h" + ++#ifdef HAVE_SYSTEM_TZDATA ++#include ++#include ++#include ++#include ++#include ++ ++#include "php_scandir.h" ++#endif ++ + #include + + #ifdef HAVE_LOCALE_H +@@ -36,8 +46,12 @@ + #include + #endif + ++#ifndef HAVE_SYSTEM_TZDATA + #define TIMELIB_SUPPORTS_V2DATA + #include "timezonedb.h" ++#endif ++ ++#include + + #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) + # if defined(__LITTLE_ENDIAN__) +@@ -59,6 +73,11 @@ static int read_preamble(const unsigned char **tzf, timelib_tzinfo *tz) + { + uint32_t version; + ++ if (memcmp(*tzf, "TZif", 4) == 0) { ++ *tzf += 20; ++ return 0; ++ } ++ + /* read ID */ + version = (*tzf)[3] - '0'; + *tzf += 4; +@@ -302,7 +321,418 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz) + } + } + +-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) ++#ifdef HAVE_SYSTEM_TZDATA ++ ++#ifdef HAVE_SYSTEM_TZDATA_PREFIX ++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX ++#else ++#define ZONEINFO_PREFIX "/usr/share/zoneinfo" ++#endif ++ ++/* System timezone database pointer. */ ++static const timelib_tzdb *timezonedb_system; ++ ++/* Hash table entry for the cache of the zone.tab mapping table. */ ++struct location_info { ++ char code[2]; ++ double latitude, longitude; ++ char name[64]; ++ char *comment; ++ struct location_info *next; ++}; ++ ++/* Cache of zone.tab. */ ++static struct location_info **system_location_table; ++ ++/* Size of the zone.tab hash table; a random-ish prime big enough to ++ * prevent too many collisions. */ ++#define LOCINFO_HASH_SIZE (1021) ++ ++/* Compute a case insensitive hash of str */ ++static uint32_t tz_hash(const char *str) ++{ ++ const unsigned char *p = (const unsigned char *)str; ++ uint32_t hash = 5381; ++ int c; ++ ++ while ((c = tolower(*p++)) != '\0') { ++ hash = (hash << 5) ^ hash ^ c; ++ } ++ ++ return hash % LOCINFO_HASH_SIZE; ++} ++ ++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the ++ * parsed string on success, or NULL on parse error. On success, ++ * writes the parsed number to *result. */ ++static char *parse_iso6709(char *p, double *result) ++{ ++ double v, sign; ++ char *pend; ++ size_t len; ++ ++ if (*p == '+') ++ sign = 1.0; ++ else if (*p == '-') ++ sign = -1.0; ++ else ++ return NULL; ++ ++ p++; ++ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) ++ ;; ++ ++ /* Annoying encoding used by zone.tab has no decimal point, so use ++ * the length to determine the format: ++ * ++ * 4 = DDMM ++ * 5 = DDDMM ++ * 6 = DDMMSS ++ * 7 = DDDMMSS ++ */ ++ len = pend - p; ++ if (len < 4 || len > 7) { ++ return NULL; ++ } ++ ++ /* p => [D]DD */ ++ v = (p[0] - '0') * 10.0 + (p[1] - '0'); ++ p += 2; ++ if (len == 5 || len == 7) ++ v = v * 10.0 + (*p++ - '0'); ++ /* p => MM[SS] */ ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 60.0; ++ p += 2; ++ /* p => [SS] */ ++ if (len > 5) { ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 3600.0; ++ p += 2; ++ } ++ ++ /* Round to five decimal place, not because it's a good idea, ++ * but, because the builtin data uses rounded data, so, match ++ * that. */ ++ *result = trunc(v * sign * 100000.0) / 100000.0; ++ ++ return p; ++} ++ ++/* This function parses the zone.tab file to build up the mapping of ++ * timezone to country code and geographic location, and returns a ++ * hash table. The hash table is indexed by the function: ++ * ++ * tz_hash(timezone-name) ++ */ ++static struct location_info **create_location_table(void) ++{ ++ struct location_info **li, *i; ++ char zone_tab[PATH_MAX]; ++ char line[512]; ++ FILE *fp; ++ ++ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); ++ ++ fp = fopen(zone_tab, "r"); ++ if (!fp) { ++ return NULL; ++ } ++ ++ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); ++ ++ while (fgets(line, sizeof line, fp)) { ++ char *p = line, *code, *name, *comment; ++ uint32_t hash; ++ double latitude, longitude; ++ ++ while (isspace(*p)) ++ p++; ++ ++ if (*p == '#' || *p == '\0' || *p == '\n') ++ continue; ++ ++ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') ++ continue; ++ ++ /* code => AA */ ++ code = p; ++ p[2] = 0; ++ p += 3; ++ ++ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ ++ p = parse_iso6709(p, &latitude); ++ if (!p) { ++ continue; ++ } ++ p = parse_iso6709(p, &longitude); ++ if (!p) { ++ continue; ++ } ++ ++ if (!p || *p != '\t') { ++ continue; ++ } ++ ++ /* name = string */ ++ name = ++p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ *p++ = '\0'; ++ ++ /* comment = string */ ++ comment = p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ if (*p == '\n' || *p == '\t') ++ *p = '\0'; ++ ++ hash = tz_hash(name); ++ i = malloc(sizeof *i); ++ memcpy(i->code, code, 2); ++ strncpy(i->name, name, sizeof i->name); ++ i->comment = strdup(comment); ++ i->longitude = longitude; ++ i->latitude = latitude; ++ i->next = li[hash]; ++ li[hash] = i; ++ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ ++ } ++ ++ fclose(fp); ++ ++ return li; ++} ++ ++/* Return location info from hash table, using given timezone name. ++ * Returns NULL if the name could not be found. */ ++const struct location_info *find_zone_info(struct location_info **li, ++ const char *name) ++{ ++ uint32_t hash = tz_hash(name); ++ const struct location_info *l; ++ ++ if (!li) { ++ return NULL; ++ } ++ ++ for (l = li[hash]; l; l = l->next) { ++ if (strcasecmp(l->name, name) == 0) ++ return l; ++ } ++ ++ return NULL; ++} ++ ++/* Filter out some non-tzdata files and the posix/right databases, if ++ * present. */ ++static int index_filter(const struct dirent *ent) ++{ ++ return strcmp(ent->d_name, ".") != 0 ++ && strcmp(ent->d_name, "..") != 0 ++ && strcmp(ent->d_name, "posix") != 0 ++ && strcmp(ent->d_name, "posixrules") != 0 ++ && strcmp(ent->d_name, "right") != 0 ++ && strstr(ent->d_name, ".tab") == NULL; ++} ++ ++static int sysdbcmp(const void *first, const void *second) ++{ ++ const timelib_tzdb_index_entry *alpha = first, *beta = second; ++ ++ return strcasecmp(alpha->id, beta->id); ++} ++ ++ ++/* Create the zone identifier index by trawling the filesystem. */ ++static void create_zone_index(timelib_tzdb *db) ++{ ++ size_t dirstack_size, dirstack_top; ++ size_t index_size, index_next; ++ timelib_tzdb_index_entry *db_index; ++ char **dirstack; ++ ++ /* LIFO stack to hold directory entries to scan; each slot is a ++ * directory name relative to the zoneinfo prefix. */ ++ dirstack_size = 32; ++ dirstack = malloc(dirstack_size * sizeof *dirstack); ++ dirstack_top = 1; ++ dirstack[0] = strdup(""); ++ ++ /* Index array. */ ++ index_size = 64; ++ db_index = malloc(index_size * sizeof *db_index); ++ index_next = 0; ++ ++ do { ++ struct dirent **ents; ++ char name[PATH_MAX], *top; ++ int count; ++ ++ /* Pop the top stack entry, and iterate through its contents. */ ++ top = dirstack[--dirstack_top]; ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); ++ ++ count = php_scandir(name, &ents, index_filter, php_alphasort); ++ ++ while (count > 0) { ++ struct stat st; ++ const char *leaf = ents[count - 1]->d_name; ++ ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", ++ top, leaf); ++ ++ if (strlen(name) && stat(name, &st) == 0) { ++ /* Name, relative to the zoneinfo prefix. */ ++ const char *root = top; ++ ++ if (root[0] == '/') root++; ++ ++ snprintf(name, sizeof name, "%s%s%s", root, ++ *root ? "/": "", leaf); ++ ++ if (S_ISDIR(st.st_mode)) { ++ if (dirstack_top == dirstack_size) { ++ dirstack_size *= 2; ++ dirstack = realloc(dirstack, ++ dirstack_size * sizeof *dirstack); ++ } ++ dirstack[dirstack_top++] = strdup(name); ++ } ++ else { ++ if (index_next == index_size) { ++ index_size *= 2; ++ db_index = realloc(db_index, ++ index_size * sizeof *db_index); ++ } ++ ++ db_index[index_next++].id = strdup(name); ++ } ++ } ++ ++ free(ents[--count]); ++ } ++ ++ if (count != -1) free(ents); ++ free(top); ++ } while (dirstack_top); ++ ++ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); ++ ++ db->index = db_index; ++ db->index_size = index_next; ++ ++ free(dirstack); ++} ++ ++#define FAKE_HEADER "1234\0??\1??" ++#define FAKE_UTC_POS (7 - 4) ++ ++/* Create a fake data segment for database 'sysdb'. */ ++static void fake_data_segment(timelib_tzdb *sysdb, ++ struct location_info **info) ++{ ++ size_t n; ++ char *data, *p; ++ ++ data = malloc(3 * sysdb->index_size + 7); ++ ++ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); ++ ++ for (n = 0; n < sysdb->index_size; n++) { ++ const struct location_info *li; ++ timelib_tzdb_index_entry *ent; ++ ++ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; ++ ++ /* Lookup the timezone name in the hash table. */ ++ if (strcmp(ent->id, "UTC") == 0) { ++ ent->pos = FAKE_UTC_POS; ++ continue; ++ } ++ ++ li = find_zone_info(info, ent->id); ++ if (li) { ++ /* If found, append the BC byte and the ++ * country code; set the position for this ++ * section of timezone data. */ ++ ent->pos = (p - data) - 4; ++ *p++ = '\1'; ++ *p++ = li->code[0]; ++ *p++ = li->code[1]; ++ } ++ else { ++ /* If not found, the timezone data can ++ * point at the header. */ ++ ent->pos = 0; ++ } ++ } ++ ++ sysdb->data = (unsigned char *)data; ++} ++ ++/* Returns true if the passed-in stat structure describes a ++ * probably-valid timezone file. */ ++static int is_valid_tzfile(const struct stat *st) ++{ ++ return S_ISREG(st->st_mode) && st->st_size > 20; ++} ++ ++/* To allow timezone names to be used case-insensitively, find the ++ * canonical name for this timezone, if possible. */ ++static const char *canonical_tzname(const char *timezone) ++{ ++ if (timezonedb_system) { ++ timelib_tzdb_index_entry *ent, lookup; ++ ++ lookup.id = (char *)timezone; ++ ++ ent = bsearch(&lookup, timezonedb_system->index, ++ timezonedb_system->index_size, sizeof lookup, ++ sysdbcmp); ++ if (ent) { ++ return ent->id; ++ } ++ } ++ ++ return timezone; ++} ++ ++/* Return the mmap()ed tzfile if found, else NULL. On success, the ++ * length of the mapped data is placed in *length. */ ++static char *map_tzfile(const char *timezone, size_t *length) ++{ ++ char fname[PATH_MAX]; ++ struct stat st; ++ char *p; ++ int fd; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return NULL; ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ fd = open(fname, O_RDONLY); ++ if (fd == -1) { ++ return NULL; ++ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) { ++ close(fd); ++ return NULL; ++ } ++ ++ *length = st.st_size; ++ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ close(fd); ++ ++ return p != MAP_FAILED ? p : NULL; ++} ++ ++#endif ++ ++static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) + { + int left = 0, right = tzdb->index_size - 1; + #ifdef HAVE_SETLOCALE +@@ -341,21 +771,88 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const + return 0; + } + ++static int seek_to_tz_position(const unsigned char **tzf, char *timezone, ++ char **map, size_t *maplen, ++ const timelib_tzdb *tzdb) ++{ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char *orig; ++ ++ orig = map_tzfile(timezone, maplen); ++ if (orig == NULL) { ++ return 0; ++ } ++ ++ (*tzf) = (unsigned char *)orig; ++ *map = orig; ++ return 1; ++ } ++ else ++#endif ++ { ++ return inmem_seek_to_tz_position(tzf, timezone, tzdb); ++ } ++} ++ + const timelib_tzdb *timelib_builtin_db(void) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ if (timezonedb_system == NULL) { ++ timelib_tzdb *tmp = malloc(sizeof *tmp); ++ ++ tmp->version = "0.system"; ++ tmp->data = NULL; ++ create_zone_index(tmp); ++ system_location_table = create_location_table(); ++ fake_data_segment(tmp, system_location_table); ++ timezonedb_system = tmp; ++ } ++ ++ return timezonedb_system; ++#else + return &timezonedb_builtin; ++#endif + } + + const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ *count = timezonedb_system->index_size; ++ return timezonedb_system->index; ++#else + *count = sizeof(timezonedb_idx_builtin) / sizeof(*timezonedb_idx_builtin); + return timezonedb_idx_builtin; ++#endif + } + + int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; +- return (seek_to_tz_position(&tzf, timezone, tzdb)); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char fname[PATH_MAX]; ++ struct stat st; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return 0; ++ } ++ ++ if (system_location_table) { ++ if (find_zone_info(system_location_table, timezone) != NULL) { ++ /* found in cache */ ++ return 1; ++ } ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ return stat(fname, &st) == 0 && is_valid_tzfile(&st); ++ } ++#endif ++ ++ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); + } + + static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) +@@ -380,24 +877,54 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz) + timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; ++ char *memmap = NULL; ++ size_t maplen; + timelib_tzinfo *tmp; + int version; + +- if (seek_to_tz_position(&tzf, timezone, tzdb)) { ++ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { + tmp = timelib_tzinfo_ctor(timezone); + + version = read_preamble(&tzf, tmp); + read_header(&tzf, tmp); + read_transistions(&tzf, tmp); + read_types(&tzf, tmp); +- if (version == 2) { +- skip_64bit_preamble(&tzf, tmp); +- read_64bit_header(&tzf, tmp); +- skip_64bit_transistions(&tzf, tmp); +- skip_64bit_types(&tzf, tmp); +- skip_posix_string(&tzf, tmp); +- } +- read_location(&tzf, tmp); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (memmap) { ++ const struct location_info *li; ++ ++ /* TZif-style - grok the location info from the system database, ++ * if possible. */ ++ ++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { ++ tmp->location.comments = timelib_strdup(li->comment); ++ strncpy(tmp->location.country_code, li->code, 2); ++ tmp->location.longitude = li->longitude; ++ tmp->location.latitude = li->latitude; ++ tmp->bc = 1; ++ } ++ else { ++ strcpy(tmp->location.country_code, "??"); ++ tmp->bc = 0; ++ tmp->location.comments = timelib_strdup(""); ++ } ++ ++ /* Now done with the mmap segment - discard it. */ ++ munmap(memmap, maplen); ++ } else ++#endif ++ { ++ /* PHP-style - use the embedded info. */ ++ if (version == 2) { ++ skip_64bit_preamble(&tzf, tmp); ++ read_64bit_header(&tzf, tmp); ++ skip_64bit_transistions(&tzf, tmp); ++ skip_64bit_types(&tzf, tmp); ++ skip_posix_string(&tzf, tmp); ++ } ++ read_location(&tzf, tmp); ++ } + } else { + tmp = NULL; + } +diff --git a/ext/date/lib/timelib.m4 b/ext/date/lib/timelib.m4 +index c725572..4c837c7 100644 +--- a/ext/date/lib/timelib.m4 ++++ b/ext/date/lib/timelib.m4 +@@ -78,3 +78,17 @@ stdlib.h + + dnl Check for strtoll, atoll + AC_CHECK_FUNCS(strtoll atoll strftime) ++ ++PHP_ARG_WITH(system-tzdata, for use of system timezone data, ++[ --with-system-tzdata[=DIR] to specify use of system timezone data], ++no, no) ++ ++if test "$PHP_SYSTEM_TZDATA" != "no"; then ++ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) ++ ++ if test "$PHP_SYSTEM_TZDATA" != "yes"; then ++ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", ++ [Define for location of system timezone data]) ++ fi ++fi ++ diff --git a/lang/php7/patches/0016-dont-gitclean-in-build.patch b/lang/php7/patches/0016-dont-gitclean-in-build.patch new file mode 100644 index 0000000..32de557 --- /dev/null +++ b/lang/php7/patches/0016-dont-gitclean-in-build.patch @@ -0,0 +1,19 @@ +From: Debian PHP Maintainers +Date: Sat, 2 May 2015 10:26:53 +0200 +Subject: dont-gitclean-in-build + +--- + build/build.mk | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/build/build.mk b/build/build.mk +index 9452984..b964def 100644 +--- a/build/build.mk ++++ b/build/build.mk +@@ -63,6 +63,5 @@ gitclean-work: + @if (test ! -f '.git/info/exclude' || grep -s "git-ls-files" .git/info/exclude); then \ + (echo "Rebuild .git/info/exclude" && echo '*.o' > .git/info/exclude && git svn propget svn:ignore | grep -v config.nice >> .git/info/exclude); \ + fi; \ +- git clean -X -f -d; + + .PHONY: $(ALWAYS) snapshot diff --git a/lang/php7/patches/0032-Use-system-timezone.patch b/lang/php7/patches/0032-Use-system-timezone.patch new file mode 100644 index 0000000..11a6393 --- /dev/null +++ b/lang/php7/patches/0032-Use-system-timezone.patch @@ -0,0 +1,43 @@ +From: Debian PHP Maintainers +Date: Sat, 2 May 2015 10:26:56 +0200 +Subject: Use system timezone + +Upstream don't want this patch. See +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771 for a summary. + +This delta is recovered from previous versions of the system timezone patch in +Debian, and appears to have inadvertently been dropped. Author unknown. + +To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezonedb_fixes.patch. +--- + ext/date/php_date.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/ext/date/php_date.c b/ext/date/php_date.c +index e780b2e..2b5a528 100644 +--- a/ext/date/php_date.c ++++ b/ext/date/php_date.c +@@ -992,6 +992,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb) + DATEG(timezone_valid) = 1; + return DATEG(default_timezone); + } ++ /* Try to guess timezone from system information */ ++ { ++ struct tm *ta, tmbuf; ++ time_t the_time; ++ char *tzid = NULL; ++ ++ the_time = time(NULL); ++ ta = php_localtime_r(&the_time, &tmbuf); ++ if (ta) { ++ tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst); ++ } ++ if (! tzid) { ++ tzid = "UTC"; ++ } ++ ++ return tzid; ++ } + /* Fallback to UTC */ + return "UTC"; + } diff --git a/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch b/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch new file mode 100644 index 0000000..abfd6f7 --- /dev/null +++ b/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch @@ -0,0 +1,131 @@ +From: Thijs Kinkhorst +Date: Wed, 15 Jun 2016 09:18:03 +0200 +Subject: Add patch to remove build timestamps from generated binaries. + +--- + ext/standard/info.c | 1 - + sapi/apache2handler/config.m4 | 15 +++------------ + sapi/cgi/cgi_main.c | 4 ++-- + sapi/cli/php_cli.c | 4 ++-- + sapi/fpm/fpm/fpm_main.c | 4 ++-- + sapi/litespeed/lsapi_main.c | 4 ++-- + sapi/phpdbg/phpdbg.c | 4 +--- + 7 files changed, 12 insertions(+), 24 deletions(-) + +diff --git a/ext/standard/info.c b/ext/standard/info.c +index e6eaac3..024e5c9 100644 +--- a/ext/standard/info.c ++++ b/ext/standard/info.c +@@ -863,7 +863,6 @@ PHPAPI void php_print_info(int flag) + php_info_print_box_end(); + php_info_print_table_start(); + php_info_print_table_row(2, "System", ZSTR_VAL(php_uname)); +- php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__); + #ifdef COMPILER + php_info_print_table_row(2, "Compiler", COMPILER); + #endif +diff --git a/sapi/apache2handler/config.m4 b/sapi/apache2handler/config.m4 +index f286b1a..fba92b8 100644 +--- a/sapi/apache2handler/config.m4 ++++ b/sapi/apache2handler/config.m4 +@@ -59,18 +59,9 @@ if test "$PHP_APXS2" != "no"; then + APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1" + + APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR` +- if test -z `$APXS -q SYSCONFDIR`; then +- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ +- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ +- -i -n php7" +- else +- APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR` +- INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ +- \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \ +- $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ +- -S SYSCONFDIR='$APXS_SYSCONFDIR' \ +- -i -a -n php7" +- fi ++ INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \ ++ $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \ ++ -i -n php7" + + case $host_alias in + *aix*) +diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c +index 8983b53..589e299 100644 +--- a/sapi/cgi/cgi_main.c ++++ b/sapi/cgi/cgi_main.c +@@ -2216,9 +2216,9 @@ consult the installation file that came with this distribution, or visit \n\ + SG(request_info).no_headers = 1; + } + #if ZEND_DEBUG +- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #else +- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #endif + php_request_shutdown((void *) 0); + fcgi_shutdown(); +diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c +index 978c8b3..3ee61a4 100644 +--- a/sapi/cli/php_cli.c ++++ b/sapi/cli/php_cli.c +@@ -682,8 +682,8 @@ static int do_cli(int argc, char **argv) /* {{{ */ + goto out; + + case 'v': /* show php version & quit */ +- php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", +- PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__, ++ php_printf("PHP %s (%s) ( %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", ++ PHP_VERSION, cli_sapi_module.name, + #if ZTS + "ZTS " + #else +diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c +index 5adeb63..5e60255 100644 +--- a/sapi/fpm/fpm/fpm_main.c ++++ b/sapi/fpm/fpm/fpm_main.c +@@ -1757,9 +1757,9 @@ int main(int argc, char *argv[]) + SG(request_info).no_headers = 1; + + #if ZEND_DEBUG +- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #else +- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #endif + php_request_shutdown((void *) 0); + fcgi_shutdown(); +diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c +index b0ea105..4feb8f3 100644 +--- a/sapi/litespeed/lsapi_main.c ++++ b/sapi/litespeed/lsapi_main.c +@@ -811,9 +811,9 @@ static int cli_main( int argc, char * argv[] ) + case 'v': + if (php_request_startup() != FAILURE) { + #if ZEND_DEBUG +- php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #else +- php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version()); ++ php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version()); + #endif + #ifdef PHP_OUTPUT_NEWAPI + php_output_end_all(); +diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c +index 68a164c..82565d8 100644 +--- a/sapi/phpdbg/phpdbg.c ++++ b/sapi/phpdbg/phpdbg.c +@@ -1657,10 +1657,8 @@ + phpdbg_do_help(NULL); + } else if (show_version) { + phpdbg_out( +- "phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s", ++ "phpdbg %s\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s", + PHPDBG_VERSION, +- __DATE__, +- __TIME__, + PHP_VERSION, + get_zend_version() + ); diff --git a/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch b/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch new file mode 100644 index 0000000..78f7dca --- /dev/null +++ b/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch @@ -0,0 +1,25 @@ +From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= +Date: Wed, 29 Jul 2015 14:37:55 +0200 +Subject: Remove W3C validation icon to not expose the reader's IP address to + potential tracking. + +--- + sapi/fpm/status.html.in | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/sapi/fpm/status.html.in b/sapi/fpm/status.html.in +index 86492d7..31c31ff 100644 +--- a/sapi/fpm/status.html.in ++++ b/sapi/fpm/status.html.in +@@ -71,11 +71,6 @@ + PID↓Start TimeStart SinceRequests ServedRequest DurationRequest methodRequest URIContent LengthUserScriptLast Request %CPULast Request Memory + + +-

+- +- Valid XHTML 1.0 Transitional +- +-

+ + + + + + diff --git a/net/addrwatch/Makefile b/net/addrwatch/Makefile new file mode 100644 index 0000000..aadac26 --- /dev/null +++ b/net/addrwatch/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=addrwatch +PKG_VERSION:=0.8 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-master.tar.gz +PKG_SOURCE_URL:=https://github.com/fln/addrwatch/releases/download/$(PKG_VERSION)/ +PKG_MD5SUM:=8f401415be993005fa5fb58a05e14295 +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-master +PKG_FIXUP:=autoreconf +PKG_BUILD_DEPENDS:=USE_UCLIBC:argp-standalone USE_MUSL:argp-standalone + +include $(INCLUDE_DIR)/package.mk + +define Package/addrwatch + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libevent2 + TITLE:=IPv4/IPv6 and ethernet address pairing tool + URL:=https://github.com/fln/addrwatch + MAINTAINER:=Ondrej Caletka +endef + +define Package/addrwatch/description + This is a tool similar to arpwatch. It main purpose is to monitor network and + log discovered ethernet/ip pairings. Addrwatch is extremely useful in networks + with IPv6 autoconfiguration (RFC4862) enabled. It allows to track IPv6 + addresses of hosts using IPv6 privacy extensions (RFC4941). +endef + +define Package/addrwatch/conffiles + /etc/config/addrwatch +endef + +define Package/addrwatch/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/addrwatch $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/addrwatch.init $(1)/etc/init.d/addrwatch + $(INSTALL_CONF) ./files/addrwatch.config $(1)/etc/config/addrwatch$ +endef + +$(eval $(call BuildPackage,addrwatch)) diff --git a/net/addrwatch/files/addrwatch.config b/net/addrwatch/files/addrwatch.config new file mode 100644 index 0000000..177eeef --- /dev/null +++ b/net/addrwatch/files/addrwatch.config @@ -0,0 +1,12 @@ + +config addrwatch + option disabled '0' + list interface 'lan' + #list interface 'wan' + #option syslog '1' + #option verbose '0' + #option output '/var/log/addrwatch' + #list blacklist '192.168.1.1' + #option hashsize '1' + #option ratelimit '-1' + diff --git a/net/addrwatch/files/addrwatch.init b/net/addrwatch/files/addrwatch.init new file mode 100644 index 0000000..c7cbbfe --- /dev/null +++ b/net/addrwatch/files/addrwatch.init @@ -0,0 +1,74 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2016 OpenWrt.org + +START=50 +USE_PROCD=1 + +. /lib/functions/network.sh + +validate_section_addrwatch() { + uci_validate_section addrwatch addrwatch "${1}" \ + 'disabled:bool:0' \ + 'interface:list(string):lan' \ + 'syslog:bool:1' \ + 'output:string' \ + 'quiet:bool:0' \ + 'verbose:bool:0' \ + 'ipv4only:bool:0' \ + 'ipv6only:bool:0' \ + 'blacklist:list(or(ip4addr,ip6addr))' \ + 'hashsize:range(1,65536):1024'\ + 'ratelimit:integer:3600' + return $? +} + +start_instance() { + local cfg="$1" + local disabled interface syslog output quiet verbose ipv4only ipv6only + local blacklist hashsize ratelimit + local netdevs="" + + validate_section_addrwatch "${cfg}" || { + echo "validation of config $cfg failed" + return 1 + } + [ $disabled -ne 0 ] && return 1 + + for iface in $interface; do + local netdev + network_get_physdev netdev "${iface}" + append netdevs "${netdev}" + done + + procd_open_instance + procd_set_param command /usr/sbin/addrwatch + [ "${syslog}" -eq 1 ] && procd_append_param command --syslog + [ -n "${output}" ] && procd_append_param command --output "$output" + [ "$quiet" -eq 1 ] && procd_append_param command --quiet + [ "$verbose" -eq 1 ] && procd_append_param command --verbose + [ "$ipv4only" -eq 1 ] && procd_append_param command --ipv4only + [ "$ipv6only" -eq 1 ] && procd_append_param command --ipv6only + [ -n "$hashsize" ] && procd_append_param command --hashsize "$hashsize" + [ -n "$ratelimit" ] && procd_append_param command --ratelimit "$ratelimit" + for blitem in $blacklist; do + procd_append_param command "--blacklist=${blitem}" + done + procd_append_param command $netdevs + procd_set_param netdev $netdevs + procd_set_param respawn + procd_open_trigger + for iface in $interface; do + procd_add_interface_trigger "interface.*" ${iface} /etc/init.d/addrwatch reload + done + procd_close_trigger + procd_close_instance +} + +start_service() { + config_load 'addrwatch' + config_foreach start_instance 'addrwatch' +} + +service_triggers() { + procd_add_reload_trigger 'addrwatch' +} diff --git a/net/addrwatch/patches/001-fix-sys_siglist.patch b/net/addrwatch/patches/001-fix-sys_siglist.patch new file mode 100644 index 0000000..53032b5 --- /dev/null +++ b/net/addrwatch/patches/001-fix-sys_siglist.patch @@ -0,0 +1,32 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -56,9 +56,6 @@ AC_CHECK_HEADERS([arpa/inet.h netinet/in + # Checks for typedefs, structures, and compiler characteristics. + AC_C_INLINE + AC_TYPE_PID_T +-AC_CHECK_DECLS([sys_siglist], [], [ +- AC_MSG_ERROR([Unable to find sys_siglist declaration.]) +-], [[#include ]]) + AC_TYPE_UINT32_T + AC_TYPE_UINT16_T + AC_TYPE_UINT8_T +--- a/src/addrwatch.c ++++ b/src/addrwatch.c +@@ -339,7 +339,7 @@ void reload_cb(evutil_socket_t fd, short + void reload_cb(int fd, short events, void *arg) + #endif + { +- log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, sys_siglist[fd]); ++ log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, strsignal(fd)); + log_msg(LOG_DEBUG, "Reopening output files"); + + output_flatfile_reload(); +@@ -353,7 +353,7 @@ void stop_cb(evutil_socket_t fd, short e + void stop_cb(int fd, short events, void *arg) + #endif + { +- log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, sys_siglist[fd]); ++ log_msg(LOG_DEBUG, "Received signal (%d), %s", fd, strsignal(fd)); + #if HAVE_LIBEVENT2 + event_base_loopbreak(cfg.eb); + #else diff --git a/net/addrwatch/patches/002-fix-uclibc-sysconf.patch b/net/addrwatch/patches/002-fix-uclibc-sysconf.patch new file mode 100644 index 0000000..c3c0e2e --- /dev/null +++ b/net/addrwatch/patches/002-fix-uclibc-sysconf.patch @@ -0,0 +1,11 @@ +--- a/src/addrwatch.c ++++ b/src/addrwatch.c +@@ -492,7 +492,7 @@ int main(int argc, char *argv[]) + argp_parse(&argp, argc, argv, 0, &optind, 0); + + if (!cfg.hostname) { +- cfg.hostname_len = sysconf(_SC_HOST_NAME_MAX); ++ cfg.hostname_len = HOST_NAME_MAX; + cfg.hostname = (char *)calloc(cfg.hostname_len, sizeof(char)); + gethostname(cfg.hostname, cfg.hostname_len); + } diff --git a/net/aggregate/Makefile b/net/aggregate/Makefile new file mode 100644 index 0000000..0127285 --- /dev/null +++ b/net/aggregate/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=aggregate +PKG_VERSION:=1.6 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://ftp.isc.org/isc/aggregate/ +PKG_MD5SUM:=6fcc515388bf2c5b0c8f9f733bfee7e1 + +PKG_MAINTAINER:=Nikil Mehta +PKG_LICENSE:=ISC +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/aggregate + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=ipv4 cidr prefix aggregator + URL:=https://ftp.isc.org/isc/aggregate/ +endef + +define Package/aggregate/description + takes a list of prefixes in conventional format on stdin, and performs two + optimisations to reduce the length of the prefix list. It removes any + supplied prefixes which are supurfluous because they are already included in + another supplied prefix (e.g., 203.97.2.0/24 would be removed if + 203.97.0.0/17 was also supplied), and identifies adjacent prefixes that can + be combined under a single, shorter-length prefix (e.g., 203.97.2.0/24 and + 203.97.3.0/24 can be combined into the single prefix 203.97.2.0/23). +endef + +define Package/aggregate/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/aggregate $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,aggregate)) diff --git a/net/aircrack-ng/Makefile b/net/aircrack-ng/Makefile new file mode 100644 index 0000000..866db9f --- /dev/null +++ b/net/aircrack-ng/Makefile @@ -0,0 +1,74 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=aircrack-ng +PKG_VERSION:=1.2-rc1 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://download.aircrack-ng.org/ \ + http://archive.aircrack-ng.org/aircrack-ng/$(PKG_VERSION)/ +PKG_MD5SUM:=c2f8648c92f7e46051c86c618d4fb0d5 + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Rick Farina + +include $(INCLUDE_DIR)/package.mk + +define Package/aircrack-ng + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libpthread +libopenssl +libnl-core +libnl-genl +zlib + TITLE:=WLAN tools (without airmon-ng) for breaking 802.11 WEP/WPA keys + URL:=http://www.aircrack-ng.org/ + SUBMENU:=wireless +endef + +define Package/aircrack-ng/description + WLAN tools for breaking 802.11 WEP/WPA keys +endef + +define Package/airmon-ng + SECTION:=net + CATEGORY:=Network + DEPENDS:=+wireless-tools +ethtool +procps-ng +CONFIG_PCI_SUPPORT:pciutils +CONFIG_USB_SUPPORT:usbutils + TITLE:=Bash script designed to turn wireless cards into monitor mode. + URL:=http://www.aircrack-ng.org/ + SUBMENU:=wireless +endef + +define Package/airmon-ng/description + Bash script designed to turn wireless cards into monitor mode. +endef + +MAKE_FLAGS += prefix=/usr \ + libnl=true \ + sqlite=false \ + unstable=false \ + OSNAME=Linux + +define Package/aircrack-ng/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ + rm -f $(1)/usr/sbin/airmon-ng +endef + +define Package/airmon-ng/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/airmon-ng $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,aircrack-ng)) +$(eval $(call BuildPackage,airmon-ng)) diff --git a/net/announce/Makefile b/net/announce/Makefile new file mode 100644 index 0000000..60d9e63 --- /dev/null +++ b/net/announce/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=announce +PKG_VERSION:=1.0.1 +PKG_RELEASE:=1 +PKG_LICENSE:=BSD-3-Clause +PKG_LICENSE_FILES:=src/LICENSE.txt +PKG_MAINTAINER:=Simon Peter + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/probonopd/announce.git +PKG_SOURCE_VERSION:=1368525c7305ca5bb4134242f332344f5f7e94e3 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION) +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +PKG_BUILD_DEPENDS:= +libpthread + +define Package/announce + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=Announce services on the network with Zeroconf/Bonjour + URL:=https://github.com/probonopd/announce + DEPENDS:= +libpthread +endef + +define Package/announce/description + Announce services on the network with Zeroconf/Bonjour. + This announces services such as ssh, sftp, and http running on the local machine + to the network. +endef + +define Build/Prepare + $(call Build/Prepare/Default) + $(CP) $(PKG_BUILD_DIR)/src/* $(PKG_BUILD_DIR)/ +endef + +define Package/announce/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/announce $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/announce.initscript $(1)/etc/init.d/announce +endef + +$(eval $(call BuildPackage,announce)) diff --git a/net/apache/Makefile b/net/apache/Makefile new file mode 100644 index 0000000..6d24fb4 --- /dev/null +++ b/net/apache/Makefile @@ -0,0 +1,165 @@ +# +# Copyright (C) 2007-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=apache +PKG_VERSION:=2.2.31 +PKG_RELEASE:=2 +PKG_SOURCE_NAME:=httpd +PKG_MAINTAINER:=Thomas Heil +PKG_LICENSE:=Apache License + +PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@APACHE/httpd/ +PKG_MD5SUM:=6c10e15835ab214464228a9beb7afba8 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION) + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/apache/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=The Apache Web Server + URL:=http://httpd.apache.org/ +endef + +define Package/apache/Default/description + The Apache Web Server is a powerful and flexible HTTP/1.1 compliant + web server. Originally designed as a replacement for the NCSA HTTP + Server, it has grown to be the most popular web server on the Internet. +endef + +define Package/apache +$(call Package/apache/Default) + DEPENDS:=+libapr +libaprutil +libpcre +libopenssl +unixodbc +endef + +define Package/apache/description +$(call Package/apache/Default/description) + . + This package contains the Apache web server and utility programs. + . + Take care that you don't include apache at the moment into your image + please select it only as module because busybox will override + /usr/sbin/httpd. It'll be solved soon. If you need to include this + package in the image anyway, remove httpd from busybox + (Base system --> Configuration --> Networking Utilities --> httpd). + Also you should take care for the initscripts, apache's httpd isn't + compatible with the one from busybox, so if you want to use apache + for running your webif, you'll need to change the parameters in the + scripts and configure the rest in /etc/httpd.conf. +endef + +define Package/apache/conffiles +/etc/apache/httpd.conf +/etc/apache/extra/httpd-autoindex.conf +/etc/apache/extra/httpd-dav.conf +/etc/apache/extra/httpd-default.conf +/etc/apache/extra/httpd-info.conf +/etc/apache/extra/httpd-languages.conf +/etc/apache/extra/httpd-manual.conf +/etc/apache/extra/httpd-mpm.conf +/etc/apache/extra/httpd-multilang-errordoc.conf +/etc/apache/extra/httpd-ssl.conf +/etc/apache/extra/httpd-userdir.conf +/etc/apache/extra/httpd-vhosts.conf +/etc/apache/magic +/etc/apache/mime.types +endef + +define Package/apache-icons +$(call Package/apache/Default) + TITLE:=Icons from Apache + DEPENDS:=apache +endef + +define Package/apache-icons/description +$(call Package/apache/Default/description) + . + This package contains the icons from Apache. +endef + +TARGET_CFLAGS += $(FPIC) +TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +define Build/Configure + $(call Build/Configure/Default, \ + --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \ + --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \ + --with-pcre="$(STAGING_DIR)/usr/bin/pcre-config" \ + --enable-http \ + --enable-ssl \ + --enable-proxy \ + --disable-disk-cache \ + --enable-maintainer-mode \ + --enable-mime-magic \ + --without-suexec-bin \ + --sysconfdir=/etc/apache \ + ap_cv_void_ptr_lt_long=no \ + logfiledir="/var/log" \ + runtimedir="/var/run" \ + ) +endef + +define Build/InstallDev + rm -rf $(PKG_INSTALL_DIR)/usr/man/ \ + $(PKG_INSTALL_DIR)/usr/share/manual/ + # if you need docs take a look into the build-dir :) + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/* \ + $(1)/etc + $(INSTALL_DIR) $(1)/usr/include/apache + $(CP) $(PKG_INSTALL_DIR)/usr/include/* \ + $(1)/usr/include/apache + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/httpd.exp \ + $(1)/usr/lib + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* \ + $(1)/usr/sbin + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/* \ + $(1)/usr/share +endef + +define Package/apache/preinst + rm /usr/sbin/httpd + echo -e "You should take a look in the initscripts, busybox's httpd \n\ + uses some parameters which are maybe unsupported by apache." +endef + +define Package/apache/install + $(INSTALL_DIR) $(1)/usr/sbin + # we don't need apxs on the router, it's just for building apache modules. + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{ab,apachectl,checkgid,dbmmanage,envvars,envvars-std,htcacheclean,htdbm,htdigest,htpasswd,httpd,httxt2dbm,logresolve,rotatelogs} $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/httpd.exp $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/{error,htdocs,cgi-bin,build} $(1)/usr/share/ + $(INSTALL_DIR) $(1)/etc/apache + $(CP) $(PKG_INSTALL_DIR)/etc/apache/{httpd.conf,magic,mime.types,extra} $(1)/etc/apache/ +endef + +define Package/apache/postrm + rm -rf /usr/sbin/httpd + ln -s /bin/busybox /usr/sbin/httpd + echo -e "You may need to change your initscripts back for the use \n\ + with busybox's httpd." +endef + +define Package/apache-icons/install + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/icons $(1)/usr/share/ +endef + +$(eval $(call BuildPackage,apache)) +$(eval $(call BuildPackage,apache-icons)) diff --git a/net/apache/patches/001-Makefile_in.patch b/net/apache/patches/001-Makefile_in.patch new file mode 100644 index 0000000..0bccfd3 --- /dev/null +++ b/net/apache/patches/001-Makefile_in.patch @@ -0,0 +1,14 @@ +--- a/server/Makefile.in ++++ b/server/Makefile.in +@@ -26,7 +26,10 @@ gen_test_char: $(gen_test_char_OBJECTS) + $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS) + + test_char.h: gen_test_char +- ./gen_test_char > test_char.h ++ true ++# ./gen_test_char > test_char.h ++# doesn't matter if you run it on the buildhost or on an wl500gd, ++# same output on both, so i just patched in the test_char.h :). + + util.lo: test_char.h + diff --git a/net/apache/patches/002-test_char_h.patch b/net/apache/patches/002-test_char_h.patch new file mode 100644 index 0000000..e8ea3cd --- /dev/null +++ b/net/apache/patches/002-test_char_h.patch @@ -0,0 +1,26 @@ +--- /dev/null ++++ b/server/test_char.h +@@ -0,0 +1,23 @@ ++/* this file is automatically generated by gen_test_char, do not edit */ ++#define T_ESCAPE_SHELL_CMD (1) ++#define T_ESCAPE_PATH_SEGMENT (2) ++#define T_OS_ESCAPE_PATH (4) ++#define T_HTTP_TOKEN_STOP (8) ++#define T_ESCAPE_LOGITEM (16) ++#define T_ESCAPE_FORENSIC (32) ++ ++static const unsigned char test_char_table[256] = { ++ 32,62,62,62,62,62,62,62,62,62,63,62,62,62,62,62,62,62,62,62, ++ 62,62,62,62,62,62,62,62,62,62,62,62,14,0,23,6,1,38,1,1, ++ 9,9,1,0,8,0,0,10,0,0,0,0,0,0,0,0,0,0,40,15, ++ 15,8,15,15,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ++ 0,0,0,0,0,0,0,0,0,0,0,15,31,15,7,0,7,0,0,0, ++ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, ++ 0,0,0,15,39,15,1,62,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, ++ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54 ++}; diff --git a/net/apache/patches/003-logdir_fix.patch b/net/apache/patches/003-logdir_fix.patch new file mode 100644 index 0000000..635c65c --- /dev/null +++ b/net/apache/patches/003-logdir_fix.patch @@ -0,0 +1,33 @@ +--- a/build/mkconfNW.awk ++++ b/build/mkconfNW.awk +@@ -24,7 +24,7 @@ BEGIN { + A["sysconfdir"] = "conf" + A["iconsdir"] = "icons" + A["manualdir"] = "manual" +- A["runtimedir"] = "logs" ++ A["runtimedir"] = "log" + A["errordir"] = "error" + A["proxycachedir"] = "proxy" + +--- a/config.layout ++++ b/config.layout +@@ -28,8 +28,8 @@ + cgidir: ${datadir}/cgi-bin + includedir: ${prefix}/include + localstatedir: ${prefix} +- runtimedir: ${localstatedir}/logs +- logfiledir: ${localstatedir}/logs ++ runtimedir: ${localstatedir}/log ++ logfiledir: ${localstatedir}/log + proxycachedir: ${localstatedir}/proxy + + +@@ -150,7 +150,7 @@ + includedir: ${prefix}/include + localstatedir: /var${prefix} + runtimedir: ${localstatedir}/run +- logfiledir: ${localstatedir}/logs ++ logfiledir: ${localstatedir}/log + proxycachedir: ${localstatedir}/proxy + + diff --git a/net/apache/patches/004-pidfile_fix.patch b/net/apache/patches/004-pidfile_fix.patch new file mode 100644 index 0000000..e9f0b6d --- /dev/null +++ b/net/apache/patches/004-pidfile_fix.patch @@ -0,0 +1,11 @@ +--- a/include/scoreboard.h ++++ b/include/scoreboard.h +@@ -42,7 +42,7 @@ extern "C" { + + /* Scoreboard file, if there is one */ + #ifndef DEFAULT_SCOREBOARD +-#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" ++#define DEFAULT_SCOREBOARD "log/apache_runtime_status" + #endif + + /* Scoreboard info on a process is, for now, kept very brief --- diff --git a/net/apache/patches/005-httpd_conf.patch b/net/apache/patches/005-httpd_conf.patch new file mode 100644 index 0000000..3bcbba4 --- /dev/null +++ b/net/apache/patches/005-httpd_conf.patch @@ -0,0 +1,60 @@ +--- a/docs/conf/httpd.conf.in ++++ b/docs/conf/httpd.conf.in +@@ -52,7 +52,6 @@ Listen @@Port@@ + # Example: + # LoadModule foo_module modules/mod_foo.so + # +-@@LoadModule@@ + + + +@@ -64,8 +63,8 @@ Listen @@Port@@ + # It is usually good practice to create a dedicated user and group for + # running httpd, as with most system services. + # +-User daemon +-Group daemon ++User nobody ++Group nogroup + + + +@@ -192,7 +191,7 @@ ErrorLog "@rel_logfiledir@/error_log" + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + # +-LogLevel warn ++LogLevel debug + + + # +@@ -337,7 +336,7 @@ DefaultType text/plain + # contents of the file itself to determine its type. The MIMEMagicFile + # directive tells the module where the hint definitions are located. + # +-#MIMEMagicFile @rel_sysconfdir@/magic ++MIMEMagicFile @rel_sysconfdir@/magic + + # + # Customizable error responses come in three flavors: +@@ -366,7 +365,7 @@ DefaultType text/plain + # broken on your system. + # + #EnableMMAP off +-#EnableSendfile off ++EnableSendfile off + + # Supplemental configuration + # +@@ -412,7 +411,7 @@ DefaultType text/plain + # starting without SSL on platforms with no /dev/random equivalent + # but a statically compiled-in mod_ssl. + # +- +-SSLRandomSeed startup builtin +-SSLRandomSeed connect builtin +- ++# ++#SSLRandomSeed startup builtin ++#SSLRandomSeed connect builtin ++# diff --git a/net/apache/patches/006-remove-ssl3.patch b/net/apache/patches/006-remove-ssl3.patch new file mode 100644 index 0000000..c09654c --- /dev/null +++ b/net/apache/patches/006-remove-ssl3.patch @@ -0,0 +1,13 @@ +--- a/support/ab.c ++++ b/support/ab.c +@@ -2232,8 +2232,10 @@ int main(int argc, const char * const ar + } else if (strncasecmp(optarg, "SSL2", 4) == 0) { + meth = SSLv2_client_method(); + #endif ++#ifndef OPENSSL_NO_SSL3_METHOD + } else if (strncasecmp(optarg, "SSL3", 4) == 0) { + meth = SSLv3_client_method(); ++#endif + #ifdef HAVE_TLSV1_X + } else if (strncasecmp(optarg, "TLS1.1", 6) == 0) { + meth = TLSv1_1_client_method(); diff --git a/net/apcupsd/Makefile b/net/apcupsd/Makefile new file mode 100644 index 0000000..e0b8016 --- /dev/null +++ b/net/apcupsd/Makefile @@ -0,0 +1,106 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=apcupsd +PKG_VERSION:=3.14.14 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Othmar Truniger +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/apcupsd +PKG_MD5SUM:=cc8f5ced77f38906a274787acb9bc980 + +PKG_BUILD_DEPENDS:=libgd + +include $(INCLUDE_DIR)/package.mk + +define Package/apcupsd + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpthread +libusb-compat + TITLE:=UPS control software + URL:=http://www.apcupsd.org/ +endef + +define Package/apcupsd-cgi + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpthread +libgd + TITLE:=UPS control software CGI module + URL:=http://www.apcupsd.org/ +endef + +define Build/Configure + $(CP) $(SCRIPT_DIR)/config.* $(PKG_BUILD_DIR)/autoconf/ + $(call Build/Configure/Default, \ + --with-distname=unknown \ + --sysconfdir=/etc/apcupsd \ + --enable-cgi \ + --enable-usb \ + --enable-modbus-usb \ + --without-x \ + ) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + LD="$(TARGET_CC)" \ + all install +endef + +define Package/apcupsd/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcupsd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/smtp $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apctest $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apcaccess $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/apcupsd + $(INSTALL_CONF) ./files/apcupsd.conf $(1)/etc/apcupsd/ + $(INSTALL_CONF) ./files/apcupsd_mail.conf $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/changeme $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/commfailure $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/commok $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/offbattery $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/onbattery $(1)/etc/apcupsd/ + $(INSTALL_BIN) ./files/apccontrol $(1)/etc/apcupsd/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/apcupsd.init $(1)/etc/init.d/apcupsd +endef + +define Package/apcupsd-cgi/install + $(INSTALL_DIR) $(1)/www/cgi-bin/apcupsd + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/apcupsd/*.cgi $(1)/www/cgi-bin/apcupsd + $(INSTALL_DIR) $(1)/etc/apcupsd + $(INSTALL_CONF) ./files/apcupsd.css $(1)/etc/apcupsd/ + $(INSTALL_CONF) ./files/hosts.conf $(1)/etc/apcupsd/ + $(INSTALL_CONF) ./files/multimon.conf $(1)/etc/apcupsd/ +endef + +define Package/apcupsd/conffiles +/etc/apcupsd/apcupsd.conf +/etc/apcupsd/apcupsd_mail.conf +/etc/apcupsd/changeme +/etc/apcupsd/commfailure +/etc/apcupsd/commok +/etc/apcupsd/offbattery +/etc/apcupsd/onbattery +endef + +define Package/apcupsd-cgi/conffiles +/etc/apcupsd/apcupsd.css +/etc/apcupsd/hosts.conf +/etc/apcupsd/multimon.conf +endef + +$(eval $(call BuildPackage,apcupsd)) +$(eval $(call BuildPackage,apcupsd-cgi)) diff --git a/net/apcupsd/files/apccontrol b/net/apcupsd/files/apccontrol new file mode 100644 index 0000000..2549354 --- /dev/null +++ b/net/apcupsd/files/apccontrol @@ -0,0 +1,146 @@ +#!/bin/sh +# +# Copyright (C) 1999-2002 Riccardo Facchetti +# +# for apcupsd release 3.14.1 (04 May 2007) - unknown +# +# platforms/apccontrol. Generated from apccontrol.in by configure. +# +# Note, this is a generic file that can be used by most +# systems. If a particular system needs to have something +# special, start with this file, and put a copy in the +# platform subdirectory. +# + +# +# These variables are needed for set up the autoconf other variables. +# +prefix=/usr +exec_prefix=/usr + +APCPID=/var/run/apcupsd.pid +APCUPSD=/usr/sbin/apcupsd +SHUTDOWN=/sbin/shutdown +SCRIPTSHELL=/bin/sh +SCRIPTDIR=/etc/apcupsd +WALL=true + +# +# Concatenate all output from this script to the events file +# Note, the following kills the script in a power fail situation +# where the disks are mounted read-only. +# exec >>/var/log/apcupsd.events 2>&1 + +# +# This piece is to substitute the default behaviour with your own script, +# perl, or C program. +# You can customize every single command creating an executable file (may be a +# script or a compiled program) and calling it the same as the $1 parameter +# passed by apcupsd to this script. +# +# After executing your script, apccontrol continues with the default action. +# If you do not want apccontrol to continue, exit your script with exit +# code 99. E.g. "exit 99". +# +# WARNING: the apccontrol file will be overwritten every time you update your +# apcupsd, doing `make install'. Your own customized scripts will _not_ be +# overwritten. If you wish to make changes to this file (discouraged), you +# should change apccontrol.sh.in and then rerun the configure process. +# +if [ -f ${SCRIPTDIR}/${1} -a -x ${SCRIPTDIR}/${1} ] +then + ${SCRIPTDIR}/${1} ${2} ${3} ${4} + # exit code 99 means he does not want us to do default action + if [ $? = 99 ] ; then + exit 0 + fi +fi + +case "$1" in + killpower) + echo "Apccontrol doing: ${APCUPSD} --killpower on UPS ${2}" + sleep 10 + ${APCUPSD} --killpower + echo "Apccontrol has done: ${APCUPSD} --killpower on UPS ${2}" | ${WALL} + ;; + commfailure) + echo "Warning communications lost with UPS ${2}" | ${WALL} + ;; + commok) + echo "Communications restored with UPS ${2}" | ${WALL} + ;; +# +# powerout, onbattery, offbattery, mainsback events occur +# in that order. +# + powerout) + echo "Warning power loss detected on UPS ${2}" | ${WALL} + ;; + onbattery) + echo "Power failure on UPS ${2}. Running on batteries." | ${WALL} + ;; + offbattery) + ;; + mainsback) + echo "Power has returned on UPS ${2}..." | ${WALL} + if [ -f /etc/powerfail ] ; then + printf "Continuing with shutdown." | ${WALL} + fi + ;; + failing) + echo "Battery power exhaused on UPS ${2}. Doing shutdown." | ${WALL} + ;; + timeout) + echo "Battery time limit exceeded on UPS ${2}. Doing shutdown." | ${WALL} + ;; + loadlimit) + echo "Remaining battery charge below limit on UPS ${2}. Doing shutdown." | ${WALL} + ;; + runlimit) + echo "Remaining battery runtime below limit on UPS ${2}. Doing shutdown." | ${WALL} + ;; + doreboot) + echo "UPS ${2} initiating Reboot Sequence" | ${WALL} + ${SHUTDOWN} -r now "apcupsd UPS ${2} initiated reboot" + ;; + doshutdown) + echo "UPS ${2} initiated Shutdown Sequence" | ${WALL} + ${SHUTDOWN} -h now "apcupsd UPS ${2} initiated shutdown" + ;; + annoyme) + echo "Power problems with UPS ${2}. Please logoff." | ${WALL} + ;; + emergency) + echo "Emergency Shutdown. Possible battery failure on UPS ${2}." | ${WALL} + ;; + changeme) + echo "Emergency! Batteries have failed on UPS ${2}. Change them NOW" | ${WALL} + ;; + remotedown) + echo "Remote Shutdown. Beginning Shutdown Sequence." | ${WALL} + ;; + restartme) + echo -n "Restarting APCUPSD Power Management: " + THEPID=`cat ${APCPID}` + kill ${THEPID} + rm -f ${APCPID} + rm -f /etc/powerfail + rm -f /etc/nologin + sleep 5 + `${APCUPSD}` + echo "apcupsd" + ;; + startselftest) + ;; + endselftest) + ;; + battdetach) + ;; + battattach) + ;; + *) echo "Usage: ${0##*/} command" + echo " warning: this script is intended to be launched by" + echo " apcupsd and should never be launched by users." + exit 1 + ;; +esac diff --git a/net/apcupsd/files/apcupsd.conf b/net/apcupsd/files/apcupsd.conf new file mode 100644 index 0000000..5f478b9 --- /dev/null +++ b/net/apcupsd/files/apcupsd.conf @@ -0,0 +1,322 @@ +## apcupsd.conf v1.1 ## +# +# for apcupsd release 3.14.1 (04 May 2007) - unknown +# +# "apcupsd" POSIX config file + +# +# ========= General configuration parameters ============ +# + +# UPSNAME xxx +# Use this to give your UPS a name in log files and such. This +# is particularly useful if you have multiple UPSes. This does not +# set the EEPROM. It should be 8 characters or less. +UPSNAME ups1 + +# UPSCABLE +# Defines the type of cable connecting the UPS to your computer. +# +# Possible generic choices for are: +# simple, smart, ether, usb +# +# Or a specific cable model number may be used: +# 940-0119A, 940-0127A, 940-0128A, 940-0020B, +# 940-0020C, 940-0023A, 940-0024B, 940-0024C, +# 940-1524C, 940-0024G, 940-0095A, 940-0095B, +# 940-0095C, M-04-02-2000 +# +UPSCABLE smart + +# To get apcupsd to work, in addition to defining the cable +# above, you must also define a UPSTYPE, which corresponds to +# the type of UPS you have (see the Description for more details). +# You must also specify a DEVICE, sometimes referred to as a port. +# For USB UPSes, please leave the DEVICE directive blank. For +# other UPS types, you must specify an appropriate port or address. +# +# UPSTYPE DEVICE Description +# apcsmart /dev/tty** Newer serial character device, +# appropriate for SmartUPS models using +# a serial cable (not USB). +# +# usb Most new UPSes are USB. A blank DEVICE +# setting enables autodetection, which is +# the best choice for most installations. +# +# net hostname:port Network link to a master apcupsd +# through apcupsd's Network Information +# Server. This is used if you don't have +# a UPS directly connected to your computer. +# +# snmp hostname:port:vendor:community +# SNMP Network link to an SNMP-enabled +# UPS device. Vendor is the MIB used by +# the UPS device: can be "APC", "APC_NOTRAP" +# or "RFC" where APC is the powernet MIB, +# "APC_NOTRAP" is powernet with SNMP trap +# catching disabled, and RFC is the IETF's +# rfc1628 UPS-MIB. You usually want "APC". +# Port is usually 161. Community is usually +# "private". +# +# dumb /dev/tty** Old serial character device for use +# with simple-signaling UPSes. +# +# pcnet ipaddr:username:passphrase +# PowerChute Network Shutdown protocol +# which can be used as an alternative to SNMP +# with AP9617 family of smart slot cards. +# ipaddr is the IP address of the UPS mgmt +# card. username and passphrase are the +# credentials for which the card has been +# configured. +# +UPSTYPE apcsmart +DEVICE /dev/ttyS0 + + +# LOCKFILE +# Path for device lock file. Not used on Win32. +LOCKFILE /var/lock + +# SCRIPTDIR +# Directory in which apccontrol and event scripts are located. +SCRIPTDIR /etc/apcupsd + +# PWRFAILDIR +# Directory in which to write the powerfail flag file. This file +# is created when apcupsd initiates a system shutdown and is +# checked in the OS halt scripts to determine if a killpower +# (turning off UPS output power) is required. +PWRFAILDIR /etc + +# NOLOGINDIR +# Directory in which to write the nologin file. The existence +# of this flag file tells the OS to disallow new logins. +NOLOGINDIR /etc + + +# +# ======== Configuration parameters used during power failures ========== +# + +# The ONBATTERYDELAY is the time in seconds from when a power failure +# is detected until we react to it with an onbattery event. +# +# This means that, apccontrol will be called with the powerout argument +# immediately when a power failure is detected. However, the +# onbattery argument is passed to apccontrol only after the +# ONBATTERYDELAY time. If you don't want to be annoyed by short +# powerfailures, make sure that apccontrol powerout does nothing +# i.e. comment out the wall. +#ONBATTERYDELAY 6 + +# +# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so +# the first that occurs will cause the initiation of a shutdown. +# + +# If during a power failure, the remaining battery percentage +# (as reported by the UPS) is below or equal to BATTERYLEVEL, +# apcupsd will initiate a system shutdown. +BATTERYLEVEL 5 + +# If during a power failure, the remaining runtime in minutes +# (as calculated internally by the UPS) is below or equal to MINUTES, +# apcupsd, will initiate a system shutdown. +MINUTES 3 + +# If during a power failure, the UPS has run on batteries for TIMEOUT +# many seconds or longer, apcupsd will initiate a system shutdown. +# A value of 0 disables this timer. +# +# Note, if you have a Smart UPS, you will most likely want to disable +# this timer by setting it to zero. That way, you UPS will continue +# on batteries until either the % charge remaining drops to or below BATTERYLEVEL, +# or the remaining battery runtime drops to or below MINUTES. Of course, +# if you are testing, setting this to 60 causes a quick system shutdown +# if you pull the power plug. +# If you have an older dumb UPS, you will want to set this to less than +# the time you know you can run on batteries. +TIMEOUT 0 + +# Time in seconds between annoying users to signoff prior to +# system shutdown. 0 disables. +ANNOY 300 + +# Initial delay after power failure before warning users to get +# off the system. +ANNOYDELAY 60 + +# The condition which determines when users are prevented from +# logging in during a power failure. +# NOLOGON [ disable | timeout | percent | minutes | always ] +NOLOGON disable + +# If KILLDELAY is non-zero, apcupsd will continue running after a +# shutdown has been requested, and after the specified time in +# seconds attempt to kill the power. This is for use on systems +# where apcupsd cannot regain control after a shutdown. +# KILLDELAY 0 disables +KILLDELAY 0 + +# +# ==== Configuration statements for Network Information Server ==== +# + +# NETSERVER [ on | off ] on enables, off disables the network +# information server. If netstatus is on, a network information +# server process will be started for serving the STATUS and +# EVENT data over the network (used by CGI programs). +NETSERVER on + +# NISIP +# IP address on which NIS server will listen for incoming connections. +# This is useful if your server is multi-homed (has more than one +# network interface and IP address). Default value is 0.0.0.0 which +# means any incoming request will be serviced. Alternatively, you can +# configure this setting to any specific IP address of your server and +# NIS will listen for connections only on that interface. Use the +# loopback address (127.0.0.1) to accept connections only from the +# local machine. +NISIP 0.0.0.0 + +# NISPORT default is 3551 as registered with the IANA +# port to use for sending STATUS and EVENTS data over the network. +# It is not used unless NETSERVER is on. If you change this port, +# you will need to change the corresponding value in the cgi directory +# and rebuild the cgi programs. +NISPORT 3551 + +# If you want the last few EVENTS to be available over the network +# by the network information server, you must define an EVENTSFILE. +EVENTSFILE /var/log/apcupsd.events + +# EVENTSFILEMAX +# By default, the size of the EVENTSFILE will be not be allowed to exceed +# 10 kilobytes. When the file grows beyond this limit, older EVENTS will +# be removed from the beginning of the file (first in first out). The +# parameter EVENTSFILEMAX can be set to a different kilobyte value, or set +# to zero to allow the EVENTSFILE to grow without limit. +EVENTSFILEMAX 10 + +# +# ========== Configuration statements used if sharing ============= +# a UPS with more than one machine + +# NETTIME +# Interval (in seconds) at which the NIS client polls the server. +# Used only when this apcupsd is a network client (UPSTYPE net). +#NETTIME 60 + +# +# Remaining items are for ShareUPS (APC expansion card) ONLY +# + +# UPSCLASS [ standalone | shareslave | sharemaster ] +# Normally standalone unless you share an UPS using an APC ShareUPS +# card. +UPSCLASS standalone + +# UPSMODE [ disable | share ] +# Normally disable unless you share an UPS using an APC ShareUPS card. +UPSMODE disable + +# +# ===== Configuration statements to control apcupsd system logging ======== +# + +# Time interval in seconds between writing the STATUS file; 0 disables +STATTIME 0 + +# Location of STATUS file (written to only if STATTIME is non-zero) +STATFILE /var/log/apcupsd.status + +# LOGSTATS [ on | off ] on enables, off disables +# Note! This generates a lot of output, so if +# you turn this on, be sure that the +# file defined in syslog.conf for LOG_NOTICE is a named pipe. +# You probably do not want this on. +LOGSTATS off + +# Time interval in seconds between writing the DATA records to +# the log file. 0 disables. +DATATIME 0 + +# FACILITY defines the logging facility (class) for logging to syslog. +# If not specified, it defaults to "daemon". This is useful +# if you want to separate the data logged by apcupsd from other +# programs. +#FACILITY DAEMON + +# +# ========== Configuration statements used in updating the UPS EPROM ========= +# + +# +# These statements are used only by apctest when choosing "Set EEPROM with conf +# file values" from the EEPROM menu. THESE STATEMENTS HAVE NO EFFECT ON APCUPSD. +# + +# UPS name, max 8 characters +#UPSNAME UPS_IDEN + +# Battery date - 8 characters +#BATTDATE mm/dd/yy + +# Sensitivity to line voltage quality (H cause faster transfer to batteries) +# SENSITIVITY H M L (default = H) +#SENSITIVITY H + +# UPS delay after power return (seconds) +# WAKEUP 000 060 180 300 (default = 0) +#WAKEUP 60 + +# UPS Grace period after request to power off (seconds) +# SLEEP 020 180 300 600 (default = 20) +#SLEEP 180 + +# Low line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 106 103 100 097 +# M 177 172 168 182 +# A 092 090 088 086 +# I 208 204 200 196 (default = 0 => not valid) +#LOTRANSFER 208 + +# High line voltage causing transfer to batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 127 130 133 136 +# M 229 234 239 224 +# A 108 110 112 114 +# I 253 257 261 265 (default = 0 => not valid) +#HITRANSFER 253 + +# Battery charge needed to restore power +# RETURNCHARGE 00 15 50 90 (default = 15) +#RETURNCHARGE 15 + +# Alarm delay +# 0 = zero delay after pwr fail, T = power fail + 30 sec, L = low battery, N = never +# BEEPSTATE 0 T L N (default = 0) +#BEEPSTATE T + +# Low battery warning delay in minutes +# LOWBATT 02 05 07 10 (default = 02) +#LOWBATT 2 + +# UPS Output voltage when running on batteries +# The permitted values depend on your model as defined by last letter +# of FIRMWARE or APCMODEL. Some representative values are: +# D 115 +# M 208 +# A 100 +# I 230 240 220 225 (default = 0 => not valid) +#OUTPUTVOLTS 230 + +# Self test interval in hours 336=2 weeks, 168=1 week, ON=at power on +# SELFTEST 336 168 ON OFF (default = 336) +#SELFTEST 336 diff --git a/net/apcupsd/files/apcupsd.css b/net/apcupsd/files/apcupsd.css new file mode 100644 index 0000000..e98c75e --- /dev/null +++ b/net/apcupsd/files/apcupsd.css @@ -0,0 +1,64 @@ +body { + color: black; + background: white; +} + +div.Center { + text-align: center; +} + +img { + border-style: none; +} + +pre { + text-align: left; +} + +strong { + color: red; +} + +table.Outer { + color: black; + background: #60a0a0; + empty-cells: show; border: solid #60a0a0 +} + +th.Outer { + color: black; + background: #60b0b0 +} + +.Title { + font-size: 18pt; +} + +.SubTitle { + font-size: 12pt; +} + +.Empty { + color: black; + background: aqua; +} + +.Fault { + color: black; + background: red; +} + +.Label { + color: black; + background: aqua; +} + +.Normal { + color: black; + background: lime; +} + +.Warning { + color: black; + background: yellow; +} diff --git a/net/apcupsd/files/apcupsd.init b/net/apcupsd/files/apcupsd.init new file mode 100644 index 0000000..5454377 --- /dev/null +++ b/net/apcupsd/files/apcupsd.init @@ -0,0 +1,12 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +START=50 +STOP=50 + +start() { + /usr/sbin/apcupsd -f /etc/apcupsd/apcupsd.conf +} + +stop() { + kill $(cat /var/run/apcupsd.pid) +} diff --git a/net/apcupsd/files/apcupsd_mail.conf b/net/apcupsd/files/apcupsd_mail.conf new file mode 100644 index 0000000..3ada8e5 --- /dev/null +++ b/net/apcupsd/files/apcupsd_mail.conf @@ -0,0 +1,7 @@ +#!/bin/sh + +MAILPROG="/usr/sbin/smtp" +MAILHOST="mail:25" +FROM="OpenWrt" +TO="apcups@example.com" +HOSTNAME="OpenWrt" diff --git a/net/apcupsd/files/changeme b/net/apcupsd/files/changeme new file mode 100644 index 0000000..bcf448a --- /dev/null +++ b/net/apcupsd/files/changeme @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# detects that the battery should be replaced. +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME UPS battery needs changing NOW." +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/commfailure b/net/apcupsd/files/commfailure new file mode 100644 index 0000000..b899195 --- /dev/null +++ b/net/apcupsd/files/commfailure @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# loses contact with the UPS (i.e. the serial connection is not responding). +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Communications with UPS lost" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/commok b/net/apcupsd/files/commok new file mode 100644 index 0000000..cd5d1c6 --- /dev/null +++ b/net/apcupsd/files/commok @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# restores contact with the UPS (i.e. the serial connection is restored). +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Communications with UPS restored" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/hosts.conf b/net/apcupsd/files/hosts.conf new file mode 100644 index 0000000..854e008 --- /dev/null +++ b/net/apcupsd/files/hosts.conf @@ -0,0 +1,19 @@ +# Network UPS Tools - hosts.conf +# +# This file does double duty - it lists the systems that multimon will +# monitor, and also specifies the systems that upsstats is allowed to +# watch. It keeps people from feeding random addresses to upsstats, +# among other things. upsimage also uses this file to know who it +# may speak to. upsfstats too. +# +# Usage: list systems running upsd that you want to monitor +# +# MONITOR
"" +# +# Please note, MONITOR must start in column 1 (no spaces permitted) +# +# Example: +# MONITOR 10.64.1.1 "Finance department" +# MONITOR 10.78.1.1 "Sierra High School data room #1" +# +MONITOR 127.0.0.1 "Local Host" diff --git a/net/apcupsd/files/multimon.conf b/net/apcupsd/files/multimon.conf new file mode 100644 index 0000000..4cdf9b0 --- /dev/null +++ b/net/apcupsd/files/multimon.conf @@ -0,0 +1,63 @@ +# Sample multimon configuration file +# +# This file is not required. Without it, multimon will use the default +# field layout. +# +# Temperature selection +# +# Pick "TEMPC" for Celsius or "TEMPF" for Fahrenheit. This will override +# the --enable-celsius setting from the compile. UPSTEMP (below) will +# use this setting by default. + +TEMPC + +# Format: +# FIELD "" "" +# +# is either a word from the UPS protocol like battchg (see the +# table in src/cgi/upsfetch.c) or a special word in uppercase. +# +# Special words are: +# MODEL - Show the model name for this system in cyan +# +# STATUS - Parse the status for this system using the appropriate color +# +# UPSTEMP and AMBTEMP use the default scale. This is set to C if you use +# --enable-celsius at compile time *or* if you use "TEMPC" above. +# +# UPSTEMP - Show the UPS temperature in the default scale (suffix ignored) +# AMBTEMP - Show the ambient temperature in the default scale (suffix ignored) +# +# UPSTEMPC - Show the UPS temperature in degrees C (suffix ignored) +# UPSTEMPF - Show the UPS temperature in degrees F (suffix ignored) +# AMBTEMPC - Show the ambient temperature in degrees C (suffix ignored) +# AMBTEMPF - Show the ambient temperature in degrees F (suffix ignored) +# +# They're called "special" since they actually understand the content +# being printed and do other things based on what's in there. +# +# is what you'd like this column to be called on the page. +# Remember that this is HTML, so you can actually embed markup in here. +# This means you can even include images here. You can include quotes +# (and backslashes!) in the string by escaping them with a backslash (\). +# +# is typically something like % or VAC. It's useful if +# you want to convey the units that apply to a value. +# +# Example config + +FIELD SYSTEM "System" "" +FIELD MODEL "Model" "" +FIELD STATUS "Status" "" +FIELD battpct "Battery Chg" "%" +FIELD utility "Utility" "VAC" +FIELD loadpct "UPS Load" "%" +FIELD UPSTEMP "UPS Temp" "" +FIELD runtime "Batt. Run Time" "min." +FIELD DATA "Data" "All data" + +# These are only useful if you have a Smart-UPS model with the Measure-UPS II +# measurement card. No other models presently support these features. +# +# FIELD AMBTEMP "Ambient Temp" "" +# FIELD HUMIDITY "Ambient Humidity" "%" diff --git a/net/apcupsd/files/offbattery b/net/apcupsd/files/offbattery new file mode 100644 index 0000000..cd5d1c6 --- /dev/null +++ b/net/apcupsd/files/offbattery @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when apcupsd +# restores contact with the UPS (i.e. the serial connection is restored). +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Communications with UPS restored" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/files/onbattery b/net/apcupsd/files/onbattery new file mode 100644 index 0000000..ee5f653 --- /dev/null +++ b/net/apcupsd/files/onbattery @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This shell script if placed in /etc/apcupsd +# will be called by /etc/apcupsd/apccontrol when the UPS +# goes on batteries. +# We send an email message to root to notify him. +# +. /etc/apcupsd/apcupsd_mail.conf + +MSG="$HOSTNAME Power Failure !!!" +# +( + echo "$MSG" + echo " " + /usr/sbin/apcaccess status +) | $MAILPROG -h $MAILHOST -f $FROM -s "$MSG" $TO +exit 0 diff --git a/net/apcupsd/patches/010-fix-usb.patch b/net/apcupsd/patches/010-fix-usb.patch new file mode 100644 index 0000000..b313bb2 --- /dev/null +++ b/net/apcupsd/patches/010-fix-usb.patch @@ -0,0 +1,8 @@ +--- a/include/libusb.h.in.orig 2015-02-21 18:53:51.023682068 +0100 ++++ a/include/libusb.h.in 2015-02-21 18:54:14.722788757 +0100 +@@ -6,4 +6,4 @@ + * path at configure time and various apcupsd bits include this + * when they need libusb's usb.h. + */ +-#include "@LIBUSBH@" ++#include "usb.h" diff --git a/net/apinger/Makefile b/net/apinger/Makefile new file mode 100644 index 0000000..5d73ae1 --- /dev/null +++ b/net/apinger/Makefile @@ -0,0 +1,67 @@ +# +# Copyright (C) 2006-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=apinger +PKG_VERSION:=0.6.1 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/Jajcus/apinger.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=c7da72f7ec26eedd7fd8d224c0e10787b204f94e +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_MAINTAINER:=Alex Samorukov +PKG_LICENSE:= GPL-2.0 + +PKG_FIXUP:=autoreconf + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/apinger + SECTION:=net + CATEGORY:=Network + TITLE:=Tool which monitors various IP devices by simple ICMP echo requests + URL:=https://github.com/Jajcus/apinger + PKG_MAINTAINER:=Alex Samorukov +endef + +define Package/apinger/description + Alarm Pinger (apinger) is a little tool which monitors various IP devices by + simple ICMP echo requests. There are various other tools, that can do this, + but most of them are shell or perl scripts, spawning many processes, thus much + CPU-expensive, especially when one wants continuous monitoring and fast + response on target failure. Alarm Pinger is a single program written in C, so + it doesn't need much CPU power even when monitoring many targets with frequent + probes. Alarm Pinger supports both IPv4 and IPv6. The code have been tested + on Linux and FreeBSD. +endef + +define Package/apinger/conffiles +/etc/apinger.conf +endef + +define Build/Configure + $(call Build/Configure/Default) +endef + +define Package/apinger/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/apinger $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/apinger.conf $(1)/etc/apinger.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/apinger.init $(1)/etc/init.d/apinger +endef + +$(eval $(call BuildPackage,apinger)) + diff --git a/net/apinger/files/apinger.init b/net/apinger/files/apinger.init new file mode 100644 index 0000000..8caac38 --- /dev/null +++ b/net/apinger/files/apinger.init @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=80 + +SERVICE_USE_PID=1 + +start() { + service_start /usr/sbin/apinger +} + +stop() { + service_stop /usr/sbin/apinger +} + +reload() { + service_reload /usr/sbin/apinger +} diff --git a/net/apinger/patches/001-autoreconf.patch b/net/apinger/patches/001-autoreconf.patch new file mode 100644 index 0000000..cb5bd45 --- /dev/null +++ b/net/apinger/patches/001-autoreconf.patch @@ -0,0 +1,13 @@ +--- apinger-0.6.1/acinclude.m4 2003-10-21 12:44:48.000000000 +0000 ++++ apinger-0.6.1/acinclude.m4 2015-04-08 15:27:37.451903960 +0000 +@@ -39,9 +39,7 @@ + [$jk_inet_includes + $jk_icmp_includes]) + +-AC_CHECK_MEMBERS([struct icmp.icmp_type, struct icmp.icmp_code,\ +-struct icmp.icmp_cksum, struct icmp.icmp_seq,\ +-struct icmp.icmp_id],[], ++AC_CHECK_MEMBERS([struct icmp.icmp_type, struct icmp.icmp_code,struct icmp.icmp_cksum, struct icmp.icmp_seq,struct icmp.icmp_id],[], + AC_MSG_ERROR(struct icmp not defined or not compatible), + [$jk_inet_includes + $jk_icmp_includes]) diff --git a/net/apinger/patches/002-run_as_user.patch b/net/apinger/patches/002-run_as_user.patch new file mode 100644 index 0000000..16d64ac --- /dev/null +++ b/net/apinger/patches/002-run_as_user.patch @@ -0,0 +1,11 @@ +--- apinger-0.6.1/src/apinger.conf.orig 2015-04-08 16:05:24.558919722 +0000 ++++ apinger-0.6.1/src/apinger.conf 2015-04-08 16:07:47.089170236 +0000 +@@ -9,7 +9,7 @@ + + ## User and group the pinger should run as + user "nobody" +-group "nobody" ++group "nogroup" + + ## Mailer to use (default: "/usr/lib/sendmail -t") + #mailer "/var/qmail/bin/qmail-inject" diff --git a/net/apinger/patches/003-no_docs.patch b/net/apinger/patches/003-no_docs.patch new file mode 100644 index 0000000..c08f44d --- /dev/null +++ b/net/apinger/patches/003-no_docs.patch @@ -0,0 +1,11 @@ +--- apinger-0.6.1/Makefile.am.orig 2015-04-08 16:47:40.999990050 +0000 ++++ apinger-0.6.1/Makefile.am 2015-04-08 16:48:07.565220137 +0000 +@@ -1,7 +1,7 @@ + + EXTRA_DIST = autogen.sh TODO BUGS + +-SUBDIRS = src doc ++SUBDIRS = src + + .PHONY: ChangeLog + diff --git a/net/aria2/Config.in b/net/aria2/Config.in new file mode 100644 index 0000000..b0d7309 --- /dev/null +++ b/net/aria2/Config.in @@ -0,0 +1,45 @@ +menu "Aria2 configuration" + depends on PACKAGE_aria2 + +choice + prompt "SSL library" + default ARIA2_OPENSSL + +config ARIA2_OPENSSL + bool "OpenSSL" + +config ARIA2_GNUTLS + bool "GNUTLS" + +config ARIA2_NOSSL + bool "No SSL support" + +endchoice + +config ARIA2_BITTORRENT + bool "Enable bittorrent support" + depends on ARIA2_OPENSSL + default n + +config ARIA2_METALINK + bool "Enable metalink support" + default n + +config ARIA2_SFTP + bool "Enable sftp support" + default n + +choice + prompt "XML library" + default ARIA2_EXPAT + depends on ARIA2_METALINK + +config ARIA2_EXPAT + bool "EXPAT" + +config ARIA2_LIBXML2 + bool "LIBXML2" + +endchoice + +endmenu diff --git a/net/aria2/Makefile b/net/aria2/Makefile new file mode 100644 index 0000000..81acf83 --- /dev/null +++ b/net/aria2/Makefile @@ -0,0 +1,81 @@ +# +# Copyright (C) 2012-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=aria2 +PKG_VERSION:=1.28.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=https://github.com/aria2/aria2/releases/download/release-$(PKG_VERSION)/ +PKG_MD5SUM:=f649ab30f3b09d0c0ebb816ce0c0205d +PKG_INSTALL:=1 + +PKG_MAINTAINER:=Imre Kaloz , Hsing-Wang Liao +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:=COPYING + +PKG_CONFIG_DEPENDS := \ + ARIA2_NOSSL \ + ARIA2_OPENSSL \ + ARIA2_GNUTLS \ + ARIA2_BITTORRENT \ + ARIA2_METALINK \ + ARIA2_SFTP \ + ARIA2_EXPAT \ + ARIA2_LIBXML2 + +include $(INCLUDE_DIR)/package.mk + +define Package/aria2/config + source "$(SOURCE)/Config.in" +endef + +define Package/aria2 + SECTION:=net + CATEGORY:=Network + SUBMENU:=File Transfer + TITLE:=lightweight download utility + URL:=https://aria2.github.io/ + DEPENDS:=+zlib +ARIA2_SFTP:libssh2 +ARIA2_LIBXML2:libxml2 +ARIA2_EXPAT:libexpat +libstdcpp +ARIA2_OPENSSL:libopenssl +ARIA2_GNUTLS:libgnutls +endef + +define Package/aria2/description + aria2 is a lightweight multi-protocol & multi-source command-line download + utility +endef + +CONFIGURE_ARGS += \ + --disable-nls \ + $(if $(CONFIG_ARIA2_NOSSL),--disable,--enable)-ssl \ + $(if $(CONFIG_ARIA2_OPENSSL),--with,--without)-openssl \ + $(if $(CONFIG_ARIA2_GNUTLS),--with,--without)-gnutls \ + $(if $(CONFIG_ARIA2_BITTORRENT),--enable,--disable)-bittorrent \ + $(if $(CONFIG_ARIA2_METALINK),--enable,--disable)-metalink \ + $(if $(CONFIG_ARIA2_SFTP),--with,--without)-libssh2 \ + $(if $(CONFIG_ARIA2_LIBXML2),--with,--without)-libxml2 \ + $(if $(CONFIG_ARIA2_EXPAT),--with,--without)-libexpat \ + --without-libnettle \ + --without-libgmp \ + --without-libgcrypt \ + --without-libcares \ + --without-libuv \ + --without-sqlite3 \ + --with-libz + +define Package/aria2/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/aria2c $(1)/usr/bin + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/aria2.init $(1)/etc/init.d/aria2 + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/aria2.conf $(1)/etc/config/aria2 +endef + +$(eval $(call BuildPackage,aria2)) diff --git a/net/aria2/files/aria2.conf b/net/aria2/files/aria2.conf new file mode 100644 index 0000000..e6d7617 --- /dev/null +++ b/net/aria2/files/aria2.conf @@ -0,0 +1,10 @@ + +config aria2 'main' + option enabled '0' + option file_allocation 'none' + option bt_enable_lpd 'true' + option enable_dht 'true' + option follow_torrent 'true' + option user 'root' + option dir '/mnt/sda1/aria2' + option save_session_interval '30' diff --git a/net/aria2/files/aria2.init b/net/aria2/files/aria2.init new file mode 100755 index 0000000..d6bcda4 --- /dev/null +++ b/net/aria2/files/aria2.init @@ -0,0 +1,112 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014-2016 nanpuyue +# Copyright (C) 2016 kuoruan + +START=99 +SERVICE_WRITE_PID=1 +SERVICE_DAEMONIZE=1 + + +append_params() { + local p; local v; local s="$1"; shift + for p in $*; do + config_get v "$s" "$p" + [ -n "$v" ] && ( + p=$(echo "$p" | sed -e 's|_|-|g'); + echo "$p=$v" >> $config_file + ) + done +} + +section_enabled() { + local result + config_get_bool result "$1" 'enabled' 0 + [ $result -eq 1 ] +} + +option_disabled() { + local result + config_get_bool result "$1" "$2" 1 + [ $result -eq 0 ] +} + +start_instance() { + local s="$1" + local user + + section_enabled "$s" || return 1 + + config_get config_dir "$s" 'config_dir' '/var/etc/aria2' + config_get dir "$s" 'dir' + config_get user "$s" 'user' + + config_file="$config_dir/aria2.conf" + session_file="$config_dir/aria2.session" + dht_file="$config_dir/dht.dat" + log_file="$config_dir/aria2.log" + + [ -d "$config_dir" ] || { + mkdir -m 0755 -p "$config_dir" + touch "$config_file" + } + + [ -d "$dir" ] || { + mkdir -m 0755 -p "$dir" # create download dir + touch "$dir" + } + + touch "$session_file" # create session file + + echo -e "enable-rpc=true\nrpc-allow-origin-all=true\nrpc-listen-all=true\nquiet=true" > $config_file + echo -e "continue=true\ninput-file=$session_file\nsave-session=$session_file" >> $config_file + + option_disabled "$s" 'enable_dht' || echo "dht-file-path=$dht_file" >> $config_file + option_disabled "$s" 'enable_log' || { + [ -f "$log_file" ] && echo > $log_file # if log file exist, clear it + echo -e "log=$log_file" >> $config_file + } + + # if user is set, change dir owner + [ -z "$user" ] || { + chown -R $user:$user $config_dir + chown -R $user:$user $dir + } + + append_params "$s" \ + file_allocation bt_enable_lpd enable_dht rpc_user rpc_passwd rpc_listen_port dir bt_tracker disk_cache \ + max_overall_download_limit max_overall_upload_limit max_download_limit max_upload_limit max_concurrent_downloads \ + max_connection_per_server min_split_size split save_session_interval follow_torrent listen_port bt_max_peers \ + peer_id_prefix user_agent rpc_secret log_level + + config_list_foreach "$s" extra_settings append_extrasettings + + SERVICE_UID="$user" \ + service_start /usr/bin/aria2c --conf-path="$config_file" # start service +} + +append_extrasettings() { + echo "$1" >> $config_file +} + +start() { + logger -t ARIA2C 'Starting aria2c service' + config_load 'aria2' + config_foreach start_instance 'aria2' + return 0 +} + +stop() { + if [ -n "`pidof aria2c`" ]; then + logger -t ARIA2C 'Shutting down aria2c service' + service_stop /usr/bin/aria2c + fi + return 0 +} + +restart() { + logger -t ARIA2C 'Restarting aria2c service' + stop + sleep 2 # give time to shutdown + start +} + diff --git a/net/arp-scan/Makefile b/net/arp-scan/Makefile new file mode 100644 index 0000000..78e8412 --- /dev/null +++ b/net/arp-scan/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=arp-scan +PKG_VERSION:=1.9-40-g69b2f70 +PKG_RELEASE:=1 +PKG_LICENSE:=GPL-3.0 +PKG_MAINTAINER:=Sergey Urushkin + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/royhills/arp-scan.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=69b2f70588565385f3a61d9b1f100f01747cd5e1 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_FIXUP:=autoreconf + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/arp-scan + SECTION:=net + CATEGORY:=Network + TITLE:=ARP scanner + DEPENDS:=+libpcap + URL:=https://github.com/royhills/arp-scan + PKG_MAINTAINER:=Sergey Urushkin +endef + +define Package/arp-scan/description + ARP scanner +endef + +define Package/arp-scan/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/arp-scan $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,arp-scan)) diff --git a/net/arp-scan/patches/001-cross_compile.patch b/net/arp-scan/patches/001-cross_compile.patch new file mode 100644 index 0000000..aa7f53e --- /dev/null +++ b/net/arp-scan/patches/001-cross_compile.patch @@ -0,0 +1,10 @@ +--- a/acinclude.m4 2016-02-19 15:21:01.000000000 +0300 ++++ b/acinclude.m4 2016-02-19 17:18:50.480874343 +0300 +@@ -211,7 +211,6 @@ + LONG_LONG_INT_FORMAT='' + + case $pgac_cv_snprintf_long_long_int_format in +- cross) AC_MSG_RESULT([cannot test (not on host machine)]);; + ?*) AC_MSG_RESULT([$pgac_cv_snprintf_long_long_int_format]) + LONG_LONG_INT_FORMAT=$pgac_cv_snprintf_long_long_int_format;; + *) AC_MSG_RESULT(none);; diff --git a/net/atftp/Makefile b/net/atftp/Makefile new file mode 100644 index 0000000..9b2404b --- /dev/null +++ b/net/atftp/Makefile @@ -0,0 +1,57 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=atftp +PKG_VERSION:=0.7.1 +PKG_RELEASE:=5 +PKG_MAINTAINER:=Daniel Danzberger +PKG_LICENSE:=GPL-2.0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://freefr.dl.sourceforge.net/project/atftp/ +PKG_MD5SUM:=367bf401965fbed04585b1229c2191a8 + +PKG_BUILD_DEPENDS:=libpcre libreadline + +include $(INCLUDE_DIR)/package.mk + +define Package/atftp/Default + SECTION:=net + CATEGORY:=Network + TITLE:=TFTP + SUBMENU:=File Transfer +endef + +define Package/atftp + $(call Package/atftp/Default) + DEPENDS:=+libreadline +libncurses + TITLE+= client +endef + +define Package/atftpd + $(call Package/atftp/Default) + DEPENDS:=+libpcre +libpthread + TITLE+= server +endef + +CONFIGURE_ARGS += \ + --disable-libwrap + +define Package/atftp/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/atftp $(1)/usr/sbin/ +endef + +define Package/atftpd/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/atftpd $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,atftp)) +$(eval $(call BuildPackage,atftpd)) diff --git a/net/atftp/patches/01-missing-u_char-type-patch.patch b/net/atftp/patches/01-missing-u_char-type-patch.patch new file mode 100644 index 0000000..081f4b3 --- /dev/null +++ b/net/atftp/patches/01-missing-u_char-type-patch.patch @@ -0,0 +1,13 @@ +diff --git a/tftpd.h b/tftpd.h +index 945065e..4c2f214 100644 +--- a/tftpd.h ++++ b/tftpd.h +@@ -46,7 +46,7 @@ struct thread_data { + char *mc_addr; /* multicast address */ + struct sockaddr_storage sa_mcast; + union ip_mreq_storage mcastaddr; +- u_char mcast_ttl; ++ unsigned char mcast_ttl; + + /* + * Self can read/write until client_ready is set. Then only allowed to read. diff --git a/net/atftp/patches/02-fix-invalid-read-in-tftp_send_request.patch b/net/atftp/patches/02-fix-invalid-read-in-tftp_send_request.patch new file mode 100644 index 0000000..679af5c --- /dev/null +++ b/net/atftp/patches/02-fix-invalid-read-in-tftp_send_request.patch @@ -0,0 +1,13 @@ +diff --git a/tftp_io.c b/tftp_io.c +index 605a9c2..6cce1f4 100644 +--- a/tftp_io.c ++++ b/tftp_io.c +@@ -64,7 +64,7 @@ int tftp_send_request(int socket, struct sockaddr_storage *sa, short type, + buf_index += strlen(mode); + buf_index++; + +- for (i = 2; ; i++) ++ for (i = 2; i < OPT_NUMBER; i++) + { + if (strlen(tftp_options[i].option) == 0) + break; diff --git a/net/atftp/patches/03-Fix-undefined-reference-linker-errors.patch b/net/atftp/patches/03-Fix-undefined-reference-linker-errors.patch new file mode 100644 index 0000000..c828e1a --- /dev/null +++ b/net/atftp/patches/03-Fix-undefined-reference-linker-errors.patch @@ -0,0 +1,55 @@ +diff --git a/tftp_def.c b/tftp_def.c +index 96abdc5..16240f7 100644 +--- a/tftp_def.c ++++ b/tftp_def.c +@@ -141,7 +141,7 @@ int print_eng(double value, char *string, int size, char *format) + /* + * This is a strncpy function that take care of string NULL termination + */ +-inline char *Strncpy(char *to, const char *from, size_t size) ++char *Strncpy(char *to, const char *from, size_t size) + { + strncpy(to, from, size); + if (size>0) +diff --git a/tftp_def.h b/tftp_def.h +index e4b338d..4418ee7 100644 +--- a/tftp_def.h ++++ b/tftp_def.h +@@ -50,7 +50,7 @@ extern char *tftp_errmsg[9]; + + int timeval_diff(struct timeval *res, struct timeval *t1, struct timeval *t0); + int print_eng(double value, char *string, int size, char *format); +-inline char *Strncpy(char *to, const char *from, size_t size); ++char *Strncpy(char *to, const char *from, size_t size); + int Gethostbyname(char *addr, struct hostent *host); + + char *sockaddr_print_addr(const struct sockaddr_storage *, char *, size_t); +diff --git a/tftpd.h b/tftpd.h +index 945065e..4bd3f17 100644 +--- a/tftpd.h ++++ b/tftpd.h +@@ -93,7 +93,7 @@ int tftpd_list_find_multicast_server_and_add(struct thread_data **thread, + /* + * Defined in tftpd_list.c, operation on client structure list. + */ +-inline void tftpd_clientlist_ready(struct thread_data *thread); ++void tftpd_clientlist_ready(struct thread_data *thread); + void tftpd_clientlist_remove(struct thread_data *thread, + struct client_info *client); + void tftpd_clientlist_free(struct thread_data *thread); +diff --git a/tftpd_list.c b/tftpd_list.c +index f376159..159ffca 100644 +--- a/tftpd_list.c ++++ b/tftpd_list.c +@@ -201,7 +201,7 @@ int tftpd_list_find_multicast_server_and_add(struct thread_data **thread, + return 0; + } + +-inline void tftpd_clientlist_ready(struct thread_data *thread) ++void tftpd_clientlist_ready(struct thread_data *thread) + { + pthread_mutex_lock(&thread->client_mutex); + thread->client_ready = 1; +-- +2.1.4 + diff --git a/net/autossh/Makefile b/net/autossh/Makefile new file mode 100644 index 0000000..9a27767 --- /dev/null +++ b/net/autossh/Makefile @@ -0,0 +1,52 @@ +# +# Copyright (C) 2006-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=autossh +PKG_VERSION:=1.4e +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://www.harding.motd.ca/autossh/ +PKG_MD5SUM:=f86684b96e99d22b2e9d35dc63b0aa29 +PKG_LICENSE:=0BSD + +include $(INCLUDE_DIR)/package.mk + +define Package/autossh + SECTION:=net + CATEGORY:=Network + TITLE:=Autossh client + URL:=http://www.harding.motd.ca/autossh/ + MAINTAINER:=Christian Beier + SUBMENU:=SSH +endef + +define Build/Compile + $(call Build/Compile/Default, -f Makefile \ + CFLAGS="$(TARGET_CFLAGS) -Wall -D\"SSH_PATH=\\\"\$$$$(SSH)\\\"\" -D\"VER=\\\"\$$$$(VER)\\\"\"" \ + all \ + ) +endef + +define Package/autossh/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/autossh $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/autossh.init $(1)/etc/init.d/autossh + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/autossh.config $(1)/etc/config/autossh + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/autossh.hotplug $(1)/etc/hotplug.d/iface/20-autossh +endef + +define Package/autossh/conffiles +/etc/config/autossh +endef + +$(eval $(call BuildPackage,autossh)) diff --git a/net/autossh/files/autossh.config b/net/autossh/files/autossh.config new file mode 100644 index 0000000..6ec3238 --- /dev/null +++ b/net/autossh/files/autossh.config @@ -0,0 +1,5 @@ +config autossh + option ssh '-i /etc/dropbear/id_rsa -N -T -R 2222:localhost:22 user@host' + option gatetime '0' + option monitorport '20000' + option poll '600' diff --git a/net/autossh/files/autossh.hotplug b/net/autossh/files/autossh.hotplug new file mode 100644 index 0000000..4f695f4 --- /dev/null +++ b/net/autossh/files/autossh.hotplug @@ -0,0 +1,14 @@ +#!/bin/sh +# Copyright (C) 2007 OpenWrt.org + +/etc/init.d/autossh enabled && { + + [ "$ACTION" = "ifup" ] && { + /etc/init.d/autossh start + } + + [ "$ACTION" = "ifdown" ] && { + /etc/init.d/autossh stop + } + +} diff --git a/net/autossh/files/autossh.init b/net/autossh/files/autossh.init new file mode 100644 index 0000000..f81bf4d --- /dev/null +++ b/net/autossh/files/autossh.init @@ -0,0 +1,30 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2011 OpenWrt.org + +START=80 + +start_instance() { + local section="$1" + + config_get ssh "$section" 'ssh' + config_get gatetime "$section" 'gatetime' + config_get monitorport "$section" 'monitorport' + config_get poll "$section" 'poll' + + export AUTOSSH_GATETIME="${gatetime:-30}" + export AUTOSSH_POLL="${poll:-600}" + service_start /usr/sbin/autossh -M ${monitorport:-20000} -f ${ssh} +} + +boot() { + return +} + +start() { + config_load 'autossh' + config_foreach start_instance 'autossh' +} + +stop() { + service_stop /usr/sbin/autossh +} diff --git a/net/bcp38/Makefile b/net/bcp38/Makefile new file mode 100644 index 0000000..9ca1910 --- /dev/null +++ b/net/bcp38/Makefile @@ -0,0 +1,62 @@ +# +# Copyright (C) 2014 Openwrt.org +# +# This is free software, licensed under the GNU General Public License v2. + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bcp38 +PKG_VERSION:=5 +PKG_RELEASE:=1 +PKG_LICENCE:=GPL-3.0+ + +include $(INCLUDE_DIR)/package.mk + +define Package/bcp38 + SECTION:=net + CATEGORY:=Network + SUBMENU:=Routing and Redirection + TITLE:=BCP38 compliance + URL:=https://github.com/dtaht/ceropackages-3.10 + MAINTAINER:=Toke Høiland-Jørgensen + DEPENDS:=+ipset +endef + +define Package/bcp38/description + bcp38 implements IETF BCP38 for home routers. See https://tools.ietf.org/html/bcp38. +endef + +define Package/bcp38/conffiles +/etc/config/bcp38 +endef + +define Build/Prepare +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/bcp38/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/bcp38.config $(1)/etc/config/bcp38 + $(INSTALL_DIR) $(1)/usr/lib/bcp38 + $(INSTALL_BIN) ./files/run.sh $(1)/usr/lib/bcp38/run.sh + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) ./files/bcp38.defaults $(1)/etc/uci-defaults/bcp38 +endef + +define Package/bcp38/postinst +#!/bin/sh +[ -x /etc/uci-defaults/bcp38 ] && /etc/uci-defaults/bcp38 || exit 0 +endef + +define Package/bcp38/postrm +#!/bin/sh +uci delete firewall.bcp38 +uci commit +endef + +$(eval $(call BuildPackage,bcp38)) diff --git a/net/bcp38/files/bcp38.config b/net/bcp38/files/bcp38.config new file mode 100644 index 0000000..08e8e20 --- /dev/null +++ b/net/bcp38/files/bcp38.config @@ -0,0 +1,22 @@ +config bcp38 + option enabled 0 + option interface 'eth1' + option detect_upstream 1 + list match '127.0.0.0/8' + list match '0.0.0.0/8' # RFC 1700 + list match '240.0.0.0/4' # RFC 5745 + list match '192.0.2.0/24' # RFC 5737 + list match '198.51.100.0/24' # RFC 5737 + list match '203.0.113.0/24' # RFC 5737 + list match '192.168.0.0/16' # RFC 1918 + list match '10.0.0.0/8' # RFC 1918 + list match '172.16.0.0/12' # RFC 1918 + list match '169.254.0.0/16' # RFC 3927 + +# list nomatch '172.26.0.0/21' # Example of something not to match +# There is a dhcp trigger to do this for the netmask of a +# double natted connection needed + +# I will argue that this level of indirection doesn't scale +# very well - see how to block china as an example +# http://www.okean.com/china.txt diff --git a/net/bcp38/files/bcp38.defaults b/net/bcp38/files/bcp38.defaults new file mode 100644 index 0000000..d7e0d80 --- /dev/null +++ b/net/bcp38/files/bcp38.defaults @@ -0,0 +1,13 @@ +#!/bin/sh + +uci -q batch <<-EOT + delete firewall.bcp38 + set firewall.bcp38=include + set firewall.bcp38.type=script + set firewall.bcp38.path=/usr/lib/bcp38/run.sh + set firewall.bcp38.family=IPv4 + set firewall.bcp38.reload=1 + commit firewall +EOT + +exit 0 diff --git a/net/bcp38/files/run.sh b/net/bcp38/files/run.sh new file mode 100755 index 0000000..00d5034 --- /dev/null +++ b/net/bcp38/files/run.sh @@ -0,0 +1,104 @@ +#!/bin/sh +# BCP38 filtering implementation for CeroWrt. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 3 of the License, or (at your option) any later +# version. +# +# Author: Toke Høiland-Jørgensen + +STOP=$1 +IPSET_NAME=bcp38-ipv4 +IPTABLES_CHAIN=BCP38 + +. /lib/functions.sh + +config_load bcp38 + +add_bcp38_rule() +{ + local subnet="$1" + local action="$2" + + if [ "$action" == "nomatch" ]; then + ipset add "$IPSET_NAME" "$subnet" nomatch + else + ipset add "$IPSET_NAME" "$subnet" + fi +} + +detect_upstream() +{ + local interface="$1" + + subnets=$(ip route show dev "$interface" | grep 'scope link' | awk '{print $1}') + for subnet in $subnets; do + # ipset test doesn't work for subnets, so strip out the subnet part + # and test for that; add as exception if there's a match + addr=$(echo $subnet | sed 's|/[0-9]\+$||') + ipset test "$IPSET_NAME" $addr 2>/dev/null && add_bcp38_rule $subnet nomatch + done +} + +run() { + local section="$1" + local enabled + local interface + local detect_upstream + config_get_bool enabled "$section" enabled 0 + config_get interface "$section" interface + config_get detect_upstream "$section" detect_upstream + + if [ "$enabled" -eq "1" -a -n "$interface" -a -z "$STOP" ] ; then + setup_ipset + setup_iptables "$interface" + config_list_foreach "$section" match add_bcp38_rule match + config_list_foreach "$section" nomatch add_bcp38_rule nomatch + [ "$detect_upstream" -eq "1" ] && detect_upstream "$interface" + fi + exit 0 +} + +setup_ipset() +{ + ipset create "$IPSET_NAME" hash:net family ipv4 + ipset flush "$IPSET_NAME" +} + +setup_iptables() +{ + local interface="$1" + iptables -N "$IPTABLES_CHAIN" 2>/dev/null + iptables -F "$IPTABLES_CHAIN" 2>/dev/null + + iptables -I output_rule -m state --state NEW -j "$IPTABLES_CHAIN" + iptables -I input_rule -m state --state NEW -j "$IPTABLES_CHAIN" + iptables -I forwarding_rule -m state --state NEW -j "$IPTABLES_CHAIN" + + # always accept DHCP traffic + iptables -A "$IPTABLES_CHAIN" -p udp --dport 67:68 --sport 67:68 -j RETURN + iptables -A "$IPTABLES_CHAIN" -o "$interface" -m set --match-set "$IPSET_NAME" dst -j REJECT --reject-with icmp-net-unreachable + iptables -A "$IPTABLES_CHAIN" -i "$interface" -m set --match-set "$IPSET_NAME" src -j DROP +} + +destroy_ipset() +{ + ipset flush "$IPSET_NAME" 2>/dev/null + ipset destroy "$IPSET_NAME" 2>/dev/null +} + +destroy_iptables() +{ + iptables -D output_rule -m state --state NEW -j "$IPTABLES_CHAIN" 2>/dev/null + iptables -D input_rule -m state --state NEW -j "$IPTABLES_CHAIN" 2>/dev/null + iptables -D forwarding_rule -m state --state NEW -j "$IPTABLES_CHAIN" 2>/dev/null + iptables -F "$IPTABLES_CHAIN" 2>/dev/null + iptables -X "$IPTABLES_CHAIN" 2>/dev/null +} + +destroy_iptables +destroy_ipset +config_foreach run bcp38 + +exit 0 diff --git a/net/bind/Config.in b/net/bind/Config.in new file mode 100644 index 0000000..f0d4847 --- /dev/null +++ b/net/bind/Config.in @@ -0,0 +1,17 @@ +if PACKAGE_bind-server + +config BIND_ENABLE_FILTER_AAAA + bool + default n + prompt "Enable filtering of AAAA records returned to the client" + help + BIND 9 has an option to filter AAAA (IPv6 address) records + returned to the client based on the transport used for the + query, and other filtering conditions. This filtering does + not affect the recursive queries made by the server (if + any) as a result of the client request. + + Additional details are available at + https://kb.isc.org/article/AA-00576/0/Filter-AAAA-option-in-BIND-9-.html + +endif diff --git a/net/bind/Makefile b/net/bind/Makefile new file mode 100644 index 0000000..959184a --- /dev/null +++ b/net/bind/Makefile @@ -0,0 +1,220 @@ +# +# Copyright (C) 2006-2012 OpenWrt.org +# 2014-2016 Noah Meyerhans +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bind +PKG_VERSION:=9.10.4-P4 +PKG_RELEASE:=2 +USERID:=bind=57:bind=57 + +PKG_MAINTAINER:=Noah Meyerhans +PKG_LICENSE := BSD-3-Clause + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:= \ + ftp://ftp.isc.org/isc/bind9/$(PKG_VERSION) \ + http://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9/$(PKG_VERSION) +PKG_MD5SUM:=e110904a1d54f83f01d4be8bcd842927 + +PKG_FIXUP:=autoreconf +PKG_REMOVE_FILES:=aclocal.m4 libtool.m4 + +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 + +PKG_CONFIG_DEPENDS := \ + CONFIG_OPENSSL_WITH_EC \ + CONFIG_BIND_ENABLE_FILTER_AAAA + +include $(INCLUDE_DIR)/package.mk + +define Package/bind/Default + SECTION:=net + CATEGORY:=Network + DEPENDS:=+bind-libs + TITLE:=bind + URL:=https://www.isc.org/software/bind + SUBMENU:=IP Addresses and Names +endef + +define Package/bind-libs + SECTION:=libs + CATEGORY:=Libraries + DEPENDS:=+libopenssl + TITLE:=bind shared libraries + URL:=https://www.isc.org/software/bind +endef + +define Package/bind-server + $(call Package/bind/Default) + TITLE+= DNS server +endef + +define Package/bind-server/config + source "$(SOURCE)/Config.in" +endef + +define Package/bind-client + $(call Package/bind/Default) + TITLE+= dynamic DNS client +endef + +define Package/bind-tools + $(call Package/bind/Default) + TITLE+= administration tools (all) +endef + +define Package/bind-rndc + $(call Package/bind/Default) + TITLE+= administration tools (rndc and rndc-confgen only) +endef + +define Package/bind-check + $(call Package/bind/Default) + TITLE+= administration tools (named-checkconf and named-checkzone only) +endef + +define Package/bind-dnssec + $(call Package/bind/Default) + TITLE+= administration tools (dnssec-keygen and dnssec-signzone only) +endef + +define Package/bind-host + $(call Package/bind/Default) + TITLE+= simple DNS client +endef + +define Package/bind-dig + $(call Package/bind/Default) + TITLE+= DNS excavation tool +endef + +export BUILD_CC="$(TARGET_CC)" + +CONFIGURE_ARGS += \ + --enable-shared \ + --enable-static \ + --with-randomdev="/dev/urandom" \ + --disable-threads \ + --disable-linux-caps \ + --with-openssl="$(STAGING_DIR)/usr" \ + --with-libjson=no \ + --with-libtool \ + --with-libxml2=no \ + --enable-epoll=yes \ + --with-gost=no \ + --with-gssapi=no \ + --with-ecdsa=$(if $(CONFIG_OPENSSL_WITH_EC),yes,no) \ + --with-readline=no \ + --sysconfdir=/etc/bind + +ifdef CONFIG_BIND_ENABLE_FILTER_AAAA + CONFIGURE_ARGS += \ + --enable-filter-aaaa +endif + +CONFIGURE_VARS += \ + BUILD_CC="$(TARGET_CC)" \ + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR)/lib/dns \ + BUILD_CC="$(HOSTCC)" \ + CC="$(HOSTCC)" \ + CFLAGS="-O2" \ + LIBS="" \ + gen + $(call Build/Compile/Default) +endef + +define Package/bind-libs/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib +endef + +define Package/bind-server/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/bind + $(CP) \ + ./files/bind/db.0 \ + ./files/bind/db.127 \ + ./files/bind/db.255 \ + ./files/bind/db.local \ + ./files/bind/db.root \ + $(1)/etc/bind/ + $(CP) ./files/bind/named.conf.example $(1)/etc/bind/named.conf + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/named.init $(1)/etc/init.d/named + find $(1)/etc/bind/ -name ".svn" | xargs rm -rf +endef + +define Package/bind-server/conffiles +/etc/bind/db.0 +/etc/bind/db.127 +/etc/bind/db.255 +/etc/bind/db.local +/etc/bind/db.root +/etc/bind/named.conf +endef + +define Package/bind-client/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nsupdate $(1)/usr/bin/ +endef + +define Package/bind-tools/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/ +endef + +define Package/bind-rndc/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rndc-confgen $(1)/usr/sbin/ +endef + +define Package/bind-check/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkconf $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/named-checkzone $(1)/usr/sbin/ +endef + +define Package/bind-dnssec/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-keygen $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dnssec-signzone $(1)/usr/sbin/ +endef + +define Package/bind-host/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/host $(1)/usr/bin/ +endef + +define Package/bind-dig/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/dig $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,bind-libs)) +$(eval $(call BuildPackage,bind-server)) +$(eval $(call BuildPackage,bind-client)) +$(eval $(call BuildPackage,bind-tools)) +$(eval $(call BuildPackage,bind-rndc)) +$(eval $(call BuildPackage,bind-check)) +$(eval $(call BuildPackage,bind-dnssec)) +$(eval $(call BuildPackage,bind-host)) +$(eval $(call BuildPackage,bind-dig)) diff --git a/net/bind/files/bind/db.0 b/net/bind/files/bind/db.0 new file mode 100644 index 0000000..e3aabdb --- /dev/null +++ b/net/bind/files/bind/db.0 @@ -0,0 +1,12 @@ +; +; BIND reverse data file for broadcast zone +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. diff --git a/net/bind/files/bind/db.127 b/net/bind/files/bind/db.127 new file mode 100644 index 0000000..cd05bef --- /dev/null +++ b/net/bind/files/bind/db.127 @@ -0,0 +1,13 @@ +; +; BIND reverse data file for local loopback interface +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. +1.0.0 IN PTR localhost. diff --git a/net/bind/files/bind/db.255 b/net/bind/files/bind/db.255 new file mode 100644 index 0000000..e3aabdb --- /dev/null +++ b/net/bind/files/bind/db.255 @@ -0,0 +1,12 @@ +; +; BIND reverse data file for broadcast zone +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. diff --git a/net/bind/files/bind/db.local b/net/bind/files/bind/db.local new file mode 100644 index 0000000..66b4892 --- /dev/null +++ b/net/bind/files/bind/db.local @@ -0,0 +1,13 @@ +; +; BIND data file for local loopback interface +; +$TTL 604800 +@ IN SOA localhost. root.localhost. ( + 1 ; Serial + 604800 ; Refresh + 86400 ; Retry + 2419200 ; Expire + 604800 ) ; Negative Cache TTL +; +@ IN NS localhost. +@ IN A 127.0.0.1 diff --git a/net/bind/files/bind/db.root b/net/bind/files/bind/db.root new file mode 100644 index 0000000..f0b79d2 --- /dev/null +++ b/net/bind/files/bind/db.root @@ -0,0 +1,90 @@ +; This file holds the information on root name servers needed to +; initialize cache of Internet domain name servers +; (e.g. reference this file in the "cache . " +; configuration file of BIND domain name servers). +; +; This file is made available by InterNIC +; under anonymous FTP as +; file /domain/named.cache +; on server FTP.INTERNIC.NET +; -OR- RS.INTERNIC.NET +; +; last update: February 17, 2016 +; related version of root zone: 2016021701 +; +; formerly NS.INTERNIC.NET +; +. 3600000 NS A.ROOT-SERVERS.NET. +A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 +A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:ba3e::2:30 +; +; FORMERLY NS1.ISI.EDU +; +. 3600000 NS B.ROOT-SERVERS.NET. +B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201 +B.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:84::b +; +; FORMERLY C.PSI.NET +; +. 3600000 NS C.ROOT-SERVERS.NET. +C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 +C.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2::c +; +; FORMERLY TERP.UMD.EDU +; +. 3600000 NS D.ROOT-SERVERS.NET. +D.ROOT-SERVERS.NET. 3600000 A 199.7.91.13 +D.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2d::d +; +; FORMERLY NS.NASA.GOV +; +. 3600000 NS E.ROOT-SERVERS.NET. +E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 +; +; FORMERLY NS.ISC.ORG +; +. 3600000 NS F.ROOT-SERVERS.NET. +F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 +F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f +; +; FORMERLY NS.NIC.DDN.MIL +; +. 3600000 NS G.ROOT-SERVERS.NET. +G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 +; +; FORMERLY AOS.ARL.ARMY.MIL +; +. 3600000 NS H.ROOT-SERVERS.NET. +H.ROOT-SERVERS.NET. 3600000 A 198.97.190.53 +H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::53 +; +; FORMERLY NIC.NORDU.NET +; +. 3600000 NS I.ROOT-SERVERS.NET. +I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 +I.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fe::53 +; +; OPERATED BY VERISIGN, INC. +; +. 3600000 NS J.ROOT-SERVERS.NET. +J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30 +J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:c27::2:30 +; +; OPERATED BY RIPE NCC +; +. 3600000 NS K.ROOT-SERVERS.NET. +K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 +K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1 +; +; OPERATED BY ICANN +; +. 3600000 NS L.ROOT-SERVERS.NET. +L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42 +L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:3::42 +; +; OPERATED BY WIDE +; +. 3600000 NS M.ROOT-SERVERS.NET. +M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 +M.ROOT-SERVERS.NET. 3600000 AAAA 2001:dc3::35 +; End of file diff --git a/net/bind/files/bind/named.conf.example b/net/bind/files/bind/named.conf.example new file mode 100644 index 0000000..1624549 --- /dev/null +++ b/net/bind/files/bind/named.conf.example @@ -0,0 +1,45 @@ +// This is the primary configuration file for the BIND DNS server named. + +options { + directory "/tmp"; + + // If your ISP provided one or more IP addresses for stable + // nameservers, you probably want to use them as forwarders. + // Uncomment the following block, and insert the addresses replacing + // the all-0's placeholder. + + // forwarders { + // 0.0.0.0; + // }; + + auth-nxdomain no; # conform to RFC1035 +}; + +// prime the server with knowledge of the root servers +zone "." { + type hint; + file "/etc/bind/db.root"; +}; + +// be authoritative for the localhost forward and reverse zones, and for +// broadcast zones as per RFC 1912 + +zone "localhost" { + type master; + file "/etc/bind/db.local"; +}; + +zone "127.in-addr.arpa" { + type master; + file "/etc/bind/db.127"; +}; + +zone "0.in-addr.arpa" { + type master; + file "/etc/bind/db.0"; +}; + +zone "255.in-addr.arpa" { + type master; + file "/etc/bind/db.255"; +}; diff --git a/net/bind/files/named.init b/net/bind/files/named.init new file mode 100644 index 0000000..b7876d9 --- /dev/null +++ b/net/bind/files/named.init @@ -0,0 +1,35 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2014 Noah Meyerhans +# Licensed under the terms of the GNU General Public License version 2 +# or (at your discretion) any later later version + +USE_PROCD=1 + +START=50 + +config_file=/etc/bind/named.conf +pid_file=/var/run/named/named.pid + +logdir=/var/log/named/ +cachedir=/var/cache/bind +libdir=/var/lib/bind + +fix_perms() { + for dir in $libdir $logdir $cachedir; do + test -e "$dir" || { + mkdir -p "$dir" + chgrp bind "$dir" + chmod g+w "$dir" + } + done +} + +start_service() { + user_exists bind 57 || user_add bind 57 + group_exists bind 57 || group_add bind 57 + fix_perms + procd_open_instance + procd_set_param command /usr/sbin/named -u bind -f -c $config_file + procd_set_param respawn + procd_close_instance +} diff --git a/net/bind/patches/001-no-tests.patch b/net/bind/patches/001-no-tests.patch new file mode 100644 index 0000000..321924b --- /dev/null +++ b/net/bind/patches/001-no-tests.patch @@ -0,0 +1,26 @@ +Index: bind-9.10.4-P3/bin/Makefile.in +=================================================================== +--- bind-9.10.4-P3.orig/bin/Makefile.in ++++ bind-9.10.4-P3/bin/Makefile.in +@@ -19,7 +19,7 @@ srcdir = @srcdir@ + VPATH = @srcdir@ + top_srcdir = @top_srcdir@ + +-SUBDIRS = named rndc dig delv dnssec tools tests nsupdate \ ++SUBDIRS = named rndc dig delv dnssec tools nsupdate \ + check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@ + TARGETS = + +Index: bind-9.10.4-P3/lib/Makefile.in +=================================================================== +--- bind-9.10.4-P3.orig/lib/Makefile.in ++++ bind-9.10.4-P3/lib/Makefile.in +@@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@ + # Attempt to disable parallel processing. + .NOTPARALLEL: + .NO_PARALLEL: +-SUBDIRS = isc isccc dns isccfg bind9 lwres irs tests samples ++SUBDIRS = isc isccc dns isccfg bind9 lwres irs samples + TARGETS = + + @BIND9_MAKE_RULES@ diff --git a/net/bind/patches/002-autoconf-ar-fix.patch b/net/bind/patches/002-autoconf-ar-fix.patch new file mode 100644 index 0000000..c360260 --- /dev/null +++ b/net/bind/patches/002-autoconf-ar-fix.patch @@ -0,0 +1,31 @@ +Index: bind-9.10.4-P3/configure.in +=================================================================== +--- bind-9.10.4-P3.orig/configure.in ++++ bind-9.10.4-P3/configure.in +@@ -167,26 +167,11 @@ esac + # + AC_CONFIG_FILES([make/rules make/includes]) + +-AC_PATH_PROG(AR, ar) +-ARFLAGS="cruv" +-AC_SUBST(AR) +-AC_SUBST(ARFLAGS) +- + # The POSIX ln(1) program. Non-POSIX systems may substitute + # "copy" or something. + LN=ln + AC_SUBST(LN) + +-case "$AR" in +- "") +- AC_MSG_ERROR([ +-ar program not found. Please fix your PATH to include the directory in +-which ar resides, or set AR in the environment with the full path to ar. +-]) +- +- ;; +-esac +- + # + # Etags. + # diff --git a/net/bmon/Makefile b/net/bmon/Makefile new file mode 100644 index 0000000..e39e24e --- /dev/null +++ b/net/bmon/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2007-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bmon +PKG_VERSION:=3.9 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/tgraf/bmon/releases/download/v$(PKG_VERSION)/ +PKG_MD5SUM:=a959371dc6f8eecdfe27c088447ec636 +PKG_MAINTAINER:=Baptiste Jonglez +PKG_LICENSE:=MIT + +include $(INCLUDE_DIR)/package.mk + +define Package/bmon + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libncursesw +libnl-core +libnl-route +confuse +terminfo + TITLE:=bmon is a portable bandwidth monitor + URL:=https://github.com/tgraf/bmon/ +endef + +define Package/bmon/description + bmon is a portable bandwidth monitor + and rate estimator running on various + operating systems. It supports various + input methods for different architectures. +endef + +CONFIGURE_ARGS += \ + --disable-cnt-workaround \ + +CONFIGURE_VARS += \ + ac_cv_lib_nl_nl_connect=no \ + +# Needed to compile some objects +TARGET_CFLAGS+= -std=gnu99 + +define Package/bmon/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bmon $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,bmon)) diff --git a/net/bridge-utils/Makefile b/net/bridge-utils/Makefile new file mode 100644 index 0000000..0075c0e --- /dev/null +++ b/net/bridge-utils/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=bridge-utils +PKG_VERSION:=1.5 +PKG_RELEASE:=5 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/bridge-utils.git +PKG_SOURCE_VERSION:=v${PKG_VERSION} +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_FIXUP:=autoreconf + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +include $(INCLUDE_DIR)/package.mk + +define Package/bridge + SECTION:=net + CATEGORY:=Base system + TITLE:=Ethernet bridging configuration utility + URL:=http://bridge.sourceforge.net/ + PKG_MAINTAINER:=Nikolay Martynov +endef + +define Package/bridge/description + Manage ethernet bridging: a way to connect networks together to + form a larger network. +endef + +TARGET_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +CONFIGURE_ARGS += \ + --with-linux-headers="$(LINUX_DIR)" \ + +define Package/bridge/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin +endef + +define Package/bridge/prerm +#!/bin/sh +$${IPKG_INSTROOT}/bin/busybox brctl -h 2>&1 | grep -q BusyBox && \ +ln -sf ../../bin/busybox $${IPKG_INSTROOT}/usr/sbin/brctl +exit 0 +endef + +$(eval $(call BuildPackage,bridge)) diff --git a/net/bridge-utils/patches/001-libbridge_cflags.patch b/net/bridge-utils/patches/001-libbridge_cflags.patch new file mode 100644 index 0000000..e35a649 --- /dev/null +++ b/net/bridge-utils/patches/001-libbridge_cflags.patch @@ -0,0 +1,11 @@ +--- a/libbridge/Makefile.in ++++ b/libbridge/Makefile.in +@@ -5,7 +5,7 @@ AR=ar + RANLIB=@RANLIB@ + + CC=@CC@ +-CFLAGS = -Wall -g $(KERNEL_HEADERS) ++CFLAGS = -Wall -g @CFLAGS@ $(KERNEL_HEADERS) + + prefix=@prefix@ + exec_prefix=@exec_prefix@ diff --git a/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch b/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch new file mode 100644 index 0000000..c2087e5 --- /dev/null +++ b/net/bridge-utils/patches/010-fix_struct_in6_addr_usage.patch @@ -0,0 +1,10 @@ +--- a/libbridge/libbridge.h ++++ b/libbridge/libbridge.h +@@ -20,6 +20,7 @@ + #define _LIBBRIDGE_H + + #include ++#include + #include + #include + diff --git a/net/bridge-utils/patches/100-musl-compat.patch b/net/bridge-utils/patches/100-musl-compat.patch new file mode 100644 index 0000000..5655643 --- /dev/null +++ b/net/bridge-utils/patches/100-musl-compat.patch @@ -0,0 +1,11 @@ +--- a/libbridge/libbridge.h ++++ b/libbridge/libbridge.h +@@ -19,6 +19,8 @@ + #ifndef _LIBBRIDGE_H + #define _LIBBRIDGE_H + ++#include ++#include + #include + #include + #include diff --git a/net/bwm-ng/Config.in b/net/bwm-ng/Config.in new file mode 100644 index 0000000..d822e12 --- /dev/null +++ b/net/bwm-ng/Config.in @@ -0,0 +1,35 @@ +# bwm-ng advanced configuration + +menu "Configuration" + depends on PACKAGE_bwm-ng + +config BWMNG_CONFIGFILE + bool "enable configfile support" + default n + +config BWMNG_HTML + bool "enable html output" + default n + +config BWMNG_CSV + bool "enable csv output" + default n + +config BWMNG_EXTENDEDSTATS + bool "enable max, sum and avg stats" + default y + +config BWMNG_LIBNCURSES + bool "enable libncurses support" + default n + +config BWMNG_TIME + bool "enable accurate time calculating" + default y + +config BWMNG_GETOPT_LONG + bool "enable long options" + default n + +endmenu + diff --git a/net/bwm-ng/Makefile b/net/bwm-ng/Makefile new file mode 100644 index 0000000..21c896c --- /dev/null +++ b/net/bwm-ng/Makefile @@ -0,0 +1,61 @@ +# +# Copyright (C) 2014-2015 OpenWrt.org +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=bwm-ng +PKG_VERSION:=0.6.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.gropp.org/bwm-ng +PKG_MD5SUM:=ef0c7669508e95f56250ad4f8db98b7f +PKG_MAINTAINER:=Julen Landa Alustiza +PKG_LICENSE:=GPL2-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/bwm-ng + SECTION:=net + CATEGORY:=Network + DEPENDS:=+BWMNG_LIBNCURSES:libncurses + TITLE:=bwm-ng + URL:=http://www.gropp.org/?id=projects&sub=bwm-ng + MENU:=1 +endef + +define Package/bwm-ng/description + Bandwidth Monitor NG is a small and simple console-based live + network and disk io bandwidth monitor. +endef + +define Package/bwm-ng/config + source "$(SOURCE)/Config.in" +endef + +define Build/Configure + $(call Build/Configure/Default, \ + $(if $(CONFIG_BWMNG_CONFIGFILE),--enable,--disable)-configfile \ + $(if $(CONFIG_BWMNG_HTML),--enable,--disable)-html \ + $(if $(CONFIG_BWMNG_CSV),--enable,--disable)-csv \ + $(if $(CONFIG_BWMNG_EXTENDEDSTATS),--enable,--disable)-extendedstats \ + $(if $(CONFIG_BWMNG_LIBNCURSES),--with,--without)-ncurses \ + $(if $(CONFIG_BWMNG_TIME),--with,--without)-time \ + $(if $(CONFIG_BWMNG_GETOPT_LONG),--with,--without)-getopt_long \ + --with-strip \ + --with-procnetdev \ + --with-diskstats \ + ) +endef + +define Package/bwm-ng/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bwm-ng $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,bwm-ng)) diff --git a/net/cgi-io/Makefile b/net/cgi-io/Makefile new file mode 100644 index 0000000..c36231a --- /dev/null +++ b/net/cgi-io/Makefile @@ -0,0 +1,44 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=cgi-io +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0+ + +PKG_MAINTAINER:=John Crispin + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/cgi-io + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + DEPENDS:=+libubox +libubus + TITLE:=CGI utility for handling up/downloading of files +endef + +define Package/cgi-io/description + This package contains an cgi utility that is useful for up/downloading files +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) + $(CP) ./src/* $(PKG_BUILD_DIR)/ +endef + +define Package/cgi-io/install + $(INSTALL_DIR) $(1)/usr/libexec $(1)/www/cgi-bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/cgi-io $(1)/usr/libexec + $(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-upload + $(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-download +endef + +$(eval $(call BuildPackage,cgi-io)) diff --git a/net/cgi-io/src/CMakeLists.txt b/net/cgi-io/src/CMakeLists.txt new file mode 100644 index 0000000..8a4ca19 --- /dev/null +++ b/net/cgi-io/src/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.6) + +PROJECT(cgi-io C) + +INCLUDE(CheckFunctionExists) + +ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) + +SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") + +IF(APPLE) + INCLUDE_DIRECTORIES(/opt/local/include) + LINK_DIRECTORIES(/opt/local/lib) +ENDIF() + +ADD_EXECUTABLE(cgi-io main.c multipart_parser.c) +TARGET_LINK_LIBRARIES(cgi-io ubox ubus) + +INSTALL(TARGETS cgi-io RUNTIME DESTINATION sbin) diff --git a/net/cgi-io/src/main.c b/net/cgi-io/src/main.c new file mode 100644 index 0000000..69df2d6 --- /dev/null +++ b/net/cgi-io/src/main.c @@ -0,0 +1,644 @@ +/* + * cgi-io - LuCI non-RPC helper + * + * Copyright (C) 2013 Jo-Philipp Wich + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "multipart_parser.h" + + +enum part { + PART_UNKNOWN, + PART_SESSIONID, + PART_FILENAME, + PART_FILEMODE, + PART_FILEDATA +}; + +const char *parts[] = { + "(bug)", + "sessionid", + "filename", + "filemode", + "filedata", +}; + +struct state +{ + bool is_content_disposition; + enum part parttype; + char *sessionid; + char *filename; + bool filedata; + int filemode; + int filefd; + int tempfd; +}; + +enum { + SES_ACCESS, + __SES_MAX, +}; + +static const struct blobmsg_policy ses_policy[__SES_MAX] = { + [SES_ACCESS] = { .name = "access", .type = BLOBMSG_TYPE_BOOL }, +}; + + +static struct state st; + +static void +session_access_cb(struct ubus_request *req, int type, struct blob_attr *msg) +{ + struct blob_attr *tb[__SES_MAX]; + bool *allow = (bool *)req->priv; + + if (!msg) + return; + + blobmsg_parse(ses_policy, __SES_MAX, tb, blob_data(msg), blob_len(msg)); + + if (tb[SES_ACCESS]) + *allow = blobmsg_get_bool(tb[SES_ACCESS]); +} + +static bool +session_access(const char *sid, const char *obj, const char *func) +{ + uint32_t id; + bool allow = false; + struct ubus_context *ctx; + static struct blob_buf req; + + ctx = ubus_connect(NULL); + + if (!ctx || ubus_lookup_id(ctx, "session", &id)) + goto out; + + blob_buf_init(&req, 0); + blobmsg_add_string(&req, "ubus_rpc_session", sid); + blobmsg_add_string(&req, "scope", "cgi-io"); + blobmsg_add_string(&req, "object", obj); + blobmsg_add_string(&req, "function", func); + + ubus_invoke(ctx, id, "access", req.head, session_access_cb, &allow, 500); + +out: + if (ctx) + ubus_free(ctx); + + return allow; +} + +static char * +md5sum(const char *file) +{ + pid_t pid; + int fds[2]; + static char md5[33]; + + if (pipe(fds)) + return NULL; + + switch ((pid = fork())) + { + case -1: + return NULL; + + case 0: + uloop_done(); + + dup2(fds[1], 1); + + close(0); + close(2); + close(fds[0]); + close(fds[1]); + + if (execl("/bin/busybox", "/bin/busybox", "md5sum", file, NULL)); + return NULL; + + break; + + default: + memset(md5, 0, sizeof(md5)); + read(fds[0], md5, 32); + waitpid(pid, NULL, 0); + close(fds[0]); + close(fds[1]); + } + + return md5; +} + +static char * +datadup(const void *in, size_t len) +{ + char *out = malloc(len + 1); + + if (!out) + return NULL; + + memcpy(out, in, len); + + *(out + len) = 0; + + return out; +} + +static bool +urldecode(char *buf) +{ + char *c, *p; + + if (!buf || !*buf) + return true; + +#define hex(x) \ + (((x) <= '9') ? ((x) - '0') : \ + (((x) <= 'F') ? ((x) - 'A' + 10) : \ + ((x) - 'a' + 10))) + + for (c = p = buf; *p; c++) + { + if (*p == '%') + { + if (!isxdigit(*(p + 1)) || !isxdigit(*(p + 2))) + return false; + + *c = (char)(16 * hex(*(p + 1)) + hex(*(p + 2))); + + p += 3; + } + else if (*p == '+') + { + *c = ' '; + p++; + } + else + { + *c = *p++; + } + } + + *c = 0; + + return true; +} + +static bool +postdecode(char **fields, int n_fields) +{ + char *p; + const char *var; + static char buf[1024]; + int i, len, field, found = 0; + + var = getenv("CONTENT_TYPE"); + + if (!var || strncmp(var, "application/x-www-form-urlencoded", 33)) + return false; + + memset(buf, 0, sizeof(buf)); + + if ((len = read(0, buf, sizeof(buf) - 1)) > 0) + { + for (p = buf, i = 0; i <= len; i++) + { + if (buf[i] == '=') + { + buf[i] = 0; + + for (field = 0; field < (n_fields * 2); field += 2) + { + if (!strcmp(p, fields[field])) + { + fields[field + 1] = buf + i + 1; + found++; + } + } + } + else if (buf[i] == '&' || buf[i] == '\0') + { + buf[i] = 0; + + if (found >= n_fields) + break; + + p = buf + i + 1; + } + } + } + + for (field = 0; field < (n_fields * 2); field += 2) + if (!urldecode(fields[field + 1])) + return false; + + return (found >= n_fields); +} + +static int +response(bool success, const char *message) +{ + char *md5; + struct stat s; + + printf("Status: 200 OK\r\n"); + printf("Content-Type: text/plain\r\n\r\n{\n"); + + if (success) + { + if (!stat(st.filename, &s) && (md5 = md5sum(st.filename)) != NULL) + printf("\t\"size\": %u,\n\t\"checksum\": \"%s\"\n", + (unsigned int)s.st_size, md5); + } + else + { + if (message) + printf("\t\"message\": \"%s\",\n", message); + + printf("\t\"failure\": [ %u, \"%s\" ]\n", errno, strerror(errno)); + + if (st.filefd > -1) + unlink(st.filename); + } + + printf("}\n"); + + return -1; +} + +static int +failure(int e, const char *message) +{ + printf("Status: 500 Internal Server failure\r\n"); + printf("Content-Type: text/plain\r\n\r\n"); + printf("%s", message); + + if (e) + printf(": %s", strerror(e)); + + return -1; +} + +static int +filecopy(void) +{ + int len; + char buf[4096]; + + if (!st.filedata) + { + close(st.tempfd); + errno = EINVAL; + return response(false, "No file data received"); + } + + if (lseek(st.tempfd, 0, SEEK_SET) < 0) + { + close(st.tempfd); + return response(false, "Failed to rewind temp file"); + } + + st.filefd = open(st.filename, O_CREAT | O_TRUNC | O_WRONLY, 0600); + + if (st.filefd < 0) + { + close(st.tempfd); + return response(false, "Failed to open target file"); + } + + while ((len = read(st.tempfd, buf, sizeof(buf))) > 0) + { + if (write(st.filefd, buf, len) != len) + { + close(st.tempfd); + close(st.filefd); + return response(false, "I/O failure while writing target file"); + } + } + + close(st.tempfd); + close(st.filefd); + + if (chmod(st.filename, st.filemode)) + return response(false, "Failed to chmod target file"); + + return 0; +} + +static int +header_field(multipart_parser *p, const char *data, size_t len) +{ + st.is_content_disposition = !strncasecmp(data, "Content-Disposition", len); + return 0; +} + +static int +header_value(multipart_parser *p, const char *data, size_t len) +{ + int i, j; + + if (!st.is_content_disposition) + return 0; + + if (len < 10 || strncasecmp(data, "form-data", 9)) + return 0; + + for (data += 9, len -= 9; *data == ' ' || *data == ';'; data++, len--); + + if (len < 8 || strncasecmp(data, "name=\"", 6)) + return 0; + + for (data += 6, len -= 6, i = 0; i <= len; i++) + { + if (*(data + i) != '"') + continue; + + for (j = 1; j < sizeof(parts) / sizeof(parts[0]); j++) + if (!strncmp(data, parts[j], i)) + st.parttype = j; + + break; + } + + return 0; +} + +static int +data_begin_cb(multipart_parser *p) +{ + char tmpname[24] = "/tmp/luci-upload.XXXXXX"; + + if (st.parttype == PART_FILEDATA) + { + if (!st.sessionid) + return response(false, "File data without session"); + + if (!st.filename) + return response(false, "File data without name"); + + st.tempfd = mkstemp(tmpname); + + if (st.tempfd < 0) + return response(false, "Failed to create temporary file"); + + unlink(tmpname); + } + + return 0; +} + +static int +data_cb(multipart_parser *p, const char *data, size_t len) +{ + switch (st.parttype) + { + case PART_SESSIONID: + st.sessionid = datadup(data, len); + break; + + case PART_FILENAME: + st.filename = datadup(data, len); + break; + + case PART_FILEMODE: + st.filemode = strtoul(data, NULL, 8); + break; + + case PART_FILEDATA: + if (write(st.tempfd, data, len) != len) + { + close(st.tempfd); + return response(false, "I/O failure while writing temporary file"); + } + + if (!st.filedata) + st.filedata = !!len; + + break; + + default: + break; + } + + return 0; +} + +static int +data_end_cb(multipart_parser *p) +{ + if (st.parttype == PART_SESSIONID) + { + if (!session_access(st.sessionid, "upload", "write")) + { + errno = EPERM; + return response(false, "Upload permission denied"); + } + } + else if (st.parttype == PART_FILEDATA) + { + if (st.tempfd < 0) + return response(false, "Internal program failure"); + +#if 0 + /* prepare directory */ + for (ptr = st.filename; *ptr; ptr++) + { + if (*ptr == '/') + { + *ptr = 0; + + if (mkdir(st.filename, 0755)) + { + unlink(st.tmpname); + return response(false, "Failed to create destination directory"); + } + + *ptr = '/'; + } + } +#endif + + if (filecopy()) + return -1; + + return response(true, NULL); + } + + st.parttype = PART_UNKNOWN; + return 0; +} + +static multipart_parser * +init_parser(void) +{ + char *boundary; + const char *var; + + multipart_parser *p; + static multipart_parser_settings s = { + .on_part_data = data_cb, + .on_headers_complete = data_begin_cb, + .on_part_data_end = data_end_cb, + .on_header_field = header_field, + .on_header_value = header_value + }; + + var = getenv("CONTENT_TYPE"); + + if (!var || strncmp(var, "multipart/form-data;", 20)) + return NULL; + + for (var += 20; *var && *var != '='; var++); + + if (*var++ != '=') + return NULL; + + boundary = malloc(strlen(var) + 3); + + if (!boundary) + return NULL; + + strcpy(boundary, "--"); + strcpy(boundary + 2, var); + + st.tempfd = -1; + st.filefd = -1; + st.filemode = 0600; + + p = multipart_parser_init(boundary, &s); + + free(boundary); + + return p; +} + +static int +main_upload(int argc, char *argv[]) +{ + int rem, len; + char buf[4096]; + multipart_parser *p; + + p = init_parser(); + + if (!p) + { + errno = EINVAL; + return response(false, "Invalid request"); + } + + while ((len = read(0, buf, sizeof(buf))) > 0) + { + rem = multipart_parser_execute(p, buf, len); + + if (rem < len) + break; + } + + multipart_parser_free(p); + + /* read remaining post data */ + while ((len = read(0, buf, sizeof(buf))) > 0); + + return 0; +} + +static int +main_backup(int argc, char **argv) +{ + pid_t pid; + time_t now; + int len; + int fds[2]; + char buf[4096]; + char datestr[16] = { 0 }; + char hostname[64] = { 0 }; + char *fields[] = { "sessionid", NULL }; + + if (!postdecode(fields, 1) || !session_access(fields[1], "backup", "read")) + return failure(0, "Backup permission denied"); + + if (pipe(fds)) + return failure(errno, "Failed to spawn pipe"); + + switch ((pid = fork())) + { + case -1: + return failure(errno, "Failed to fork process"); + + case 0: + dup2(fds[1], 1); + + close(0); + close(2); + close(fds[0]); + close(fds[1]); + + chdir("/"); + + execl("/sbin/sysupgrade", "/sbin/sysupgrade", + "--create-backup", "-", NULL); + + return -1; + + default: + now = time(NULL); + strftime(datestr, sizeof(datestr) - 1, "%Y-%m-%d", localtime(&now)); + + if (gethostname(hostname, sizeof(hostname) - 1)) + sprintf(hostname, "OpenWrt"); + + printf("Status: 200 OK\r\n"); + printf("Content-Type: application/x-targz\r\n"); + printf("Content-Disposition: attachment; " + "filename=\"backup-%s-%s.tar.gz\"\r\n\r\n", hostname, datestr); + + while ((len = read(fds[0], buf, sizeof(buf))) > 0) + fwrite(buf, len, 1, stdout); + + waitpid(pid, NULL, 0); + + close(fds[0]); + close(fds[1]); + + return 0; + } +} + +int main(int argc, char **argv) +{ + if (strstr(argv[0], "cgi-upload")) + return main_upload(argc, argv); + else if (strstr(argv[0], "cgi-backup")) + return main_backup(argc, argv); + + return -1; +} diff --git a/net/cgi-io/src/multipart_parser.c b/net/cgi-io/src/multipart_parser.c new file mode 100644 index 0000000..ee82c82 --- /dev/null +++ b/net/cgi-io/src/multipart_parser.c @@ -0,0 +1,309 @@ +/* Based on node-formidable by Felix Geisendörfer + * Igor Afonov - afonov@gmail.com - 2012 + * MIT License - http://www.opensource.org/licenses/mit-license.php + */ + +#include "multipart_parser.h" + +#include +#include +#include + +static void multipart_log(const char * format, ...) +{ +#ifdef DEBUG_MULTIPART + va_list args; + va_start(args, format); + + fprintf(stderr, "[HTTP_MULTIPART_PARSER] %s:%d: ", __FILE__, __LINE__); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); +#endif +} + +#define NOTIFY_CB(FOR) \ +do { \ + if (p->settings->on_##FOR) { \ + if (p->settings->on_##FOR(p) != 0) { \ + return i; \ + } \ + } \ +} while (0) + +#define EMIT_DATA_CB(FOR, ptr, len) \ +do { \ + if (p->settings->on_##FOR) { \ + if (p->settings->on_##FOR(p, ptr, len) != 0) { \ + return i; \ + } \ + } \ +} while (0) + + +#define LF 10 +#define CR 13 + +struct multipart_parser { + void * data; + + size_t index; + size_t boundary_length; + + unsigned char state; + + const multipart_parser_settings* settings; + + char* lookbehind; + char multipart_boundary[1]; +}; + +enum state { + s_uninitialized = 1, + s_start, + s_start_boundary, + s_header_field_start, + s_header_field, + s_headers_almost_done, + s_header_value_start, + s_header_value, + s_header_value_almost_done, + s_part_data_start, + s_part_data, + s_part_data_almost_boundary, + s_part_data_boundary, + s_part_data_almost_end, + s_part_data_end, + s_part_data_final_hyphen, + s_end +}; + +multipart_parser* multipart_parser_init + (const char *boundary, const multipart_parser_settings* settings) { + + multipart_parser* p = malloc(sizeof(multipart_parser) + + strlen(boundary) + + strlen(boundary) + 9); + + strcpy(p->multipart_boundary, boundary); + p->boundary_length = strlen(boundary); + + p->lookbehind = (p->multipart_boundary + p->boundary_length + 1); + + p->index = 0; + p->state = s_start; + p->settings = settings; + + return p; +} + +void multipart_parser_free(multipart_parser* p) { + free(p); +} + +void multipart_parser_set_data(multipart_parser *p, void *data) { + p->data = data; +} + +void *multipart_parser_get_data(multipart_parser *p) { + return p->data; +} + +size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len) { + size_t i = 0; + size_t mark = 0; + char c, cl; + int is_last = 0; + + while(i < len) { + c = buf[i]; + is_last = (i == (len - 1)); + switch (p->state) { + case s_start: + multipart_log("s_start"); + p->index = 0; + p->state = s_start_boundary; + + /* fallthrough */ + case s_start_boundary: + multipart_log("s_start_boundary"); + if (p->index == p->boundary_length) { + if (c != CR) { + return i; + } + p->index++; + break; + } else if (p->index == (p->boundary_length + 1)) { + if (c != LF) { + return i; + } + p->index = 0; + NOTIFY_CB(part_data_begin); + p->state = s_header_field_start; + break; + } + if (c != p->multipart_boundary[p->index]) { + return i; + } + p->index++; + break; + + case s_header_field_start: + multipart_log("s_header_field_start"); + mark = i; + p->state = s_header_field; + + /* fallthrough */ + case s_header_field: + multipart_log("s_header_field"); + if (c == CR) { + p->state = s_headers_almost_done; + break; + } + + if (c == '-') { + break; + } + + if (c == ':') { + EMIT_DATA_CB(header_field, buf + mark, i - mark); + p->state = s_header_value_start; + break; + } + + cl = tolower(c); + if (cl < 'a' || cl > 'z') { + multipart_log("invalid character in header name"); + return i; + } + if (is_last) + EMIT_DATA_CB(header_field, buf + mark, (i - mark) + 1); + break; + + case s_headers_almost_done: + multipart_log("s_headers_almost_done"); + if (c != LF) { + return i; + } + + p->state = s_part_data_start; + break; + + case s_header_value_start: + multipart_log("s_header_value_start"); + if (c == ' ') { + break; + } + + mark = i; + p->state = s_header_value; + + /* fallthrough */ + case s_header_value: + multipart_log("s_header_value"); + if (c == CR) { + EMIT_DATA_CB(header_value, buf + mark, i - mark); + p->state = s_header_value_almost_done; + } + if (is_last) + EMIT_DATA_CB(header_value, buf + mark, (i - mark) + 1); + break; + + case s_header_value_almost_done: + multipart_log("s_header_value_almost_done"); + if (c != LF) { + return i; + } + p->state = s_header_field_start; + break; + + case s_part_data_start: + multipart_log("s_part_data_start"); + NOTIFY_CB(headers_complete); + mark = i; + p->state = s_part_data; + + /* fallthrough */ + case s_part_data: + multipart_log("s_part_data"); + if (c == CR) { + EMIT_DATA_CB(part_data, buf + mark, i - mark); + mark = i; + p->state = s_part_data_almost_boundary; + p->lookbehind[0] = CR; + break; + } + if (is_last) + EMIT_DATA_CB(part_data, buf + mark, (i - mark) + 1); + break; + + case s_part_data_almost_boundary: + multipart_log("s_part_data_almost_boundary"); + if (c == LF) { + p->state = s_part_data_boundary; + p->lookbehind[1] = LF; + p->index = 0; + break; + } + EMIT_DATA_CB(part_data, p->lookbehind, 1); + p->state = s_part_data; + mark = i --; + break; + + case s_part_data_boundary: + multipart_log("s_part_data_boundary"); + if (p->multipart_boundary[p->index] != c) { + EMIT_DATA_CB(part_data, p->lookbehind, 2 + p->index); + p->state = s_part_data; + mark = i --; + break; + } + p->lookbehind[2 + p->index] = c; + if ((++ p->index) == p->boundary_length) { + NOTIFY_CB(part_data_end); + p->state = s_part_data_almost_end; + } + break; + + case s_part_data_almost_end: + multipart_log("s_part_data_almost_end"); + if (c == '-') { + p->state = s_part_data_final_hyphen; + break; + } + if (c == CR) { + p->state = s_part_data_end; + break; + } + return i; + + case s_part_data_final_hyphen: + multipart_log("s_part_data_final_hyphen"); + if (c == '-') { + NOTIFY_CB(body_end); + p->state = s_end; + break; + } + return i; + + case s_part_data_end: + multipart_log("s_part_data_end"); + if (c == LF) { + p->state = s_header_field_start; + NOTIFY_CB(part_data_begin); + break; + } + return i; + + case s_end: + multipart_log("s_end: %02X", (int) c); + break; + + default: + multipart_log("Multipart parser unrecoverable error"); + return 0; + } + ++ i; + } + + return len; +} diff --git a/net/cgi-io/src/multipart_parser.h b/net/cgi-io/src/multipart_parser.h new file mode 100644 index 0000000..87e67f4 --- /dev/null +++ b/net/cgi-io/src/multipart_parser.h @@ -0,0 +1,48 @@ +/* Based on node-formidable by Felix Geisendörfer + * Igor Afonov - afonov@gmail.com - 2012 + * MIT License - http://www.opensource.org/licenses/mit-license.php + */ +#ifndef _multipart_parser_h +#define _multipart_parser_h + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include + +typedef struct multipart_parser multipart_parser; +typedef struct multipart_parser_settings multipart_parser_settings; +typedef struct multipart_parser_state multipart_parser_state; + +typedef int (*multipart_data_cb) (multipart_parser*, const char *at, size_t length); +typedef int (*multipart_notify_cb) (multipart_parser*); + +struct multipart_parser_settings { + multipart_data_cb on_header_field; + multipart_data_cb on_header_value; + multipart_data_cb on_part_data; + + multipart_notify_cb on_part_data_begin; + multipart_notify_cb on_headers_complete; + multipart_notify_cb on_part_data_end; + multipart_notify_cb on_body_end; +}; + +multipart_parser* multipart_parser_init + (const char *boundary, const multipart_parser_settings* settings); + +void multipart_parser_free(multipart_parser* p); + +size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len); + +void multipart_parser_set_data(multipart_parser* p, void* data); +void * multipart_parser_get_data(multipart_parser* p); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/net/chaosvpn/Makefile b/net/chaosvpn/Makefile new file mode 100644 index 0000000..f36c8d5 --- /dev/null +++ b/net/chaosvpn/Makefile @@ -0,0 +1,56 @@ +# +# Copyright (C) 2010-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=chaosvpn + +PKG_REV:=2eb24810b5aa0b2d56f21562e52927020dc3090a +PKG_VERSION:=2014-01-24 +PKG_RELEASE=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/ryd/chaosvpn.git +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_LICENSE:=Apache-2.0 +PKG_MAINTAINER:=Norbert Summer + +include $(INCLUDE_DIR)/package.mk + +define Package/chaosvpn + TITLE:=Config generator for chaos vpn + SECTION:=net + CATEGORY:=Network + URL:=https://wiki.hamburg.ccc.de/index.php/ChaosVPN::DebianHowto + SUBMENU:=VPN + DEPENDS:=+tinc +ip +kmod-tun +libopenssl +zlib +endef + +define Package/chaosvpn/description + Configure tincd for the chaosvpn network +endef + +define Package/chaosvpn/conffiles +/etc/tinc/chaosvpn.conf +endef + +MAKE_FLAGS += \ + COPT="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" + +define Package/chaosvpn/install + $(INSTALL_DIR) $(1)/etc/tinc/chaos/ $(1)/usr/sbin/ $(1)/etc/init.d/ $(1)/etc/hotplug.d/iface/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chaosvpn $(1)/usr/sbin/ + $(INSTALL_BIN) ./files/chaosvpn.init $(1)/etc/init.d/chaosvpn + $(INSTALL_BIN) ./files/chaosvpn.hotplug $(1)/etc/hotplug.d/iface/40-chaosvpn + sed -i -e 's/"\/sbin\/ip /"\/usr\/sbin\/ip /' $(PKG_BUILD_DIR)/chaosvpn.conf + $(INSTALL_CONF) $(PKG_BUILD_DIR)/chaosvpn.conf $(1)/etc/tinc/chaosvpn.conf +endef + +$(eval $(call BuildPackage,chaosvpn)) + diff --git a/net/chaosvpn/files/chaosvpn.hotplug b/net/chaosvpn/files/chaosvpn.hotplug new file mode 100755 index 0000000..3044e53 --- /dev/null +++ b/net/chaosvpn/files/chaosvpn.hotplug @@ -0,0 +1,3 @@ +[ "$INTERFACE" == "wan" ] || return +[ "$ACTION" == "ifup" ] && /etc/init.d/chaosvpn restart + diff --git a/net/chaosvpn/files/chaosvpn.init b/net/chaosvpn/files/chaosvpn.init new file mode 100755 index 0000000..f847a9a --- /dev/null +++ b/net/chaosvpn/files/chaosvpn.init @@ -0,0 +1,31 @@ +#!/bin/sh /etc/rc.common +START=99 + +USE_PROCD=1 + +start_service() +{ + #check if chaosvpn is configured + if [ ! -f "/etc/tinc/chaos/rsa_key.pub" -o ! -f "/etc/tinc/chaos/rsa_key.priv" ]; then + logger -t chaosvpn "please generate rsa key pair" + logger -t chaosvpn "tincd -n chaos --generate-keys=2048" + exit 1 + fi + + if [ "`grep unique_name /etc/tinc/chaosvpn.conf | wc -l`" != "0" ]; then + logger -t chaosvpn "/etc/tinc/chaosvpn.conf is not configured yet or contains 'unique_name'" + exit 1 + fi + + procd_open_instance + procd_set_param command /usr/sbin/chaosvpn -r -c /etc/tinc/chaosvpn.conf + procd_close_instance +} + +stop_service() +{ + #force remove tinc pid + if [ -f "/var/run/tinc.chaos.pid" ]; then + rm "/var/run/tinc.chaos.pid" + fi +} diff --git a/net/chrony/Makefile b/net/chrony/Makefile new file mode 100644 index 0000000..db631fe --- /dev/null +++ b/net/chrony/Makefile @@ -0,0 +1,76 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=chrony +PKG_VERSION:=2.4.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://download.tuxfamily.org/chrony/ +PKG_MD5SUM:=d08dd5a7d79a89891d119adcccb4397d + +PKG_MAINTAINER:=Miroslav Lichvar +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_BUILD_DEPENDS:=+pps-tools + +include $(INCLUDE_DIR)/package.mk + +define Package/chrony + SUBMENU:=Time Synchronization + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libcap + USERID:=chrony=323:chrony=323 + TITLE:=A versatile NTP client and server + URL:=http://chrony.tuxfamily.org/ +endef + +define Package/chrony/description + An NTP client and server designed to perform well in a wide range + of conditions. It can synchronize the system clock with NTP servers, + reference clocks, and manual input using wristwatch and keyboard. +endef + +define Package/chrony/conffiles +/etc/chrony/chrony.conf +/etc/config/chrony +endef + +CONFIGURE_ARGS+= \ + --host-machine=$(shell echo $(GNU_TARGET_NAME) | sed -e 's/-.*//') \ + --host-release="" \ + --host-system=Linux \ + --sysconfdir=/etc/chrony \ + --prefix=/usr \ + --chronysockdir=/var/run/chrony \ + --disable-readline \ + --disable-rtc \ + --disable-asyncdns \ + --with-user=chrony + +CONFIGURE_VARS+=CPPFLAGS=-DNDEBUG + +define Package/chrony/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyd $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/chronyc $(1)/usr/bin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DIR) $(1)/etc/chrony + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) ./files/chrony.hotplug $(1)/etc/hotplug.d/iface/20-chrony + $(INSTALL_BIN) ./files/chronyd.init $(1)/etc/init.d/chronyd + $(INSTALL_CONF) ./files/chrony.config $(1)/etc/config/chrony + $(INSTALL_CONF) ./files/chrony.conf $(1)/etc/chrony/chrony.conf +endef + +$(eval $(call BuildPackage,chrony)) diff --git a/net/chrony/files/chrony.conf b/net/chrony/files/chrony.conf new file mode 100644 index 0000000..b207c94 --- /dev/null +++ b/net/chrony/files/chrony.conf @@ -0,0 +1,7 @@ +# This file is included from config file generated from /etc/config/chrony + +# Log clock errors above 0.5 seconds +logchange 0.5 + +# Don't log client accesses +noclientlog diff --git a/net/chrony/files/chrony.config b/net/chrony/files/chrony.config new file mode 100644 index 0000000..63f494d --- /dev/null +++ b/net/chrony/files/chrony.config @@ -0,0 +1,14 @@ +config pool + option hostname '2.openwrt.pool.ntp.org' + option maxpoll '12' + option iburst 'yes' + +config dhcp_ntp_server + option iburst 'yes' + +config allow + option interface 'lan' + +config makestep + option threshold '1.0' + option limit '3' diff --git a/net/chrony/files/chrony.hotplug b/net/chrony/files/chrony.hotplug new file mode 100644 index 0000000..6ab2104 --- /dev/null +++ b/net/chrony/files/chrony.hotplug @@ -0,0 +1,44 @@ +#!/bin/sh +# Set chronyd online/offline status, allow NTP access and add servers from DHCP + +[ "$ACTION" = ifup -o "$ACTION" = ifdown ] || exit 0 + +run_command() { + /usr/bin/chronyc -n "$*" > /dev/null 2>&1 +} + +run_command tracking || exit 0 + +. /lib/functions/network.sh + +network_find_wan iface4 +network_find_wan6 iface6 +run_command $([ -n "$iface4" ] && echo online || echo offline) 0.0.0.0/0.0.0.0 +run_command $([ -n "$iface6" ] && echo online || echo offline) ::/0 + +[ "$ACTION" = ifup ] || exit 0 + +. /lib/functions.sh +. /etc/init.d/chronyd + +config_load chrony + +config_foreach handle_allow allow | while read command; do + run_command "$command" +done + +# Add servers from DHCP only if the config has a dhcp_ntp_server section +[ -z "$(config_foreach echo dhcp_ntp_server)" ] && exit 0 + +. /usr/share/libubox/jshn.sh + +for iface in $iface4 $iface6; do + json_load "$(ifstatus $iface)" + json_select data + json_get_var dhcp_ntp_servers ntpserver + + for server in $dhcp_ntp_servers; do + run_command add $(NTP_SOURCE_HOSTNAME=$server config_foreach \ + handle_source dhcp_ntp_server server) + done +done diff --git a/net/chrony/files/chronyd.init b/net/chrony/files/chronyd.init new file mode 100644 index 0000000..f7aee0a --- /dev/null +++ b/net/chrony/files/chronyd.init @@ -0,0 +1,76 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2015 OpenWrt.org + +START=15 +USE_PROCD=1 +PROG=/usr/sbin/chronyd +CONFIGFILE=/var/etc/chrony.conf +INCLUDEFILE=/etc/chrony/chrony.conf + +handle_source() { + local cfg=$1 sourcetype=$2 hostname minpoll maxpoll iburst + + hostname=$NTP_SOURCE_HOSTNAME + [ -z "$hostname" ] && config_get hostname "$cfg" hostname + [ -z "$hostname" ] && return + config_get minpoll "$cfg" minpoll + config_get maxpoll "$cfg" maxpoll + config_get_bool iburst "$cfg" iburst 0 + echo $( + echo $sourcetype $hostname + [ -n "$minpoll" ] && echo minpoll $minpoll + [ -n "$maxpoll" ] && echo maxpoll $maxpoll + [ "$iburst" = "1" ] && echo iburst + ) +} + +handle_allow() { + local cfg=$1 iface wan_iface wan6_iface subnet subnets subnets6 + + network_find_wan wan_iface true + network_find_wan6 wan6_iface true + config_get iface "$cfg" interface + + if [ "$wan_iface" = "$iface" ]; then + echo allow 0/0 + elif [ "$wan6_iface" = "$iface" ]; then + echo allow ::/0 + else + network_get_subnets subnets $iface || \ + network_get_subnets subnets6 $iface || continue + for subnet in $subnets $subnets6; do + echo allow $subnet + done + fi +} + +handle_makestep() { + local cfg=$1 threshold limit + + config_get threshold "$cfg" threshold + config_get limit "$cfg" limit + [ -z "$threshold" -o -z "$limit" ] && return + echo makestep $threshold $limit +} + +start_service() { + . /lib/functions/network.sh + + procd_open_instance + procd_set_param command $PROG -n -f $CONFIGFILE + procd_set_param file $CONFIGFILE + procd_set_param file $INCLUDEFILE + procd_close_instance + + config_load chrony + mkdir -p $(dirname $CONFIGFILE) + + ( + echo include $INCLUDEFILE + config_foreach handle_source server server + config_foreach handle_source pool pool + config_foreach handle_source peer peer + config_foreach handle_allow allow + config_foreach handle_makestep makestep + ) > $CONFIGFILE +} diff --git a/net/chrony/patches/001-freebind_uclibc.patch b/net/chrony/patches/001-freebind_uclibc.patch new file mode 100644 index 0000000..e18d07e --- /dev/null +++ b/net/chrony/patches/001-freebind_uclibc.patch @@ -0,0 +1,13 @@ +diff --git a/sysincl.h b/sysincl.h +index 30e9b48..8fe16c0 100644 +--- a/sysincl.h ++++ b/sysincl.h +@@ -70,4 +70,8 @@ + #include + #endif + ++#if defined(LINUX) && !defined(IP_FREEBIND) ++#define IP_FREEBIND 15 ++#endif ++ + #endif /* GOT_SYSINCL_H */ diff --git a/net/cifs-utils/Makefile b/net/cifs-utils/Makefile new file mode 100644 index 0000000..ed2edd6 --- /dev/null +++ b/net/cifs-utils/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2007-2012 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=cifs-utils +PKG_VERSION:=6.4 +PKG_RELEASE:=2 + +PKG_SOURCE_URL:=http://ftp.samba.org/pub/linux-cifs/cifs-utils +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_MD5SUM:=b7d75b67fd3987952896d27256c7293d + +PKG_MAINTAINER:=Florian Fainelli +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=COPYING + +include $(INCLUDE_DIR)/package.mk + +define Package/cifsmount + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-fs-cifs + TITLE:=CIFS mount utilities + URL:=http://wiki.samba.org/index.php/LinuxCIFS_utils +endef + +TARGET_CFLAGS += -Wno-error + +CONFIGURE_ARGS += \ + --exec-prefix=/usr \ + --prefix=/ \ + --with-libcap-ng=no \ + --with-libcap=no + +define Package/cifsmount/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/mount.cifs $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,cifsmount)) diff --git a/net/cifs-utils/patches/001-fix-musl-build.patch b/net/cifs-utils/patches/001-fix-musl-build.patch new file mode 100644 index 0000000..e34d4f1 --- /dev/null +++ b/net/cifs-utils/patches/001-fix-musl-build.patch @@ -0,0 +1,30 @@ +From 6603cef0f06c450196a1bca06bb143d8fcda5651 Mon Sep 17 00:00:00 2001 +From: Felix Janda +Date: Fri, 5 Dec 2014 23:19:29 +0100 +Subject: [PATCH 1/1] mtab.c: include for _PATH_MOUNTED +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Backported from: 6603cef0f06c450196a1bca06bb143d8fcda5651 + +Signed-off-by: Felix Janda +Signed-off-by: Jörg Krause +--- + mtab.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mtab.c b/mtab.c +index 7b365b3..a662a3c 100644 +--- a/mtab.c ++++ b/mtab.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + #include "mount.h" + #include "config.h" + +-- +2.5.0 diff --git a/net/clamav/Makefile b/net/clamav/Makefile new file mode 100644 index 0000000..3f3edab --- /dev/null +++ b/net/clamav/Makefile @@ -0,0 +1,120 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=clamav +PKG_VERSION:=0.98.7 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Marko Ratkaj + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://sourceforge.net/projects/clamav/files/clamav/$(PKG_VERSION)/ +PKG_MD5SUM:=157c601161da1c2d5a0e48ea1b49e067 + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + +define Package/clamav/Default + SECTION:=net + DEPENDS:=+libpthread +uclibcxx +zlib +libcurl +libopenssl + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=ClamAV + URL:=http://www.clamav.net/ +endef + +define Package/clamav + $(call Package/clamav/Default) +endef + +define Package/freshclam + $(call Package/clamav/Default) + DEPENDS+= +clamav + TITLE+=database updater +endef + +define Package/clamav/description + ClamAV is an open source antivirus engine for detecting trojans, + viruses, malware & other malicious threats. +endef + +define Package/freshclam/description + Database updater for ClamAV +endef + +define Package/clamav/conffiles +endef + +CONFIGURE_VARS += \ + INCLUDES="" \ + CXXFLAGS="$$$$CXXFLAGS -fno-rtti" \ + LIBS="-lpthread" \ + +define Build/Configure + $(call Build/Configure/Default, \ + --sysconfdir=/etc/clamav/ \ + --prefix=/usr/ \ + --exec-prefix=/usr/ \ + --disable-xml \ + --disable-bzip2 \ + --enable-ltdl-install \ + --with-user nobody \ + --with-group nogroup \ + ) +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + all install +endef + +define Package/clamav/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/clamd $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamav-config $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clambc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamconf $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamdscan $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/clamscan $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sigtool $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/clamav.h $(1)/usr/include/ + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib*/* $(1)/usr/lib/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/clamav.config $(1)/etc/config/clamav + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/clamav.init $(1)/etc/init.d/clamav + + $(INSTALL_DIR) $(1)/usr/share/clamav + $(CP) ./files/bytecode.cvd $(1)/usr/share/clamav/ +endef + +define Package/freshclam/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/freshclam $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/freshclam.config $(1)/etc/config/freshclam + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/freshclam.init $(1)/etc/init.d/freshclam +endef + +$(eval $(call BuildPackage,clamav)) +$(eval $(call BuildPackage,freshclam)) diff --git a/net/clamav/files/bytecode.cvd b/net/clamav/files/bytecode.cvd new file mode 100644 index 0000000..07ff8ab Binary files /dev/null and b/net/clamav/files/bytecode.cvd differ diff --git a/net/clamav/files/clamav.config b/net/clamav/files/clamav.config new file mode 100644 index 0000000..1543caa --- /dev/null +++ b/net/clamav/files/clamav.config @@ -0,0 +1,34 @@ +config clamav 'clamav' + option clamd_config_file '/etc/clamav/clamd.conf' + option LogFile '/tmp/clamd.log' + option LogFileMaxSize '1M' + option LogTime 'no' + option LogVerbose 'no' + option ExtendedDetectionInfo 'no' + option OfficialDatabaseOnly 'no' + option StreamMinPort '1024' + option StreamMaxPort '2048' + option MaxThreads '10' + option ReadTimeout '30' + option CommandReadTimeout '5' + option MaxDirectoryRecursion '15' + option FollowDirectorySymlinks 'no' + option FollowFileSymlinks 'no' + option SelfCheck '600' + option DetectPUA 'yes' + option ScanPE 'yes' + option DisableCertCheck 'no' + option ScanELF 'yes' + option DetectBrokenExecutables 'no' + option ScanOLE2 'yes' + option ScanPDF 'yes' + option ScanSWF 'yes' + option ScanMail 'yes' + option ScanPartialMessages 'no' + option ScanArchive 'yes' + option ArchiveBlockEncrypted 'yes' + option MaxFileSize '10M' + option TemporaryDirectory '/tmp' + option LocalSocket '/var/run/clamav/clamd.sock' + option User 'nobody' + option ExitOnOOM 'yes' diff --git a/net/clamav/files/clamav.init b/net/clamav/files/clamav.init new file mode 100644 index 0000000..b2a8950 --- /dev/null +++ b/net/clamav/files/clamav.init @@ -0,0 +1,116 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/sbin/clamd +CLAMD_CONFIGFILE="/tmp/clamav/clamd.conf" + +validate_clamav_section() { + uci_validate_section clamav clamav "${1}" \ + 'clamd_config_file:string' \ + 'LogFile:string' \ + 'LogFileMaxSize:string' \ + 'LogVerbose:string' \ + 'ExtendedDetectionInfo:string' \ + 'LogTime:string' \ + 'OfficialDatabaseOnly:string' \ + 'StreamMinPort:uinteger' \ + 'StreamMaxPort:uinteger' \ + 'MaxThreads:uinteger' \ + 'ReadTimeout:uinteger' \ + 'CommandReadTimeout:uinteger' \ + 'MaxDirectoryRecursion:uinteger' \ + 'FollowDirectorySymlinks:string' \ + 'FollowFileSymlinks:string' \ + 'SelfCheck:uinteger' \ + 'DetectPUA:string' \ + 'ScanPE:string' \ + 'DisableCertCheck:string' \ + 'ScanELF:string' \ + 'DetectBrokenExecutables:string' \ + 'ScanOLE2:string' \ + 'ScanPDF:string' \ + 'ScanSWF:string' \ + 'ScanMail:string' \ + 'ScanPartialMessages:string' \ + 'ScanArchive:string' \ + 'TemporaryDirectory:string' \ + 'ArchiveBlockEncrypted:string' \ + 'MaxFileSize:string' \ + 'LocalSocket:string' \ + 'User:string' \ + 'ExitOnOOM:string' +} + +start_service() { + local clamd_config_file LogFile LogTime StreamMinPort \ + StreamMaxPort MaxThreads ReadTimeout CommandReadTimeout MaxDirectoryRecursion \ + FollowFileSymlinks FollowDirectorySymlinks SelfCheck DetectPUA ScanPE DisableCertCheck \ + ScanELF DetectBrokenExecutables ScanOLE2 ScanPDF ScanSWF ScanMail ScanPartialMessages \ + ScanArchive TemporaryDirectory ArchiveBlockEncrypted MaxFileSize LocalSocket User + + validate_clamav_section clamav || { + echo "validation failed" + return 1 + } + + mkdir -p /usr/share/clamav + mkdir -p /etc/clamav/ + mkdir -p /var/run/clamav/ + chmod a+rw /var/run/clamav + + mkdir -p $(dirname $CLAMD_CONFIGFILE) + ln -sf $clamd_config_file $CLAMD_CONFIGFILE + + echo "LogFile " $LogFile > $CLAMD_CONFIGFILE + echo "LogFileMaxSize " $LogFileMaxSize >> $CLAMD_CONFIGFILE + echo "LogVerbose " $LogVerbose >> $CLAMD_CONFIGFILE + echo "ExtendedDetectionInfo " $ExtendedDetectionInfo >> $CLAMD_CONFIGFILE + echo "LogTime " $LogTime >> $CLAMD_CONFIGFILE + echo "OfficialDatabaseOnly " $OfficialDatabaseOnly >> $CLAMD_CONFIGFILE + echo "StreamMinPort " $StreamMinPort >> $CLAMD_CONFIGFILE + echo "StreamMaxPort " $StreamMaxPort >> $CLAMD_CONFIGFILE + echo "MaxThreads " $MaxThreads >> $CLAMD_CONFIGFILE + echo "ReadTimeout " $ReadTimeout >> $CLAMD_CONFIGFILE + echo "CommandReadTimeout " $CommandReadTimeout >> $CLAMD_CONFIGFILE + echo "MaxDirectoryRecursion " $MaxDirectoryRecursion >> $CLAMD_CONFIGFILE + echo "FollowDirectorySymlinks " $FollowDirectorySymlinks >> $CLAMD_CONFIGFILE + echo "FollowFileSymlinks " $FollowFileSymlinks >> $CLAMD_CONFIGFILE + echo "SelfCheck " $SelfCheck >> $CLAMD_CONFIGFILE + echo "DetectPUA " $DetectPUA >> $CLAMD_CONFIGFILE + echo "ScanPE " $ScanPE >> $CLAMD_CONFIGFILE + echo "DisableCertCheck " $DisableCertCheck >> $CLAMD_CONFIGFILE + echo "ScanELF " $ScanELF >> $CLAMD_CONFIGFILE + echo "DetectBrokenExecutables " $DetectBrokenExecutables >> $CLAMD_CONFIGFILE + echo "ScanOLE2 " $ScanOLE2 >> $CLAMD_CONFIGFILE + echo "ScanPDF " $ScanPDF >> $CLAMD_CONFIGFILE + echo "ScanSWF " $ScanSWF >> $CLAMD_CONFIGFILE + echo "ScanMail " $ScanMail >> $CLAMD_CONFIGFILE + echo "ScanPartialMessages " $ScanPartialMessages >> $CLAMD_CONFIGFILE + echo "ScanArchive " $ScanArchive >> $CLAMD_CONFIGFILE + echo "TemporaryDirectory " $TemporaryDirectory >> $CLAMD_CONFIGFILE + echo "ArchiveBlockEncrypted " $ArchiveBlockEncrypted >> $CLAMD_CONFIGFILE + echo "MaxFileSize " $MaxFileSize >> $CLAMD_CONFIGFILE + echo "LocalSocket " $LocalSocket >> $CLAMD_CONFIGFILE + echo "User " $User >> $CLAMD_CONFIGFILE + echo "ExitOnOOM " $ExitOnOOM >> $CLAMD_CONFIGFILE + + procd_open_instance + procd_set_param command $PROG -c $CLAMD_CONFIGFILE + procd_set_param file $CLAMD_CONFIGFILE + procd_close_instance +} + +stop_service() +{ + service_stop ${PROG} +} + +service_triggers() +{ + procd_add_reload_trigger "clamav" + procd_add_validation validate_clamav_section +} diff --git a/net/clamav/files/freshclam.config b/net/clamav/files/freshclam.config new file mode 100644 index 0000000..827e8dd --- /dev/null +++ b/net/clamav/files/freshclam.config @@ -0,0 +1,7 @@ +config freshclam 'freshclam' + option freshclam_config_file '/etc/clamav/freshclam.conf' + option UpdateLogFile '/tmp/freshclam.log' + option DatabaseMirror 'database.clamav.net' + option NotifyClamd '/etc/clamav/clamd.conf' + option DatabaseOwner 'root' + option CompressLocalDatabase 'yes' diff --git a/net/clamav/files/freshclam.init b/net/clamav/files/freshclam.init new file mode 100644 index 0000000..37b2767 --- /dev/null +++ b/net/clamav/files/freshclam.init @@ -0,0 +1,63 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/sbin/freshclam +FRESHCLAM_CONFIGFILE="/tmp/clamav/freshclam.conf" + +validate_freshclam_section() { + uci_validate_section freshclam freshclam "${1}" \ + 'freshclam_config_file:string' \ + 'UpdateLogFile:string' \ + 'DatabaseMirror:string' \ + 'NotifyClamd:string' \ + 'DatabaseOwner:string' \ + 'CompressLocalDatabase:string:' +} + +start_service() { + local freshclam_config_file UpdateLogFile DatabaseOwner NotifyClamd DatabaseMirror + + validate_freshclam_section freshclam || { + echo "validation failed" + return 1 + } + + [ -f /tmp/freshclam.pid ] && echo "already running" && return 0 + + mkdir -p /usr/share/clamav + mkdir -p /etc/clamav + touch /tmp/freshclam.log + touch /tmp/freshclam.pid + + mkdir -p $(dirname $FRESHCLAM_CONFIGFILE) + ln -sf $freshclam_config_file $FRESHCLAM_CONFIGFILE + + echo "UpdateLogFile " $UpdateLogFile > $FRESHCLAM_CONFIGFILE + echo "DatabaseMirror " $DatabaseMirror >> $FRESHCLAM_CONFIGFILE + echo "NotifyClamd " $NotifyClamd >> $FRESHCLAM_CONFIGFILE + echo "DatabaseOwner " $DatabaseOwner >> $FRESHCLAM_CONFIGFILE + echo "CompressLocalDatabase " $CompressLocalDatabase >> $FRESHCLAM_CONFIGFILE + + procd_open_instance + procd_set_param command $PROG -d --config-file=$FRESHCLAM_CONFIGFILE -p /tmp/freshclam.pid --no-warnings + procd_set_param file $FRESHCLAM_CONFIGFILE + procd_close_instance +} + +stop_service() +{ + [ ! -f /tmp/freshclam.pid ] && echo "not running" && return 0 + PID=`cat /tmp/freshclam.pid` + kill $PID + rm -f /tmp/freshclam.pid +} + +service_triggers() +{ + procd_add_reload_trigger "freshclam" + procd_add_validation validate_freshclam_section +} diff --git a/net/clamav/patches/001-compile.patch b/net/clamav/patches/001-compile.patch new file mode 100644 index 0000000..3992257 --- /dev/null +++ b/net/clamav/patches/001-compile.patch @@ -0,0 +1,10 @@ +--- a/clamdscan/proto.c ++++ b/clamdscan/proto.c +@@ -55,6 +55,7 @@ + #include "shared/misc.h" + #include "shared/clamdcom.h" + ++#include + #include "proto.h" + #include "client.h" + diff --git a/net/coova-chilli/Config.in b/net/coova-chilli/Config.in new file mode 100644 index 0000000..c0c671f --- /dev/null +++ b/net/coova-chilli/Config.in @@ -0,0 +1,52 @@ +# CoovaChilli advanced configuration + +menu "Configuration" + depends on PACKAGE_coova-chilli + +config COOVACHILLI_PROXY + bool "Enable support for chilli proxy. Required for AAA Proxy through http" + default n + +config COOVACHILLI_REDIR + bool "Enable support for redir server. Required for uamregex" + default n + +config COOVACHILLI_MINIPORTAL + bool "Enable support Coova miniportal" + default n + +config COOVACHILLI_USERAGENT + bool "Enable recording user-agent" + default n + +config COOVACHILLI_DNSLOG + bool "Enable support to log DNS name queries" + default n + +config COOVACHILLI_UAMDOMAINFILE + bool "Enable loading of mass uamdomains from file" + default n + +config COOVACHILLI_LARGELIMITS + bool "Enable larger limits for use with non-embedded systems" + default n + +choice + prompt "SSL library" + default COOVACHILLI_NOSSL + +config COOVACHILLI_NOSSL + bool "No SSL support" + +config COOVACHILLI_MATRIXSSL + bool "MatrixSSL" + +config COOVACHILLI_CYASSL + bool "CyaSSL" + +config COOVACHILLI_OPENSSL + bool "OpenSSL" + +endchoice + +endmenu diff --git a/net/coova-chilli/Makefile b/net/coova-chilli/Makefile new file mode 100644 index 0000000..b926a1d --- /dev/null +++ b/net/coova-chilli/Makefile @@ -0,0 +1,150 @@ +# +# Copyright (C) 2007-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=coova-chilli +PKG_VERSION:=1.3.0+20141128 +PKG_MAINTAINER:=Imre Kaloz +PKG_LICENSE:=GPL-2.0+ +PKG_LICENSE_FILES:=COPYING +PKG_RELEASE:=4 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/coova/coova-chilli +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=b93de20a288c01c2ba28e96e31ad6da01627f45f +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_MD5SUM:=2adb27ec56172b18c5beee359dd7898d + +PKG_INSTALL:=1 + +PKG_CONFIG_DEPENDS := \ + COOVACHILLI_MINIPORTAL \ + COOVACHILLI_REDIR \ + COOVACHILLI_USERAGENT \ + COOVACHILLI_DNSLOG \ + COOVACHILLI_UAMDOMAINFILE \ + COOVACHILLI_LARGELIMITS \ + COOVACHILLI_NOSSL \ + COOVACHILLI_MATRIXSSL \ + COOVACHILLI_CYASSL \ + COOVACHILLI_OPENSSL + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/kernel.mk + +define Package/coova-chilli + SUBMENU:=Captive Portals + SECTION:=net + CATEGORY:=Network + DEPENDS:=+kmod-tun +librt +COOVACHILLI_MATRIXSSL:libmatrixssl +COOVACHILLI_CYASSL:libcyassl +COOVACHILLI_OPENSSL:libopenssl + TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version) + URL:=http://www.coova.org/CoovaChilli + MENU:=1 +endef + +define Package/coova-chilli/description + CoovaChilli is an open source access controller for wireless LAN + access points and is based on ChilliSpot. It is used for authenticating + users of a wireless (or wired) LAN. It supports web based login (UAM) + which is today's standard for public HotSpots and it supports Wireless + Protected Access (WPA) which is the standard of the future. + Authentication, authorization and accounting (AAA) is handled by your + favorite radius server. +endef + +define Package/coova-chilli/config + source "$(SOURCE)/Config.in" +endef + +define KernelPackage/ipt-coova + URL:=http://www.coova.org/CoovaChilli + SUBMENU:=Netfilter Extensions + DEPENDS:=coova-chilli +kmod-ipt-core +libxtables + TITLE:=Coova netfilter module + FILES:=$(PKG_BUILD_DIR)/src/linux/xt_*.$(LINUX_KMOD_SUFFIX) + AUTOLOAD:=$(call AutoProbe,xt_coova) +endef + +define KernelPackage/ipt-coova/description + Netfilter kernel module for CoovaChilli + Includes: + - coova +endef + +DISABLE_NLS= + +TARGET_CFLAGS += $(FPIC) + +CONFIGURE_VARS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" + +MAKE_FLAGS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" + +MAKE_INSTALL_FLAGS += \ + ARCH="$(LINUX_KARCH)" \ + KERNEL_DIR="$(LINUX_DIR)" \ + INSTALL_MOD_PATH="$(PKG_INSTALL_DIR)" + +define Build/Prepare +$(call Build/Prepare/Default) + ( cd $(PKG_BUILD_DIR) ; \ + [ -f ./configure ] || { \ + ./bootstrap ; \ + } \ + ) +endef + +define Build/Configure + $(call Build/Configure/Default, \ + $(if $(CONFIG_COOVACHILLI_PROXY),--enable,--disable)-chilliproxy \ + $(if $(CONFIG_COOVACHILLI_REDIR),--enable,--disable)-chilliredir \ + $(if $(CONFIG_COOVACHILLI_DNSLOG),--enable,--disable)-dnslog \ + $(if $(CONFIG_COOVACHILLI_MINIPORTAL),--enable,--disable)-miniportal \ + $(if $(CONFIG_COOVACHILLI_USERAGENT),--enable,--disable)-useragent \ + $(if $(CONFIG_COOVACHILLI_LARGELIMITS),--enable,--disable)-largelimits \ + $(if $(CONFIG_COOVACHILLI_UAMDOMAINFILE),--enable,--disable)-uamdomainfile \ + $(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \ + $(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyassl \ + $(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \ + $(if $(CONFIG_PACKAGE_kmod-ipt-coova),--with-nfcoova) \ + ) +endef + +define Package/coova-chilli/conffiles +/etc/config/chilli +endef + +define Package/coova-chilli/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/chilli.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/chilli + $(CP) $(PKG_INSTALL_DIR)/etc/chilli/* $(1)/etc/chilli/ + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/chilli.hotplug $(1)/etc/hotplug.d/iface/30-chilli + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/ + $(if $(CONFIG_PACKAGE_kmod-ipt-coova), \ + $(INSTALL_DIR) $(1)/usr/lib/iptables; \ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/iptables/lib*.so $(1)/usr/lib/iptables/ \ + ) + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) files/chilli.init $(1)/etc/init.d/chilli + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) files/chilli.config $(1)/etc/config/chilli + $(INSTALL_DIR) $(1)/lib/firewall + $(CP) files/chilli.firewall $(1)/lib/firewall/chilli.sh +endef + +$(eval $(call BuildPackage,coova-chilli)) +$(eval $(call KernelPackage,ipt-coova)) diff --git a/net/coova-chilli/files/chilli.config b/net/coova-chilli/files/chilli.config new file mode 100644 index 0000000..4c037c6 --- /dev/null +++ b/net/coova-chilli/files/chilli.config @@ -0,0 +1,233 @@ +# +# Sample Coova-Chilli configuration file +# + +config chilli + # disable to running chilli. remove this option before running. + option disabled 1 + + # name of TUN device name. required. + option tundev 'tun0' + + # name of network interface + option network '' + + # Include this flag if process is to run in the foreground + #option fg + + # Include this flag to include debug information. + #option debug 9 + + # Re-read configuration file at this interval. Will also cause new domain + # name lookups to be performed. Value is given in seconds. + #option interval 3600 + + # File to store information about the process id of the program. + # The program must have write access to this file/directory. + #option pidfile /var/run/chilli.pid + + # Directory to use for nonvolatile storage. + # The program must have write access to this directory. + # this option is currently ignored + #option statedir ./ + + + # TUN parameters + + # IP network address of external packet data network + # Used to allocate dynamic IP addresses and set up routing. + # Normally you do not need to uncomment this option. + #option net 192.168.182.0/24 + + # Dynamic IP address pool + # Used to allocate dynamic IP addresses to clients. + # If not set it defaults to the net tag. + # Do not uncomment this option unless you are an experienced user! + #option dynip 192.168.182.0/24 + + # Static IP address pool + # Used to allocate static IP addresses to clients. + # Do not uncomment this option unless you are an experienced user! + #option statip 192.168.182.0/24 + + + # Primary DNS server. + # Will be suggested to the client. + # If omitted the system default will be used. + # Normally you do not need to uncomment this option. + #option dns1 172.16.0.5 + + # Secondary DNS server. + # Will be suggested to the client. + # If omitted the system default will be used. + # Normally you do not need to uncomment this option. + #option dns2 172.16.0.6 + + # Domain name + # Will be suggested to the client. + # Normally you do not need to uncomment this option. + #option domain key.chillispot.org + + # Script executed after network interface has been brought up. + # Executed with the following parameters: + # + # Normally you do not need to uncomment this option. + #option ipup /etc/chilli.ipup + + # Script executed after network interface has been taken down. + # Executed with the following parameters: + # + # Normally you do not need to uncomment this option. + #option ipdown /etc/chilli.ipdown + + + # Radius parameters + + # IP address to listen to + # Normally you do not need to uncomment this option. + #option radiuslisten 127.0.0.1 + + # IP address of radius server 1 + # For most installations you need to modify this option. + option radiusserver1 rad01.chillispot.org + + # IP address of radius server 2 + # If you have only one radius server you should set radiusserver2 to the + # same value as radiusserver1. + # For most installations you need to modify this option. + option radiusserver2 rad02.chillispot.org + + # Radius authentication port + # The UDP port number to use for radius authentication requests. + # The same port number is used for both radiusserver1 and radiusserver2. + # Normally you do not need to uncomment this option. + #option radiusauthport 1812 + + # Radius accounting port + # The UDP port number to use for radius accounting requests. + # The same port number is used for both radiusserver1 and radiusserver2. + # Normally you do not need to uncomment this option. + #option radiusacctport 1813 + + # Radius shared secret for both servers + # For all installations you should modify this option. + #option radiussecret testing123 + + # Radius NAS-Identifier + # Normally you do not need to uncomment this option. + #option radiusnasid nas01 + + # WISPr Location ID. Should be in the format: isocc=, + # cc=,ac=,network= + # Normally you do not need to uncomment this option. + #option radiuslocationid isocc=us,cc=1,ac=408,network=ACMEWISP_NewarkAirport + + # WISPr Location Name. Should be in the format: + # , + # Normally you do not need to uncomment this option. + #option radiuslocationname ACMEWISP,Gate_14_Terminal_C_of_Newark_Airport + + + # Radius proxy parameters + + # IP address to listen to + # Normally you do not need to uncomment this option. + #option proxylisten 10.0.0.1 + + # UDP port to listen to. + # If not specified a port will be selected by the system + # Normally you do not need to uncomment this option. + #option proxyport 1645 + + # Client(s) from which we accept radius requests + # Normally you do not need to uncomment this option. + #option proxyclient 10.0.0.1/24 + + # Radius proxy shared secret for all clients + # If not specified defaults to radiussecret + # Normally you do not need to uncomment this option. + #option proxysecret testing123 + + + # DHCP Parameters + + # Ethernet interface to listen to. + # This is the network interface which is connected to the access points. + # In a typical configuration this option should be set to eth1. + option dhcpif eth1 + + # Use specified MAC address. + # An address in the range 00:00:5E:00:02:00 - 00:00:5E:FF:FF:FF falls + # within the IANA range of addresses and is not allocated for other + # purposes. + # Normally you do not need to uncomment this option. + #option dhcpmac 00:00:5E:00:02:00 + + # Time before DHCP lease expires + # Normally you do not need to uncomment this option. + #option lease 600 + + + # Universal access method (UAM) parameters + + # URL of web server handling authentication. + option uamserver https://radius.chillispot.org/hotspotlogin + + # URL of welcome homepage. + # Unauthenticated users will be redirected to this URL. If not specified + # users will be redirected to the uamserver instead. + # Normally you do not need to uncomment this option. + #option uamhomepage http://192.168.182.1/welcome.html + + # Shared between chilli and authentication web server + #option uamsecret ht2eb8ej6s4et3rg1ulp + + # IP address to listen to for authentication requests + # Do not uncomment this option unless you are an experienced user! + #option uamlisten 192.168.182.1 + + # TCP port to listen to for authentication requests + # Do not uncomment this option unless you are an experienced user! + #option uamport 3990 + + # Comma separated list of domain names, IP addresses or network segments + # the client can access without first authenticating. + # It is possible to specify this option multiple times. + # Normally you do not need to uncomment this option. + #option uamallowed www.chillispot.org,10.11.12.0/24 + + # Comma separated list of domain names + # the client can access without first authenticating. + # It is possible to specify this option multiple times. + # Normally you do not need to uncomment this option. + #option uamdomain .chillispot.org,.coova.org + + # If this flag is given unauthenticated users are allowed to use + # any DNS server. + # Normally you do not need to uncomment this option. + #option uamanydns + + + # MAC authentication + + # If this flag is given users will be authenticated only on their MAC + # address. + # Normally you do not need to uncomment this option. + #option macauth + + # List of MAC addresses. + # The MAC addresses specified in this list will be authenticated only on + # their MAC address. + # this option is ignored if the macauth tag is given. + # It is possible to specify this option multiple times. + # Normally you do not need to uncomment this option. + #option macallowed 00-0A-5E-AC-BE-51,00-30-1B-3C-32-E9 + + # Password to use for MAC authentication. + # Normally you do not need to uncomment this option. + #option macpasswd password + + # Suffix to add to MAC address in order to form the username. + # Normally you do not need to uncomment this option. + #option macsuffix suffix + diff --git a/net/coova-chilli/files/chilli.firewall b/net/coova-chilli/files/chilli.firewall new file mode 100644 index 0000000..a5b1d00 --- /dev/null +++ b/net/coova-chilli/files/chilli.firewall @@ -0,0 +1,41 @@ +#!/bin/sh + +chilli_firewall() { + local cfg="$1" + + local network ifname tun + + config_get network "$cfg" network + + . /lib/functions/network.sh + network_get_device ifname ${network:-lan} + + if [ "$ifname" = "" ] + then + config_get ifname "$cfg" dhcpif + fi + + config_get tun "$cfg" tundev + + for n in ACCEPT DROP REJECT + do + iptables -F zone_${network}_${n} + iptables -I zone_${network}_${n} -i $tun -j $n + iptables -I zone_${network}_${n} -o $tun -j $n + done + + iptables -D forward -i ${ifname} -j zone_${network}_forward + iptables -A forward -i ${ifname} -j DROP + iptables -A forward -i $tun -j zone_${network}_forward + + iptables -D input -i ${ifname} -j zone_${network} + iptables -A input -i $tun -j zone_${network} + + iptables -I zone_${network} -p tcp --dport 3990 -j ACCEPT + iptables -I zone_${network} -p tcp --dport 3991 -j ACCEPT +} + +chilli_post_core_cb() { + config_load chilli + config_foreach chilli_firewall chilli +} diff --git a/net/coova-chilli/files/chilli.hotplug b/net/coova-chilli/files/chilli.hotplug new file mode 100644 index 0000000..e12812b --- /dev/null +++ b/net/coova-chilli/files/chilli.hotplug @@ -0,0 +1,7 @@ +#!/bin/sh + +[ "$ACTION" == "ifup" ] || exit 0 + +[ "$INTERFACE" = "wan" ] && { + /etc/init.d/chilli restart +} diff --git a/net/coova-chilli/files/chilli.init b/net/coova-chilli/files/chilli.init new file mode 100644 index 0000000..0103a23 --- /dev/null +++ b/net/coova-chilli/files/chilli.init @@ -0,0 +1,61 @@ +#!/bin/sh /etc/rc.common + +START=30 +STOP=90 + +config_cb() { + chilli_inst=$2 + if [ "$chilli_inst" != "" ] + then + rm -f /var/run/chilli_${chilli_inst}.* + chilli_conf=/var/run/chilli_${chilli_inst}.conf + eval "start_chilli_$chilli_inst=1" + fi +} + +option_cb() { + case "$1" in + # UCI settings + network) + . /lib/functions/network.sh + local ifname + network_get_device ifname $2 + echo "dhcpif=\"$ifname\"" >> $chilli_conf + ;; + disabled) + eval "start_chilli_$chilli_inst=0" + ;; + # boolean settings + dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only) + [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf + ;; + *) + echo "$1=\"$2\"" >> $chilli_conf + ;; + esac +} + +start_chilli() { + local cfg="$1" + local start_chilli=$(eval "echo \$start_chilli_$cfg") + [ "$start_chilli" = "0" ] && return + local base=/var/run/chilli_${cfg} + chilli -c ${base}.conf \ + --pidfile ${base}.pid \ + --cmdsocket ${base}.sock \ + --unixipc ${base}.ipc & +} + +start() { + config_load chilli + config_foreach start_chilli chilli +} + +stop() { + ls /var/run/chilli*.pid 2>/dev/null && { + kill $(cat /var/run/chilli*.pid) + sleep 1 + killall -9 chilli + rm -f /var/run/chilli* + } +} diff --git a/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch new file mode 100644 index 0000000..2efecbe --- /dev/null +++ b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch @@ -0,0 +1,24 @@ +--- a/src/system.h ++++ b/src/system.h +@@ -83,10 +83,6 @@ + #include + #endif + +-#ifdef HAVE_SYS_SYSINFO_H +-#include +-#endif +- + #ifdef HAVE_TIME_H + #include + #endif +@@ -139,6 +135,10 @@ + #include + #endif + ++#ifdef HAVE_SYS_SYSINFO_H ++#include ++#endif ++ + #elif defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__) + #include + #include diff --git a/net/coova-chilli/patches/200-fix_compile_kmod.patch b/net/coova-chilli/patches/200-fix_compile_kmod.patch new file mode 100644 index 0000000..2722578 --- /dev/null +++ b/net/coova-chilli/patches/200-fix_compile_kmod.patch @@ -0,0 +1,17 @@ +--- a/src/linux/Makefile ++++ b/src/linux/Makefile +@@ -21,11 +21,11 @@ lib%.so: lib%.o + $(CC) $(CFLAGS) -shared -o $@ $^; + + lib%.o: lib%.c +- $(CC) $(CFLAGS) -fPIC -O2 -Wall -I${KERNEL_DIR}/include -D_INIT=lib$*_init -c -o $@ $<; ++ $(CC) $(CFLAGS) -D_INIT=lib$*_init -c -o $@ $<; + + install: modules_install libxt_coova.so +- mkdir -p $(DESTDIR)/lib/xtables/ +- cp libxt_coova.so $(DESTDIR)/lib/xtables/ ++ mkdir -p $(DESTDIR)/usr/lib/iptables/ ++ cp libxt_coova.so $(DESTDIR)/usr/lib/iptables/ + + distdir: + diff --git a/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch b/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch new file mode 100644 index 0000000..d608835 --- /dev/null +++ b/net/coova-chilli/patches/201-fix_dereferencing_pointers.patch @@ -0,0 +1,49 @@ +--- a/src/linux/xt_coova.c ++++ b/src/linux/xt_coova.c +@@ -292,6 +292,8 @@ static int coova_mt_check(const struct x + struct coova_table *t; + #ifdef CONFIG_PROC_FS + struct proc_dir_entry *pde; ++ kuid_t uid; ++ kgid_t gid; + #endif + unsigned i; + int ret = 0; +@@ -330,8 +332,9 @@ static int coova_mt_check(const struct x + ret = -ENOMEM; + goto out; + } +- pde->uid = ip_list_uid; +- pde->gid = ip_list_gid; ++ uid = make_kuid(&init_user_ns, ip_list_uid); ++ gid = make_kgid(&init_user_ns, ip_list_gid); ++ proc_set_user(pde, uid, gid); + #endif + spin_lock_bh(&coova_lock); + list_add_tail(&t->list, &tables); +@@ -445,14 +448,13 @@ static const struct seq_operations coova + + static int coova_seq_open(struct inode *inode, struct file *file) + { +- struct proc_dir_entry *pde = PDE(inode); + struct coova_iter_state *st; + + st = __seq_open_private(file, &coova_seq_ops, sizeof(*st)); + if (st == NULL) + return -ENOMEM; + +- st->table = pde->data; ++ st->table = PDE_DATA(inode); + return 0; + } + +@@ -460,8 +462,7 @@ static ssize_t + coova_mt_proc_write(struct file *file, const char __user *input, + size_t size, loff_t *loff) + { +- const struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode); +- struct coova_table *t = pde->data; ++ struct coova_table *t = PDE_DATA(file->f_path.dentry->d_inode); + struct coova_entry *e; + char buf[sizeof("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de")]; + const char *c = buf; diff --git a/net/coova-chilli/patches/300-fix-compile-with-cyassl.patch b/net/coova-chilli/patches/300-fix-compile-with-cyassl.patch new file mode 100644 index 0000000..3b61d49 --- /dev/null +++ b/net/coova-chilli/patches/300-fix-compile-with-cyassl.patch @@ -0,0 +1,28 @@ +--- a/src/md5.h ++++ b/src/md5.h +@@ -28,6 +28,14 @@ + #define MD5Update MD5_Update + #define MD5Final MD5_Final + ++#elif HAVE_CYASSL ++#include ++ ++#define MD5Init MD5_Init ++#define MD5Update MD5_Update ++#define MD5Final MD5_Final ++ ++typedef struct CYASSL_MD5_CTX MD5_CTX; + #else + + struct MD5Context { +--- a/src/md5.c ++++ b/src/md5.c +@@ -18,7 +18,7 @@ + #include /* for memcpy() */ + #include "md5.h" + +-#ifndef HAVE_OPENSSL ++#if !defined(HAVE_OPENSSL) && !defined(HAVE_CYASSL) + + void byteReverse(unsigned char *buf, size_t longs); + diff --git a/net/coova-chilli/patches/400-fix-compile-with-musl.patch b/net/coova-chilli/patches/400-fix-compile-with-musl.patch new file mode 100644 index 0000000..a810a73 --- /dev/null +++ b/net/coova-chilli/patches/400-fix-compile-with-musl.patch @@ -0,0 +1,61 @@ +--- a/src/system.h ++++ b/src/system.h +@@ -78,11 +78,6 @@ + #include + #endif + +-#ifdef HAVE_LINUX_SYSINFO_H +-#define _LINUX_KERNEL_H +-#include +-#endif +- + #ifdef HAVE_TIME_H + #include + #endif +@@ -123,6 +118,11 @@ + #include + #endif + ++#ifdef HAVE_SYS_SYSINFO_H ++#define _LINUX_SYSINFO_H ++#include ++#endif ++ + #if defined(__linux__) + #include + #include +@@ -135,10 +135,6 @@ + #include + #endif + +-#ifdef HAVE_SYS_SYSINFO_H +-#include +-#endif +- + #elif defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__) + #include + #include +@@ -170,10 +166,6 @@ + #include + #endif + +-#ifdef HAVE_NET_ETHERNET_H +-#include +-#endif +- + #ifdef HAVE_ASM_TYPES_H + #include + #endif +--- a/src/chilli_limits.h ++++ b/src/chilli_limits.h +@@ -18,8 +18,8 @@ + * + */ + +-#ifndef _LIMITS_H +-#define _LIMITS_H ++#ifndef _CHILLI_LIMITS_H ++#define _CHILLI_LIMITS_H + + /* + * extracted from various .h files, needs some cleanup. diff --git a/net/cshark/Makefile b/net/cshark/Makefile new file mode 100644 index 0000000..88fd17d --- /dev/null +++ b/net/cshark/Makefile @@ -0,0 +1,75 @@ +# +# Copyright (C) 2014-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=cshark +PKG_VERSION:=2015-11-24 +PKG_RELEASE=$(PKG_SOURCE_VERSION) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/cloudshark/cshark.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=e575ab3d35d75a6f70488001fcba45690ebe9b3e +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/cshark + SECTION:=net + CATEGORY:=Network + TITLE:=CloudShark capture tool + URL:=http://www.cloudshark.org/ + DEPENDS:=+libjson-c +libpcap +libuci +libubox +libuclient +libustream-polarssl + MAINTAINER:=Luka Perkov +endef + +define Package/luci-app-cshark + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=Cloudshark capture tool Web UI + DEPENDS:=+cshark +luci + MAINTAINER:=Luka Perkov +endef + +CMAKE_OPTIONS = \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DWITH_DEBUG=OFF \ + +define Package/cshark/conffiles +/etc/config/cshark +endef + +define Package/cshark/install + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/cshark \ + $(1)/sbin/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/config/cshark \ + $(1)/etc/config/ + + $(INSTALL_DIR) $(1)/etc/ssl/certs + $(INSTALL_CONF) \ + $(PKG_BUILD_DIR)/config/ca-the_usertrust_network.pem \ + $(1)/etc/ssl/certs/ +endef + +define Package/luci-app-cshark/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/ +endef + +$(eval $(call BuildPackage,cshark)) +$(eval $(call BuildPackage,luci-app-cshark)) diff --git a/net/ctorrent-svn/Makefile b/net/ctorrent-svn/Makefile new file mode 100644 index 0000000..0725f59 --- /dev/null +++ b/net/ctorrent-svn/Makefile @@ -0,0 +1,98 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ctorrent-svn +PKG_REV:=322 +PKG_VERSION:=r$(PKG_REV) +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://svn.code.sf.net/p/dtorrent/code/dtorrent/trunk +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_VERSION:=$(PKG_REV) +PKG_SOURCE_PROTO:=svn + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) +PKG_CHECK_FORMAT_SECURITY:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/ctorrent-svn/Default + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + DEPENDS:=+uclibcxx + TITLE:=console-based BitTorrent client + MAINTAINER:=Peter Wagner + URL:=http://www.rahul.net/dholmes/ctorrent/ +endef + +define Package/ctorrent-svn/Default/description + CTorrent is a BitTorrent client written in the C programming language, + known to be a very robust and mature programming language, which produces + fast and optimized application. +endef + +define Package/ctorrent-svn +$(call Package/ctorrent-svn/Default) + TITLE+= (with OpenSSL support) + DEPENDS+=+libopenssl + VARIANT:=ssl +endef + +define Package/ctorrent-svn/description +$(call Package/ctorrent-svn/Default/description) + This package is built with OpenSSL support. +endef + +define Package/ctorrent-svn-nossl +$(call Package/ctorrent-svn/Default) + TITLE+= (with builtin SHA-1) + VARIANT:=nossl +endef + +define Package/ctorrent-svn-nossl/description +$(call Package/ctorrent-svn/Default/description) + This package is built with builtin (Steve Reid's public-domain) SHA-1 support +endef + +CONFIGURE_VARS += \ + CXX="g++-uc" \ + LIBS="-nodefaultlibs -luClibc++ $(LIBGCC_S) -lc" + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-ssl="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --with-ssl=no +endif + +define Build/Configure + (cd $(PKG_BUILD_DIR); touch \ + configure.ac \ + aclocal.m4 \ + Makefile.in \ + config.h.in \ + configure \ + ); + $(call Build/Configure/Default) +endef + +define Package/ctorrent-svn/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ctorrent $(1)/usr/bin/ctorrent +endef + +Package/ctorrent-svn-nossl/install = $(Package/ctorrent-svn/install) + +$(eval $(call BuildPackage,ctorrent-svn)) +$(eval $(call BuildPackage,ctorrent-svn-nossl)) diff --git a/net/ctorrent-svn/patches/100-compile-fix.patch b/net/ctorrent-svn/patches/100-compile-fix.patch new file mode 100644 index 0000000..bb7d33f --- /dev/null +++ b/net/ctorrent-svn/patches/100-compile-fix.patch @@ -0,0 +1,88 @@ +diff --git a/btconfig.cpp b/btconfig.cpp +index e1badd0..aaa6feb 100644 +--- a/btconfig.cpp ++++ b/btconfig.cpp +@@ -828,7 +828,7 @@ void CfgCTCS(Config *config) + strncpy(CTCS.m_host, *cfg_ctcs, MAXHOSTNAMELEN-1); + CTCS.m_host[MAXHOSTNAMELEN-1] = '\0'; + if( (s = strchr(CTCS.m_host, ':')) ) *s='\0'; +- CTCS.m_port = atoi(s = (strchr(*cfg_ctcs, ':')+1)); ++ CTCS.m_port = atoi(s = (char*)(strchr(*cfg_ctcs, ':')+1)); + if( strchr(s, ':') ) + CONSOLE.Input("Enter CTCS password: ", CTCS.m_pass, CTCS_PASS_SIZE); + else *CTCS.m_pass = '\0'; +diff --git a/btcontent.cpp b/btcontent.cpp +index d84f450..88ccb50 100644 +--- a/btcontent.cpp ++++ b/btcontent.cpp +@@ -1408,27 +1408,27 @@ void btContent::CompletionCommand() + ptmp = cmdstr + strlen(cmdstr); + parg = strstr(parg, "&t") + 2; + strcat(pt, parg); +- pt = strstr(ptmp, "&t"); +- if( pd ) pd = strstr(ptmp, "&d"); +- if( pw ) pw = strstr(ptmp, "&w"); ++ pt = (char *)strstr(ptmp, "&t"); ++ if( pd ) pd = (char *)strstr(ptmp, "&d"); ++ if( pw ) pw = (char *)strstr(ptmp, "&w"); + } + if( pd && (!pt || pd < pt) && (!pw || pd < pw) ){ + strcpy(pd, m_btfiles.GetDataName()); + ptmp = cmdstr + strlen(cmdstr); + parg = strstr(parg, "&d") + 2; + strcat(pd, parg); +- pd = strstr(ptmp, "&d"); +- if( pt ) pt = strstr(ptmp, "&t"); +- if( pw ) pw = strstr(ptmp, "&w"); ++ pd = (char *)strstr(ptmp, "&d"); ++ if( pt ) pt = (char *)strstr(ptmp, "&t"); ++ if( pw ) pw = (char *)strstr(ptmp, "&w"); + } + if( pw && (!pt || pw < pt) && (!pd || pw < pd) ){ + strcpy(pw, wd); + ptmp = cmdstr + strlen(cmdstr); + parg = strstr(parg, "&w") + 2; + strcat(pw, parg); +- pw = strstr(ptmp, "&w"); +- if( pt ) pt = strstr(ptmp, "&t"); +- if( pd ) pd = strstr(ptmp, "&d"); ++ pw = (char *)strstr(ptmp, "&w"); ++ if( pt ) pt = (char *)strstr(ptmp, "&t"); ++ if( pd ) pd = (char *)strstr(ptmp, "&d"); + } + } + } +diff --git a/console.cpp b/console.cpp +index bdadb61..5ab2492 100644 +--- a/console.cpp ++++ b/console.cpp +@@ -511,11 +511,8 @@ void ConStream::Error(int sev, const char *message, ...) + va_list ap; + + va_start(ap, message); +- if( g_console_ready ) CONSOLE.Error(sev, message, ap); +- else{ + vfprintf(stderr, message, ap); + fflush(stderr); +- } + va_end(ap); + } + +@@ -1766,7 +1763,7 @@ void Console::Warning(int sev, const char *message, ...) + va_end(ap); + } + +- ++/* + void Console::Error(int sev, const char *message, va_list ap) + { + vsnprintf(m_buffer, sizeof(m_buffer), message, ap); +@@ -1778,7 +1775,7 @@ void Console::Error(int sev, const char *message, va_list ap) + m_warnings.AddMessage(sev, m_buffer); + if( sev && *cfg_ctcs ) CTCS.Send_Info(sev, m_buffer); + } +- ++*/ + + void Console::Debug(const char *message, ...) + { diff --git a/net/ctorrent-svn/patches/300-negative.patch b/net/ctorrent-svn/patches/300-negative.patch new file mode 100644 index 0000000..e1e1e65 --- /dev/null +++ b/net/ctorrent-svn/patches/300-negative.patch @@ -0,0 +1,14 @@ +diff --git a/bencode.cpp b/bencode.cpp +index fef82ba..b7f14bc 100644 +--- a/bencode.cpp ++++ b/bencode.cpp +@@ -45,6 +45,9 @@ size_t buf_int(const char *b, size_t len, char beginchar, char endchar, + p++; + len--; + } ++ if( *p == '-'){ ++ p++; len--; ++ } + + for( psave = p; len && isdigit(*p); p++, len-- ); + diff --git a/net/ctorrent-svn/patches/400-musl-compat.patch b/net/ctorrent-svn/patches/400-musl-compat.patch new file mode 100644 index 0000000..e17c147 --- /dev/null +++ b/net/ctorrent-svn/patches/400-musl-compat.patch @@ -0,0 +1,10 @@ +--- a/compat.c ++++ b/compat.c +@@ -51,6 +51,7 @@ int snprintf(char *str, size_t size, con + + #ifndef HAVE_STRNSTR + #include ++#include + /* FUNCTION PROGRAMER: Siberiaic Sang */ + char *strnstr(const char *haystack, const char *needle, size_t haystacklen) + { diff --git a/net/ctorrent/Makefile b/net/ctorrent/Makefile new file mode 100644 index 0000000..6a8e481 --- /dev/null +++ b/net/ctorrent/Makefile @@ -0,0 +1,84 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ctorrent +PKG_VERSION:=dnh3.3.2 +PKG_RELEASE:=7 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/dtorrent \ + http://www.rahul.net/dholmes/ctorrent/ +PKG_MD5SUM:=59b23dd05ff70791cd6449effa7fc3b6 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + +define Package/ctorrent/Default + SUBMENU:=BitTorrent + SECTION:=net + CATEGORY:=Network + DEPENDS:=$(CXX_DEPENDS) + TITLE:=console-based BitTorrent client + MAINTAINER:=Peter Wagner + URL:=http://www.rahul.net/dholmes/ctorrent/ +endef + +define Package/ctorrent/Default/description + CTorrent is a BitTorrent client written in the C programming language, + known to be a very robust and mature programming language, which produces + fast and optimized application. +endef + +define Package/ctorrent +$(call Package/ctorrent/Default) + TITLE+= (with OpenSSL support) + DEPENDS+=+libopenssl + VARIANT:=ssl +endef + +define Package/ctorrent/description +$(call Package/ctorrent/Default/description) + This package is built with OpenSSL support. +endef + +define Package/ctorrent-nossl +$(call Package/ctorrent/Default) + TITLE+= (with builtin SHA-1) + VARIANT:=nossl +endef + +define Package/ctorrent-nossl/description +$(call Package/ctorrent/Default/description) + This package is built with builtin (Steve Reid's public-domain) SHA-1 support +endef + +CONFIGURE_VARS += \ + CXXFLAGS="$$$$CXXFLAGS -fno-rtti" + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += \ + --with-ssl="$(STAGING_DIR)/usr" +endif + +ifeq ($(BUILD_VARIANT),nossl) + CONFIGURE_ARGS += \ + --with-ssl=no +endif + +define Package/ctorrent/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin/$(PKG_NAME) +endef + +Package/ctorrent-nossl/install = $(Package/ctorrent/install) + +$(eval $(call BuildPackage,ctorrent)) +$(eval $(call BuildPackage,ctorrent-nossl)) diff --git a/net/ctorrent/patches/100-CVE-2009-1759.patch b/net/ctorrent/patches/100-CVE-2009-1759.patch new file mode 100644 index 0000000..86ae1d7 --- /dev/null +++ b/net/ctorrent/patches/100-CVE-2009-1759.patch @@ -0,0 +1,364 @@ +Patch for CVE-2009-1759. +Source: Upstream SVN, rev 302 from the dtorrent-3 branch. + +Index: a/bencode.h +=================================================================== +--- a/bencode.h (revision 300) ++++ b/bencode.h (revision 302) +@@ -25,7 +25,7 @@ + size_t decode_list(const char *b,size_t len,const char *keylist); + size_t decode_rev(const char *b,size_t len,const char *keylist); + size_t decode_query(const char *b,size_t len,const char *keylist,const char **ps,size_t *pi,int64_t *pl,int method); +-size_t decode_list2path(const char *b, size_t n, char *pathname); ++size_t decode_list2path(const char *b, size_t n, char *pathname, size_t maxlen); + size_t bencode_buf(const char *str,size_t len,FILE *fp); + size_t bencode_str(const char *str, FILE *fp); + size_t bencode_int(const uint64_t integer, FILE *fp); +Index: a/bencode.cpp +=================================================================== +--- a/bencode.cpp (revision 300) ++++ b/bencode.cpp (revision 302) +@@ -233,22 +233,28 @@ + return bencode_end_dict_list(fp); + } + +-size_t decode_list2path(const char *b, size_t n, char *pathname) ++size_t decode_list2path(const char *b, size_t n, char *pathname, size_t maxlen) + { + const char *pb = b; + const char *s = (char *) 0; ++ const char *endmax = pathname + maxlen - 1; + size_t r,q; + + if( 'l' != *pb ) return 0; + pb++; + n--; + if( !n ) return 0; +- for(; n;){ ++ while( n && pathname < endmax ){ + if(!(r = buf_str(pb, n, &s, &q)) ) return 0; ++ if( q >= maxlen ) return 0; + memcpy(pathname, s, q); + pathname += q; +- pb += r; n -= r; +- if( 'e' != *pb ){*pathname = PATH_SP, pathname++;} else break; ++ maxlen -= q; ++ pb += r; ++ n -= r; ++ if( 'e' == *pb ) break; ++ if( pathname >= endmax ) return 0; ++ *pathname++ = PATH_SP; + } + *pathname = '\0'; + return (pb - b + 1); +Index: a/btfiles.cpp +=================================================================== +--- a/btfiles.cpp (revision 300) ++++ b/btfiles.cpp (revision 302) +@@ -449,7 +449,8 @@ + return 0; + } + +-int btFiles::BuildFromMI(const char *metabuf, const size_t metabuf_len, const char *saveas) ++int btFiles::BuildFromMI(const char *metabuf, const size_t metabuf_len, ++ const char *saveas, unsigned char exam_only) + { + char path[MAXPATHLEN]; + const char *s, *p; +@@ -458,11 +459,19 @@ + int f_warned = 0; + + if( !decode_query(metabuf, metabuf_len, "info|name", &s, &q, (int64_t*)0, +- QUERY_STR) || MAXPATHLEN <= q ) ++ QUERY_STR) || MAXPATHLEN <= q ){ ++ errno = EINVAL; + return -1; ++ } + + memcpy(path, s, q); + path[q] = '\0'; ++ if( !exam_only && ++ (PATH_SP == path[0] || '/' == path[0] || 0==strncmp("..", path, 2)) ){ ++ CONSOLE.Warning(1, "error, unsafe path \"%s\" in torrent data", path); ++ errno = EINVAL; ++ return -1; ++ } + + r = decode_query(metabuf, metabuf_len, "info|files", (const char**)0, &q, + (int64_t*)0, QUERY_POS); +@@ -471,21 +480,31 @@ + BTFILE *pbf_last = (BTFILE*) 0; + BTFILE *pbf = (BTFILE*) 0; + size_t dl; ++ unsigned long nfiles = 0; ++ + if( decode_query(metabuf,metabuf_len,"info|length", +- (const char**) 0,(size_t*) 0,(int64_t*) 0,QUERY_LONG) ) ++ (const char**) 0,(size_t*) 0,(int64_t*) 0,QUERY_LONG) ){ ++ errno = EINVAL; + return -1; ++ } + + if( saveas ){ + m_directory = new char[strlen(saveas) + 1]; + #ifndef WINDOWS +- if(!m_directory) return -1; ++ if( !m_directory ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_directory,saveas); + }else{ + int f_conv; + char *tmpfn = new char[strlen(path)*2+5]; + #ifndef WINDOWS +- if( !tmpfn ) return -1; ++ if( !tmpfn ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + if( f_conv = ConvertFilename(tmpfn, path, strlen(path)*2+5) ){ + if( arg_flg_convert_filenames ){ +@@ -493,6 +512,7 @@ + #ifndef WINDOWS + if( !m_directory ){ + delete []tmpfn; ++ errno = ENOMEM; + return -1; + } + #endif +@@ -507,7 +527,10 @@ + if( !f_conv || !arg_flg_convert_filenames ){ + m_directory = new char[strlen(path) + 1]; + #ifndef WINDOWS +- if( !m_directory ) return -1; ++ if( !m_directory ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_directory,path); + } +@@ -517,24 +540,50 @@ + p = metabuf + r + 1; + q--; + for(; q && 'e' != *p; p += dl, q -= dl){ +- if(!(dl = decode_dict(p, q, (const char*) 0)) ) return -1; +- if( !decode_query(p, dl, "length", (const char**) 0, +- (size_t*) 0,&t,QUERY_LONG) ) return -1; ++ if( !(dl = decode_dict(p, q, (const char*) 0)) || ++ !decode_query(p, dl, "length", (const char**) 0, (size_t*) 0, &t, ++ QUERY_LONG) ){ ++ errno = EINVAL; ++ return -1; ++ } + pbf = _new_bfnode(); + #ifndef WINDOWS +- if( !pbf ) return -1; ++ if( !pbf ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif ++ nfiles++; + pbf->bf_length = t; + m_total_files_length += t; + r = decode_query(p, dl, "path", (const char **)0, &n, (int64_t*)0, + QUERY_POS); +- if( !r ) return -1; +- if(!decode_list2path(p + r, n, path)) return -1; ++ if( !r || !decode_list2path(p + r, n, path, sizeof(path)) ){ ++ CONSOLE.Warning(1, ++ "error, invalid path in torrent data for file %lu at offset %llu", ++ nfiles, m_total_files_length - t); ++ delete pbf; ++ errno = EINVAL; ++ return -1; ++ } ++ if( !exam_only && ++ (PATH_SP == path[0] || '/' == path[0] || 0==strncmp("..", path, 2)) ){ ++ CONSOLE.Warning(1, ++ "error, unsafe path \"%s\" in torrent data for file %lu", ++ path, nfiles); ++ delete pbf; ++ errno = EINVAL; ++ return -1; ++ } + ++ + int f_conv; + char *tmpfn = new char[strlen(path)*2+5]; + #ifndef WINDOWS +- if( !tmpfn ) return -1; ++ if( !tmpfn ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + if( f_conv = ConvertFilename(tmpfn, path, strlen(path)*2+5) ){ + if( arg_flg_convert_filenames ){ +@@ -542,6 +591,7 @@ + #ifndef WINDOWS + if( !pbf->bf_filename ){ + delete []tmpfn; ++ errno = ENOMEM; + return -1; + } + #endif +@@ -556,7 +606,10 @@ + if( !f_conv || !arg_flg_convert_filenames ){ + pbf->bf_filename = new char[strlen(path) + 1]; + #ifndef WINDOWS +- if( !pbf->bf_filename ) return -1; ++ if( !pbf->bf_filename ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(pbf->bf_filename, path); + } +@@ -564,30 +617,42 @@ + pbf_last = pbf; + } + }else{ +- if( !decode_query(metabuf,metabuf_len,"info|length", +- (const char**) 0,(size_t*) 0,&t,QUERY_LONG) ) ++ if( !decode_query(metabuf,metabuf_len, "info|length", ++ (const char**)0, (size_t*) 0, &t, QUERY_LONG) ){ ++ errno = EINVAL; + return -1; ++ } + m_btfhead = _new_bfnode(); + #ifndef WINDOWS +- if( !m_btfhead) return -1; ++ if( !m_btfhead ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + m_btfhead->bf_length = m_total_files_length = t; + if( saveas ){ + m_btfhead->bf_filename = new char[strlen(saveas) + 1]; + #ifndef WINDOWS +- if(!m_btfhead->bf_filename ) return -1; ++ if( !m_btfhead->bf_filename ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_btfhead->bf_filename, saveas); + }else if( arg_flg_convert_filenames ){ + char *tmpfn = new char[strlen(path)*2+5]; + #ifndef WINDOWS +- if( !tmpfn ) return -1; ++ if( !tmpfn ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + ConvertFilename(tmpfn, path, strlen(path)*2+5); + m_btfhead->bf_filename = new char[strlen(tmpfn) + 1]; + #ifndef WINDOWS + if( !m_btfhead->bf_filename ){ + delete []tmpfn; ++ errno = ENOMEM; + return -1; + } + #endif +@@ -596,7 +661,10 @@ + }else{ + m_btfhead->bf_filename = new char[strlen(path) + 1]; + #ifndef WINDOWS +- if(!m_btfhead->bf_filename ) return -1; ++ if( !m_btfhead->bf_filename ){ ++ errno = ENOMEM; ++ return -1; ++ } + #endif + strcpy(m_btfhead->bf_filename, path); + } +@@ -694,6 +762,32 @@ + size_t btFiles::FillMetaInfo(FILE* fp) + { + BTFILE *p; ++ const char *refname, *s; ++ char path[MAXPATHLEN]; ++ ++ refname = m_directory ? m_directory : m_btfhead->bf_filename; ++ while( (s = strchr(refname, PATH_SP)) && *(s + 1) ){ ++ refname = s + 1; ++ } ++ if( m_directory && '.' == *refname ){ ++ char dir[MAXPATHLEN]; ++ if( getcwd(dir, sizeof(dir)) && 0==chdir(m_directory) ){ ++ if( getcwd(path, sizeof(path)) ){ ++ refname = path; ++ while( (s = strchr(refname, PATH_SP)) && *(s + 1) ){ ++ refname = s + 1; ++ } ++ } ++ chdir(dir); ++ } ++ } ++ if( '/' == *refname || '\0' == *refname || '.' == *refname ){ ++ CONSOLE.Warning(1, "error, inappropriate file or directory name \"%s\"", ++ m_directory ? m_directory : m_btfhead->bf_filename); ++ errno = EINVAL; ++ return 0; ++ } ++ + if( m_directory ){ + // multi files + if( bencode_str("files", fp) != 1 ) return 0; +@@ -715,16 +809,15 @@ + if(bencode_end_dict_list(fp) != 1 ) return 0; + + if(bencode_str("name", fp) != 1) return 0; +- return bencode_str(m_directory, fp); +- ++ return bencode_str(refname, fp); + }else{ + if( bencode_str("length", fp) != 1 ) return 0; + if( bencode_int(m_btfhead->bf_length, fp) != 1) return 0; + + if( bencode_str("name", fp) != 1 ) return 0; +- return bencode_str(m_btfhead->bf_filename, fp); ++ return bencode_str(refname, fp); + } +- return 1; ++ return 0; + } + + +Index: a/btcontent.cpp +=================================================================== +--- a/btcontent.cpp (revision 300) ++++ b/btcontent.cpp (revision 302) +@@ -357,7 +357,11 @@ + + cfg_req_queue_length = (m_piece_length / cfg_req_slice_size) * 2 - 1; + +- if( m_btfiles.BuildFromMI(b, flen, saveas) < 0 ) ERR_RETURN(); ++ if( m_btfiles.BuildFromMI(b, flen, saveas, arg_flg_exam_only) < 0 ){ ++ if( EINVAL == errno ) ++ CONSOLE.Warning(1, "Torrent metainfo file data is invalid or unusable."); ++ ERR_RETURN(); ++ } + + delete []b; + b = (char *)0; +Index: a/btfiles.h +=================================================================== +--- a/btfiles.h (revision 300) ++++ b/btfiles.h (revision 302) +@@ -61,7 +61,7 @@ + + int BuildFromFS(const char *pathname); + int BuildFromMI(const char *metabuf, const size_t metabuf_len, +- const char *saveas); ++ const char *saveas, unsigned char exam_only); + + char *GetDataName() const; + uint64_t GetTotalLength() const { return m_total_files_length; } diff --git a/net/ctorrent/patches/100-negative-ints.patch b/net/ctorrent/patches/100-negative-ints.patch new file mode 100644 index 0000000..864ce1b --- /dev/null +++ b/net/ctorrent/patches/100-negative-ints.patch @@ -0,0 +1,13 @@ +--- a/bencode.cpp ++++ b/bencode.cpp +@@ -44,6 +44,10 @@ size_t buf_long(const char *b,size_t len + p++; len--; + } + ++ if( *p == '-'){ ++ p++; len--; ++ } ++ + for(psave = p; len && isdigit(*p); p++,len--) ; + + if(!len || MAX_INT_SIZ < (p - psave) || *p != endchar) return 0; diff --git a/net/ctorrent/patches/200-musl-compat.patch b/net/ctorrent/patches/200-musl-compat.patch new file mode 100644 index 0000000..65cb71e --- /dev/null +++ b/net/ctorrent/patches/200-musl-compat.patch @@ -0,0 +1,10 @@ +--- a/compat.c ++++ b/compat.c +@@ -63,6 +63,7 @@ int snprintf(char *str, size_t size, con + + #ifndef HAVE_STRNSTR + #include ++#include + /* FUNCTION PROGRAMER: Siberiaic Sang */ + char *strnstr(const char *haystack, const char *needle, size_t haystacklen) + { diff --git a/net/daemonlogger/Makefile b/net/daemonlogger/Makefile new file mode 100644 index 0000000..41853f2 --- /dev/null +++ b/net/daemonlogger/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2007-2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=daemonlogger +PKG_VERSION:=1.2.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/daemonlogger +PKG_MD5SUM:=acb64aa6cd5777e297569f100b5c39ee + +PKG_LICENSE:=GPL-2.0 +PKG_LICENSE_FILES:=COPYING + +PKG_MAINTAINER:=Mirko Vogt + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/daemonlogger + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +libdnet + TITLE:=Software Network Tap + URL:=http://www.snort.org/snort-downloads/additional-downloads +endef + +CONFIGURE_VARS += \ + BUILD_CC="$(TARGET_CC)" \ + HOSTCC="$(HOSTCC)" + +MAKE_FLAGS := CCOPT="$(TARGET_CFLAGS)" INCLS="-I. $(TARGET_CPPFLAGS)" + +define Package/daemonlogger/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/daemonlogger $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,daemonlogger)) diff --git a/net/dansguardian/Makefile b/net/dansguardian/Makefile new file mode 100644 index 0000000..eefefaa --- /dev/null +++ b/net/dansguardian/Makefile @@ -0,0 +1,78 @@ +# +# Copyright (C) 2008-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dansguardian +PKG_VERSION:=2.12.0.3 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Luka Perkov + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/dansguardian +PKG_MD5SUM:=2a88d0392cd28eaec02b7ee727b2e253 + +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/uclibc++.mk +include $(INCLUDE_DIR)/package.mk + +define Package/dansguardian + SECTION:=net + DEPENDS:=+libpthread $(CXX_DEPENDS) +zlib + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=DansGuardian + URL:=http://dansguardian.org +endef + +define Package/dansguardian/conffiles +/etc/dansguardian/dansguardianf1.conf +/etc/config/dansguardian +endef + +CONFIGURE_VARS += \ + INCLUDES="" \ + CXXFLAGS="$$$$CXXFLAGS -fno-rtti" \ + LIBS="-lpthread" \ + +define Build/Configure + $(call Build/Configure/Default,\ + --disable-clamav \ + --with-sysconfsubdir=dansguardian \ + --with-proxyuser=root \ + --with-proxygroup=root \ + --disable-pcre \ + ) +endef + +define Package/dansguardian/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/dansguardian $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/etc + $(CP) $(PKG_INSTALL_DIR)/etc/dansguardian $(1)/etc/ + $(INSTALL_CONF) ./files/dansguardianf1.conf $(1)/etc/dansguardian/dansguardianf1.conf + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/dansguardian.config $(1)/etc/config/dansguardian + + $(INSTALL_DIR) $(1)/usr/share/dansguardian + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/dansguardian/transparent1x1.gif $(1)/usr/share/dansguardian/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/dansguardian/blockedflash.swf $(1)/usr/share/dansguardian/ + + $(INSTALL_DIR) $(1)/usr/share/dansguardian/languages/ukenglish + $(CP) $(PKG_INSTALL_DIR)/usr/share/dansguardian/languages/ukenglish/* $(1)/usr/share/dansguardian/languages/ukenglish/ + + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) ./files/dansguardian.init $(1)/etc/init.d/dansguardian +endef + +$(eval $(call BuildPackage,dansguardian)) diff --git a/net/dansguardian/files/dansguardian.config b/net/dansguardian/files/dansguardian.config new file mode 100644 index 0000000..86640af --- /dev/null +++ b/net/dansguardian/files/dansguardian.config @@ -0,0 +1,71 @@ +config dansguardian 'dansguardian' + option config_file '/etc/dansguardian/dansguardianf1.conf' + option accessdeniedaddress 'http://YOURSERVER.YOURDOMAIN/cgi-bin/dansguardian.pl' + option bannediplist '/etc/dansguardian/lists/bannediplist' + option contentscanexceptions 'off' + option contentscannertimeout '60' + option createlistcachefiles 'on' + option custombannedflashfile '/usr/share/dansguardian/blockedflash.swf' + option custombannedimagefile '/usr/share/dansguardian/transparent1x1.gif' + option deletedownloadedtempfiles 'on' + option downloadmanager '/etc/dansguardian/downloadmanagers/default.conf' + option exceptioniplist '/etc/dansguardian/lists/exceptioniplist' + option filecachedir '/tmp' + option filtergroups '1' + option filtergroupslist '/etc/dansguardian/lists/filtergroupslist' + option filterip '' + option filterports '8080' + option forcequicksearch 'off' + option forwardedfor 'off' + option hexdecodecontent 'off' + option initialtrickledelay '20' + option ipcfilename '/tmp/.dguardianipc' + option ipipcfilename '/tmp/.dguardianipipc' + option languagedir '/usr/share/dansguardian/languages' + option language 'ukenglish' + option logadblocks 'off' + option logchildprocesshandling 'off' + option logclienthostnames 'off' + option logconnectionhandlingerrors 'on' + option logexceptionhits '2' + option logfileformat '1' + option loglevel '2' + option loglocation '/dev/null' + option logsyslog 'on' + option loguseragent 'off' + option maxagechildren '500' + option maxchildren '120' + option maxcontentfilecachescansize '20000' + option maxcontentfiltersize '256' + option maxcontentramcachescansize '2000' + option maxips '0' + option maxsparechildren '32' + option maxuploadsize '-1' + option minchildren '8' + option minsparechildren '4' + option nodaemon 'off' + option nologger 'off' + option nonstandarddelimiter 'on' + option perroomblockingdirectory '/etc/dansguardian/lists/bannedrooms/' + option phrasefiltermode '2' + option prefercachedlists 'off' + option preforkchildren '6' + option preservecase '0' + option proxyip '127.0.0.1' + option proxyport '3128' + option proxytimeout '20' + option recheckreplacedurls 'off' + option reportinglevel '3' + option reverseaddresslookups 'off' + option reverseclientiplookups 'off' + option scancleancache 'on' + option showweightedfound 'on' + option softrestart 'off' + option trickledelay '10' + option urlcacheage '900' + option urlcachenumber '1000' + option urlipcfilename '/tmp/.dguardianurlipc' + option usecustombannedflash 'on' + option usecustombannedimage 'on' + option usexforwardedfor 'off' + option weightedphrasemode '2' diff --git a/net/dansguardian/files/dansguardian.init b/net/dansguardian/files/dansguardian.init new file mode 100644 index 0000000..67ec6bd --- /dev/null +++ b/net/dansguardian/files/dansguardian.init @@ -0,0 +1,190 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2015 OpenWrt.org + +START=90 +STOP=10 + +USE_PROCD=1 +PROG=/usr/sbin/dansguardian +CONFIGFILE="/tmp/dansguardian/dansguardian.conf" + +validate_dansguardian_section() { + uci_validate_section dansguardian dansguardian "${1}" \ + 'config_file:string' \ + 'accessdeniedaddress:string' \ + 'bannediplist:string' \ + 'contentscanexceptions:string' \ + 'contentscannertimeout:uinteger' \ + 'createlistcachefiles:string' \ + 'custombannedflashfile:string' \ + 'custombannedimagefile:string' \ + 'deletedownloadedtempfiles:string' \ + 'downloadmanager:string' \ + 'exceptioniplist:string' \ + 'filecachedir:string' \ + 'filtergroups:uinteger' \ + 'filtergroupslist:string' \ + 'filterip:ipaddr' \ + 'filterports:port:8080' \ + 'forcequicksearch:string' \ + 'forwardedfor:string' \ + 'hexdecodecontent:string' \ + 'initialtrickledelay:uinteger' \ + 'ipcfilename:string' \ + 'ipipcfilename:string' \ + 'languagedir:string' \ + 'language:string' \ + 'logadblocks:string' \ + 'logchildprocesshandling:string' \ + 'logclienthostnames:string' \ + 'logconnectionhandlingerrors:string' \ + 'logexceptionhits:range(0,2)' \ + 'logfileformat:range(1,4)' \ + 'loglevel:range(0,3)' \ + 'loglocation:string' \ + 'loguseragent:string' \ + 'maxagechildren:uinteger' \ + 'maxchildren:uinteger' \ + 'maxcontentfilecachescansize:uinteger' \ + 'maxcontentfiltersize:uinteger' \ + 'maxcontentramcachescansize:uinteger' \ + 'maxips:uinteger' \ + 'maxsparechildren:uinteger' \ + 'maxuploadsize:integer' \ + 'minchildren:uinteger' \ + 'minsparechildren:uinteger' \ + 'nodaemon:string' \ + 'nologger:string' \ + 'nonstandarddelimiter:string' \ + 'perroomblockingdirectory:string' \ + 'phrasefiltermode:range(0,3)' \ + 'prefercachedlists:string' \ + 'preforkchildren:uinteger' \ + 'preservecase:range(0,2)' \ + 'proxyip:ipaddr' \ + 'proxyport:port:3128' \ + 'proxytimeout:range(20,30)' \ + 'recheckreplacedurls:string' \ + 'reportinglevel:range(-1,3)' \ + 'reverseaddresslookups:string' \ + 'reverseclientiplookups:string' \ + 'scancleancache:string' \ + 'showweightedfound:string' \ + 'softrestart:string' \ + 'trickledelay:uinteger' \ + 'urlcacheage:uinteger' \ + 'urlcachenumber:uinteger' \ + 'urlipcfilename:string' \ + 'usecustombannedflash:string' \ + 'usecustombannedimage:string' \ + 'usexforwardedfor:string' \ + 'weightedphrasemode:range(0,2)' +} + +start_service() { + local config_file accessdeniedaddress bannediplist contentscanexceptions contentscannertimeout \ + createlistcachefiles custombannedflashfile custombannedimagefile deletedownloadedtempfiles \ + downloadmanager exceptioniplist filecachedir filtergroups filtergroupslist filterip filterports \ + forcequicksearch forwardedfor hexdecodecontent initialtrickledelay ipcfilename ipipcfilename \ + language languagedir logadblocks logchildprocesshandling logclienthostnames logconnectionhandlingerrors \ + logexceptionhits logfileformat loglevel loguseragent maxagechildren maxchildren maxcontentfilecachescansize \ + maxcontentfiltersize maxcontentramcachescansize maxips maxsparechildren maxuploadsize minchildren minsparechildren \ + nodaemon nologger nonstandarddelimiter perroomblockingdirectory phrasefiltermode prefercachedlists preforkchildren \ + preservecase proxyip proxyport proxytimeout recheckreplacedurls reportinglevel reverseaddresslookups \ + reverseclientiplookups scancleancache showweightedfound softrestart trickledelay urlcacheage urlcachenumber \ + urlipcfilename usecustombannedflash usecustombannedimage usexforwardedfor weightedphrasemode + + validate_dansguardian_section dansguardian || { + echo "validation failed" + return 1 + } + + mkdir -p $(dirname $CONFIGFILE) + ln -sf $config_file $(dirname $CONFIGFILE) + + echo "accessdeniedaddress = " $accessdeniedaddress > $CONFIGFILE + echo "bannediplist = " $bannediplist >> $CONFIGFILE + echo "contentscanexceptions = " $contentscanexceptions >> $CONFIGFILE + echo "contentscannertimeout = " $contentscannertimeout >> $CONFIGFILE + echo "createlistcachefiles = " $createlistcachefiles >> $CONFIGFILE + echo "custombannedflashfile = " $custombannedflashfile >> $CONFIGFILE + echo "custombannedimagefile = " $custombannedimagefile >> $CONFIGFILE + echo "deletedownloadedtempfiles = " $deletedownloadedtempfiles >> $CONFIGFILE + echo "downloadmanager = " $downloadmanager >> $CONFIGFILE + echo "exceptioniplist = " $exceptioniplist >> $CONFIGFILE + echo "filecachedir = " $filecachedir >> $CONFIGFILE + echo "filtergroups = " $filtergroups >> $CONFIGFILE + echo "filtergroupslist = " $filtergroupslist >> $CONFIGFILE + echo "filterip = " $filterip >> $CONFIGFILE + echo "filterports = " $filterports >> $CONFIGFILE + echo "forcequicksearch = " $forcequicksearch >> $CONFIGFILE + echo "forwardedfor = " $forwardedfor >> $CONFIGFILE + echo "hexdecodecontent = " $hexdecodecontent >> $CONFIGFILE + echo "initialtrickledelay = " $initialtrickledelay >> $CONFIGFILE + echo "ipcfilename = " $ipcfilename >> $CONFIGFILE + echo "ipipcfilename = " $ipipcfilename >> $CONFIGFILE + echo "language = " $language >> $CONFIGFILE + echo "languagedir = " $languagedir >> $CONFIGFILE + echo "logadblocks = " $logadblocks >> $CONFIGFILE + echo "logchildprocesshandling = " $logchildprocesshandling >> $CONFIGFILE + echo "logclienthostnames = " $logclienthostnames >> $CONFIGFILE + echo "logconnectionhandlingerrors = " $logconnectionhandlingerrors >> $CONFIGFILE + echo "logexceptionhits = " $logexceptionhits >> $CONFIGFILE + echo "logfileformat = " $logfileformat >> $CONFIGFILE + echo "loglevel = " $loglevel >> $CONFIGFILE + echo "loglocation = " $loglocation >> $CONFIGFILE + echo "loguseragent = " $loguseragent >> $CONFIGFILE + echo "maxagechildren = " $maxagechildren >> $CONFIGFILE + echo "maxchildren = " $maxchildren >> $CONFIGFILE + echo "maxcontentfilecachescansize = " $maxcontentfilecachescansize >> $CONFIGFILE + echo "maxcontentfiltersize = " $maxcontentfiltersize >> $CONFIGFILE + echo "maxcontentramcachescansize = " $maxcontentramcachescansize >> $CONFIGFILE + echo "maxips = " $maxips >> $CONFIGFILE + echo "maxsparechildren = " $maxsparechildren >> $CONFIGFILE + echo "maxuploadsize = " $maxuploadsize >> $CONFIGFILE + echo "minchildren = " $minchildren >> $CONFIGFILE + echo "minsparechildren = " $minsparechildren >> $CONFIGFILE + echo "nodaemon = " $nodaemon >> $CONFIGFILE + echo "nologger = " $nologger >> $CONFIGFILE + echo "nonstandarddelimiter = " $nonstandarddelimiter >> $CONFIGFILE + echo "perroomblockingdirectory = " $perroomblockingdirectory >> $CONFIGFILE + echo "phrasefiltermode = " $phrasefiltermode >> $CONFIGFILE + echo "prefercachedlists = " $prefercachedlists >> $CONFIGFILE + echo "preforkchildren = " $preforkchildren >> $CONFIGFILE + echo "preservecase = " $preservecase >> $CONFIGFILE + echo "proxyip = " $proxyip >> $CONFIGFILE + echo "proxyport = " $proxyport >> $CONFIGFILE + echo "proxytimeout = " $proxytimeout >> $CONFIGFILE + echo "recheckreplacedurls = " $recheckreplacedurls >> $CONFIGFILE + echo "reportinglevel = " $reportinglevel >> $CONFIGFILE + echo "reverseaddresslookups = " $reverseaddresslookups >> $CONFIGFILE + echo "reverseclientiplookups = " $reverseclientiplookups >> $CONFIGFILE + echo "scancleancache = " $scancleancache >> $CONFIGFILE + echo "showweightedfound = " $showweightedfound >> $CONFIGFILE + echo "softrestart = " $softrestart >> $CONFIGFILE + echo "trickledelay = " $trickledelay >> $CONFIGFILE + echo "urlcacheage = " $urlcacheage >> $CONFIGFILE + echo "urlcachenumber = " $urlcachenumber >> $CONFIGFILE + echo "urlipcfilename = " $urlipcfilename >> $CONFIGFILE + echo "usecustombannedflash = " $usecustombannedflash >> $CONFIGFILE + echo "usecustombannedimage = " $usecustombannedimage >> $CONFIGFILE + echo "usexforwardedfor = " $usexforwardedfor >> $CONFIGFILE + echo "weightedphrasemode = " $weightedphrasemode >> $CONFIGFILE + + procd_open_instance + procd_set_param command $PROG -N -c "$CONFIGFILE" + procd_set_param file $CONFIGFILE + procd_set_param respawn + procd_close_instance +} + +stop_service() +{ + dansguardian -s | awk -F':' '{ print $2}' | xargs kill -9 +} + +service_triggers() +{ + procd_add_reload_trigger "dansguardian" + procd_add_validation validate_dansguardian_section +} diff --git a/net/dansguardian/files/dansguardianf1.conf b/net/dansguardian/files/dansguardianf1.conf new file mode 100644 index 0000000..01e09ae --- /dev/null +++ b/net/dansguardian/files/dansguardianf1.conf @@ -0,0 +1,348 @@ +# DansGuardian filter group config file for version 2.12.0.0 + + +# Filter group mode +# This option determines whether members of this group have their web access +# unfiltered, filtered, or banned. This mechanism replaces the "banneduserlist" +# and "exceptionuserlist" files from previous versions. +# +# 0 = banned +# 1 = filtered +# 2 = unfiltered (exception) +# +# Only filter groups with a mode of 1 need to define phrase, URL, site, extension, +# mimetype and PICS lists; in other modes, these options are ignored to conserve +# memory. +# +# Defaults to 0 if unspecified. +# Unauthenticated users are treated as being in the first filter group. +groupmode = 1 + +# Filter group name +# Used to fill in the -FILTERGROUP- placeholder in the HTML template file, and to +# name the group in the access logs +# Defaults to empty string +#groupname = '' + +# Content filtering files location +bannedphraselist = '/etc/dansguardian/lists/bannedphraselist' +weightedphraselist = '/etc/dansguardian/lists/weightedphraselist' +exceptionphraselist = '/etc/dansguardian/lists/exceptionphraselist' +bannedsitelist = '/etc/dansguardian/lists/bannedsitelist' +greysitelist = '/etc/dansguardian/lists/greysitelist' +exceptionsitelist = '/etc/dansguardian/lists/exceptionsitelist' +bannedurllist = '/etc/dansguardian/lists/bannedurllist' +greyurllist = '/etc/dansguardian/lists/greyurllist' +exceptionurllist = '/etc/dansguardian/lists/exceptionurllist' +exceptionregexpurllist = '/etc/dansguardian/lists/exceptionregexpurllist' +bannedregexpurllist = '/etc/dansguardian/lists/bannedregexpurllist' +picsfile = '/etc/dansguardian/lists/pics' +contentregexplist = '/etc/dansguardian/lists/contentregexplist' +urlregexplist = '/etc/dansguardian/lists/urlregexplist' + +# Filetype filtering +# +# Blanket download blocking +# If enabled, all files will be blocked, unless they match the +# exceptionextensionlist or exceptionmimetypelist. +# These lists do not override virus scanning. +# Exception lists defined above override all types of filtering, including +# the blanket download block. +# Defaults to disabled. +# (on | off) +# +blockdownloads = off +exceptionextensionlist = '/etc/dansguardian/lists/exceptionextensionlist' +exceptionmimetypelist = '/etc/dansguardian/lists/exceptionmimetypelist' +# +# Use the following lists to block specific kinds of file downloads. +# The two exception lists above can be used to override these. +# +bannedextensionlist = '/etc/dansguardian/lists/bannedextensionlist' +bannedmimetypelist = '/etc/dansguardian/lists/bannedmimetypelist' +# +# In either file filtering mode, the following list can be used to override +# MIME type & extension blocks for particular domains & URLs (trusted download sites). +# +exceptionfilesitelist = '/etc/dansguardian/lists/exceptionfilesitelist' +exceptionfileurllist = '/etc/dansguardian/lists/exceptionfileurllist' + +# Categorise without blocking: +# Supply categorised lists here and the category string shall be logged against +# matching requests, but matching these lists does not perform any filtering +# action. +#logsitelist = '/etc/dansguardian/lists/logsitelist' +#logurllist = '/etc/dansguardian/lists/logurllist' +#logregexpurllist = '/etc/dansguardian/lists/logregexpurllist' + +# Outgoing HTTP header rules: +# Optional lists for blocking based on, and modification of, outgoing HTTP +# request headers. Format for headerregexplist is one modification rule per +# line, similar to content/URL modifications. Format for +# bannedregexpheaderlist is one regular expression per line, with matching +# headers causing a request to be blocked. +# Headers are matched/replaced on a line-by-line basis, not as a contiguous +# block. +# Use for example, to remove cookies or prevent certain user-agents. +headerregexplist = '/etc/dansguardian/lists/headerregexplist' +bannedregexpheaderlist = '/etc/dansguardian/lists/bannedregexpheaderlist' + +# Weighted phrase mode +# Optional; overrides the weightedphrasemode option in dansguardian.conf +# for this particular group. See documentation for supported values in +# that file. +#weightedphrasemode = 0 + +# Naughtiness limit +# This the limit over which the page will be blocked. Each weighted phrase is given +# a value either positive or negative and the values added up. Phrases to do with +# good subjects will have negative values, and bad subjects will have positive +# values. See the weightedphraselist file for examples. +# As a guide: +# 50 is for young children, 100 for old children, 160 for young adults. +naughtynesslimit = 50 + +# Search term blocking +# Search terms can be extracted from search URLs and filtered using the +# bannedphraselist, weightedphraselist and exceptionphraselist, with a separate +# threshold for blocking than that used for normal page content. +# To do this, the first two options below must be enabled. +# +# Search engine regular expression list +# List of regular expressions for matching search engine URLs. It is assumed +# that the search terms themselves will be contained within the first submatch +# of each expression. +#searchengineregexplist = '/etc/dansguardian/lists/searchengineregexplist' +# +# Search term limit +# The limit over which requests will be blocked for containing search terms +# which match the weightedphraselist. This should usually be lower than the +# 'naughtynesslimit' value above, because the amount of text being filtered +# is only a few words, rather than a whole page. +# This option must be uncommented if searchengineregexplist is uncommented. +# A value of 0 here indicates that search terms should be extracted, +# for logging/reporting purposes, but no filtering should be performed +# on the resulting text. +#searchtermlimit = 30 +# +# Search term lists +# If the three lines below are uncommented, search term blocking will use +# the banned, weighted & exception phrases from these lists, instead of using +# the same phrase lists as for page content. This is optional but recommended, +# as weights for individual phrases in the "normal" lists may not be +# appropriate for blocking when those phrases appear in a much smaller block +# of text. +# Please note that all or none of the below should be uncommented, not a +# mixture. +#bannedsearchtermlist = '/etc/dansguardian/lists/bannedsearchtermlist' +#weightedsearchtermlist = '/etc/dansguardian/lists/weightedsearchtermlist' +#exceptionsearchtermlist = '/etc/dansguardian/lists/exceptionsearchtermlist' + +# Category display threshold +# This option only applies to pages blocked by weighted phrase filtering. +# Defines the minimum score that must be accumulated within a particular +# category in order for it to show up on the block pages' category list. +# All categories under which the page scores positively will be logged; those +# that were not displayed to the user appear in brackets. +# +# -1 = display only the highest scoring category +# 0 = display all categories (default) +# > 0 = minimum score for a category to be displayed +categorydisplaythreshold = 0 + +# Embedded URL weighting +# When set to something greater than zero, this option causes URLs embedded within a +# page's HTML (from links, image tags, etc.) to be extracted and checked against the +# bannedsitelist and bannedurllist. Each link to a banned page causes the amount set +# here to be added to the page's weighting. +# The behaviour of this option with regards to multiple occurrences of a site/URL is +# affected by the weightedphrasemode setting. +# +# NB: Currently, this feature uses regular expressions that require the PCRE library. +# As such, it is only available if you compiled DansGuardian with '--enable-pcre=yes'. +# You can check compile-time options by running 'dansguardian -v'. +# +# Set to 0 to disable. +# Defaults to 0. +# WARNING: This option is highly CPU intensive! +embeddedurlweight = 0 + +# Enable PICS rating support +# +# Defaults to disabled +# (on | off) +enablepics = off + +# Temporary Denied Page Bypass +# This provides a link on the denied page to bypass the ban for a few minutes. To be +# secure it uses a random hashed secret generated at daemon startup. You define the +# number of seconds the bypass will function for before the deny will appear again. +# To allow the link on the denied page to appear you will need to edit the template.html +# or dansguardian.pl file for your language. +# 300 = enable for 5 minutes +# 0 = disable ( defaults to 0 ) +# -1 = enable but you require a separate program/CGI to generate a valid link +bypass = 0 + +# Temporary Denied Page Bypass Secret Key +# Rather than generating a random key you can specify one. It must be more than 8 chars. +# '' = generate a random one (recommended and default) +# 'Mary had a little lamb.' = an example +# '76b42abc1cd0fdcaf6e943dcbc93b826' = an example +bypasskey = '' + +# Infection/Scan Error Bypass +# Similar to the 'bypass' setting, but specifically for bypassing files scanned and found +# to be infected, or files that trigger scanner errors - for example, archive types with +# recognised but unsupported compression schemes, or corrupt archives. +# The option specifies the number of seconds for which the bypass link will be valid. +# 300 = enable for 5 minutes +# 0 = disable (default) +# -1 = enable, but require a separate program/CGI to generate a valid link +infectionbypass = 0 + +# Infection/Scan Error Bypass Secret Key +# Same as the 'bypasskey' option, but used for infection bypass mode. +infectionbypasskey = '' + +# Infection/Scan Error Bypass on Scan Errors Only +# Enable this option to allow infectionbypass links only when virus scanning fails, +# not when a file is found to contain a virus. +# on = enable (default and highly recommended) +# off = disable +infectionbypasserrorsonly = on + +# Disable content scanning +# If you enable this option you will disable content scanning for this group. +# Content scanning primarily is AV scanning (if enabled) but could include +# other types. +# (on|off) default = off. +disablecontentscan = off + +# Enable Deep URL Analysis +# When enabled, DG looks for URLs within URLs, checking against the bannedsitelist and +# bannedurllist. This can be used, for example, to block images originating from banned +# sites from appearing in Google Images search results, as the original URLs are +# embedded in the thumbnail GET requests. +# (on|off) default = off +deepurlanalysis = off + +# reportinglevel +# +# -1 = log, but do not block - Stealth mode +# 0 = just say 'Access Denied' +# 1 = report why but not what denied phrase +# 2 = report fully +# 3 = use HTML template file (accessdeniedaddress ignored) - recommended +# +# If defined, this overrides the global setting in dansguardian.conf for +# members of this filter group. +# +#reportinglevel = 3 + +# accessdeniedaddress is the address of your web server to which the cgi +# dansguardian reporting script was copied. Only used in reporting levels +# 1 and 2. +# +# This webserver must be either: +# 1. Non-proxied. Either a machine on the local network, or listed as an +# exception in your browser's proxy configuration. +# 2. Added to the exceptionsitelist. Option 1 is preferable; this option is +# only for users using both transparent proxying and a non-local server +# to host this script. +# +# If defined, this overrides the global setting in dansguardian.conf for +# members of this filter group. +# +#accessdeniedaddress = 'http://YOURSERVER.YOURDOMAIN/cgi-bin/dansguardian.pl' + +# HTML Template override +# If defined, this specifies a custom HTML template file for members of this +# filter group, overriding the global setting in dansguardian.conf. This is +# only used in reporting level 3. +# +# The default template file path is //template.html +# e.g. /usr/share/dansguardian/languages/ukenglish/template.html when using 'ukenglish' +# language. +# +# This option generates a file path of the form: +# // +# e.g. /usr/share/dansguardian/languages/ukenglish/custom.html +# +#htmltemplate = 'custom.html' + +# Email reporting - original patch by J. Gauthier + +# Use SMTP +# If on, will enable system wide events to be reported by email. +# need to configure mail program (see 'mailer' in global config) +# and email recipients +# default usesmtp = off +#!! Not compiled !!usesmtp = off + +# mailfrom +# who the email would come from +# example: mailfrom = 'dansguardian@mycompany.com' +#!! Not compiled !!mailfrom = '' + +# avadmin +# who the virus emails go to (if notify av is on) +# example: avadmin = 'admin@mycompany.com' +#!! Not compiled !!avadmin = '' + +# contentdmin +# who the content emails go to (when thresholds are exceeded) +# and contentnotify is on +# example: contentadmin = 'admin@mycompany.com' +#!! Not compiled !!contentadmin = '' + +# avsubject +# Subject of the email sent when a virus is caught. +# only applicable if notifyav is on +# default avsubject = 'dansguardian virus block' +#!! Not compiled !!avsubject = 'dansguardian virus block' + +# content +# Subject of the email sent when violation thresholds are exceeded +# default contentsubject = 'dansguardian violation' +#!! Not compiled !!contentsubject = 'dansguardian violation' + +# notifyAV +# This will send a notification, if usesmtp/notifyav is on, any time an +# infection is found. +# Important: If this option is off, viruses will still be recorded like a +# content infraction. +#!! Not compiled !!notifyav = off + +# notifycontent +# This will send a notification, if usesmtp is on, based on thresholds +# below +#!! Not compiled !!notifycontent = off + +# thresholdbyuser +# results are only predictable with user authenticated configs +# if enabled the violation/threshold count is kept track of by the user +#!! Not compiled !!thresholdbyuser = off + +#violations +# number of violations before notification +# setting to 0 will never trigger a notification +#!! Not compiled !!violations = 0 + +#threshold +# this is in seconds. If 'violations' occur in 'threshold' seconds, then +# a notification is made. +# if this is set to 0, then whenever the set number of violations are made a +# notifaction will be sent. +#!! Not compiled !!threshold = 0 + +#SSL certificate checking +# Check that ssl certificates for servers on https connections are valid +# and signed by a ca in the configured path +sslcertcheck = off + +#SSL man in the middle +# Forge ssl certificates for all sites, decrypt the data then re encrypt it +# using a different private key. Used to filter ssl sites +sslmitm = off + diff --git a/net/dansguardian/patches/001-compile.patch b/net/dansguardian/patches/001-compile.patch new file mode 100644 index 0000000..db8efa4 --- /dev/null +++ b/net/dansguardian/patches/001-compile.patch @@ -0,0 +1,29 @@ +--- a/configure ++++ b/configure +@@ -827,7 +827,7 @@ sysconfdir='${prefix}/etc' + sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' + includedir='${prefix}/include' +-oldincludedir='/usr/include' ++oldincludedir='${prefix}/usr/include' + docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' + infodir='${datarootdir}/info' + htmldir='${docdir}' +@@ -5265,7 +5265,7 @@ $as_echo_n "checking for zlib... " >&6; + # Check whether --with-zlib was given. + if test "${with_zlib+set}" = set; then : + withval=$with_zlib; # check for header & func (in library) in given prefix +- CPPFLAGS="${CPPFLAGS} -I${withval}/include" ++ CPPFLAGS="${CPPFLAGS}" + if test "x$staticzlib" = "xtrue"; then + LIBS="-Bstatic -L${withval} -lz -Bdynamic ${LIBS}" + else +@@ -7095,7 +7095,7 @@ $as_echo "#define ENABLE_NTLM /**/" >>co + if test "${with_libiconv+set}" = set; then : + withval=$with_libiconv; # check for header & func (in library) in given prefix + if test "x$withval" != "x"; then +- CPPFLAGS="${CPPFLAGS} -I${withval}/include" ++ CPPFLAGS="${CPPFLAGS}" + LIBS="-L${withval}/lib -liconv ${LIBS}" + else + LIBS="-liconv ${LIBS}" diff --git a/net/darkstat/Makefile b/net/darkstat/Makefile new file mode 100644 index 0000000..027ad36 --- /dev/null +++ b/net/darkstat/Makefile @@ -0,0 +1,66 @@ +# +# Copyright (C) 2007-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=darkstat +PKG_VERSION:=3.0.719 +PKG_RELEASE:=1 + +PKG_MAINTAINER:=Jean-Michel Lacroix + +PKG_LICENSE:=GPL-2.0 BSD-ISC +PKG_LICENSE_FILES:=COPYING.GPL LICENSE + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=http://unix4lyfe.org/darkstat +PKG_MD5SUM:=963145de05cb21f4d93a9c244beeaea0 + +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/darkstat + SECTION:=net + CATEGORY:=Network + DEPENDS:=+libpcap +zlib + TITLE:=Network bandwidth monitor + URL:=http://unix4lyfe.org/darkstat/ +endef + +define Package/darkstat/description +darkstat is a packet sniffer that runs as a background process on a cable/DSL +router, gathers all sorts of statistics about network usage, and serves them +over HTTP. +endef + +define Package/darkstat/conffiles +/etc/config/darkstat +endef + +CONFIGURE_ARGS += \ + --disable-debug \ + --with-chroot-dir=/var/empty + +TARGET_CFLAGS += -std=gnu99 + +define Build/Compile + $(HOSTCC) $(PKG_BUILD_DIR)/static/c-ify.c \ + -o $(PKG_BUILD_DIR)/c-ify + $(call Build/Compile/Default) +endef + +define Package/darkstat/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/darkstat $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/darkstat.init $(1)/etc/init.d/darkstat + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/darkstat.config $(1)/etc/config/darkstat +endef + +$(eval $(call BuildPackage,darkstat)) diff --git a/net/darkstat/files/darkstat.config b/net/darkstat/files/darkstat.config new file mode 100644 index 0000000..ba7c1c2 --- /dev/null +++ b/net/darkstat/files/darkstat.config @@ -0,0 +1,20 @@ +config darkstat + option interface 'lan' + option syslog false + option verbose true + option no_daemon false + option no_promisc false + option no_dns false + option no_macs false + option no_lastseen false +# option httpaddr '0.0.0.0' +# option httpport '667' +# option network_filter 'not (src net 192.168.1 and dst net 192.168.1)' +# option network_netmask '192.168.1.0/255.255.255.0' + option local_only false +# option hosts_max '1000' +# option hosts_keep '500' +# option ports_max '60' +# option ports_keep '30' +# option highest_port '65534' + diff --git a/net/darkstat/files/darkstat.init b/net/darkstat/files/darkstat.init new file mode 100755 index 0000000..27d063e --- /dev/null +++ b/net/darkstat/files/darkstat.init @@ -0,0 +1,97 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2007-2016 OpenWrt.org + +START=60 +APP=darkstat +RUN_D=/var/empty +PID_F=$RUN_D/darkstat.pid + +SYSLOG="" +VERBOSE="" +NODAEMON="" +NOPROMISC="" +NODNS="" +NOMACS="" +NOLASTSEEN="" +LOCAL="" +paramstr="" + +export_bool () { + local option="$1" + local section="$2" + local _keystr="$3" + local _loctmp + paramstr="" + config_get_bool _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + if [ 1 -eq "$_loctmp" ]; then + paramstr="${_keystr} " + fi + fi +} + +start() { + mkdir -p $RUN_D + . /lib/functions/network.sh + config_load darkstat + config_foreach start_darkstat darkstat +} + +start_darkstat() { + local cfg="$1" + config_get interface $cfg interface + export_bool syslog $cfg "--syslog" + SYSLOG=$paramstr + export_bool verbose $cfg "--verbose" + VERBOSE=$paramstr + export_bool no_daemon $cfg "--no-daemon" + NODAEMON=$paramstr + export_bool no_promisc $cfg "--no-promisc" + NOPROMISC=$paramstr + export_bool no_dns $cfg "--no-dns" + NODNS=$paramstr + export_bool no_macs $cfg "--no-macs" + NOMACS=$paramstr + export_bool no_lastseen $cfg "--no-lastseen" + NOLASTSEEN=$paramstr + config_get httpaddr $cfg httpaddr + config_get httpport $cfg httpport + config_get network_filter $cfg network_filter + config_get network_netmask $cfg network_netmask + export_bool local_only $cfg "--local-only" + LOCAL=$paramstr + config_get hosts_max $cfg hosts_max + config_get hosts_keep $cfg hosts_keep + config_get ports_max $cfg ports_max + config_get ports_keep $cfg ports_keep + config_get highest_port $cfg highest_port + + + network_get_device ifname "$interface" && { + /usr/sbin/$APP -i "$ifname" \ + ${SYSLOG} \ + ${VERBOSE} \ + ${NODAEMON} \ + ${NOPROMISC} \ + ${NODNS} \ + ${NOMACS} \ + ${NOLASTSEEN} \ + ${httpaddr:+-b "$httpaddr"} \ + ${httpport:+-p "$httpport"} \ + ${network_filter:+-f "$network_filter"} \ + ${network_netmask:+-l "$network_netmask"} \ + ${LOCAL} \ + ${hosts_max:+--hosts-max "$hosts_max"} \ + ${hosts_keep:+--hosts-keep "$hosts_keep"} \ + ${ports_max:+--ports-max "$ports_max"} \ + ${ports_keep:+--ports-keep "$ports_keep"} \ + ${highest_port:+--highest-port "$highest_port"} \ + --chroot $RUN_D \ + --pidfile $PID_F + } +} + +stop() { + start-stop-daemon -K -n $APP -p $PID_F -s TERM + rm -f $PID_F +} diff --git a/net/darkstat/patches/100-do-not-use-NI_IDN.patch b/net/darkstat/patches/100-do-not-use-NI_IDN.patch new file mode 100644 index 0000000..7f7eecd --- /dev/null +++ b/net/darkstat/patches/100-do-not-use-NI_IDN.patch @@ -0,0 +1,12 @@ +--- a/dns.c ++++ b/dns.c +@@ -347,9 +347,6 @@ dns_main(void) + + reply.addr = ip; + flags = NI_NAMEREQD; +-# ifdef NI_IDN +- flags |= NI_IDN; +-# endif + switch (ip.family) { + case IPv4: + sin.sin_family = AF_INET; diff --git a/net/davfs2/Makefile b/net/davfs2/Makefile new file mode 100644 index 0000000..4e1f092 --- /dev/null +++ b/net/davfs2/Makefile @@ -0,0 +1,71 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=davfs2 +PKG_VERSION:=1.5.4 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://download.savannah.gnu.org/releases/davfs2/ +PKG_MD5SUM:=c9f0b557275b7ec88fec751bf22f30cf + +PKG_FIXUP:=gettext-version autoreconf + +include $(INCLUDE_DIR)/package.mk + +define Package/davfs2 + SECTION:=net + CATEGORY:=Network + SUBMENU:=Filesystem + DEPENDS=+libneon +kmod-fuse +libfuse + TITLE:=Mount a WebDAV resource as a regular file system. + URL:=http://savannah.nongnu.org/projects/davfs2/ + MAINTAINER:=Federico Di Marco +endef + +define Package/davfs2/description + Web Distributed Authoring and Versioning (WebDAV), an extension to the HTTP-protocol, + allows authoring of resources on a remote web server.davfs2 provides the ability to + access such resources like a typical filesystem, allowing for use by standard + applications with no built-in support for WebDAV. + + davfs2 is designed to fully integrate into the filesystem semantics of Unix-like + systems (mount, umount, etc.). davfs2 makes mounting by unprivileged users as easy + and secure as possible. + + davfs2 does extensive caching to make the file system responsive, to avoid + unnecessary network traffic and to prevent data loss, and to cope for slow or + unreliable connections. + + davfs2 will work with most WebDAV servers needing little or no configuration. +endef + +define Package/davfs2/conffiles +/etc/davfs2/davfs2.conf +endef + +TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include + +TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE + +CONFIGURE_VARS += \ + LDFLAGS="$(TARGET_LDFLAGS) -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib" + +CONFIGURE_ARGS += --with-neon="$(STAGING_DIR)/usr" + +define Package/davfs2/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mount.davfs $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/umount.davfs $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/davfs2 + $(INSTALL_DATA) files/$(PKG_NAME).conf $(1)/etc/davfs2 +endef + +$(eval $(call BuildPackage,davfs2)) diff --git a/net/davfs2/files/davfs2.conf b/net/davfs2/files/davfs2.conf new file mode 100644 index 0000000..4cf501b --- /dev/null +++ b/net/davfs2/files/davfs2.conf @@ -0,0 +1,9 @@ +# +# davfs2 configuration file +# please see http://linux.die.net/man/5/davfs2.conf for details +# + +dav_user nobody +dav_group nogroup +cache_dir /tmp/davfs2 +cache_size 4 diff --git a/net/davfs2/patches/010-main_code_fix.patch b/net/davfs2/patches/010-main_code_fix.patch new file mode 100644 index 0000000..d91336d --- /dev/null +++ b/net/davfs2/patches/010-main_code_fix.patch @@ -0,0 +1,22 @@ +--- a/src/cache.c ++++ b/src/cache.c +@@ -58,7 +58,7 @@ + #ifdef HAVE_SYS_TYPES_H + #include + #endif +-#include ++#include + + #include + #include +--- a/src/webdav.c ++++ b/src/webdav.c +@@ -2033,7 +2033,7 @@ ssl_verify(void *userdata, int failures, + len = getline(&s, &n, stdin); + if (len < 0) + abort(); +- if (rpmatch(s) > 0) ++ if ((s[0]=='y' || s[0]=='Y') > 0) + ret = 0; + free(s); + } diff --git a/net/davfs2/patches/100-musl-compat.patch b/net/davfs2/patches/100-musl-compat.patch new file mode 100644 index 0000000..e819cbc --- /dev/null +++ b/net/davfs2/patches/100-musl-compat.patch @@ -0,0 +1,194 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -42,7 +42,7 @@ DAV_CHECK_NEON + # Checks for header files. + AC_HEADER_DIRENT + AC_HEADER_STDC +-AC_CHECK_HEADERS([fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h]) ++AC_CHECK_HEADERS([error.h fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h sys/select.h sys/types.h syslog.h termios.h unistd.h utime.h]) + + # Checks for typedefs, structures, and compiler characteristics. + AC_C_CONST +@@ -78,7 +78,7 @@ AC_FUNC_SELECT_ARGTYPES + AC_FUNC_STRFTIME + AC_FUNC_STAT + AC_FUNC_UTIME_NULL +-AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime]) ++AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime canonicalize_file_name fopencookie]) + + # Misc. + DAV_DEFAULTS +--- a/src/cache.c ++++ b/src/cache.c +@@ -19,12 +19,12 @@ + + + #include "config.h" ++#include "compat.h" + + #ifdef HAVE_DIRENT_H + #include + #endif + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +--- a/src/dav_fuse.c ++++ b/src/dav_fuse.c +@@ -47,6 +47,9 @@ + #ifdef HAVE_SYS_STAT_H + #include + #endif ++#ifdef HAVE_SYS_SELECT_H ++#include ++#endif + + #include "defaults.h" + #include "mount_davfs.h" +--- a/src/kernel_interface.c ++++ b/src/kernel_interface.c +@@ -19,8 +19,8 @@ + + + #include "config.h" ++#include "compat.h" + +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +@@ -51,6 +51,9 @@ + #ifdef HAVE_SYS_STAT_H + #include + #endif ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif + #include + + #include "defaults.h" +--- a/src/mount_davfs.c ++++ b/src/mount_davfs.c +@@ -19,10 +19,10 @@ + + + #include "config.h" ++#include "compat.h" + + #include + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +--- a/src/umount_davfs.c ++++ b/src/umount_davfs.c +@@ -19,8 +19,8 @@ + + + #include "config.h" ++#include "compat.h" + +-#include + #include + #include + #ifdef HAVE_LIBINTL_H +--- a/src/webdav.c ++++ b/src/webdav.c +@@ -19,9 +19,9 @@ + + + #include "config.h" ++#include "compat.h" + + #include +-#include + #ifdef HAVE_FCNTL_H + #include + #endif +@@ -368,6 +368,7 @@ dav_init_webdav(const dav_args *args) + error(EXIT_FAILURE, errno, _("socket library initialization failed")); + + if (args->neon_debug & ~NE_DBG_HTTPPLAIN) { ++#ifdef HAVE_FOPENCOOKIE + char *buf = malloc(log_bufsize); + cookie_io_functions_t *log_func = malloc(sizeof(cookie_io_functions_t)); + if (!log_func) abort(); +@@ -380,6 +381,9 @@ dav_init_webdav(const dav_args *args) + error(EXIT_FAILURE, errno, + _("can't open stream to log neon-messages")); + ne_debug_init(log_stream, args->neon_debug); ++#else ++ error(EXIT_FAILURE, 0, "neon debugging unsupported"); ++#endif + } + + session = ne_session_create(args->scheme, args->host, args->port); +--- /dev/null ++++ b/src/compat.h +@@ -0,0 +1,64 @@ ++#ifndef _COMPAT_H ++#define _COMPAT_H ++ ++#ifndef _PATH_MOUNTED ++# define _PATH_MOUNTED "/proc/mounts" ++#endif ++ ++#ifndef _PATH_MNTTAB ++# define _PATH_MNTTAB "/etc/fstab" ++#endif ++ ++#ifdef HAVE_ERROR_H ++# include ++#else ++# include ++# include ++# include ++# include ++static void error_at_line(int status, int errnum, const char *filename, ++ unsigned int linenum, const char *format, ...) ++{ ++ va_list ap; ++ ++ fflush(stdout); ++ ++ if (filename != NULL) ++ fprintf(stderr, "%s:%u: ", filename, linenum); ++ ++ va_start(ap, format); ++ vfprintf(stderr, format, ap); ++ va_end(ap); ++ ++ if (errnum != 0) ++ fprintf(stderr, ": %s", strerror(errnum)); ++ ++ fprintf(stderr, "\n"); ++ ++ if (status != 0) ++ exit(status); ++} ++ ++#define error(status, errnum, format...) \ ++ error_at_line(status, errnum, NULL, 0, format) ++ ++#endif /* HAVE_ERROR_H */ ++ ++#ifndef HAVE_CANONICALIZE_FILE_NAME ++#include ++#include ++#include ++static char * canonicalize_file_name(const char *path) ++{ ++ char buf[PATH_MAX] = { }; ++ ++ snprintf(buf, sizeof(buf) - 1, "%s", path); ++ ++ if (!realpath(path, buf)) ++ return NULL; ++ ++ return strdup(buf); ++} ++#endif ++ ++#endif /* _COMPAT_H */ diff --git a/net/davfs2/patches/200-davfs2-1.5.4-no-forced-stack-protector.patch b/net/davfs2/patches/200-davfs2-1.5.4-no-forced-stack-protector.patch new file mode 100644 index 0000000..f581e05 --- /dev/null +++ b/net/davfs2/patches/200-davfs2-1.5.4-no-forced-stack-protector.patch @@ -0,0 +1,12 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -32,8 +32,7 @@ mount_davfs_SOURCES = cache.c dav_coda.c + kernel_interface.h mount_davfs.h webdav.h + umount_davfs_SOURCES = umount_davfs.c defaults.h + +-AM_CFLAGS = -Wall -Werror=format-security \ +- -fstack-protector-strong --param=ssp-buffer-size=4 ++AM_CFLAGS = -Wall -Werror=format-security + DEFS = -DPROGRAM_NAME=\"mount.davfs\" \ + -DDAV_SYS_CONF_DIR=\"$(pkgsysconfdir)\" \ + -DDAV_LOCALSTATE_DIR=\"$(dav_localstatedir)\" \ diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile new file mode 100755 index 0000000..6be7846 --- /dev/null +++ b/net/ddns-scripts/Makefile @@ -0,0 +1,364 @@ +# +# Copyright (C) 2008-2016 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=ddns-scripts +# Version == major.minor.patch +# increase on new functionality (minor) or patches (patch) +PKG_VERSION:=2.7.6 +# Release == build +# increase on changes of services files or tld_names.dat +PKG_RELEASE:=4 + +PKG_LICENSE:=GPL-2.0 +PKG_MAINTAINER:=Christian Schoenebeck + +include $(INCLUDE_DIR)/package.mk + +# no default dependencies +PKG_DEFAULT_DEPENDS= + +define Package/$(PKG_NAME)/Default + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + PKGARCH:=all +endef + +###### ************************************************************************* +define Package/$(PKG_NAME) + $(call Package/$(PKG_NAME)/Default) + TITLE:=Dynamic DNS Client scripts (with IPv6 support) +endef +# shown in LuCI package description +define Package/$(PKG_NAME)/description + Dynamic DNS Client scripts (with IPv6 support) - Info: http://wiki.openwrt.org/doc/howto/ddns.client +endef +# shown in menuconfig +define Package/$(PKG_NAME)/config + help + A highly configurable set of scripts for doing dynamic dns updates. + - IPv6 support + - DNS server support + - Glue Record support (require BIND host or KNOT host) + - DNS requests via TCP + - Proxy server support + - log file support + - support to run once + Version: $(PKG_VERSION)-$(PKG_RELEASE) + Info : http://wiki.openwrt.org/doc/howto/ddns.client +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare + $(call Package/$(PKG_NAME)/Default) + TITLE:=CloudFlare.com API v1 (deprecated) + DEPENDS:=$(PKG_NAME) +endef +define Package/$(PKG_NAME)_cloudflare/description + Dynamic DNS Client scripts extension for CloudFlare.com API-v1 (deprecated) +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare.com-v4 + $(call Package/$(PKG_NAME)/Default) + TITLE:=CloudFlare.com API v4 (require cURL) + DEPENDS:=$(PKG_NAME) +curl +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/description + Dynamic DNS Client scripts extension for CloudFlare.com API-v4 (require/install cURL) +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_godaddy.com-v1 + $(call Package/$(PKG_NAME)/Default) + TITLE:=GoDaddy.com (require cURL) + DEPENDS:=$(PKG_NAME) +curl +endef +define Package/$(PKG_NAME)_godaddy.com-v1/description + Dynamic DNS Client scripts extension for GoDaddy.com (require/install cURL) +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_no-ip_com + $(call Package/$(PKG_NAME)/Default) + TITLE:=DDNS extension for No-IP.com + DEPENDS:=$(PKG_NAME) +endef +define Package/$(PKG_NAME)_no-ip_com/description + Dynamic DNS Client scripts extension for No-IP.com +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_nsupdate + $(call Package/$(PKG_NAME)/Default) + TITLE:=DDNS extension using Bind nsupdate + DEPENDS:=$(PKG_NAME) +bind-client +endef +define Package/$(PKG_NAME)_nsupdate/description + Dynamic DNS Client scripts extension for direct updates using Bind nsupdate +endef +define Package/$(PKG_NAME)_nsupdate/config + help + The script directly updates a PowerDNS (or maybe bind server) via nsupdate + from bind-client package. It requires + "option dns_server" to be set to the server to be used by nsupdate. + "option username" should be set to the key name and + "option password" to the base64 encoded shared secret. + +endef + +###### ************************************************************************* +define Build/Configure +endef +define Build/Compile + $(CP) ./files $(PKG_BUILD_DIR) + for FILE in `find $(PKG_BUILD_DIR)/files -type f`; do \ + $(SED) 's/^\s*#/#/' \ + -e '/^#\s\|^#$$$$/d' \ + -e 's/\s#\s.*$$$$//' \ + -e 's/\s*$$$$//' \ + -e '/^\/\/\s/d' \ + -e '/^\s*$$$$/d' $$$$FILE; \ + done + # ensure that VERSION inside dynamic_dns_functions.sh reflect PKG_VERSION of Makefile + $(SED) '/^VERSION=*/s/.*/VERSION="$(PKG_VERSION)"/' $(PKG_BUILD_DIR)/files/dynamic_dns_functions.sh + $(CP) ./tools $(PKG_BUILD_DIR) + chmod 755 $(PKG_BUILD_DIR)/tools/* + $(PKG_BUILD_DIR)/tools/public_suffix_list.sh + mv -f $(PKG_BUILD_DIR)/tools/public_suffix_list.dat.gz \ + $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/ddns +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)/preinst + #!/bin/sh + # if NOT run buildroot and PKG_UPGRADE then stop service + [ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.hotplug $(1)/etc/hotplug.d/iface/95-ddns + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.init $(1)/etc/init.d/ddns + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(PKG_BUILD_DIR)/files/ddns.config $(1)/etc/config/ddns + + $(INSTALL_DIR) $(1)/etc/ddns + $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/services* $(1)/etc/ddns + + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/dynamic_dns_*.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)/postinst + #!/bin/sh + # if NOT run buildroot and PKG_UPGRADE then (re)start service if enabled + [ -z "$${IPKG_INSTROOT}" -a "$${PKG_UPGRADE}" = "1" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)/prerm + #!/bin/sh + # if run within buildroot exit + [ -n "$${IPKG_INSTROOT}" ] && exit 0 + + # stop running scripts + /etc/init.d/ddns stop + /etc/init.d/ddns disable + + # clear LuCI indexcache + rm -f /tmp/luci-indexcache >/dev/null 2>&1 + + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v1.sh $(1)/usr/lib/ddns + $(INSTALL_DIR) $(1)/usr/share + $(INSTALL_DATA) $(PKG_BUILD_DIR)/files/public_suffix_list.dat.gz $(1)/usr/share +endef +define Package/$(PKG_NAME)_cloudflare/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"cloudflare.com-v1"' '"update_cloudflare_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare/prerm + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_cloudflare.com-v4/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_cloudflare.com-v4 + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_cloudflare_com_v4.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"cloudflare.com-v4"' '"update_cloudflare_com_v4.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_cloudflare.com-v4/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/cloudflare\.com-v4/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_godaddy.com-v1/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_godaddy.com-v1/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_godaddy.com-v1 + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_godaddy_com_v1.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_godaddy.com-v1/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"godaddy.com-v1"' '"update_godaddy_com_v1.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_godaddy.com-v1/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/godaddy\.com-v1/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_no-ip_com/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_no-ip_com/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_no-ip_com + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_no-ip_com.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_no-ip_com/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"no-ip.com"' '"update_no-ip_com.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_no-ip_com/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/no-ip\.com/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +define Package/$(PKG_NAME)_nsupdate/preinst + #!/bin/sh + # if NOT run buildroot then stop service + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_nsupdate/install + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/ddns.defaults $(1)/etc/uci-defaults/ddns_nsupdate + $(INSTALL_DIR) $(1)/usr/lib/ddns + $(INSTALL_BIN) $(PKG_BUILD_DIR)/files/update_nsupdate.sh $(1)/usr/lib/ddns +endef +define Package/$(PKG_NAME)_nsupdate/postinst + #!/bin/sh + # if NOT upgrading add entries + [ "$${PKG_UPGRADE}" = "1" ] || { + printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services + printf "%s\\t%s\\n" '"bind-nsupdate"' '"update_nsupdate.sh"' >> $${IPKG_INSTROOT}/etc/ddns/services_ipv6 + } + # on real system restart service if enabled + [ -z "$${IPKG_INSTROOT}" ] \ + && /etc/init.d/ddns enabled \ + && /etc/init.d/ddns start >/dev/null 2>&1 + exit 0 # suppress errors +endef +define Package/$(PKG_NAME)_nsupdate/prerm + #!/bin/sh + [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/ddns stop >/dev/null 2>&1 + /bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services >/dev/null 2>&1 + /bin/sed -i '/bind-nsupdate/d' $${IPKG_INSTROOT}/etc/ddns/services_ipv6 >/dev/null 2>&1 + exit 0 # suppress errors +endef + +###### ************************************************************************* +$(eval $(call BuildPackage,$(PKG_NAME))) +$(eval $(call BuildPackage,$(PKG_NAME)_cloudflare)) +$(eval $(call BuildPackage,$(PKG_NAME)_cloudflare.com-v4)) +$(eval $(call BuildPackage,$(PKG_NAME)_godaddy.com-v1)) +$(eval $(call BuildPackage,$(PKG_NAME)_no-ip_com)) +$(eval $(call BuildPackage,$(PKG_NAME)_nsupdate)) diff --git a/net/ddns-scripts/files/ddns.config b/net/ddns-scripts/files/ddns.config new file mode 100644 index 0000000..6d6b810 --- /dev/null +++ b/net/ddns-scripts/files/ddns.config @@ -0,0 +1,32 @@ +# +# Please read http://wiki.openwrt.org/doc/uci/ddns +# +config ddns "global" + option ddns_dateformat "%F %R" +# option ddns_rundir "/var/run/ddns" +# option ddns_logdir "/var/log/ddns" + option ddns_loglines "250" + option upd_privateip "0" + + +config service "myddns_ipv4" + option service_name "dyndns.org" + option lookup_host "yourhost.example.com" + option domain "yourhost.example.com" + option username "your_username" + option password "your_password" + option interface "wan" + option ip_source "network" + option ip_network "wan" + +config service "myddns_ipv6" + option update_url "http://[USERNAME]:[PASSWORD]@your.provider.net/nic/update?hostname=[DOMAIN]&myip=[IP]" + option lookup_host "yourhost.example.com" + option domain "yourhost.example.com" + option username "your_username" + option password "your_password" + option use_ipv6 "1" + option interface "wan6" + option ip_source "network" + option ip_network "wan6" + diff --git a/net/ddns-scripts/files/ddns.defaults b/net/ddns-scripts/files/ddns.defaults new file mode 100755 index 0000000..8631208 --- /dev/null +++ b/net/ddns-scripts/files/ddns.defaults @@ -0,0 +1,99 @@ +#!/bin/sh + +# using function to not confuse function calls with existing ones inside /lib/functions.sh +update_ddns_config() { + udc_uci="$(which uci) -q" # ignore errors + udc_pkg="ddns" + udc_cfg="" + udc_name="" + udc_var="" + udc_val="" + package() { return 0; } + config () { + udc_cfg="$1" + udc_name="$2" + + # Type = ddns Name = global + if [ "$udc_cfg" = "$udc_pkg" -a "$udc_name" = "global" ]; then + option() { return 0; } + # rename options + $udc_uci rename $udc_pkg.$udc_name.allow_local_ip="upd_privateip" + $udc_uci rename $udc_pkg.$udc_name.date_format="ddns_dateformat" + $udc_uci rename $udc_pkg.$udc_name.log_dir="ddns_logdir" + $udc_uci rename $udc_pkg.$udc_name.log_lines="ddns_loglines" + $udc_uci rename $udc_pkg.$udc_name.run_dir="ddns_rundir" + + # Type = service Name = ??? + elif [ "$udc_cfg" = "service" ]; then + option() { + udc_var="$1"; shift + udc_val="$*" + # fix some option service_name values + case "$udc_var" in + service_name) + case "$udc_val" in + freedns\.afraid\.org|afraid\.org) + $udc_uci set $udc_pkg.$udc_name.$udc_var="afraid.org-keyauth";; + Bind-nsupdate) + $udc_uci set $udc_pkg.$udc_name.$udc_var="bind-nsupdate";; + CloudFlare|cloudflare\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="cloudflare.com-v1";; + dyndns\.org|dyndns\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="dyn.com";; + free\.editdns\.net) + $udc_uci set $udc_pkg.$udc_name.$udc_var="editdns.net";; + domains\.google\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="google.com";; + loopia\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="loopia.se";; + NoIP\.com|No-IP\.com) + $udc_uci set $udc_pkg.$udc_name.$udc_var="no-ip.com";; + spdns\.de) + $udc_uci set $udc_pkg.$udc_name.$udc_var="spdyn.de";; + strato\.de) + $udc_uci set $udc_pkg.$udc_name.$udc_var="strato.com";; + *) + # all others leave unchanged + ;; + esac + # rename option service_name to option upd_provider +# $udc_uci rename $udc_pkg.$udc_name.$udc_var="upd_provider" + ;; + *) + # leave all other options currently unchanged + ;; + esac + return 0 + } + return 0 + + # ignore unknown + else + return 0 + fi + } + + # read package config file + udc_data=$($udc_uci -S -n export "$udc_pkg") + udc_ret="$?" + # No error and udc_data then execute (eval) + # this will call functions defined above + [ "$udc_ret" -eq 0 -a -n "$udc_data" ] && eval "$udc_data" + + # add config ddns "global" (ignore error if exists) + $udc_uci set ddns.global="$udc_pkg" + + # write changes to config file + $udc_uci commit "$udc_pkg" + + unset udc_uci udc_pkg udc_cfg udc_name udc_var udc_val udc_ret udc_data + return 0 +} + +# do existing config update +update_ddns_config + +# clear Ludc_uci indexcache +rm -f /tmp/luci-indexcache >/dev/null 2>&1 + +return 0 diff --git a/net/ddns-scripts/files/ddns.hotplug b/net/ddns-scripts/files/ddns.hotplug new file mode 100755 index 0000000..9ef172d --- /dev/null +++ b/net/ddns-scripts/files/ddns.hotplug @@ -0,0 +1,11 @@ +#!/bin/sh + +# there are other ACTIONs like ifupdate we don't need +case "$ACTION" in + ifup) # OpenWrt is giving a network not phys. Interface + /etc/init.d/ddns enabled && /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- start + ;; + ifdown) + /usr/lib/ddns/dynamic_dns_updater.sh -n "$INTERFACE" -- stop + ;; +esac diff --git a/net/ddns-scripts/files/ddns.init b/net/ddns-scripts/files/ddns.init new file mode 100755 index 0000000..b2156a6 --- /dev/null +++ b/net/ddns-scripts/files/ddns.init @@ -0,0 +1,27 @@ +#!/bin/sh /etc/rc.common +START=95 +STOP=10 + +boot() { + return 0 +} + +reload() { + /usr/lib/ddns/dynamic_dns_updater.sh -- reload + return 0 +} + +restart() { + /usr/lib/ddns/dynamic_dns_updater.sh -- stop + sleep 1 # give time to shutdown + /usr/lib/ddns/dynamic_dns_updater.sh -- start +} + +start() { + /usr/lib/ddns/dynamic_dns_updater.sh -- start +} + +stop() { + /usr/lib/ddns/dynamic_dns_updater.sh -- stop + return 0 +} diff --git a/net/ddns-scripts/files/dynamic_dns_functions.sh b/net/ddns-scripts/files/dynamic_dns_functions.sh new file mode 100755 index 0000000..8d64851 --- /dev/null +++ b/net/ddns-scripts/files/dynamic_dns_functions.sh @@ -0,0 +1,1357 @@ +#!/bin/sh +# /usr/lib/ddns/dynamic_dns_functions.sh +# +#.Distributed under the terms of the GNU General Public License (GPL) version 2.0 +# Original written by Eric Paul Bishop, January 2008 +# (Loosely) based on the script on the one posted by exobyte in the forums here: +# http://forum.openwrt.org/viewtopic.php?id=14040 +# extended and partial rewritten +#.2014-2016 Christian Schoenebeck +# +# function timeout +# copied from http://www.ict.griffith.edu.au/anthony/software/timeout.sh +# @author Anthony Thyssen 6 April 2011 +# +# variables in small chars are read from /etc/config/ddns +# variables in big chars are defined inside these scripts as global vars +# variables in big chars beginning with "__" are local defined inside functions only +# set -vx #script debugger + +. /lib/functions.sh +. /lib/functions/network.sh + +# GLOBAL VARIABLES # +VERSION="2.7.6" +SECTION_ID="" # hold config's section name +VERBOSE=1 # default mode is log to console, but easily changed with parameter +MYPROG=$(basename $0) # my program call name + +LOGFILE="" # logfile - all files are set in dynamic_dns_updater.sh +PIDFILE="" # pid file +UPDFILE="" # store UPTIME of last update +DATFILE="" # save stdout data of WGet and other external programs called +ERRFILE="" # save stderr output of WGet and other external programs called +TLDFILE=/usr/share/public_suffix_list.dat.gz # TLD file used by split_FQDN + +CHECK_SECONDS=0 # calculated seconds out of given +FORCE_SECONDS=0 # interval and unit +RETRY_SECONDS=0 # in configuration + +LAST_TIME=0 # holds the uptime of last successful update +CURR_TIME=0 # holds the current uptime +NEXT_TIME=0 # calculated time for next FORCED update +EPOCH_TIME=0 # seconds since 1.1.1970 00:00:00 + +REGISTERED_IP="" # holds the IP read from DNS +LOCAL_IP="" # holds the local IP read from the box + +URL_USER="" # url encoded $username from config file +URL_PASS="" # url encoded $password from config file +URL_PENC="" # url encoded $param_enc from config file + +UPD_ANSWER="" # Answer given by service on success + +ERR_LAST=0 # used to save $? return code of program and function calls +ERR_UPDATE=0 # error counter on different local and registered ip + +PID_SLEEP=0 # ProcessID of current background "sleep" + +# regular expression to detect IPv4 / IPv6 +# IPv4 0-9 1-3x "." 0-9 1-3x "." 0-9 1-3x "." 0-9 1-3x +IPV4_REGEX="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}" +# IPv6 ( ( 0-9a-f 1-4char ":") min 1x) ( ( 0-9a-f 1-4char )optional) ( (":" 0-9a-f 1-4char ) min 1x) +IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(\(:[0-9A-Fa-f]\{1,4\}\)\{1,\}\)" + +# detect if called by ddns-lucihelper.sh script, disable retrys (empty variable == false) +LUCI_HELPER=$(printf %s "$MYPROG" | grep -i "luci") + +# Name Server Lookup Programs +BIND_HOST=$(which host) +KNOT_HOST=$(which khost) +DRILL=$(which drill) +HOSTIP=$(which hostip) +NSLOOKUP=$(which nslookup) +NSLOOKUP_MUSL=$($(which nslookup) localhost 2>&1 | grep -F "(null)") # not empty busybox compiled with musl + +# Transfer Programs +WGET=$(which wget) +WGET_SSL=$(which wget-ssl) + +CURL=$(which curl) +# CURL_SSL not empty then SSL support available +CURL_SSL=$($(which curl) -V 2>/dev/null | grep "Protocols:" | grep -F "https") +# CURL_PROXY not empty then Proxy support available +CURL_PROXY=$(find /lib /usr/lib -name libcurl.so* -exec grep -i "all_proxy" {} 2>/dev/null \;) + +UCLIENT_FETCH=$(which uclient-fetch) +# UCLIENT_FETCH_SSL not empty then SSL support available +UCLIENT_FETCH_SSL=$(find /lib /usr/lib -name libustream-ssl.so* 2>/dev/null) + +# Global configuration settings +# allow NON-public IP's +upd_privateip=$(uci -q get ddns.global.allow_local_ip) || upd_privateip=0 + +# directory to store run information to. +ddns_rundir=$(uci -q get ddns.global.run_dir) || ddns_rundir="/var/run/ddns" +[ -d $ddns_rundir ] || mkdir -p -m755 $ddns_rundir + +# directory to store log files +ddns_logdir=$(uci -q get ddns.global.log_dir) || ddns_logdir="/var/log/ddns" +[ -d $ddns_logdir ] || mkdir -p -m755 $ddns_logdir + +# number of lines to before rotate logfile +ddns_loglines=$(uci -q get ddns.global.log_lines) || ddns_loglines=250 +ddns_loglines=$((ddns_loglines + 1)) # correct sed handling + +# format to show date information in log and luci-app-ddns default ISO 8601 format +ddns_dateformat=$(uci -q get ddns.global.date_format) || ddns_dateformat="%F %R" +DATE_PROG="date +'$ddns_dateformat'" + +# USE_CURL if GNU Wget and cURL installed normally Wget is used by do_transfer() +# to change this use global option use_curl '1' +USE_CURL=$(uci -q get ddns.global.use_curl) || USE_CURL=0 # read config +[ -n "$CURL" ] || USE_CURL=0 # check for cURL + +# loads all options for a given package and section +# also, sets all_option_variables to a list of the variable names +# $1 = ddns, $2 = SECTION_ID +load_all_config_options() +{ + local __PKGNAME="$1" + local __SECTIONID="$2" + local __VAR + local __ALL_OPTION_VARIABLES="" + + # this callback loads all the variables in the __SECTIONID section when we do + # config_load. We need to redefine the option_cb for different sections + # so that the active one isn't still active after we're done with it. For reference + # the $1 variable is the name of the option and $2 is the name of the section + config_cb() + { + if [ ."$2" = ."$__SECTIONID" ]; then + option_cb() + { + __ALL_OPTION_VARIABLES="$__ALL_OPTION_VARIABLES $1" + } + else + option_cb() { return 0; } + fi + } + + config_load "$__PKGNAME" + + # Given SECTION_ID not found so no data, so return 1 + [ -z "$__ALL_OPTION_VARIABLES" ] && return 1 + + for __VAR in $__ALL_OPTION_VARIABLES + do + config_get "$__VAR" "$__SECTIONID" "$__VAR" + done + return 0 +} + +# read's all service sections from ddns config +# $1 = Name of variable to store +load_all_service_sections() { + local __DATA="" + config_cb() + { + # only look for section type "service", ignore everything else + [ "$1" = "service" ] && __DATA="$__DATA $2" + } + config_load "ddns" + + eval "$1=\"$__DATA\"" + return +} + +# starts updater script for all given sections or only for the one given +# $1 = interface (Optional: when given only scripts are started +# configured for that interface) +# used by /etc/hotplug.d/iface/95-ddns on IFUP +# and by /etc/init.d/ddns start +start_daemon_for_all_ddns_sections() +{ + local __EVENTIF="$1" + local __SECTIONS="" + local __SECTIONID="" + local __IFACE="" + + load_all_service_sections __SECTIONS + for __SECTIONID in $__SECTIONS; do + config_get __IFACE "$__SECTIONID" interface "wan" + [ -z "$__EVENTIF" -o "$__IFACE" = "$__EVENTIF" ] || continue + if [ $VERBOSE -eq 0 ]; then # start in background + /usr/lib/ddns/dynamic_dns_updater.sh -v 0 -S "$__SECTIONID" -- start & + else + /usr/lib/ddns/dynamic_dns_updater.sh -v "$VERBOSE" -S "$__SECTIONID" -- start + fi + done +} + +# stop sections process incl. childs (sleeps) +# $1 = section +stop_section_processes() { + local __PID=0 + local __PIDFILE="$ddns_rundir/$1.pid" + [ $# -ne 1 ] && write_log 12 "Error calling 'stop_section_processes()' - wrong number of parameters" + + [ -e "$__PIDFILE" ] && { + __PID=$(cat $__PIDFILE) + ps | grep "^[\t ]*$__PID" >/dev/null 2>&1 && kill $__PID || __PID=0 # terminate it + } + [ $__PID -eq 0 ] # report if process was running +} + +# stop updater script for all defines sections or only for one given +# $1 = interface (optional) +# used by /etc/hotplug.d/iface/95-ddns on 'ifdown' +# and by /etc/init.d/ddns stop +# needed because we also need to kill "sleep" child processes +stop_daemon_for_all_ddns_sections() { + local __EVENTIF="$1" + local __SECTIONS="" + local __SECTIONID="" + local __IFACE="" + + load_all_service_sections __SECTIONS + for __SECTIONID in $__SECTIONS; do + config_get __IFACE "$__SECTIONID" interface "wan" + [ -z "$__EVENTIF" -o "$__IFACE" = "$__EVENTIF" ] || continue + stop_section_processes "$__SECTIONID" + done +} + +# reports to console, logfile, syslog +# $1 loglevel 7 == Debug to 0 == EMERG +# value +10 will exit the scripts +# $2..n text to report +write_log() { + local __LEVEL __EXIT __CMD __MSG + local __TIME=$(date +%H%M%S) + [ $1 -ge 10 ] && { + __LEVEL=$(($1-10)) + __EXIT=1 + } || { + __LEVEL=$1 + __EXIT=0 + } + shift # remove loglevel + [ $__EXIT -eq 0 ] && __MSG="$*" || __MSG="$* - TERMINATE" + case $__LEVEL in # create log message and command depending on loglevel + 0) __CMD="logger -p user.emerg -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME EMERG : $__MSG" ;; + 1) __CMD="logger -p user.alert -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME ALERT : $__MSG" ;; + 2) __CMD="logger -p user.crit -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME CRIT : $__MSG" ;; + 3) __CMD="logger -p user.err -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME ERROR : $__MSG" ;; + 4) __CMD="logger -p user.warn -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME WARN : $__MSG" ;; + 5) __CMD="logger -p user.notice -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME note : $__MSG" ;; + 6) __CMD="logger -p user.info -t ddns-scripts[$$] $SECTION_ID: $__MSG" + __MSG=" $__TIME info : $__MSG" ;; + 7) __MSG=" $__TIME : $__MSG";; + *) return;; + esac + + # verbose echo + [ $VERBOSE -gt 0 -o $__EXIT -gt 0 ] && echo -e "$__MSG" + # write to logfile + if [ ${use_logfile:-1} -eq 1 -o $VERBOSE -gt 1 ]; then + echo -e "$__MSG" >> $LOGFILE + # VERBOSE > 1 then NO loop so NO truncate log to $ddns_loglines lines + [ $VERBOSE -gt 1 ] || sed -i -e :a -e '$q;N;'$ddns_loglines',$D;ba' $LOGFILE + fi + [ -n "$LUCI_HELPER" ] && return # nothing else todo when running LuCI helper script + [ $__LEVEL -eq 7 ] && return # no syslog for debug messages + __CMD=$(echo -e "$__CMD" | tr -d '\n' | tr '\t' ' ') # remove \n \t chars + [ $__EXIT -eq 1 ] && { + $__CMD # force syslog before exit + exit 1 + } + [ $use_syslog -eq 0 ] && return + [ $((use_syslog + __LEVEL)) -le 7 ] && $__CMD + + return +} + +# replace all special chars to their %hex value +# used for USERNAME and PASSWORD in update_url +# unchanged: "-"(minus) "_"(underscore) "."(dot) "~"(tilde) +# to verify: "'"(single quote) '"'(double quote) # because shell delimiter +# "$"(Dollar) # because used as variable output +# tested with the following string stored via Luci Application as password / username +# A B!"#AA$1BB%&'()*+,-./:;<=>?@[\]^_`{|}~ without problems at Dollar or quotes +urlencode() { + # $1 Name of Variable to store encoded string to + # $2 string to encode + local __STR __LEN __CHAR __OUT + local __ENC="" + local __POS=1 + + [ $# -ne 2 ] && write_log 12 "Error calling 'urlencode()' - wrong number of parameters" + + __STR="$2" # read string to encode + __LEN=${#__STR} # get string length + + while [ $__POS -le $__LEN ]; do + # read one chat of the string + __CHAR=$(expr substr "$__STR" $__POS 1) + + case "$__CHAR" in + [-_.~a-zA-Z0-9] ) + # standard char + __OUT="${__CHAR}" + ;; + * ) + # special char get %hex code + __OUT=$(printf '%%%02x' "'$__CHAR" ) + ;; + esac + __ENC="${__ENC}${__OUT}" # append to encoded string + __POS=$(( $__POS + 1 )) # increment position + done + + eval "$1=\"$__ENC\"" # transfer back to variable + return 0 +} + +# extract url or script for given DDNS Provider from +# file /etc/ddns/services for IPv4 or from +# file /etc/ddns/services_ipv6 for IPv6 +# $1 Name of Variable to store url to +# $2 Name of Variable to store script to +# $3 Name of Variable to store service answer to +get_service_data() { + [ $# -ne 3 ] && write_log 12 "Error calling 'get_service_data()' - wrong number of parameters" + + __FILE="/etc/ddns/services" # IPv4 + [ $use_ipv6 -ne 0 ] && __FILE="/etc/ddns/services_ipv6" # IPv6 + + # workaround with variables; pipe create subshell with no give back of variable content + mkfifo pipe_$$ + # only grep without # or whitespace at linestart | remove " +# grep -v -E "(^#|^[[:space:]]*$)" $__FILE | sed -e s/\"//g > pipe_$$ & + sed '/^#/d; /^[ \t]*$/d; s/\"//g' $__FILE > pipe_$$ & + + while read __SERVICE __DATA __ANSWER; do + if [ "$__SERVICE" = "$service_name" ]; then + # check if URL or SCRIPT is given + __URL=$(echo "$__DATA" | grep "^http") + [ -z "$__URL" ] && __SCRIPT="/usr/lib/ddns/$__DATA" + + eval "$1=\"$__URL\"" + eval "$2=\"$__SCRIPT\"" + eval "$3=\"$__ANSWER\"" + rm pipe_$$ + return 0 + fi + done < pipe_$$ + rm pipe_$$ + + eval "$1=\"\"" # no service match clear variables + eval "$2=\"\"" + eval "$3=\"\"" + return 1 +} + +# Calculate seconds from interval and unit +# $1 Name of Variable to store result in +# $2 Number and +# $3 Unit of time interval +get_seconds() { + [ $# -ne 3 ] && write_log 12 "Error calling 'get_seconds()' - wrong number of parameters" + case "$3" in + "days" ) eval "$1=$(( $2 * 86400 ))";; + "hours" ) eval "$1=$(( $2 * 3600 ))";; + "minutes" ) eval "$1=$(( $2 * 60 ))";; + * ) eval "$1=$2";; + esac + return 0 +} + +timeout() { + #.copied from http://www.ict.griffith.edu.au/anthony/software/timeout.sh + # only did the following changes + # - commented out "#!/bin/bash" and usage section + # - replace exit by return for usage as function + # - some reformatting + # + # timeout [-SIG] time [--] command args... + # + # Run the given command until completion, but kill it if it runs too long. + # Specifically designed to exit immediately (no sleep interval) and clean up + # nicely without messages or leaving any extra processes when finished. + # + # Example use + # timeout 5 countdown + # + # Based on notes in my "Shell Script Hints", section "Command Timeout" + # http://www.ict.griffith.edu.au/~anthony/info/shell/script.hints + # + # This script uses a lot of tricks to terminate both the background command, + # the timeout script, and even the sleep process. It also includes trap + # commands to prevent sub-shells reporting expected "Termination Errors". + # + # It took years of occasional trials, errors and testing to get a pure bash + # timeout command working as well as this does. + # + #.Anthony Thyssen 6 April 2011 + # +# PROGNAME=$(type $0 | awk '{print $3}') # search for executable on path +# PROGDIR=$(dirname $PROGNAME) # extract directory of program +# PROGNAME=$(basename $PROGNAME) # base name of program + + # output the script comments as docs +# Usage() { +# echo >&2 "$PROGNAME:" "$@" +# sed >&2 -n '/^###/q; /^#/!q; s/^#//; s/^ //; 3s/^/Usage: /; 2,$ p' "$PROGDIR/$PROGNAME" +# exit 10; +# } + + SIG=-TERM + + while [ $# -gt 0 ]; do + case "$1" in + --) + # forced end of user options + shift; + break ;; +# -\?|--help|--doc*) +# Usage ;; + [0-9]*) + TIMEOUT="$1" ;; + -*) + SIG="$1" ;; + *) + # unforced end of user options + break ;; + esac + shift # next option + done + + # run main command in backgrounds and get its pid + "$@" & + command_pid=$! + + # timeout sub-process abort countdown after ABORT seconds! also backgrounded + sleep_pid=0 + ( + # cleanup sleep process + trap 'kill -TERM $sleep_pid; return 1' 1 2 3 15 + # sleep timeout period in background + sleep $TIMEOUT & + sleep_pid=$! + wait $sleep_pid + # Abort the command + kill $SIG $command_pid >/dev/null 2>&1 + return 1 + ) & + timeout_pid=$! + + # Wait for main command to finished or be timed out + wait $command_pid + status=$? + + # Clean up timeout sub-shell - if it is still running! + kill $timeout_pid 2>/dev/null + wait $timeout_pid 2>/dev/null + + # Uncomment to check if a LONG sleep still running (no sleep should be) + # sleep 1 + # echo "-----------" + # /bin/ps j # uncomment to show if abort "sleep" is still sleeping + + return $status +} + +# verify given host and port is connectable +# $1 Host/IP to verify +# $2 Port to verify +verify_host_port() { + local __HOST=$1 + local __PORT=$2 + local __NC=$(which nc) + local __NCEXT=$($(which nc) --help 2>&1 | grep "\-w" 2>/dev/null) # busybox nc compiled with extensions + local __IP __IPV4 __IPV6 __RUNPROG __PROG __ERR + # return codes + # 1 system specific error + # 2 nslookup/host error + # 3 nc (netcat) error + # 4 unmatched IP version + + [ $# -ne 2 ] && write_log 12 "Error calling 'verify_host_port()' - wrong number of parameters" + + # check if ip or FQDN was given + __IPV4=$(echo $__HOST | grep -m 1 -o "$IPV4_REGEX$") # do not detect ip in 0.0.0.0.example.com + __IPV6=$(echo $__HOST | grep -m 1 -o "$IPV6_REGEX") + # if FQDN given get IP address + [ -z "$__IPV4" -a -z "$__IPV6" ] && { + if [ -n "$BIND_HOST" ]; then # use BIND host if installed + __PROG="BIND host" + __RUNPROG="$BIND_HOST $__HOST >$DATFILE 2>$ERRFILE" + elif [ -n "$KNOT_HOST" ]; then # use Knot host if installed + __PROG="Knot host" + __RUNPROG="$KNOT_HOST $__HOST >$DATFILE 2>$ERRFILE" + elif [ -n "$DRILL" ]; then # use drill if installed + __PROG="drill" + __RUNPROG="$DRILL -V0 $__HOST A >$DATFILE 2>$ERRFILE" # IPv4 + __RUNPROG="$__RUNPROG; $DRILL -V0 $__HOST AAAA >>$DATFILE 2>>$ERRFILE" # IPv6 + elif [ -n "$HOSTIP" ]; then # use hostip if installed + __PROG="hostip" + __RUNPROG="$HOSTIP $__HOST >$DATFILE 2>$ERRFILE" # IPv4 + __RUNPROG="$__RUNPROG; $HOSTIP -6 $__HOST >>$DATFILE 2>>$ERRFILE" # IPv6 + else # use BusyBox nslookup + __PROG="BusyBox nslookup" + __RUNPROG="$NSLOOKUP $__HOST >$DATFILE 2>$ERRFILE" + fi + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + # command error + [ $__ERR -gt 0 ] && { + write_log 3 "DNS Resolver Error - $__PROG Error '$__ERR'" + write_log 7 "$(cat $ERRFILE)" + return 2 + } + # extract IP address + if [ -n "$BIND_HOST" -o -n "$KNOT_HOST" ]; then # use BIND host or Knot host if installed + __IPV4=$(cat $DATFILE | awk -F "address " '/has address/ {print $2; exit}' ) + __IPV6=$(cat $DATFILE | awk -F "address " '/has IPv6/ {print $2; exit}' ) + elif [ -n "$DRILL" ]; then # use drill if installed + __IPV4=$(cat $DATFILE | awk '/^'"$lookup_host"'/ {print $5}' | grep -m 1 -o "$IPV4_REGEX") + __IPV6=$(cat $DATFILE | awk '/^'"$lookup_host"'/ {print $5}' | grep -m 1 -o "$IPV6_REGEX") + elif [ -n "$HOSTIP" ]; then # use hostip if installed + __IPV4=$(cat $DATFILE | grep -m 1 -o "$IPV4_REGEX") + __IPV6=$(cat $DATFILE | grep -m 1 -o "$IPV6_REGEX") + else # use BusyBox nslookup + __IPV4=$(cat $DATFILE | sed -ne "/^Name:/,\$ { s/^Address[0-9 ]\{0,\}: \($IPV4_REGEX\).*$/\\1/p }") + __IPV6=$(cat $DATFILE | sed -ne "/^Name:/,\$ { s/^Address[0-9 ]\{0,\}: \($IPV6_REGEX\).*$/\\1/p }") + fi + } + + # check IP version if forced + if [ $force_ipversion -ne 0 ]; then + __ERR=0 + [ $use_ipv6 -eq 0 -a -z "$__IPV4" ] && __ERR=4 + [ $use_ipv6 -eq 1 -a -z "$__IPV6" ] && __ERR=6 + [ $__ERR -gt 0 ] && { + [ -n "$LUCI_HELPER" ] && return 4 + write_log 14 "Verify host Error '4' - Forced IP Version IPv$__ERR don't match" + } + fi + + # verify nc command + # busybox nc compiled without -l option "NO OPT l!" -> critical error + $__NC --help 2>&1 | grep -i "NO OPT l!" >/dev/null 2>&1 && \ + write_log 12 "Busybox nc (netcat) compiled without '-l' option, error 'NO OPT l!'" + # busybox nc compiled with extensions + $__NC --help 2>&1 | grep "\-w" >/dev/null 2>&1 && __NCEXT="TRUE" + + # connectivity test + # run busybox nc to HOST PORT + # busybox might be compiled with "FEATURE_PREFER_IPV4_ADDRESS=n" + # then nc will try to connect via IPv6 if there is any IPv6 available on any host interface + # not worrying, if there is an IPv6 wan address + # so if not "force_ipversion" to use_ipv6 then connect test via ipv4, if available + [ $force_ipversion -ne 0 -a $use_ipv6 -ne 0 -o -z "$__IPV4" ] && __IP=$__IPV6 || __IP=$__IPV4 + + if [ -n "$__NCEXT" ]; then # BusyBox nc compiled with extensions (timeout support) + __RUNPROG="$__NC -w 1 $__IP $__PORT $DATFILE 2>$ERRFILE" + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + [ $__ERR -eq 0 ] && return 0 + write_log 3 "Connect error - BusyBox nc (netcat) Error '$__ERR'" + write_log 7 "$(cat $ERRFILE)" + return 3 + else # nc compiled without extensions (no timeout support) + __RUNPROG="timeout 2 -- $__NC $__IP $__PORT $DATFILE 2>$ERRFILE" + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + [ $__ERR -eq 0 ] && return 0 + write_log 3 "Connect error - BusyBox nc (netcat) timeout Error '$__ERR'" + return 3 + fi +} + +# verify given DNS server if connectable +# $1 DNS server to verify +verify_dns() { + local __ERR=255 # last error buffer + local __CNT=0 # error counter + + [ $# -ne 1 ] && write_log 12 "Error calling 'verify_dns()' - wrong number of parameters" + write_log 7 "Verify DNS server '$1'" + + while [ $__ERR -ne 0 ]; do + # DNS uses port 53 + verify_host_port "$1" "53" + __ERR=$? + if [ -n "$LUCI_HELPER" ]; then # no retry if called by LuCI helper script + return $__ERR + elif [ $__ERR -ne 0 -a $VERBOSE -gt 1 ]; then # VERBOSE > 1 then NO retry + write_log 4 "Verify DNS server '$1' failed - Verbose Mode: $VERBOSE - NO retry on error" + return $__ERR + elif [ $__ERR -ne 0 ]; then + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Verify DNS server '$1' failed after $retry_count retries" + + write_log 4 "Verify DNS server '$1' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + fi + done + return 0 +} + +# analyze and verify given proxy string +# $1 Proxy-String to verify +verify_proxy() { + # complete entry user:password@host:port + # inside user and password NO '@' of ":" allowed + # host and port only host:port + # host only host ERROR unsupported + # IPv4 address instead of host 123.234.234.123 + # IPv6 address instead of host [xxxx:....:xxxx] in square bracket + local __TMP __HOST __PORT + local __ERR=255 # last error buffer + local __CNT=0 # error counter + + [ $# -ne 1 ] && write_log 12 "Error calling 'verify_proxy()' - wrong number of parameters" + write_log 7 "Verify Proxy server 'http://$1'" + + # try to split user:password "@" host:port + __TMP=$(echo $1 | awk -F "@" '{print $2}') + # no "@" found - only host:port is given + [ -z "$__TMP" ] && __TMP="$1" + # now lets check for IPv6 address + __HOST=$(echo $__TMP | grep -m 1 -o "$IPV6_REGEX") + # IPv6 host address found read port + if [ -n "$__HOST" ]; then + # IPv6 split at "]:" + __PORT=$(echo $__TMP | awk -F "]:" '{print $2}') + else + __HOST=$(echo $__TMP | awk -F ":" '{print $1}') + __PORT=$(echo $__TMP | awk -F ":" '{print $2}') + fi + # No Port detected - EXITING + [ -z "$__PORT" ] && { + [ -n "$LUCI_HELPER" ] && return 5 + write_log 14 "Invalid Proxy server Error '5' - proxy port missing" + } + + while [ $__ERR -gt 0 ]; do + verify_host_port "$__HOST" "$__PORT" + __ERR=$? + if [ -n "$LUCI_HELPER" ]; then # no retry if called by LuCI helper script + return $__ERR + elif [ $__ERR -gt 0 -a $VERBOSE -gt 1 ]; then # VERBOSE > 1 then NO retry + write_log 4 "Verify Proxy server '$1' failed - Verbose Mode: $VERBOSE - NO retry on error" + return $__ERR + elif [ $__ERR -gt 0 ]; then + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Verify Proxy server '$1' failed after $retry_count retries" + + write_log 4 "Verify Proxy server '$1' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + fi + done + return 0 +} + +do_transfer() { + # $1 # URL to use + local __URL="$1" + local __ERR=0 + local __CNT=0 # error counter + local __PROG __RUNPROG + + [ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters" + + # lets prefer GNU Wget because it does all for us - IPv4/IPv6/HTTPS/PROXY/force IP version + if [ -n "$WGET_SSL" -a $USE_CURL -eq 0 ]; then # except global option use_curl is set to "1" + __PROG="$WGET_SSL -nv -t 1 -O $DATFILE -o $ERRFILE" # non_verbose no_retry outfile errfile + # force network/ip to use for communication + if [ -n "$bind_network" ]; then + local __BINDIP + # set correct program to detect IP + [ $use_ipv6 -eq 0 ] && __RUNPROG="network_get_ipaddr" || __RUNPROG="network_get_ipaddr6" + eval "$__RUNPROG __BINDIP $bind_network" || \ + write_log 13 "Can not detect local IP using '$__RUNPROG $bind_network' - Error: '$?'" + write_log 7 "Force communication via IP '$__BINDIP'" + __PROG="$__PROG --bind-address=$__BINDIP" + fi + # force ip version to use + if [ $force_ipversion -eq 1 ]; then + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6 + fi + # set certificate parameters + if [ $use_https -eq 1 ]; then + if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert + __PROG="$__PROG --no-check-certificate" + elif [ -f "$cacert" ]; then + __PROG="$__PROG --ca-certificate=${cacert}" + elif [ -d "$cacert" ]; then + __PROG="$__PROG --ca-directory=${cacert}" + elif [ -n "$cacert" ]; then # it's not a file and not a directory but given + write_log 14 "No valid certificate(s) found at '$cacert' for HTTPS communication" + fi + fi + # disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set) + [ -z "$proxy" ] && __PROG="$__PROG --no-proxy" + + __RUNPROG="$__PROG '$__URL'" # build final command + __PROG="GNU Wget" # reuse for error logging + + # 2nd choice is cURL IPv4/IPv6/HTTPS + # libcurl might be compiled without Proxy or HTTPS Support + elif [ -n "$CURL" ]; then + __PROG="$CURL -RsS -o $DATFILE --stderr $ERRFILE" + # check HTTPS support + [ -z "$CURL_SSL" -a $use_https -eq 1 ] && \ + write_log 13 "cURL: libcurl compiled without https support" + # force network/interface-device to use for communication + if [ -n "$bind_network" ]; then + local __DEVICE + network_get_physdev __DEVICE $bind_network || \ + write_log 13 "Can not detect local device using 'network_get_physdev $bind_network' - Error: '$?'" + write_log 7 "Force communication via device '$__DEVICE'" + __PROG="$__PROG --interface $__DEVICE" + fi + # force ip version to use + if [ $force_ipversion -eq 1 ]; then + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6 + fi + # set certificate parameters + if [ $use_https -eq 1 ]; then + if [ "$cacert" = "IGNORE" ]; then # idea from Ticket #15327 to ignore server cert + __PROG="$__PROG --insecure" # but not empty better to use "IGNORE" + elif [ -f "$cacert" ]; then + __PROG="$__PROG --cacert $cacert" + elif [ -d "$cacert" ]; then + __PROG="$__PROG --capath $cacert" + elif [ -n "$cacert" ]; then # it's not a file and not a directory but given + write_log 14 "No valid certificate(s) found at '$cacert' for HTTPS communication" + fi + fi + # disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set) + # or check if libcurl compiled with proxy support + if [ -z "$proxy" ]; then + __PROG="$__PROG --noproxy '*'" + elif [ -z "$CURL_PROXY" ]; then + # if libcurl has no proxy support and proxy should be used then force ERROR + write_log 13 "cURL: libcurl compiled without Proxy support" + fi + + __RUNPROG="$__PROG '$__URL'" # build final command + __PROG="cURL" # reuse for error logging + + # uclient-fetch possibly with ssl support if /lib/libustream-ssl.so installed + elif [ -n "$UCLIENT_FETCH" ]; then + __PROG="$UCLIENT_FETCH -q -O $DATFILE" + # force network/ip not supported + [ -n "$__BINDIP" ] && \ + write_log 14 "uclient-fetch: FORCE binding to specific address not supported" + # force ip version to use + if [ $force_ipversion -eq 1 ]; then + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" # force IPv4/IPv6 + fi + # https possibly not supported + [ $use_https -eq 1 -a -z "$UCLIENT_FETCH_SSL" ] && \ + write_log 14 "uclient-fetch: no HTTPS support! Additional install one of ustream-ssl packages" + # proxy support + [ -z "$proxy" ] && __PROG="$__PROG -Y off" || __PROG="$__PROG -Y on" + # https & certificates + if [ $use_https -eq 1 ]; then + if [ "$cacert" = "IGNORE" ]; then + __PROG="$__PROG --no-check-certificate" + elif [ -f "$cacert" ]; then + __PROG="$__PROG --ca-certificate=$cacert" + elif [ -n "$cacert" ]; then # it's not a file; nothing else supported + write_log 14 "No valid certificate file '$cacert' for HTTPS communication" + fi + fi + __RUNPROG="$__PROG '$__URL' 2>$ERRFILE" # build final command + __PROG="uclient-fetch" # reuse for error logging + + # Busybox Wget or any other wget in search $PATH (did not support neither IPv6 nor HTTPS) + elif [ -n "$WGET" ]; then + __PROG="$WGET -q -O $DATFILE" + # force network/ip not supported + [ -n "$__BINDIP" ] && \ + write_log 14 "BusyBox Wget: FORCE binding to specific address not supported" + # force ip version not supported + [ $force_ipversion -eq 1 ] && \ + write_log 14 "BusyBox Wget: Force connecting to IPv4 or IPv6 addresses not supported" + # https not supported + [ $use_https -eq 1 ] && \ + write_log 14 "BusyBox Wget: no HTTPS support" + # disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set) + [ -z "$proxy" ] && __PROG="$__PROG -Y off" + + __RUNPROG="$__PROG '$__URL' 2>$ERRFILE" # build final command + __PROG="Busybox Wget" # reuse for error logging + + else + write_log 13 "Neither 'Wget' nor 'cURL' nor 'uclient-fetch' installed or executable" + fi + + while : ; do + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG # DO transfer + __ERR=$? # save error code + [ $__ERR -eq 0 ] && return 0 # no error leave + [ -n "$LUCI_HELPER" ] && return 1 # no retry if called by LuCI helper script + + write_log 3 "$__PROG Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + + [ $VERBOSE -gt 1 ] && { + # VERBOSE > 1 then NO retry + write_log 4 "Transfer failed - Verbose Mode: $VERBOSE - NO retry on error" + return 1 + } + + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Transfer failed after $retry_count retries" + + write_log 4 "Transfer failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + done + # we should never come here there must be a programming error + write_log 12 "Error in 'do_transfer()' - program coding error" +} + +send_update() { + # $1 # IP to set at DDNS service provider + local __IP + + [ $# -ne 1 ] && write_log 12 "Error calling 'send_update()' - wrong number of parameters" + + if [ $upd_privateip -eq 0 ]; then + # verify given IP / no private IPv4's / no IPv6 addr starting with fxxx of with ":" + [ $use_ipv6 -eq 0 ] && __IP=$(echo $1 | grep -v -E "(^0|^10\.|^100\.6[4-9]\.|^100\.[7-9][0-9]\.|^100\.1[0-1][0-9]\.|^100\.12[0-7]\.|^127|^169\.254|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168)") + [ $use_ipv6 -eq 1 ] && __IP=$(echo $1 | grep "^[0-9a-eA-E]") + else + __IP=$(echo $1 | grep -m 1 -o "$IPV4_REGEX") # valid IPv4 or + [ -z "$__IP" ] && __IP=$(echo $1 | grep -m 1 -o "$IPV6_REGEX") # IPv6 + fi + [ -z "$__IP" ] && { + write_log 3 "No or private or invalid IP '$1' given! Please check your configuration" + return 127 + } + + if [ -n "$update_script" ]; then + write_log 7 "parsing script '$update_script'" + . $update_script + else + local __URL __ERR + + # do replaces in URL + __URL=$(echo $update_url | sed -e "s#\[USERNAME\]#$URL_USER#g" -e "s#\[PASSWORD\]#$URL_PASS#g" \ + -e "s#\[PARAMENC\]#$URL_PENC#g" -e "s#\[PARAMOPT\]#$param_opt#g" \ + -e "s#\[DOMAIN\]#$domain#g" -e "s#\[IP\]#$__IP#g") + [ $use_https -ne 0 ] && __URL=$(echo $__URL | sed -e 's#^http:#https:#') + + do_transfer "$__URL" || return 1 + + write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)" + + [ -z "$UPD_ANSWER" ] && return 0 # not set then ignore + + grep -i -E "$UPD_ANSWER" $DATFILE >/dev/null 2>&1 + return $? # "0" if found + fi +} + +get_local_ip () { + # $1 Name of Variable to store local IP (LOCAL_IP) + local __CNT=0 # error counter + local __RUNPROG __DATA __URL __ERR + + [ $# -ne 1 ] && write_log 12 "Error calling 'get_local_ip()' - wrong number of parameters" + write_log 7 "Detect local IP on '$ip_source'" + + while : ; do + if [ -n "$ip_network" ]; then + # set correct program + [ $use_ipv6 -eq 0 ] && __RUNPROG="network_get_ipaddr" \ + || __RUNPROG="network_get_ipaddr6" + eval "$__RUNPROG __DATA $ip_network" || \ + write_log 13 "Can not detect local IP using $__RUNPROG '$ip_network' - Error: '$?'" + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected on network '$ip_network'" + elif [ -n "$ip_interface" ]; then + local __DATA4=""; local __DATA6="" + if [ -n "$(which ip)" ]; then # ip program installed + write_log 7 "#> ip -o addr show dev $ip_interface scope global >$DATFILE 2>$ERRFILE" + ip -o addr show dev $ip_interface scope global >$DATFILE 2>$ERRFILE + __ERR=$? + if [ $__ERR -eq 0 ]; then + # DATFILE (sample) + # 5: eth1: mtu 1500 qdisc fq_codel state UP qlen 1000\ link/ether 08:00:27:d0:10:32 brd ff:ff:ff:ff:ff:ff + # 5: eth1 inet 172.27.10.128/24 brd 172.27.10.255 scope global eth1\ valid_lft forever preferred_lft forever + # 5: eth1 inet 172.55.55.155/24 brd 172.27.10.255 scope global eth1\ valid_lft 12345sec preferred_lft 12345sec + # 5: eth1 inet6 2002:b0c7:f326::806b:c629:b8b9:433/128 scope global dynamic \ valid_lft 8026sec preferred_lft 8026sec + # 5: eth1 inet6 fd43:5368:6f6d:6500:806b:c629:b8b9:433/128 scope global dynamic \ valid_lft 8026sec preferred_lft 8026sec + # 5: eth1 inet6 fd43:5368:6f6d:6500:a00:27ff:fed0:1032/64 scope global dynamic \ valid_lft 14352sec preferred_lft 14352sec + # 5: eth1 inet6 2002:b0c7:f326::a00:27ff:fed0:1032/64 scope global dynamic \ valid_lft 14352sec preferred_lft 14352sec + + # remove remove remove replace remove remove + # BROADCAST inet6 fxxx sec forever=>-1 between / and pref.. linestart to inet + sed -i "/BROADCAST/d; /inet6 f/d; s/sec//g; s/forever/-1/g; s/\/.*preferred_lft//g; s/^.*$ip_interface *//g" $DATFILE + + local __TIME4=0; local __TIME6=0 + local __TYP __ADR __TIME + while read __TYP __ADR __TIME; do + __TIME=${__TIME:-0} # supress shell errors on last (empty) line of DATFILE + # IPversion no "-1" record stored - now "-1" record or new time > oldtime + [ "$__TYP" = "inet6" -a $__TIME6 -ge 0 -a \( $__TIME -lt 0 -o $__TIME -gt $__TIME6 \) ] && { + __DATA6="$__ADR" + __TIME6="$__TIME" + } + [ "$__TYP" = "inet" -a $__TIME4 -ge 0 -a \( $__TIME -lt 0 -o $__TIME -gt $__TIME4 \) ] && { + __DATA4="$__ADR" + __TIME4="$__TIME" + } + done < $DATFILE + else + write_log 3 "ip Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + fi + else # use deprecated ifconfig + write_log 7 "#> ifconfig $ip_interface >$DATFILE 2>$ERRFILE" + ifconfig $ip_interface >$DATFILE 2>$ERRFILE + __ERR=$? + if [ $__ERR -eq 0 ]; then + __DATA4=$(awk ' + /inet addr:/ { # Filter IPv4 + # inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 + $1=""; # remove inet + $3=""; # remove Bcast: ... + $4=""; # remove Mask: ... + FS=":"; # separator ":" + $0=$0; # reread to activate separator + $1=""; # remove addr + FS=" "; # set back separator to default " " + $0=$0; # reread to activate separator (remove whitespaces) + print $1; # print IPv4 addr + }' $DATFILE + ) + __DATA6=$(awk ' + /inet6/ && /: [0-9a-eA-E]/ { # Filter IPv6 exclude fxxx + # inet6 addr: 2001:db8::xxxx:xxxx/32 Scope:Global + FS="/"; # separator "/" + $0=$0; # reread to activate separator + $2=""; # remove everything behind "/" + FS=" "; # set back separator to default " " + $0=$0; # reread to activate separator + print $3; # print IPv6 addr + }' $DATFILE + ) + else + write_log 3 "ifconfig Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + fi + fi + [ $use_ipv6 -eq 0 ] && __DATA="$__DATA4" || __DATA="$__DATA6" + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected on interface '$ip_interface'" + elif [ -n "$ip_script" ]; then + write_log 7 "#> $ip_script >$DATFILE 2>$ERRFILE" + eval $ip_script >$DATFILE 2>$ERRFILE + __ERR=$? + if [ $__ERR -eq 0 ]; then + __DATA=$(cat $DATFILE) + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected via script '$ip_script'" + else + write_log 3 "$ip_script Error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" # report error + fi + elif [ -n "$ip_url" ]; then + do_transfer "$ip_url" + # use correct regular expression + [ $use_ipv6 -eq 0 ] \ + && __DATA=$(grep -m 1 -o "$IPV4_REGEX" $DATFILE) \ + || __DATA=$(grep -m 1 -o "$IPV6_REGEX" $DATFILE) + [ -n "$__DATA" ] && write_log 7 "Local IP '$__DATA' detected on web at '$ip_url'" + else + write_log 12 "Error in 'get_local_ip()' - unhandled ip_source '$ip_source'" + fi + # valid data found return here + [ -n "$__DATA" ] && { + eval "$1=\"$__DATA\"" + return 0 + } + + [ -n "$LUCI_HELPER" ] && return 1 # no retry if called by LuCI helper script + + write_log 7 "Data detected:" + write_log 7 "$(cat $DATFILE)" + + [ $VERBOSE -gt 1 ] && { + # VERBOSE > 1 then NO retry + write_log 4 "Get local IP via '$ip_source' failed - Verbose Mode: $VERBOSE - NO retry on error" + return 1 + } + + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Get local IP via '$ip_source' failed after $retry_count retries" + write_log 4 "Get local IP via '$ip_source' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + done + # we should never come here there must be a programming error + write_log 12 "Error in 'get_local_ip()' - program coding error" +} + +get_registered_ip() { + # $1 Name of Variable to store public IP (REGISTERED_IP) + # $2 (optional) if set, do not retry on error + local __CNT=0 # error counter + local __ERR=255 + local __REGEX __PROG __RUNPROG __DATA __IP + # return codes + # 1 no IP detected + + [ $# -lt 1 -o $# -gt 2 ] && write_log 12 "Error calling 'get_registered_ip()' - wrong number of parameters" + [ $is_glue -eq 1 -a -z "$BIND_HOST" ] && write_log 14 "Lookup of glue records is only supported using BIND host" + write_log 7 "Detect registered/public IP" + + # set correct regular expression + [ $use_ipv6 -eq 0 ] && __REGEX="$IPV4_REGEX" || __REGEX="$IPV6_REGEX" + + if [ -n "$BIND_HOST" ]; then + __PROG="$BIND_HOST" + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -t A" || __PROG="$__PROG -t AAAA" + if [ $force_ipversion -eq 1 ]; then # force IP version + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" + fi + [ $force_dnstcp -eq 1 ] && __PROG="$__PROG -T" # force TCP + [ $is_glue -eq 1 ] && __PROG="$__PROG -v" # use verbose output to get additional section + + __RUNPROG="$__PROG $lookup_host $dns_server >$DATFILE 2>$ERRFILE" + __PROG="BIND host" + elif [ -n "$KNOT_HOST" ]; then + __PROG="$KNOT_HOST" + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -t A" || __PROG="$__PROG -t AAAA" + if [ $force_ipversion -eq 1 ]; then # force IP version + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" + fi + [ $force_dnstcp -eq 1 ] && __PROG="$__PROG -T" # force TCP + + __RUNPROG="$__PROG $lookup_host $dns_server >$DATFILE 2>$ERRFILE" + __PROG="Knot host" + elif [ -n "$DRILL" ]; then + __PROG="$DRILL -V0" # drill options name @server type + if [ $force_ipversion -eq 1 ]; then # force IP version + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG -4" || __PROG="$__PROG -6" + fi + [ $force_dnstcp -eq 1 ] && __PROG="$__PROG -t" || __PROG="$__PROG -u" # force TCP + __PROG="$__PROG $lookup_host" + [ -n "$dns_server" ] && __PROG="$__PROG @$dns_server" + [ $use_ipv6 -eq 0 ] && __PROG="$__PROG A" || __PROG="$__PROG AAAA" + + __RUNPROG="$__PROG >$DATFILE 2>$ERRFILE" + __PROG="drill" + elif [ -n "$HOSTIP" ]; then # hostip package installed + __PROG="$HOSTIP" + [ $force_dnstcp -ne 0 ] && \ + write_log 14 "hostip - no support for 'DNS over TCP'" + + # is IP given as dns_server ? + __IP=$(echo $dns_server | grep -m 1 -o "$IPV4_REGEX") + [ -z "$__IP" ] && __IP=$(echo $dns_server | grep -m 1 -o "$IPV6_REGEX") + + # we got NO ip for dns_server, so build command + [ -z "$__IP" -a -n "$dns_server" ] && { + __IP="\`$HOSTIP" + [ $use_ipv6 -eq 1 -a $force_ipversion -eq 1 ] && __IP="$__IP -6" + __IP="$__IP $dns_server | grep -m 1 -o" + [ $use_ipv6 -eq 1 -a $force_ipversion -eq 1 ] \ + && __IP="$__IP '$IPV6_REGEX'" \ + || __IP="$__IP '$IPV4_REGEX'" + __IP="$__IP \`" + } + + [ $use_ipv6 -eq 1 ] && __PROG="$__PROG -6" + [ -n "$dns_server" ] && __PROG="$__PROG -r $__IP" + __RUNPROG="$__PROG $lookup_host >$DATFILE 2>$ERRFILE" + __PROG="hostip" + elif [ -n "$NSLOOKUP" ]; then # last use BusyBox nslookup + [ $force_dnstcp -ne 0 ] && \ + write_log 14 "Busybox nslookup - no support for 'DNS over TCP'" + [ -n "$NSLOOKUP_MUSL" -a -n "$dns_server" ] && \ + write_log 14 "Busybox compiled with musl - nslookup don't support the use of DNS Server" + [ $force_ipversion -ne 0 ] && \ + write_log 5 "Busybox nslookup - no support to 'force IP Version' (ignored)" + + __RUNPROG="$NSLOOKUP $lookup_host $dns_server >$DATFILE 2>$ERRFILE" + __PROG="BusyBox nslookup" + else # there must be an error + write_log 12 "Error in 'get_registered_ip()' - no supported Name Server lookup software accessible" + fi + + while : ; do + write_log 7 "#> $__RUNPROG" + eval $__RUNPROG + __ERR=$? + if [ $__ERR -ne 0 ]; then + write_log 3 "$__PROG error: '$__ERR'" + write_log 7 "$(cat $ERRFILE)" + else + if [ -n "$BIND_HOST" ]; then + if [ $is_glue -eq 1 ]; then + __DATA=$(cat $DATFILE | grep "^$lookup_host" | grep -m 1 -o "$__REGEX" ) + else + __DATA=$(cat $DATFILE | awk -F "address " '/has/ {print $2; exit}' ) + fi + elif [ -n "$KNOT_HOST" ]; then + __DATA=$(cat $DATFILE | awk -F "address " '/has/ {print $2; exit}' ) + elif [ -n "$DRILL" ]; then + __DATA=$(cat $DATFILE | awk '/^'"$lookup_host"'/ {print $5; exit}' ) + elif [ -n "$HOSTIP" ]; then + __DATA=$(cat $DATFILE | grep -m 1 -o "$__REGEX") + elif [ -n "$NSLOOKUP" ]; then + __DATA=$(cat $DATFILE | sed -ne "/^Name:/,\$ { s/^Address[0-9 ]\{0,\}: \($__REGEX\).*$/\\1/p }" ) + fi + [ -n "$__DATA" ] && { + write_log 7 "Registered IP '$__DATA' detected" + eval "$1=\"$__DATA\"" # valid data found + return 0 # leave here + } + write_log 4 "NO valid IP found" + __ERR=127 + fi + + [ -n "$LUCI_HELPER" ] && return $__ERR # no retry if called by LuCI helper script + [ -n "$2" ] && return $__ERR # $2 is given -> no retry + [ $VERBOSE -gt 1 ] && { + # VERBOSE > 1 then NO retry + write_log 4 "Get registered/public IP for '$lookup_host' failed - Verbose Mode: $VERBOSE - NO retry on error" + return $__ERR + } + + __CNT=$(( $__CNT + 1 )) # increment error counter + # if error count > retry_count leave here + [ $retry_count -gt 0 -a $__CNT -gt $retry_count ] && \ + write_log 14 "Get registered/public IP for '$lookup_host' failed after $retry_count retries" + + write_log 4 "Get registered/public IP for '$lookup_host' failed - retry $__CNT/$retry_count in $RETRY_SECONDS seconds" + sleep $RETRY_SECONDS & + PID_SLEEP=$! + wait $PID_SLEEP # enable trap-handler + PID_SLEEP=0 + done + # we should never come here there must be a programming error + write_log 12 "Error in 'get_registered_ip()' - program coding error" +} + +get_uptime() { + # $1 Variable to store result in + [ $# -ne 1 ] && write_log 12 "Error calling 'verify_host_port()' - wrong number of parameters" + local __UPTIME=$(cat /proc/uptime) + eval "$1=\"${__UPTIME%%.*}\"" +} + +trap_handler() { + # $1 trap signal + # $2 optional (exit status) + local __PIDS __PID + local __ERR=${2:-0} + local __OLD_IFS=$IFS + local __NEWLINE_IFS=' +' # __NEWLINE_IFS + + [ $PID_SLEEP -ne 0 ] && kill -$1 $PID_SLEEP 2>/dev/null # kill pending sleep if exist + + case $1 in + 0) if [ $__ERR -eq 0 ]; then + write_log 5 "PID '$$' exit normal at $(eval $DATE_PROG)\n" + else + write_log 4 "PID '$$' exit WITH ERROR '$__ERR' at $(eval $DATE_PROG)\n" + fi ;; + 1) write_log 6 "PID '$$' received 'SIGHUP' at $(eval $DATE_PROG)" + # reload config via starting the script again + /usr/lib/ddns/dynamic_dns_updater.sh -v "0" -S "$__SECTIONID" -- start || true + exit 0 ;; # and leave this one + 2) write_log 5 "PID '$$' terminated by 'SIGINT' at $(eval $DATE_PROG)\n";; + 3) write_log 5 "PID '$$' terminated by 'SIGQUIT' at $(eval $DATE_PROG)\n";; + 15) write_log 5 "PID '$$' terminated by 'SIGTERM' at $(eval $DATE_PROG)\n";; + *) write_log 13 "Unhandled signal '$1' in 'trap_handler()'";; + esac + + __PIDS=$(pgrep -P $$) # get my childs (pgrep prints with "newline") + IFS=$__NEWLINE_IFS + for __PID in $__PIDS; do + kill -$1 $__PID # terminate it + done + IFS=$__OLD_IFS + + # remove out and err file + [ -f $DATFILE ] && rm -f $DATFILE + [ -f $ERRFILE ] && rm -f $ERRFILE + + # exit with correct handling: + # remove trap handling settings and send kill to myself + trap - 0 1 2 3 15 + [ $1 -gt 0 ] && kill -$1 $$ +} + +split_FQDN() { + # $1 FQDN to split + # $2 name of variable to store TLD + # $3 name of variable to store (reg)Domain + # $4 name of variable to store Host/Subdomain + + [ $# -ne 4 ] && write_log 12 "Error calling 'split_FQDN()' - wrong number of parameters" + [ -z "$1" ] && write_log 12 "Error calling 'split_FQDN()' - missing FQDN to split" + [ -f $TLDFILE ] || write_log 12 "Error calling 'split_FQDN()' - missing file '$TLDFILE'" + + local _HOST _FDOM _CTLD _FTLD + local _SET="$@" # save given function parameters + + local _PAR=$(echo "$1" | tr [A-Z] [a-z] | tr "." " ") # to lower and replace DOT with SPACE + set -- $_PAR # set new as function parameters + _PAR="" # clear variable for later reuse + while [ -n "$1" ] ; do # as long we have parameters + _PAR="$1 $_PAR" # invert order of parameters + shift + done + set -- $_PAR # use new as function parameters + _PAR="" # clear variable + + while [ -n "$1" ] ; do # as long we have parameters + if [ -z "$_CTLD" ]; then # first loop + _CTLD="$1" # CURRENT TLD to look at + shift + else + _CTLD="$1.$_CTLD" # Next TLD to look at + shift + fi + # check if TLD exact match in tld_names.dat, save TLD + zcat $TLDFILE | grep -E "^$_CTLD$" >/dev/null 2>&1 && { + _FTLD="$_CTLD" # save found + _FDOM="$1" # save domain next step might be invalid + continue + } + # check if match any "*" in tld_names.dat, + zcat $TLDFILE | grep -E "^\*.$_CTLD$" >/dev/null 2>&1 && { + [ -z "$1" ] && break # no more data break + # check if next level TLD match excludes "!" in tld_names.dat + if zcat $TLDFILE | grep -E "^!$1.$_CTLD$" >/dev/null 2>&1 ; then + _FTLD="$_CTLD" # Yes + else + _FTLD="$1.$_CTLD" + shift + fi + _FDOM="$1"; shift + } + [ -n "$_FTLD" ] && break # we have something valid, break + done + + # the leftover parameters are the HOST/SUBDOMAIN + while [ -n "$1" ]; do + _HOST="$1 $_HOST" # remember we need to invert + shift + done + _HOST=$(echo $_HOST | tr " " ".") # insert DOT + + set -- $_SET # set back parameters from function call + [ -n "$_FTLD" ] && { + eval "$2=$_FTLD" # set TLD + eval "$3=$_FDOM" # set registrable domain + eval "$4=$_HOST" # set HOST/SUBDOMAIN + return 0 + } + eval "$2=''" # clear TLD + eval "$3=''" # clear registrable domain + eval "$4=''" # clear HOST/SUBDOMAIN + return 1 +} + +expand_ipv6() { + # Original written for bash by + #.Author: Florian Streibelt + # Date: 08.04.2012 + # License: Public Domain, but please be fair and + # attribute the original author(s) and provide + # a link to the original source for corrections: + #. https://github.com/mutax/IPv6-Address-checks + + # $1 IPv6 to expand + # $2 name of variable to store expanded IPv6 + [ $# -ne 2 ] && write_log 12 "Error calling 'expand_ipv6()' - wrong number of parameters" + + INPUT="$(echo "$1" | tr 'A-F' 'a-f')" + [ "$INPUT" = "::" ] && INPUT="::0" # special case :: + + O="" + + while [ "$O" != "$INPUT" ]; do + O="$INPUT" + + # fill all words with zeroes + INPUT=$( echo "$INPUT" | sed -e 's|:\([0-9a-f]\{3\}\):|:0\1:|g' \ + -e 's|:\([0-9a-f]\{3\}\)$|:0\1|g' \ + -e 's|^\([0-9a-f]\{3\}\):|0\1:|g' \ + -e 's|:\([0-9a-f]\{2\}\):|:00\1:|g' \ + -e 's|:\([0-9a-f]\{2\}\)$|:00\1|g' \ + -e 's|^\([0-9a-f]\{2\}\):|00\1:|g' \ + -e 's|:\([0-9a-f]\):|:000\1:|g' \ + -e 's|:\([0-9a-f]\)$|:000\1|g' \ + -e 's|^\([0-9a-f]\):|000\1:|g' ) + + done + + # now expand the :: + ZEROES="" + + echo "$INPUT" | grep -qs "::" + if [ "$?" -eq 0 ]; then + GRPS="$( echo "$INPUT" | sed 's|[0-9a-f]||g' | wc -m )" + GRPS=$(( GRPS-1 )) # remove carriage return + MISSING=$(( 8-GRPS )) + while [ $MISSING -gt 0 ]; do + ZEROES="$ZEROES:0000" + MISSING=$(( MISSING-1 )) + done + + # be careful where to place the : + INPUT=$( echo "$INPUT" | sed -e 's|\(.\)::\(.\)|\1'$ZEROES':\2|g' \ + -e 's|\(.\)::$|\1'$ZEROES':0000|g' \ + -e 's|^::\(.\)|'$ZEROES':0000:\1|g;s|^:||g' ) + fi + + # an expanded address has 39 chars + CR + if [ $(echo $INPUT | wc -m) != 40 ]; then + write_log 4 "Error in 'expand_ipv6()' - invalid IPv6 found: '$1' expanded: '$INPUT'" + eval "$2='invalid'" + return 1 + fi + + # echo the fully expanded version of the address + eval "$2=$INPUT" + return 0 +} diff --git a/net/ddns-scripts/files/dynamic_dns_lucihelper.sh b/net/ddns-scripts/files/dynamic_dns_lucihelper.sh new file mode 100755 index 0000000..b2831e6 --- /dev/null +++ b/net/ddns-scripts/files/dynamic_dns_lucihelper.sh @@ -0,0 +1,171 @@ +#!/bin/sh +# /usr/lib/ddns/dynamic_dns_lucihelper.sh +# +#.Distributed under the terms of the GNU General Public License (GPL) version 2.0 +#.2014-2016 Christian Schoenebeck +# This script is used by luci-app-ddns +# +# variables in small chars are read from /etc/config/ddns as parameter given here +# variables in big chars are defined inside these scripts as gloval vars +# variables in big chars beginning with "__" are local defined inside functions only +# set -vx #script debugger + +. /usr/lib/ddns/dynamic_dns_functions.sh # global vars are also defined here + +usage() { + cat << EOF + +Usage: + $MYPROG [options] -- command + +Commands: + get_local_ip using given INTERFACE or NETWORK or SCRIPT or URL + get_registered_ip for given FQDN + verify_dns given DNS-SERVER + verify_proxy given PROXY + start start given SECTION + reload force running ddns processes to reload changed configuration + restart restart all ddns processes + +Parameters: + -6 => use_ipv6=1 (default 0) + -d DNS-SERVER => dns_server=SERVER[:PORT] + -f => force_ipversion=1 (default 0) + -g => is_glue=1 (default 0) + -i INTERFACE => ip_interface=INTERFACE; ip_source="interface" + -l FQDN => lookup_host=FQDN + -n NETWORK => ip_network=NETWORK; ip_source="network" + -p PROXY => proxy=[USER:PASS@]PROXY:PORT + -s SCRIPT => ip_script=SCRIPT; ip_source="script" + -t => force_dnstcp=1 (default 0) + -u URL => ip_url=URL; ip_source="web" + -S SECTION SECTION to start + + -h => show this help and exit + -L => use_logfile=1 (default 0) + -v LEVEL => VERBOSE=LEVEL (default 0) + -V => show version and exit + +EOF +} + +usage_err() { + printf %s\\n "$MYPROG: $@" >&2 + usage >&2 + exit 255 +} + +# preset some variables, wrong or not set in ddns-functions.sh +SECTION_ID="lucihelper" +LOGFILE="$ddns_logdir/$SECTION_ID.log" +DATFILE="$ddns_rundir/$SECTION_ID.$$.dat" # save stdout data of WGet and other extern programs called +ERRFILE="$ddns_rundir/$SECTION_ID.$$.err" # save stderr output of WGet and other extern programs called +DDNSPRG="/usr/lib/ddns/dynamic_dns_updater.sh" +VERBOSE=0 # no console logging +# global variables normally set by reading DDNS UCI configuration +use_syslog=0 # no syslog +use_logfile=0 # no logfile + +use_ipv6=0 # Use IPv6 - default IPv4 +force_ipversion=0 # Force IP Version - default 0 - No +force_dnstcp=0 # Force TCP on DNS - default 0 - No +is_glue=0 # Is glue record - default 0 - No +use_https=0 # not needed but must be set + +while getopts ":6d:fghi:l:n:p:s:S:tu:Lv:V" OPT; do + case "$OPT" in + 6) use_ipv6=1;; + d) dns_server="$OPTARG";; + f) force_ipversion=1;; + g) is_glue=1;; + i) ip_interface="$OPTARG"; ip_source="interface";; + l) lookup_host="$OPTARG";; + n) ip_network="$OPTARG"; ip_source="network";; + p) proxy="$OPTARG";; + s) ip_script="$OPTARG"; ip_source="script";; + t) force_dnstcp=1;; + u) ip_url="$OPTARG"; ip_source="web";; + h) usage; exit 255;; + L) use_logfile=1;; + v) VERBOSE=$OPTARG;; + S) SECTION=$OPTARG;; + V) printf %s\\n "ddns-scripts $VERSION"; exit 255;; + :) usage_err "option -$OPTARG missing argument";; + \?) usage_err "invalid option -$OPTARG";; + *) usage_err "unhandled option -$OPT $OPTARG";; + esac +done +shift $((OPTIND - 1 )) # OPTIND is 1 based + +[ $# -eq 0 ] && usage_err "missing command" + +__RET=0 +case "$1" in + get_registered_ip) + [ -z "$lookup_host" ] && usage_err "command 'get_registered_ip': 'lookup_host' not set" + write_log 7 "-----> get_registered_ip IP" + IP="" + get_registered_ip IP + __RET=$? + [ $__RET -ne 0 ] && IP="" + printf "%s" "$IP" + ;; + verify_dns) + [ -z "$dns_server" ] && usage_err "command 'verify_dns': 'dns_server' not set" + write_log 7 "-----> verify_dns '$dns_server'" + verify_dns "$dns_server" + __RET=$? + ;; + verify_proxy) + [ -z "$proxy" ] && usage_err "command 'verify_proxy': 'proxy' not set" + write_log 7 "-----> verify_proxy '$proxy'" + verify_proxy "$proxy" + __RET=$? + ;; + get_local_ip) + [ -z "$ip_source" ] && usage_err "command 'get_local_ip': 'ip_source' not set" + [ -n "$proxy" -a "$ip_source" = "web" ] && { + # proxy defined, used for ip_source=web + export HTTP_PROXY="http://$proxy" + export HTTPS_PROXY="http://$proxy" + export http_proxy="http://$proxy" + export https_proxy="http://$proxy" + } + # don't need IP only the return code + IP="" + if [ "$ip_source" = "web" -o "$ip_source" = "script" ]; then + # we wait only 3 seconds for an + # answer from "web" or "script" + write_log 7 "-----> timeout 3 -- get_local_ip IP" + timeout 3 -- get_local_ip IP + else + write_log 7 "-----> get_local_ip IP" + get_local_ip IP + fi + __RET=$? + ;; + start) + [ -z "$SECTION" ] && usage_err "command 'start': 'SECTION' not set" + if [ $VERBOSE -eq 0 ]; then # start in background + $DDNSPRG -v 0 -S $SECTION -- start & + else + $DDNSPRG -v $VERBOSE -S $SECTION -- start + fi + ;; + reload) + $DDNSPRG -- reload + ;; + restart) + $DDNSPRG -- stop + sleep 1 + $DDNSPRG -- start + ;; + *) + __RET=255 + ;; +esac + +# remove out and err file +[ -f $DATFILE ] && rm -f $DATFILE +[ -f $ERRFILE ] && rm -f $ERRFILE +return $__RET diff --git a/net/ddns-scripts/files/dynamic_dns_updater.sh b/net/ddns-scripts/files/dynamic_dns_updater.sh new file mode 100755 index 0000000..c58be2e --- /dev/null +++ b/net/ddns-scripts/files/dynamic_dns_updater.sh @@ -0,0 +1,419 @@ +#!/bin/sh +# /usr/lib/ddns/dynamic_dns_updater.sh +# +#.Distributed under the terms of the GNU General Public License (GPL) version 2.0 +# Original written by Eric Paul Bishop, January 2008 +# (Loosely) based on the script on the one posted by exobyte in the forums here: +# http://forum.openwrt.org/viewtopic.php?id=14040 +# extended and partial rewritten +#.2014-2016 Christian Schoenebeck +# +# variables in small chars are read from /etc/config/ddns +# variables in big chars are defined inside these scripts as global vars +# variables in big chars beginning with "__" are local defined inside functions only +# set -vx #script debugger + +. $(dirname $0)/dynamic_dns_functions.sh # global vars are also defined here + +usage() { + cat << EOF + +Usage: + $MYPROG [options] -- command + +Commands: +start Start SECTION or NETWORK or all +stop Stop NETWORK or all + +Parameters: + -n NETWORK Start/Stop sections in background monitoring NETWORK, force VERBOSE=0 + -S SECTION SECTION to start + use either -N NETWORK or -S SECTION + + -h show this help and exit + -V show version and exit + -v LEVEL VERBOSE=LEVEL (default 1) + '0' NO output to console + '1' output to console + '2' output to console AND logfile + + run once WITHOUT retry on error + '3' output to console AND logfile + + run once WITHOUT retry on error + + NOT sending update to DDNS service + +EOF +} + +usage_err() { + printf %s\\n "$MYPROG: $@" >&2 + usage >&2 + exit 1 +} + +while getopts ":hv:n:S:V" OPT; do + case "$OPT" in + h) usage; exit 0;; + v) VERBOSE=$OPTARG;; + n) NETWORK=$OPTARG;; + S) SECTION_ID=$OPTARG;; + V) printf %s\\n "ddns-scripts $VERSION"; exit 0;; + :) usage_err "option -$OPTARG missing argument";; + \?) usage_err "invalid option -$OPTARG";; + *) usage_err "unhandled option -$OPT $OPTARG";; + esac +done +shift $((OPTIND - 1 )) # OPTIND is 1 based + +[ -n "$NETWORK" -a -n "$SECTION_ID" ] && usage_err "use either option '-N' or '-S' not both" +[ $# -eq 0 ] && usage_err "missing command" +[ $# -gt 1 ] && usage_err "to much commands" + +case "$1" in + start) + if [ -n "$NETWORK" ]; then + start_daemon_for_all_ddns_sections "$NETWORK" + exit 0 + fi + if [ -z "$SECTION_ID" ]; then + start_daemon_for_all_ddns_sections + exit 0 + fi + ;; + stop) + if [ -n "$INTERFACE" ]; then + stop_daemon_for_all_ddns_sections "$NETWORK" + exit 0 + else + stop_daemon_for_all_ddns_sections + exit 0 + fi + exit 1 + ;; + reload) + killall -1 dynamic_dns_updater.sh 2>/dev/null + exit $? + ;; + *) usage_err "unknown command - $1";; +esac + +# set file names +PIDFILE="$ddns_rundir/$SECTION_ID.pid" # Process ID file +UPDFILE="$ddns_rundir/$SECTION_ID.update" # last update successful send (system uptime) +DATFILE="$ddns_rundir/$SECTION_ID.dat" # save stdout data of WGet and other extern programs called +ERRFILE="$ddns_rundir/$SECTION_ID.err" # save stderr output of WGet and other extern programs called +LOGFILE="$ddns_logdir/$SECTION_ID.log" # log file + +# VERBOSE > 1 delete logfile if exist to create an empty one +# only with this data of this run for easier diagnostic +# new one created by write_log function +[ $VERBOSE -gt 1 -a -f $LOGFILE ] && rm -f $LOGFILE + +# TRAP handler +trap "trap_handler 0 \$?" 0 # handle script exit with exit status +trap "trap_handler 1" 1 # SIGHUP Hangup / reload config +trap "trap_handler 2" 2 # SIGINT Terminal interrupt +trap "trap_handler 3" 3 # SIGQUIT Terminal quit +# trap "trap_handler 9" 9 # SIGKILL no chance to trap +trap "trap_handler 15" 15 # SIGTERM Termination + +################################################################################ +# Leave this comment here, to clearly document variable names that are expected/possible +# Use load_all_config_options to load config options, which is a much more flexible solution. +# +# config_load "ddns" +# config_get $SECTION_ID