Browse Source

First Commit

RISCi_ATOM 7 years ago
commit
704ce7f78e
100 changed files with 5551 additions and 0 deletions
  1. 114 0
      CONTRIBUTING.md
  2. 340 0
      LICENSE
  3. 26 0
      README.md
  4. 56 0
      admin/debootstrap/Makefile
  5. 347 0
      admin/debootstrap/files/pkgdetails.c
  6. 11 0
      admin/debootstrap/patches/100-busybox_fix.patch
  7. 54 0
      admin/htop/Makefile
  8. 11 0
      admin/htop/patches/100-fix-libtool-version-check.patch
  9. 95 0
      admin/monit/Makefile
  10. 15 0
      admin/monit/files/monit.init
  11. 18 0
      admin/monit/patches/001-fix-default-piddir.patch
  12. 54 0
      admin/muninlite/Makefile
  13. 10 0
      admin/muninlite/files/etc/xinetd.d/munin
  14. 10 0
      admin/muninlite/patches/001-fix_disks.patch
  15. 11 0
      admin/muninlite/patches/002-hostname.patch
  16. 21 0
      admin/muninlite/patches/100-fix-no-ethtool.patch
  17. 12 0
      admin/muninlite/patches/110-fix-uptime-days.patch
  18. 20 0
      admin/muninlite/patches/200-add-tap-dev.patch
  19. 24 0
      admin/muninlite/patches/210-add-bridge-devs.patch
  20. 22 0
      admin/muninlite/patches/220-modify-ifname-parser.patch
  21. 20 0
      admin/muninlite/patches/230-fix-available-interface-parsing.patch
  22. 68 0
      admin/netdata/Makefile
  23. 43 0
      admin/netdata/files/netdata.conf
  24. 21 0
      admin/netdata/files/netdata.init
  25. 26 0
      admin/netdata/patches/001-disable_external_plugins_by_default.patch
  26. 98 0
      admin/sudo/Makefile
  27. 11 0
      admin/sudo/files/sudo.init
  28. 16 0
      admin/sudo/patches/010-cross-compile-fixes.patch
  29. 12 0
      admin/sudo/patches/020-no-owner-change.patch
  30. 12 0
      admin/sudo/patches/030-musl-fix-missing-header.patch
  31. 235 0
      admin/zabbix/Makefile
  32. 27 0
      admin/zabbix/files/mac80211
  33. 9 0
      admin/zabbix/files/network
  34. 25 0
      admin/zabbix/files/wifi
  35. 23 0
      admin/zabbix/files/zabbix_agentd.init
  36. 77 0
      admin/zabbix/files/zabbix_helper_mac80211.c
  37. 35 0
      admin/zabbix/patches/002-fix-res_send-on-uclibc.patch
  38. 48 0
      admin/zabbix/patches/002-uclibc_loadavg.patch
  39. 17 0
      admin/zabbix/patches/003-change-user-and-foreground.patch
  40. 65 0
      admin/zabbix/patches/010-change-agentd-config.patch
  41. 23 0
      admin/zabbix/patches/100-musl-compat.patch
  42. 70 0
      devel/autoconf/Makefile
  43. 65 0
      devel/automake/Makefile
  44. 62 0
      devel/diffutils/Makefile
  45. 167 0
      devel/gcc/Makefile
  46. 10 0
      devel/gcc/README
  47. 65 0
      devel/gcc/patches/001-revert_register_mode_search.patch
  48. 14 0
      devel/gcc/patches/002-case_insensitive.patch
  49. 14 0
      devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch
  50. 38 0
      devel/gcc/patches/003-mpfr-longlong-mips.patch
  51. 23 0
      devel/gcc/patches/010-documentation.patch
  52. 28 0
      devel/gcc/patches/020-no-plt-backport.patch
  53. 23 0
      devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch
  54. 33 0
      devel/gcc/patches/100-uclibc-conf.patch
  55. 309 0
      devel/gcc/patches/200-musl_config.patch
  56. 43 0
      devel/gcc/patches/201-musl_arm.patch
  57. 35 0
      devel/gcc/patches/202-musl_mips.patch
  58. 209 0
      devel/gcc/patches/203-musl_powerpc.patch
  59. 39 0
      devel/gcc/patches/204-musl_sh.patch
  60. 41 0
      devel/gcc/patches/205-musl_x86.patch
  61. 31 0
      devel/gcc/patches/206-musl_aarch64.patch
  62. 30 0
      devel/gcc/patches/207-musl_fixincludes.patch
  63. 72 0
      devel/gcc/patches/209-musl_libstdc++.patch
  64. 13 0
      devel/gcc/patches/230-musl_libssp.patch
  65. 61 0
      devel/gcc/patches/240-musl-libitm-fixes.patch
  66. 120 0
      devel/gcc/patches/250-add-musl.patch
  67. 34 0
      devel/gcc/patches/260-musl-add-unwind-fix.patch
  68. 24 0
      devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch
  69. 14 0
      devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch
  70. 11 0
      devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch
  71. 25 0
      devel/gcc/patches/810-arm-softfloat-libgcc.patch
  72. 36 0
      devel/gcc/patches/820-libgcc_pic.patch
  73. 13 0
      devel/gcc/patches/830-arm_unbreak_armv4t.patch
  74. 19 0
      devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch
  75. 47 0
      devel/gcc/patches/850-use_shared_libgcc.patch
  76. 12 0
      devel/gcc/patches/851-libgcc_no_compat.patch
  77. 11 0
      devel/gcc/patches/870-ppc_no_crtsavres.patch
  78. 11 0
      devel/gcc/patches/880-no_java_section.patch
  79. 9 0
      devel/gcc/patches/900-bad-mips16-crt.patch
  80. 222 0
      devel/gcc/patches/910-mbsd_multi.patch
  81. 15 0
      devel/gcc/patches/920-specs_nonfatal_getenv.patch
  82. 111 0
      devel/gcc/patches/930-fix-mips-noexecstack.patch
  83. 13 0
      devel/gcc/patches/930-osdefines.patch
  84. 11 0
      devel/gcc/patches/940-no-clobber-stamp-bits.patch
  85. 182 0
      devel/gcc/patches/950-cpp_file_path_translation.patch
  86. 11 0
      devel/gcc/patches/960-go_libm.patch
  87. 11 0
      devel/gcc/patches/970-warn_bug.patch
  88. 52 0
      devel/libtool-bin/Makefile
  89. 42 0
      devel/lpc21isp/Makefile
  90. 45 0
      devel/lttng-modules/Makefile
  91. 10 0
      devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch
  92. 60 0
      devel/lttng-tools/Makefile
  93. 23 0
      devel/lttng-tools/patches/100-musl-compat.patch
  94. 423 0
      devel/lttng-tools/patches/200-use-extern.patch
  95. 41 0
      devel/m4/Makefile
  96. 46 0
      devel/make/Makefile
  97. 48 0
      devel/patch/Makefile
  98. 49 0
      devel/pkg-config/Makefile
  99. 70 0
      ipv6/aiccu/Makefile
  100. 3 0
      ipv6/aiccu/files/aiccu.hotplug

+ 114 - 0
CONTRIBUTING.md

@@ -0,0 +1,114 @@
+# Contributing Guidelines  
+(See <http://wiki.openwrt.org/doc/devel/packages> 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 `<jdh@jdhs-email-provider.org`>)
+* 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 <https://dev.openwrt.org/wiki/SubmittingPatches#a10.Signyourwork>)
+
+### 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: <http://spdx.org/licenses>)
+
+| 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|

+ 340 - 0
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.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+  <signature of Ty Coon>, 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.

+ 26 - 0
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.
+

+ 56 - 0
admin/debootstrap/Makefile

@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2010 Gianluigi Tiesi <sherpya@netfarm.it>
+# 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 <daniel@makrotopia.org>
+
+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))

+ 347 - 0
admin/debootstrap/files/pkgdetails.c

@@ -0,0 +1,347 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <errno.h>
+
+#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);
+    }
+}

+ 11 - 0
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

+ 54 - 0
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 <champetier.etienne@gmail.com>
+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))

+ 11 - 0
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)}"

+ 95 - 0
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 <champetier.etienne@gmail.com>
+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))

+ 15 - 0
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
+}

+ 18 - 0
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

+ 54 - 0
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 <jmccrohan@gmail.com>
+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))

+ 10 - 0
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
+}

+ 10 - 0
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
+ }

+ 11 - 0
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 

+ 21 - 0
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() {

+ 12 - 0
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
+ }

+ 20 - 0
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"

+ 24 - 0
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 $@; };"

+ 22 - 0
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)
+ }

+ 20 - 0
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"

+ 68 - 0
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 <daniel.engberg.lists@pyret.net>
+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))

+ 43 - 0
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

+ 21 - 0
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
+	}

+ 26 - 0
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

+ 98 - 0
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 <mail.gery@gmail.com>
+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))

+ 11 - 0
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
+	}
+}

+ 16 - 0
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 $@

+ 12 - 0
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@

+ 12 - 0
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 <sys/types.h>
++
+ /*
+  * Macros for operating on struct timeval.
+  */

+ 235 - 0
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 <champetier.etienne@gmail.com>
+  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))

+ 27 - 0
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
+

+ 9 - 0
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.."]}")'
+
+
+

+ 25 - 0
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 ''))"
+

+ 23 - 0
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
+}
+

+ 77 - 0
admin/zabbix/files/zabbix_helper_mac80211.c

@@ -0,0 +1,77 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <stdbool.h>
+
+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]);
+    }
+}

+ 35 - 0
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;

+ 48 - 0
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;

+ 17 - 0
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";

+ 65 - 0
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 #######
+ 

+ 23 - 0
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 <linux/kernel.h>
++#endif
++])
+ AC_CHECK_HEADERS(resolv.h, [], [], [
+ #ifdef HAVE_SYS_TYPES_H
+ #  include <sys/types.h>

+ 70 - 0
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 <xypron.glpk@gmx.de>
+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))

+ 65 - 0
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 <xypron.glpk@gmx.de>
+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))

+ 62 - 0
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 <rogerdammit@gmail.com>
+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))

+ 167 - 0
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 <gccmaintain@noblepepper.com>
+  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))

+ 10 - 0
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 <cb@shoutrlabs.com>

+ 65 - 0
devel/gcc/patches/001-revert_register_mode_search.patch

@@ -0,0 +1,65 @@
+Revert of:
+
+commit 275035b56823b26d5fb7e90fad945b998648edf2
+Author: bergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>
+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)

+ 14 - 0
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)

+ 14 - 0
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).

+ 38 - 0
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

+ 23 - 0
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)

+ 28 - 0
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

+ 23 - 0
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

+ 33 - 0
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

+ 309 - 0
devel/gcc/patches/200-musl_config.patch

@@ -0,0 +1,309 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+	    Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+	* 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
+ 	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) 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
+ 	 # <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) 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

+ 43 - 0
devel/gcc/patches/201-musl_arm.patch

@@ -0,0 +1,43 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+
+	* 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

+ 35 - 0
devel/gcc/patches/202-musl_mips.patch

@@ -0,0 +1,35 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+	    Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+	* 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)

+ 209 - 0
devel/gcc/patches/203-musl_powerpc.patch

@@ -0,0 +1,209 @@
+
+gcc/Changelog:
+
+2015-04-24  Gregor Richards  <gregor.richards@uwaterloo.ca>
+	    Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+	* 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.
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #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

+ 39 - 0
devel/gcc/patches/204-musl_sh.patch

@@ -0,0 +1,39 @@
+gcc/Changelog:
+
+2015-04-27  Gregor Richards  <gregor.richards@uwaterloo.ca>
+	    Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+	* 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

+ 41 - 0
devel/gcc/patches/205-musl_x86.patch

@@ -0,0 +1,41 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+
+	* 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"

+ 31 - 0
devel/gcc/patches/206-musl_aarch64.patch

@@ -0,0 +1,31 @@
+From: jgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+	    Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+	* 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}"
+ 

+ 30 - 0
devel/gcc/patches/207-musl_fixincludes.patch

@@ -0,0 +1,30 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+
+	* 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}

+ 72 - 0
devel/gcc/patches/209-musl_libstdc++.patch

@@ -0,0 +1,72 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <szabolcs.nagy@arm.com>
+
+	* 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  <szabolcs.nagy@arm.com>
+
+	* 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"

+ 13 - 0
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

+ 61 - 0
devel/gcc/patches/240-musl-libitm-fixes.patch

@@ -0,0 +1,61 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+
+       * 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 <unistd.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <elf.h>
+ 
+ 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

+ 120 - 0
devel/gcc/patches/250-add-musl.patch

@@ -0,0 +1,120 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <szabolcs.nagy@arm.com>
+
+	* 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
+ <http://www.gnu.org/licenses/>.  */
+ 
++/* 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;

+ 34 - 0
devel/gcc/patches/260-musl-add-unwind-fix.patch

@@ -0,0 +1,34 @@
+From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
+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  <gregor.richards@uwaterloo.ca>
+	    Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+	* 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

+ 24 - 0
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

+ 14 - 0
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];

+ 11 - 0
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)

+ 25 - 0
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*} \

+ 36 - 0
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))))

+ 13 - 0
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.  */

+ 19 - 0
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)
+ 

+ 47 - 0
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}}"
+ 

+ 12 - 0
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

+ 11 - 0
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;

+ 11 - 0
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

+ 9 - 0
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

+ 222 - 0
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 <tg at mirbsd.de>
+	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)
+     {

+ 15 - 0
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

+ 111 - 0
devel/gcc/patches/930-fix-mips-noexecstack.patch

@@ -0,0 +1,111 @@
+From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
+From: Andrew McDonnell <bugs@andrewmcdonnell.net>
+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 <sellcey at mips dot com>
+
+On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
+>
+>
+> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> 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  <sellcey@mips.com>
+---
+ 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
+ <http://www.gnu.org/licenses/>.  */
+ 
++
++/* 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
+ <http://www.gnu.org/licenses/>.  */
+ 
++/* 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								\

+ 13 - 0
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

+ 11 - 0
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}

+ 182 - 0
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 <dir>	Add <dir> to the end of the quote include path
+ 
++iremap
++C ObjC C++ ObjC++ Joined Separate
++-iremap <src:dst>  Convert <src> to <dst> if it occurs as prefix in __FILE__.
++
+ iwithprefix
+ C ObjC C++ ObjC++ Joined Separate
+ -iwithprefix <dir>	Add <dir> 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;
+ 

+ 11 - 0
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.
+ 

+ 11 - 0
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);

+ 52 - 0
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 <xypron.glpk@gmx.de>
+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))

+ 42 - 0
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 <sovende@gmail.com>
+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))

+ 45 - 0
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 <nico@openwrt.org>
+
+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))

+ 10 - 0
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))
+ 

+ 60 - 0
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 <nico@openwrt.org>
+
+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))

+ 23 - 0
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 <features.h>
+ #include <common/compat/fcntl.h>
+ 
++#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 <unistd.h>
+ #include <pthread.h>
++#include <sys/stat.h>
+ 
+ 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);

+ 423 - 0
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 */

+ 41 - 0
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 <xypron.glpk@gmx.de>
+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))

+ 46 - 0
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 <xypron.glpk@gmx.de>
+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))

+ 48 - 0
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 <russell@personaltelco.net>
+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))

+ 49 - 0
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 <xypron.glpk@gmx.de>
+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))

+ 70 - 0
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 <ondrej@caletka.cz>
+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))

+ 3 - 0
ipv6/aiccu/files/aiccu.hotplug

@@ -0,0 +1,3 @@
+#!/bin/sh
+NTPSTRATUMFILE="/var/run/aiccu_ntp_stratum"
+echo $stratum > "$NTPSTRATUMFILE"

Some files were not shown because too many files changed in this diff