Skip to content

Commit 00100ac

Browse files
committed
Merge branch 'dev-0.9'
2 parents 142eded + 91e9d36 commit 00100ac

File tree

17 files changed

+764
-745
lines changed

17 files changed

+764
-745
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.18.0
1+
20.9.0

CMakeLists.txt

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android")
3939
# Mac Catalyst build is the only scenario we have where the target system name
4040
# is Darwin.
4141
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
42-
set(PCRE2_TARGET --target pcre2-8-static)
4342
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -target x86_64-apple-ios-macabi")
4443
set(
4544
EXTRA_BUILD_ARGS
4645
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
4746
-DCMAKE_OSX_ARCHITECTURES=${ESCAPED_ARCHS}
4847
)
48+
# This allows to not sign compiled PCRE2 executables for iOS / macOS builds,
49+
# we don't really use them anyway, but we need them build for the install
50+
# command below to work.
51+
set(EXTRA_INSTALL_ARGS "--;CODE_SIGNING_ALLOWED=NO")
52+
4953
elseif(CMAKE_SYSTEM_NAME MATCHES "iOS")
5054
set(
5155
EXTRA_BUILD_ARGS
@@ -55,7 +59,10 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "iOS")
5559
-DCMAKE_IOS_INSTALL_COMBINED=${CMAKE_IOS_INSTALL_COMBINED}
5660
-GXcode
5761
)
58-
set(PCRE2_TARGET --target pcre2-8-static)
62+
# This allows to not sign compiled PCRE2 executables for iOS / macOS builds,
63+
# we don't really use them anyway, but we need them build for the install
64+
# command below to work.
65+
set(EXTRA_INSTALL_ARGS "--;CODE_SIGNING_ALLOWED=NO")
5966
endif()
6067

6168
if(CMAKE_SYSTEM_NAME MATCHES "Android|Windows")
@@ -75,21 +82,10 @@ execute_process(
7582

7683
execute_process(
7784
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}/pcre2
78-
--config Release
79-
${PCRE2_TARGET}
85+
--config Release ${EXTRA_INSTALL_ARGS}
8086
)
8187

82-
if(
83-
NOT CMAKE_SYSTEM_NAME MATCHES "iOS"
84-
85-
# TODO: We wanna say "and not Mac Catalyst build", for which the current
86-
# condition is not specific enough, but will do for now, as Mac Catalyst
87-
# build is the only scenario we gonna have Darwin as the target platform
88-
# as of now.
89-
AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin"
90-
)
91-
execute_process(COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR}/pcre2)
92-
endif()
88+
execute_process(COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR}/pcre2)
9389

9490
# Copies shared PCRE2 library into the folder from where Gradle automatically
9591
# will bundle it in the host app package.
@@ -104,21 +100,18 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android|Windows")
104100
set(BUILD_SHARED_LIBS 1)
105101
endif()
106102

107-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPCRE2_CODE_UNIT_WIDTH=8 -I${CMAKE_BINARY_DIR}/sysroot/include -L${CMAKE_BINARY_DIR}/sysroot/lib")
108-
109-
# To find PCRE2 Lighttpd first of all tries to use pkg_check_modules().
110-
# It seems that on Linux it ends up relying on pkg-config utility of the host
111-
# system, which find the host's version of PCRE2. With CMake 3.18.1 it was fine,
112-
# as it used to output the linker flag for PCRE2 just as "-lpcre2-8",
113-
# and just above we set the correct -L flag with the path of PCRE2
114-
# cross-compiled for Android. However, with CMake 3.22.1 the CMake's default
115-
# output is "-L/usr/lib/x86_64-linux-gnu;-lpcre2-8", which ends up forcing
116-
# Lighttpd to try linking against the host's PCRE2, which fails. The flag set
117-
# below instructs pkg-config to not include -L flag into outputs,
118-
# thus restoring the correct linking. However, it is not the best fix,
119-
# I guess.
120-
# TODO: Find a better fix.
121-
set(PKG_CONFIG_ARGN --libs-only-l)
103+
# Above we have build & installed a local version of PCRE2 library, now we want
104+
# to enforce Lighttpd build to see and use it (rather than any system-wide
105+
# installation of another PCRE2 version). On Ubuntu / macOS it can be done
106+
# by setting CMAKE_PREFIX_PATH; somehow it has no effect in Msys2 / UCRT64
107+
# builds for Windows (beyond by current understanding), but there setting
108+
# the PKG_CONFIG_PATH environment variable, which is picked up by pkg-config
109+
# does the trick.
110+
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
111+
set(ENV{PKG_CONFIG_PATH} "${CMAKE_BINARY_DIR}/sysroot/lib/pkgconfig")
112+
else()
113+
set(CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/sysroot")
114+
endif()
122115

123116
add_subdirectory(lighttpd1.4)
124117

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![GitHub Repo stars](https://img.shields.io/github/stars/birdofpreyru/react-native-static-server?style=social)](https://github.com/birdofpreyru/react-native-static-server)
77
[![Dr. Pogodin Studio](https://raw.githubusercontent.com/birdofpreyru/react-native-static-server/master/.README/logo-dr-pogodin-studio.svg)](https://dr.pogodin.studio/docs/react-native-static-server)
88

9-
Embed HTTP server for [React Native] applications for Android, iOS, Mac (Catalyst),
9+
Embedded HTTP server for [React Native] applications for Android, iOS, Mac (Catalyst),
1010
and Windows platforms. Powered by [Lighttpd] server, supports both [new][New Architecture]
1111
and [old][Old Architecture] RN architectures.
1212

@@ -109,11 +109,21 @@ and [old][Old Architecture] RN architectures.
109109
- For **Android**:
110110
- In the `build.gradle` file set `minSdkVersion` equal `28`
111111
([SDK 28 — Android 9](https://developer.android.com/studio/releases/platforms#9.0),
112-
released in August 2018), or larger.
113-
112+
released in August 2018), or larger. \
114113
**Note:** _Support of older SDKs is technically possible, but it is not
115114
a priority now._
116115
116+
- Android SDK 28 and above
117+
[forbids Cleartext / Plaintext HTTP](https://developer.android.com/privacy-and-security/risks/cleartext)
118+
by default. Thus, to access locally running server over HTTP from within
119+
your app, you should either allow all uses of HTTP in your app by adding
120+
`android:usesCleartextTraffic="true"` attribute to `<application>` element
121+
in the `AndroidManifest.xml`
122+
([see how it is done in the example app](https://github.com/birdofpreyru/react-native-static-server/blob/master/example/android/app/src/main/AndroidManifest.xml));
123+
or alternatively you should use
124+
[network security configuration](https://developer.android.com/privacy-and-security/security-config)
125+
to permit cleartext HTTP for selected domains only.
126+
117127
- For **iOS**:
118128
- After installing the package, enter `ios` folder of the app's codebase
119129
and execute

example/Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
gem 'cocoapods', '~> 1.12'
6+
gem 'cocoapods', '~> 1.13'
7+
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'

0 commit comments

Comments
 (0)