Skip to content

Commit 555573d

Browse files
committed
smb2 use cmake and support android
1 parent 2b70faa commit 555573d

File tree

7 files changed

+39
-80
lines changed

7 files changed

+39
-80
lines changed

.github/workflows/opus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ on:
55
pull_request:
66
branches: [master]
77

8-
name: Create opus Release
8+
name: Opus
99

1010
jobs:
1111
build:
12-
name: compile opus then deploy
12+
name: compile apple and android opus then deploy
1313
runs-on: macos-14
1414
env:
1515
GH_TOKEN: ${{ github.token }}

.github/workflows/smb2.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@ on:
55
pull_request:
66
branches: [master]
77

8-
name: Create smb2 Release
8+
name: Smb2
99

1010
jobs:
1111
build:
12-
name: compile smb2 then deploy
12+
name: compile apple and android smb2 then deploy
1313
runs-on: macos-14
1414
env:
1515
GH_TOKEN: ${{ github.token }}
1616
steps:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
19+
- uses: nttld/setup-ndk@v1
20+
id: setup-ndk
21+
with:
22+
ndk-version: r21e
23+
add-to-path: false
24+
local-cache: true
1925
- name: One Step
2026
run: .github/workflows/onestep.sh smb2 all

configs/libs/smb2.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
export LIB_NAME='smb2'
2626
export LIPO_LIBS="libsmb2"
27-
export LIB_DEPENDS_BIN="cmake automake autoconf libtool"
27+
export LIB_DEPENDS_BIN="cmake"
28+
export CMAKE_TARGET_NAME=smb2
2829
export GIT_LOCAL_REPO=extra/smb2
2930
export GIT_COMMIT=libsmb2-6.2
3031
export REPO_DIR=smb2

do-compile/android/smb2.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<[email protected]>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# call common cmake build shell
18+
./cmake-compatible.sh "-DENABLE_LIBKRB5=0 -DENABLE_GSSAPI=0"

do-compile/apple/cmake-compatible.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,10 @@ echo "----------------------"
7373
echo "[*] compile $LIB_NAME"
7474
echo "----------------------"
7575

76-
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
76+
if [[ "$MR_DEBUG" == "debug" ]];then
77+
cmake --build . --target $CMAKE_TARGET_NAME --config Debug -- CODE_SIGNING_ALLOWED=NO
78+
else
79+
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
80+
fi
81+
7782
cmake --install .

do-compile/apple/smb2.sh

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -13,77 +13,6 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
#
17-
18-
set -e
19-
20-
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
21-
cd "$THIS_DIR"
22-
23-
echo "=== [$0] check env begin==="
24-
env_assert "MR_ARCH"
25-
env_assert "MR_BUILD_NAME"
26-
env_assert "MR_CC"
27-
env_assert "MR_BUILD_SOURCE"
28-
env_assert "MR_BUILD_PREFIX"
29-
env_assert "MR_SYS_ROOT"
30-
env_assert "MR_HOST_NPROC"
31-
echo "MR_DEBUG:$MR_DEBUG"
32-
echo "MR_OTHER_CFLAGS:$MR_OTHER_CFLAGS"
33-
echo "===check env end==="
34-
35-
if [[ "$MR_DEBUG" == "debug" ]];then
36-
export MR_OTHER_CFLAGS="${MR_OTHER_CFLAGS} -g"
37-
else
38-
export MR_OTHER_CFLAGS="${MR_OTHER_CFLAGS} -Os"
39-
fi
40-
41-
# prepare build config
42-
CFG_FLAGS="--prefix=$MR_BUILD_PREFIX --enable-static --disable-shared --disable-dependency-tracking --disable-silent-rules"
43-
CFG_FLAGS="$CFG_FLAGS --without-libkrb5 --disable-werror"
44-
45-
CFLAGS="-arch $MR_ARCH $MR_OTHER_CFLAGS -Wno-everything -DHAVE_SOCKADDR_LEN=1 -DHAVE_SOCKADDR_STORAGE=1"
46-
47-
if [[ "$MR_DEBUG" == "debug" ]];then
48-
CFG_FLAGS="${CFG_FLAGS} use_examples=yes --disable-optimizations"
49-
fi
50-
51-
# for cross compile
52-
if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]];then
53-
echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH."
54-
# https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
55-
CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT"
56-
CFG_FLAGS="$CFG_FLAGS --host=$MR_ARCH-apple-darwin --with-sysroot=$MR_SYS_ROOT"
57-
fi
58-
59-
echo "----------------------"
60-
echo "[*] configurate $LIB_NAME"
61-
echo "----------------------"
62-
63-
cd $MR_BUILD_SOURCE
64-
65-
if [[ -f 'configure' ]]; then
66-
echo "reuse configure"
67-
else
68-
echo "auto generate configure"
69-
autoreconf -if >/dev/null
70-
fi
71-
72-
echo
73-
echo "CC: $MR_CC"
74-
echo "CFG_FLAGS: $CFG_FLAGS"
75-
echo "CFLAGS: $CFLAGS"
76-
echo
77-
78-
./configure $CFG_FLAGS \
79-
CC="$MR_CC" \
80-
CFLAGS="$CFLAGS" \
81-
LDFLAGS="$CFLAGS"
82-
83-
#----------------------
84-
echo "----------------------"
85-
echo "[*] compile $LIB_NAME"
86-
echo "----------------------"
8716

88-
make -j$MR_HOST_NPROC >/dev/null
89-
make install
17+
# call common cmake build shell
18+
./cmake-compatible.sh "-DENABLE_LIBKRB5=0 -DENABLE_GSSAPI=0"

do-init/init-repo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function pull_common() {
6161
fi
6262

6363
# fix fatal: 'stable' is not a commit and a branch 'localBranch' cannot be created from it
64-
git checkout ${GIT_COMMIT} -B localBranch
64+
git checkout -B localBranch ${GIT_COMMIT}
6565
cd - >/dev/null
6666
}
6767

0 commit comments

Comments
 (0)