1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-15 23:35:34 +00:00

[docker] Test version for DJGPP

This commit is contained in:
Witold Filipczyk 2022-07-10 19:28:04 +02:00
parent d64c5c01ce
commit a5c6641403
8 changed files with 307 additions and 0 deletions

92
docker/djgpp/Dockerfile Normal file
View File

@ -0,0 +1,92 @@
#
# [ djgpp ] elinks docker development environment v0.1c
#
# [*] base system
# get latest fedora
FROM fedora:latest
# prepare system
RUN dnf -y update && dnf -y install bash wget \
rsync vim screen git make automake meson unzip cmake patch
RUN cd /root; wget http://ftp.delorie.com/pub/djgpp/rpms/djcross-gcc-12.1.0/djcross-gcc-12.1.0-1ap.x86_64.rpm ; \
wget http://ftp.delorie.com/pub/djgpp/rpms/djcross-gcc-12.1.0/djcross-gcc-c++-12.1.0-1ap.x86_64.rpm ; \
wget http://ftp.delorie.com/pub/djgpp/rpms/djcross-gcc-12.1.0/djcross-gcc-tools-12.1.0-1ap.x86_64.rpm ; \
wget http://ftp.delorie.com/pub/djgpp/rpms/djcross-binutils-2.34-1ap.x86_64.rpm ; \
wget http://ftp.delorie.com/pub/djgpp/rpms/djcrx-2.05-5.x86_64.rpm ; \
rpm -Uhv *.rpm
# djgpp libraries
RUN cd /root; mkdir zip; cd zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2tk/expat20br2.zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2tk/wat3211b.zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2tk/xml2914b.zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2tk/zlb1212b.zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2apps/xz-525a.zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2apps/bz2-108a.zip; \
wget https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/repositories/1.3/apps/sqlite.zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2gnu/licv116b.zip; \
wget http://ftp.delorie.com/pub/djgpp/current/v2gnu/lidn138b.zip; \
RUN cd /root/zip; \
mkdir tmp; unzip expat20br2.zip -d tmp; cp -a tmp/include /usr/local/; cp -a tmp/lib /usr/local; rm -rf tmp; \
mkdir tmp; unzip wat3211b.zip -d tmp; mv -f tmp/net/watt/inc tmp/net/watt/include; cp -a tmp/net/watt/include /usr/local/; cp -a tmp/net/watt/lib /usr/local; rm -rf tmp; \
mkdir tmp; unzip xml2914b.zip -d tmp; cp -a tmp/include /usr/local/; cp -a tmp/lib /usr/local/; rm -rf tmp; \
mkdir tmp; unzip zlb1212b.zip -d tmp; cp -a tmp/include /usr/local/; cp -a tmp/lib /usr/local/; rm -rf tmp; \
mkdir tmp; unzip xz-525a.zip -d tmp; cp -a tmp/include /usr/local/; cp -a tmp/lib /usr/local/; rm -rf tmp; \
mkdir tmp; unzip bz2-108a.zip -d tmp; cp -a tmp/include /usr/local/; cp -a tmp/lib /usr/local/; rm -rf tmp; \
mkdir tmp; unzip sqlite.zip -d tmp; mkdir tmp/tmp2; unzip tmp/SOURCE/SQLITE/SOURCES.ZIP -d tmp/tmp2; cp -a tmp/tmp2/examples/sqlite3.h /usr/local/include/; cp -a tmp/tmp2/examples/libsqlite3.a /usr/local/lib/; \
cp -a tmp/tmp2/sqlite3.pc /usr/local/lib/pkgconfig/; rm -rf tmp; \
mkdir tmp; unzip licv116b.zip -d tmp; cp -a tmp/include /usr/local/; cp -a tmp/lib /usr/local/; rm -rf tmp; \
mkdir tmp; unzip lidn138b.zip -d tmp; cp -a tmp/include /usr/local/; cp -a tmp/lib /usr/local/; rm -rf tmp; \
sed -i -e 's|/dev/env/DJDIR|/usr/local|' /usr/local/lib/pkgconfig/*.pc
# openssl
RUN dnf -y install perl-FindBin; mkdir /root/tmp; cd /root/tmp; \
wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz; \
tar -xf openssl-1.1.1q.tar.gz; \
cd openssl-1.1.1q; \
CFLAGS="-I/usr/local/include -DWATT32_NO_OLDIES -DSHUT_RD=0 -L/usr/local/lib -fcommon" \
./Configure no-threads \
no-tests \
-static \
DJGPP \
--prefix=/usr/local \
--cross-compile-prefix=i586-pc-msdosdjgpp- && \
make depend && \
make -j6 && \
make install_runtime_libs && \
make install_dev ; \
rm -rf /root/tmp
# brotli
ADD cc.py /usr/local/bin/cc.py
ADD brotli.diff /root/brotli.diff
RUN mkdir /root/tmp; cd /root/tmp; \
wget https://github.com/google/brotli/archive/refs/tags/v1.0.9.tar.gz; \
tar -xf v1.0.9.tar.gz; \
cd brotli-1.0.9; \
patch -p1 < /root/brotli.diff; \
mkdir build; \
cd build; \
CC=cc.py cmake \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_STATIC_LIBS:BOOL=ON \
-DCMAKE_AR=/usr/bin/i586-pc-msdosdjgpp-ar \
.. ; \
make -j6 VERBOSE=1; \
make install; \
rm -rf /root/tmp
# [*] elinks sources
# get elinks source
RUN dnf -y install pkgconf-pkg-config gettext
RUN cd /root; git clone https://github.com/rkd77/elinks
ADD mes_djgpp.sh /root/elinks/mes_djgpp.sh
RUN cd /root/elinks; \
./mes_djgpp.sh;

129
docker/djgpp/brotli.diff Normal file
View File

@ -0,0 +1,129 @@
diff -Nru brotli-1.0.9.orig/CMakeLists.txt brotli-1.0.9/CMakeLists.txt
--- brotli-1.0.9.orig/CMakeLists.txt 2020-08-27 14:12:55.000000000 +0000
+++ brotli-1.0.9/CMakeLists.txt 2022-07-10 17:05:29.565513161 +0000
@@ -137,7 +137,7 @@
set(BROTLI_LIBRARIES ${BROTLI_LIBRARIES_CORE} ${LIBM_LIBRARY})
mark_as_advanced(BROTLI_LIBRARIES)
-set(BROTLI_LIBRARIES_CORE_STATIC brotlienc-static brotlidec-static brotlicommon-static)
+set(BROTLI_LIBRARIES_CORE_STATIC brotlienc brotlidec brotlicommon)
set(BROTLI_LIBRARIES_STATIC ${BROTLI_LIBRARIES_CORE_STATIC} ${LIBM_LIBRARY})
mark_as_advanced(BROTLI_LIBRARIES_STATIC)
@@ -160,19 +160,21 @@
transform_sources_list("scripts/sources.lst" "${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
-if(BROTLI_EMSCRIPTEN)
- set(BROTLI_SHARED_LIBS "")
-else()
- set(BROTLI_SHARED_LIBS brotlicommon brotlidec brotlienc)
- add_library(brotlicommon SHARED ${BROTLI_COMMON_C})
- add_library(brotlidec SHARED ${BROTLI_DEC_C})
- add_library(brotlienc SHARED ${BROTLI_ENC_C})
-endif()
-
-set(BROTLI_STATIC_LIBS brotlicommon-static brotlidec-static brotlienc-static)
-add_library(brotlicommon-static STATIC ${BROTLI_COMMON_C})
-add_library(brotlidec-static STATIC ${BROTLI_DEC_C})
-add_library(brotlienc-static STATIC ${BROTLI_ENC_C})
+#if(1
+# set(BROTLI_SHARED_LIBS "")
+#else()
+# set(BROTLI_SHARED_LIBS brotlicommon brotlidec brotlienc)
+# add_library(brotlicommon SHARED ${BROTLI_COMMON_C})
+# add_library(brotlidec SHARED ${BROTLI_DEC_C})
+# add_library(brotlienc SHARED ${BROTLI_ENC_C})
+#endif()
+
+set(BROTLI_SHARED_LIBS "")
+
+set(BROTLI_STATIC_LIBS brotlicommon brotlidec brotlienc)
+add_library(brotlicommon STATIC ${BROTLI_COMMON_C})
+add_library(brotlidec STATIC ${BROTLI_DEC_C})
+add_library(brotlienc STATIC ${BROTLI_ENC_C})
# Older CMake versions does not understand INCLUDE_DIRECTORIES property.
include_directories(${BROTLI_INCLUDE_DIRS})
@@ -195,13 +197,13 @@
set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIRS}")
endforeach()
-if(NOT BROTLI_EMSCRIPTEN)
+#if(NOT BROTLI_EMSCRIPTEN)
+#target_link_libraries(brotlidec brotlicommon)
+#target_link_libraries(brotlienc brotlicommon)
+#endif()
+
target_link_libraries(brotlidec brotlicommon)
target_link_libraries(brotlienc brotlicommon)
-endif()
-
-target_link_libraries(brotlidec-static brotlicommon-static)
-target_link_libraries(brotlienc-static brotlicommon-static)
# For projects stuck on older versions of CMake, this will set the
# BROTLI_INCLUDE_DIRS and BROTLI_LIBRARIES variables so they still
@@ -226,12 +228,12 @@
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
- install(
- TARGETS ${BROTLI_LIBRARIES_CORE}
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
- )
+# install(
+# TARGETS ${BROTLI_LIBRARIES_CORE}
+# ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+# LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+# RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+# )
install(
TARGETS ${BROTLI_LIBRARIES_CORE_STATIC}
diff -Nru brotli-1.0.9.orig/c/common/platform.h brotli-1.0.9/c/common/platform.h
--- brotli-1.0.9.orig/c/common/platform.h 2020-08-27 14:12:55.000000000 +0000
+++ brotli-1.0.9/c/common/platform.h 2022-07-10 15:34:19.368776746 +0000
@@ -29,7 +29,7 @@
#include <brotli/types.h>
#if defined(OS_LINUX) || defined(OS_CYGWIN) || defined(__EMSCRIPTEN__)
-#include <endian.h>
+//#include <endian.h>
#elif defined(OS_FREEBSD)
#include <machine/endian.h>
#elif defined(OS_MACOSX)
diff -Nru brotli-1.0.9.orig/scripts/libbrotlicommon.pc.in brotli-1.0.9/scripts/libbrotlicommon.pc.in
--- brotli-1.0.9.orig/scripts/libbrotlicommon.pc.in 2020-08-27 14:12:55.000000000 +0000
+++ brotli-1.0.9/scripts/libbrotlicommon.pc.in 2022-07-10 17:05:51.845405730 +0000
@@ -7,5 +7,5 @@
URL: https://github.com/google/brotli
Description: Brotli common dictionary library
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -R${libdir} -lbrotlicommon
+Libs: -L${libdir} -lbrotlicommon
Cflags: -I${includedir}
diff -Nru brotli-1.0.9.orig/scripts/libbrotlidec.pc.in brotli-1.0.9/scripts/libbrotlidec.pc.in
--- brotli-1.0.9.orig/scripts/libbrotlidec.pc.in 2020-08-27 14:12:55.000000000 +0000
+++ brotli-1.0.9/scripts/libbrotlidec.pc.in 2022-07-10 17:06:06.013337085 +0000
@@ -7,6 +7,6 @@
URL: https://github.com/google/brotli
Description: Brotli decoder library
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -R${libdir} -lbrotlidec
+Libs: -L${libdir} -lbrotlidec
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}
diff -Nru brotli-1.0.9.orig/scripts/libbrotlienc.pc.in brotli-1.0.9/scripts/libbrotlienc.pc.in
--- brotli-1.0.9.orig/scripts/libbrotlienc.pc.in 2020-08-27 14:12:55.000000000 +0000
+++ brotli-1.0.9/scripts/libbrotlienc.pc.in 2022-07-10 17:06:19.025273824 +0000
@@ -7,6 +7,6 @@
URL: https://github.com/google/brotli
Description: Brotli encoder library
Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -R${libdir} -lbrotlienc
+Libs: -L${libdir} -lbrotlienc
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}

2
docker/djgpp/build.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
sudo docker build -t "elinks-djgpp-dev:latest" .

12
docker/djgpp/cc.py Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/python3
import subprocess
import sys
if __name__ == '__main__':
args = ['/usr/bin/i586-pc-msdosdjgpp-gcc']
for i in sys.argv[1:]:
if i == '-rdynamic':
continue
args.append(i)
sys.exit(subprocess.call(args))

3
docker/djgpp/cleanup.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
sudo docker container stop elinks-djgpp-dev
sudo docker container rm elinks-djgpp-dev

60
docker/djgpp/mes_djgpp.sh Executable file
View File

@ -0,0 +1,60 @@
#!/bin/sh
rm -rf /tmp/builddir
LIBRARY_PATH="/usr/local/lib" \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" \
C_INCLUDE_PATH="/usr/local/include" \
CFLAGS="-O2 -I/usr/local/include -DWATT32_NO_NAMESPACE" \
LDFLAGS="-L/usr/local/lib" \
meson /tmp/builddir --cross-file cross/linux-djgpp.txt \
-D88-colors=false \
-D256-colors=false \
-Dbacktrace=false \
-Dbittorrent=false \
-Dbrotli=true \
-Dbzlib=false \
-Dcgi=false \
-Dcss=false \
-Dcombining=false \
-Ddgi=true \
-Dfastmem=true \
-Dfsp=false \
-Dgemini=true \
-Dgettext=false \
-Dgnutls=false \
-Dgopher=true \
-Dgpm=false \
-Dguile=false \
-Didn=true \
-Dipv6=true \
-Dlibev=false \
-Dlibevent=false \
-Dlzma=true \
-Dmailcap=false \
-Dmouse=true \
-Dnls=true \
-Dnntp=true \
-Dopenssl=true \
-Dperl=false \
-Dprefix=$HOME \
-Dpython=false \
-Dquickjs=false \
-Druby=false \
-Dsm-scripting=false \
-Dspidermonkey=false \
-Dstatic=true \
-Dterminfo=false \
-Dtre=false \
-Dtrue-color=false \
-Dutf-8=false \
-Dwithdebug=false \
-Dx=false \
-Dxbel=false \
-Dzlib=true \
-Dzstd=false
meson compile -C /tmp/builddir
cd /tmp/builddir
ninja install

6
docker/djgpp/run.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo docker run -it \
--name=elinks-djgpp-dev \
-v /tmp:/tmp/host \
elinks-djgpp-dev:latest \
/bin/bash

3
docker/djgpp/shell.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
sudo docker start elinks-djgpp-dev
sudo docker exec -it elinks-djgpp-dev bash