Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Taken from selfoss.
  • Loading branch information
jtojnar committed Jan 9, 2021
0 parents commit d6fc33b
Show file tree
Hide file tree
Showing 8 changed files with 407 additions and 0 deletions.
7 changes: 7 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright © 2020–2021 Jan Tojnar and the Nixpkgs/NixOS contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# nix-phps

This is a repository of Nix package expressions for old versions of PHP.

> **Warning:** backwards compatibility is not guaranteed, pin this repo if you want to avoid breakage.
## Why?

PHP projects like [selfoss](https://github.com/fossar/selfoss) aim to support Linux distributions that maintain their own forks of no-longer-supported PHP versions (e.g. [Debian](https://wiki.debian.org/PHP)). To be able to test those PHP versions in CI, we need Nix expressions for them. Since [Nixpkgs](https://github.com/NixOS/nixpkgs) avoids unmaintained software, we maintain those expressions here.

## How to use?

We use [Cachix](https://app.cachix.org/cache/fossar) to store `x86_64-linux` binaries of the built packages. Install it as described in its [docs](https://docs.cachix.org/) and then add the cache using `cachix use fossar` if you want to avoid building those PHP packages yourself.

This package is regularly updated to match latest Nixpkgs and the PHP packages use the [same API as those in Nixpkgs](https://nixos.org/manual/nixpkgs/unstable/#sec-php).

The following versions are currently supported:

- `php56`
- `php70`
- `php71`
- `php72`
- `php73`
- `php74`
- `php80`

There is also a `php` package which is the alias of the default PHP version in Nixpkgs.

### With Nix flakes

> **Warning:** Nix flakes are experimental technology, use it only if you are willing to accept that you might need to change your code in the future.
Add this repository to the `inputs` in your `flake.nix`’s:

```nix
inputs = {
phps.url = "github:fossar/nix-phps";
};
```

then, in `outputs`, you will be able to use the PHP package

```nix
outputs = { self, nixpkgs, phps, ... }: {
devShell.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.mkShell {
buildInputs = [
phps.packages.x86_64-linux.php
];
};
};
```
9 changes: 9 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash; }
) {
src = ./.;
}).defaultNix
60 changes: 60 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
description = "Repository of Nix expressions for old PHP versions";

inputs = {
# Shim to make flake.nix work with stable Nix.
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};

nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

utils.url = "github:numtide/flake-utils";
};

outputs = { self, flake-compat, nixpkgs, utils }:
# For each supported platform,
utils.lib.eachDefaultSystem (system:
let
# Let’s merge the package set from Nixpkgs with our custom PHP versions.
pkgs = import nixpkgs.outPath {
inherit system;
overlays = [
self.overlay
];
};
in {
packages = {
inherit (pkgs) php php56 php70 php71 php72 php73 php74 php80;
};
}
) // {
overlay = import ./pkgs/phps.nix nixpkgs.outPath;
};
}
87 changes: 87 additions & 0 deletions pkgs/intl-icu-patch-5.6-compat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
--- a
+++ b
@@ -58,7 +58,7 @@
--- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
+++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp
-@@ -26,6 +26,9 @@
+@@ -25,6 +25,9 @@
+
#include "../intl_convertcpp.h"
- #include "../intl_common.h"

+using U_ICU_NAMESPACE::RuleBasedBreakIterator;
+using U_ICU_NAMESPACE::Locale;
@@ -111,9 +111,9 @@
+
extern "C" {
#include "../php_intl.h"
- #include "../intl_common.h"
-@@ -34,6 +36,11 @@
- #include "zend_exceptions.h"
+ #define USE_TIMEZONE_POINTER 1
+@@ -32,6 +34,11 @@
+ #include <ext/date/php_date.h>
}

+using U_ICU_NAMESPACE::GregorianCalendar;
@@ -133,9 +133,9 @@
+using U_ICU_NAMESPACE::TimeZone;
+using U_ICU_NAMESPACE::UnicodeString;
+
- #include "zend_portability.h"
-
- /* {{{ timezone_convert_datetimezone
+ #ifndef INFINITY
+ #define INFINITY (DBL_MAX+DBL_MAX)
+ #endif
--- a/ext/intl/common/common_date.h
+++ b/ext/intl/common/common_date.h
@@ -28,6 +28,8 @@
@@ -144,19 +144,19 @@

+using U_ICU_NAMESPACE::TimeZone;
+
- U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func);
+ U_CFUNC TimeZone *timezone_convert_datetimezone(int type, void *object, int is_datetime, intl_error *outside_error, const char *func TSRMLS_DC);
U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz,
- intl_error *err, const char *func);
+ intl_error *err, const char *func TSRMLS_DC);
--- a/ext/intl/common/common_enum.h
+++ b/ext/intl/common/common_enum.h
-@@ -75,6 +75,7 @@
- U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter);
+@@ -69,6 +69,7 @@
+ U_CFUNC void zoi_with_current_invalidate_current(zend_object_iterator *iter TSRMLS_DC);

#ifdef __cplusplus
+using U_ICU_NAMESPACE::StringEnumeration;
- U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object);
+ U_CFUNC void IntlIterator_from_StringEnumeration(StringEnumeration *se, zval *object TSRMLS_DC);
#endif

--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -33,6 +33,12 @@
@@ -203,16 +203,16 @@
Locale const& locale,
const char *func_name,
--- a/ext/intl/intl_convertcpp.h
+++ b/ext/intl/intl_convertcpp.h
-@@ -26,6 +26,8 @@
+@@ -25,6 +25,8 @@
+
#include <unicode/unistr.h>
- #include <zend_types.h>

+using U_ICU_NAMESPACE::UnicodeString;
+
- int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status);
-
- zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status);
+ int intl_stringFromChar(UnicodeString &ret, char *str, int32_t str_len, UErrorCode *status);
+
+ int intl_charFromString(const UnicodeString &from, char **res, int *res_len, UErrorCode *status);
--- a/ext/intl/msgformat/msgformat_helpers.cpp
+++ b/ext/intl/msgformat/msgformat_helpers.cpp
@@ -76,6 +76,16 @@MessageFormatAdapter::getMessagePattern(MessageFormat* m) {
EOF
15 changes: 15 additions & 0 deletions pkgs/intl-icu-patch-7.0-compat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- a
+++ b
@@ -133,8 +133,8 @@
+using U_ICU_NAMESPACE::TimeZone;
+using U_ICU_NAMESPACE::UnicodeString;
+
- #include "zend_portability.h"
-
- /* {{{ timezone_convert_datetimezone
+ #ifndef INFINITY
+ #define INFINITY (DBL_MAX+DBL_MAX)
+ #endif
--- a/ext/intl/common/common_date.h
+++ b/ext/intl/common/common_date.h
EOF
Loading

0 comments on commit d6fc33b

Please sign in to comment.