Skip to content

Commit 1ec413e

Browse files
committed
Add macOS support.
1 parent fb7073b commit 1ec413e

3 files changed

Lines changed: 93 additions & 8 deletions

File tree

.github/workflows/build_wheels.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ jobs:
112112
run: |
113113
git clone --depth 1 https://github.com/tdlib/td.git
114114
cd td
115+
sed -i '
116+
/^if[[:space:]]*(NOT CMAKE_CROSSCOMPILING)[[:space:]]*$/{
117+
N
118+
s/^if[[:space:]]*(NOT CMAKE_CROSSCOMPILING)[[:space:]]*\n[[:space:]]*add_executable(tg_cli /if (FALSE)\n add_executable(tg_cli /
119+
}
120+
' CMakeLists.txt
121+
sed -i '
122+
s/^[[:space:]]*add_subdirectory(benchmark)[[:space:]]*$/# add_subdirectory(benchmark)/;
123+
s/^[[:space:]]*add_subdirectory(test)[[:space:]]*$/# add_subdirectory(test)/
124+
' CMakeLists.txt
125+
115126
cat << EOF > vcpkg.json
116127
{
117128
"dependencies": [ "gperf", "openssl", "zlib" ],
@@ -149,6 +160,73 @@ jobs:
149160
name: wheels-windows
150161
path: ./wheelhouse/*.whl
151162

163+
macos-build:
164+
needs: prepare
165+
runs-on: tenki-macos-latest-small
166+
env:
167+
MACOSX_DEPLOYMENT_TARGET: "11.0"
168+
169+
steps:
170+
- uses: actions/checkout@v4
171+
172+
- name: Download updated files
173+
uses: actions/download-artifact@v4
174+
with:
175+
name: updated-files
176+
path: .
177+
178+
- name: Set up Python
179+
uses: actions/setup-python@v4
180+
with:
181+
python-version: ${{ env.USING_PYTHON_VERSION }}
182+
183+
- name: Install Python dependencies
184+
run: python -m pip install --upgrade cibuildwheel
185+
186+
- name: Build OpenSSL 1.1.1
187+
run: |
188+
sudo -E git clone --depth 1 --branch OpenSSL_1_1_1-stable https://github.com/openssl/openssl.git
189+
cd openssl
190+
sudo -E perl ./Configure darwin64-arm64-cc --prefix=/usr/local --openssldir=/usr/local/openssl
191+
sudo -E make -j
192+
sudo -E make install MANDIR=/usr/local/openssl/share/man MANSUFFIX=ssl
193+
194+
- name: Build TDLib
195+
run: |
196+
git clone https://github.com/tdlib/td.git
197+
cd td
198+
sed -i '' '
199+
/^if[[:space:]]*(NOT CMAKE_CROSSCOMPILING)[[:space:]]*$/{
200+
N
201+
s/^if[[:space:]]*(NOT CMAKE_CROSSCOMPILING)[[:space:]]*\n[[:space:]]*add_executable(tg_cli /if (FALSE)\n add_executable(tg_cli /
202+
}
203+
' CMakeLists.txt
204+
sed -i '' '
205+
s/^[[:space:]]*add_subdirectory(benchmark)[[:space:]]*$/# add_subdirectory(benchmark)/;
206+
s/^[[:space:]]*add_subdirectory(test)[[:space:]]*$/# add_subdirectory(test)/
207+
' CMakeLists.txt
208+
209+
rm -rf build
210+
mkdir build
211+
cd build
212+
sudo -E cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR=/usr/local -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DTD_ENABLE_LTO=ON ..
213+
sudo -E cmake --build . --target install
214+
cd ..
215+
cd ..
216+
ls -l /usr/local
217+
218+
- name: Build wheels
219+
220+
run: |
221+
mkdir -p ./wheelhouse
222+
sudo -E python -m cibuildwheel . --output-dir ./wheelhouse
223+
224+
- name: Upload wheels
225+
uses: actions/upload-artifact@v4
226+
with:
227+
name: wheels-macos
228+
path: ./wheelhouse/*.whl
229+
152230
publish:
153231
needs: [prepare, linux-build, windows-build]
154232
runs-on: ubuntu-latest

.github/workflows/scripts/before-all-linux-64.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ cd .. && rm -rf zlib
2626
#Build TDLib
2727
git clone --depth 1 https://github.com/tdlib/td.git
2828
cd td
29+
sed -i '
30+
/^if (NOT CMAKE_CROSSCOMPILING)$/{
31+
N
32+
s/^if (NOT CMAKE_CROSSCOMPILING)\n[[:space:]]*add_executable(tg_cli /if (FALSE)\n add_executable(tg_cli /
33+
}' CMakeLists.txt
34+
sed -i '
35+
s/^[[:space:]]*add_subdirectory(benchmark)[[:space:]]*$/# add_subdirectory(benchmark)/;
36+
s/^[[:space:]]*add_subdirectory(test)[[:space:]]*$/# add_subdirectory(test)/
37+
' CMakeLists.txt
38+
2939
rm -rf build
3040
mkdir build
3141
cd build

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ By bundling **pre-built** TDLib binaries, it eliminates the effort for **manual*
1414

1515
* **Linux** (`x86_64` and `aarch64`)
1616
* Requires `glibc 2.17+`.
17-
* Includes most modern distributions like:
18-
* Debian 8+
19-
* Ubuntu 13.10+
20-
* Fedora 19+
21-
* RHEL 7+
22-
23-
* **Windows** (`x86_64`)
24-
* Windows 7+
17+
* Debian 8+, Ubuntu 13.10+, Fedora 19+, RHEL 7+
18+
19+
* **Windows** (`x86_64`) — Windows 7+
20+
21+
* **macOS** (`aarch64`) — macOS 11+
2522

2623
## Installation
2724

0 commit comments

Comments
 (0)