Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: [macintoshplus] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
# patreon: # Replace with a single Patreon username
# open_collective: # Replace with a single Open Collective username
# ko_fi: # Replace with a single Ko-fi username
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
# liberapay: # Replace with a single Liberapay username
# issuehunt: # Replace with a single IssueHunt username
# otechie: # Replace with a single Otechie username
# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
130 changes: 130 additions & 0 deletions .github/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Publish Windows Releases
on:
workflow_dispatch: ~
release:
types: [created]
push:
branches: ['*']

permissions:
contents: write

jobs:
build-lib:
runs-on: windows-2022
strategy:
fail-fast: true
matrix:
# arch: [x64, x86]
arch: [x64]
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build the library
run: |
mkdir tcl
cd tcl
Invoke-WebRequest -Uri https://github.com/tcltk/tcl/releases/download/core-9-0-3/tcl9.0.3-src.tar.gz -outFile tcl.tar.gz
7z x tcl.tar.gz -so | 7z x -aoa -si -ttar -o"."
cd tcl9.0.3\win
mkdir install
nmake -f Makefile.vc all INSTALLDIR=.\install
nmake -f Makefile.vc install INSTALLDIR=.\install
7z a tcl.zip .\install
- name: Upload TCL library
uses: actions/upload-artifact@v5
with:
name: tcl-${{ matrix.arch }}
path: tcl\tcl9.0.3\win\tcl.zip
if-no-files-found: error

get-extension-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extension-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Get the extension matrix
id: extension-matrix
uses: php/php-windows-builder/extension-matrix@v1
with:
arch-list: x64
php-version-list: "8.0"
ts-list: nts

build:
needs: [get-extension-matrix, build-lib]
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: true
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: prepare
run: |
mkdir ..\tcl
- name: Download native lib
uses: actions/download-artifact@v5
with:
name: tcl-${{ matrix.arch }}

- name: Extract native lib
run: |
dir
7z x tcl.zip -o"..\tcl"
dir ..
dir ..\tcl
dir ..\tcl\install\include
dir ..\tcl\install\lib

- name: Setup PHP SDK
id: setup-php-windows
uses: php/setup-php-sdk@v0.12
with:
version: ${{ matrix.php-version }}
arch: ${{ matrix.arch }}
ts: ${{ matrix.ts }}

- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
toolset: ${{ steps.setup-php-windows.outputs.toolset }}

- run: phpize
- run: ./configure --with-expect --with-extra-includes="$($Env:GITHUB_WORKSPACE)..\tcl\install\include" --with-extra-libs="$($Env:GITHUB_WORKSPACE)..\tcl\install\lib" --with-prefix=${{steps.setup-php-windows.outputs.prefix}}
- run: nmake
- run: nmake test TESTS=tests


# - name: Upload TCL library
# uses: actions/upload-artifact@v5
# with:
# name: tcl-${{ matrix.php }}-${{ matrix.arch }}
# path: |
# win\install\

# - name: Build the extension
# uses: php/php-windows-builder/extension@v1
# with:
# php-version: ${{ matrix.php-version }}
# arch: ${{ matrix.arch }}
# ts: ${{ matrix.ts }}
# args: '--with-expect'
release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'release' }}
steps:
- name: Upload artifact to the release
uses: php/php-windows-builder/release@v1
with:
release: ${{ github.event.release.tag_name }}
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI
on:
push:
branches: ['*']
jobs:
test-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-rel: ['8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
# php-rel: ['8.0']
ts-state: [ts, nts]

steps:
- uses: actions/checkout@v5
- name: Install dependencies
run: sudo apt-get install -y tcl-dev tcl-expect-dev
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php-rel }}'
env:
phpts: '${{ matrix.ts-state }}'

- name: build extension
env:
CPPFLAGS: -I/usr/include/tcl
run: |
phpize
./configure --with-expect
make
- name: run tests
run: make test
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/config.h
/config.h.in
/config.log
/config.nice
/config.status
/configure
/configure.ac
/expect.la
/expect.lo
/expect_fopen_wrapper.lo
/libtool
/Makefile
/Makefile.fragments
/Makefile.objects
/run-tests.php
/tests/*.diff
/tests/*.exp
/tests/*.log
/tests/*.php
/tests/*.out
/tests/*.sh
/.libs/
/autom4te.cache/
/build/
/modules/
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
PHP extension for expect library
================================

This extension allows to interact with processes through PTY, using expect library.

This extension uses a Tcl/Expect library: https://www.tcl-lang.org/.

Original author: Michael Spector

> **Unable to build this extension for Windows because the TCL Expect is not available on Windows.**


Maintained branches:

| Version | Status |
|---------|------------------------------|
| master | unmaintened :x: |
| v0.x | maintened :white_check_mark: |

Maintained PHP Versions compatibility:

| PHP Version | Status |
|-------------|------------------------|
| 5.x | no :x: |
| 7.x | no :x: |
| 8.0 | yes :white_check_mark: |
| 8.1 | yes :white_check_mark: |
| 8.2 | yes :white_check_mark: |
| 8.3 | yes :white_check_mark: |
| 8.4 | yes :white_check_mark: |
| 8.5 | yes :white_check_mark: |

Installation system support:

| Platform | Status |
|----------|------------------------|
| PECL | no :x: |
| PIE | yes :white_check_mark: |


To install the extension, install the library `tcl-dev tcl-expect-dev` first.

Debian/Ubuntu/Mint:

```shell
sudo apt-get install tcl-dev tcl-expect-dev
```

Alpine Linux:

```shell
apk add tcl-dev expect-dev
```

Fedora:

```shell
sudo dnf install tcl-devel expect-devel
```

Arch Linux:

```shell
sudo pacman -S tcl expect
```

And use PIE (PHP Installer Extension) with a command like:

```bash
pie install php-win-ext/expect
```
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "php-win-ext/expect",
"type": "php-ext",
"license": [
"PHP-3.01"
],
"authors": [
{
"name": "Michael Spector",
"email": "michael@php.net"
}
],
"require": {
"php": ">= 8.0.0"
},
"php-ext": {
"extension-name": "expect",
"os-families-exclude": ["windows"]
},
"description": "This extension allows to interact with processes through PTY, using expect library."
}
Loading