mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2026-10-10 11:26:33 +00:00
Change binary names as part of curl's build
Change the binary names of curl and libcurl as part of the curl build process by patching curl's build scripts. When running 'make' in the patched curl directory the resulting binaries will be already named 'curl-impersonate-ff' and 'curl-impersonate-chrome' (and the same for libcurl), thus saving the need for manually renaming them after the compilation. This also enables running 'make install' with curl's own Makefiles in order to install curl-impersonate.
This commit is contained in:
+18
-27
@@ -145,7 +145,8 @@ RUN cd ${CURL_VERSION} && \
|
||||
# Compile curl with nghttp2, libbrotli and nss (firefox) or boringssl (chrome).
|
||||
# Enable keylogfile for debugging of TLS traffic.
|
||||
RUN cd ${CURL_VERSION} && \
|
||||
./configure --enable-static \
|
||||
./configure --prefix=/build/install \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--with-nghttp2=/usr/local \
|
||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||
@@ -159,22 +160,25 @@ RUN cd ${CURL_VERSION} && \
|
||||
CFLAGS="-I/build/boringssl/build" \
|
||||
{{/chrome}}
|
||||
USE_CURL_SSLKEYLOGFILE=true && \
|
||||
make
|
||||
make && make install
|
||||
|
||||
RUN mkdir out && \
|
||||
{{#firefox}}
|
||||
cp ${CURL_VERSION}/src/curl out/curl-impersonate-ff && \
|
||||
cp /build/install/bin/curl-impersonate-ff out/ && \
|
||||
ln -s curl-impersonate-ff out/curl-impersonate && \
|
||||
{{/firefox}}
|
||||
{{#chrome}}
|
||||
cp ${CURL_VERSION}/src/curl out/curl-impersonate-chrome && \
|
||||
cp /build/install/bin/curl-impersonate-chrome out/ && \
|
||||
ln -s curl-impersonate-chrome out/curl-impersonate && \
|
||||
{{/chrome}}
|
||||
strip out/curl-impersonate
|
||||
|
||||
RUN rm -Rf /build/install
|
||||
|
||||
# Re-compile libcurl dynamically
|
||||
RUN cd ${CURL_VERSION} && \
|
||||
./configure --with-nghttp2=/usr/local \
|
||||
./configure --prefix=/build/install \
|
||||
--with-nghttp2=/usr/local \
|
||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||
{{#firefox}}
|
||||
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
||||
@@ -186,22 +190,19 @@ RUN cd ${CURL_VERSION} && \
|
||||
CFLAGS="-I/build/boringssl/build" \
|
||||
{{/chrome}}
|
||||
USE_CURL_SSLKEYLOGFILE=true && \
|
||||
make clean && make
|
||||
make clean && make && make install
|
||||
|
||||
# Copy libcurl-impersonate and symbolic links
|
||||
RUN cp -d /build/install/lib/libcurl-impersonate* /build/out
|
||||
|
||||
# Rename to 'libcurl-impersonate' to avoid confusion, and recreate the
|
||||
# symbolic links.
|
||||
RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl.so | sed 's/.*so\.//') && \
|
||||
major=$(echo -n $ver | cut -d'.' -f1) && \
|
||||
{{#firefox}}
|
||||
cp "${CURL_VERSION}/lib/.libs/libcurl.so.$ver" "out/libcurl-impersonate-ff.so.$ver" && \
|
||||
ln -s "libcurl-impersonate-ff.so.$ver" "out/libcurl-impersonate-ff.so.$major" && \
|
||||
ln -s "libcurl-impersonate-ff.so.$ver" "out/libcurl-impersonate-ff.so" && \
|
||||
RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl-impersonate-ff.so | sed 's/.*so\.//') && \
|
||||
major=$(echo -n $ver | cut -d'.' -f1) && \
|
||||
ln -s "libcurl-impersonate-ff.so.$ver" "out/libcurl-impersonate.so.$ver" && \
|
||||
{{/firefox}}
|
||||
{{#chrome}}
|
||||
cp "${CURL_VERSION}/lib/.libs/libcurl.so.$ver" "out/libcurl-impersonate-chrome.so.$ver" && \
|
||||
ln -s "libcurl-impersonate-chrome.so.$ver" "out/libcurl-impersonate-chrome.so.$major" && \
|
||||
ln -s "libcurl-impersonate-chrome.so.$ver" "out/libcurl-impersonate-chrome.so" && \
|
||||
RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl-impersonate-chrome.so | sed 's/.*so\.//') && \
|
||||
major=$(echo -n $ver | cut -d'.' -f1) && \
|
||||
ln -s "libcurl-impersonate-chrome.so.$ver" "out/libcurl-impersonate.so.$ver" && \
|
||||
{{/chrome}}
|
||||
ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \
|
||||
@@ -232,17 +233,7 @@ RUN apk add --no-cache nss
|
||||
{{/firefox}}
|
||||
|
||||
# Copy curl-impersonate from the builder image
|
||||
{{#firefox}}
|
||||
COPY --from=builder /build/out/curl-impersonate-ff /usr/local/bin/
|
||||
RUN ln -s curl-impersonate-ff /usr/local/bin/curl-impersonate
|
||||
{{/firefox}}
|
||||
{{#chrome}}
|
||||
COPY --from=builder /build/out/curl-impersonate-chrome /usr/local/bin/
|
||||
RUN ln -s curl-impersonate-chrome /usr/local/bin/curl-impersonate
|
||||
{{/chrome}}
|
||||
COPY --from=builder /build/install /usr/local
|
||||
# Wrapper scripts
|
||||
COPY --from=builder /build/out/curl_* /usr/local/bin/
|
||||
|
||||
# Copy libcurl-impersonate from the builder image
|
||||
COPY --from=builder /build/out/libcurl-impersonate.so /usr/local/lib/
|
||||
{{/alpine}}
|
||||
|
||||
Reference in New Issue
Block a user