rkd77 / elinks

Fork of elinks
Other
317 stars 34 forks source link

elinks and debian bookworm #273

Open moonlightz opened 8 months ago

moonlightz commented 8 months ago

Yes, I know I can install elinks from a deb package/apt. But I need to compile elinks with javascript (spidermonkey) so I can fetch an url and elinks to render the final page. I have Debian 12 Bookworm. I wasted lots of hours installing random packages like libmozjs 102 dev and following complicated tutorials. The platform is an Raspberry PI 3 A+. I use ./configure --build=aarch64-unknown-linux-gnu to run configure or it can't seem to figure out what type of platform it is. Yes, I tried copying automake's config.guess to the root of the elinks dir. Any help appreciated.

rkd77 commented 8 months ago

apt install meson libmozjs-102-dev libsqlite3-dev libcurl4-openssl-dev libexpat1-dev libevent-dev

Also libparserutils, libwapcaplet, libhubbub, libcss and libdom are required for js version. See docker//build_ scripts how they are built. COMPONENT_TYPE=lib-shared can be used instead of static Once these libraries are installed, you can compile elinks from git.

meson setup build -Dspidermonkey=true -Dlibcurl=true -Dlibcss=true -Dlibevent=true meson compile -C build

You can also consider mujs instead of spidermonkey. spidermonkey code in elinks is not good. meson is simpler and builds faster than autotools

moonlightz commented 8 months ago

Thanks @rkd77 for the reply but I'm still facing problems. All I want to do is to make ELinks fetch an url which html has some javascript embedded, and ELinks output the rendered content for late processing.

So I re/installed the packages from the apt install line of your comment and ran ./configure and I got:


Documentation Tools ............. AsciiDoc, Pod2HTML
Manual Formats .................. HTML (one file)
Man Page Formats ................ HTML
API Documentation ............... no
gpm ............................. no
terminfo ........................ no
zlib ............................ yes
bzlib ........................... no
zstd ............................ yes
brotli .......................... no
lzma ............................ no
idn2 ............................ yes
Bookmarks ....................... yes
XBEL bookmarks .................. yes
ECMAScript (JavaScript) ......... no
Browser scripting ............... no
libev ........................... no
libevent ........................ no
SSL ............................. OpenSSL
Native Language Support ......... yes
System gettext .................. no
Cookies ......................... yes
Form history .................... yes
Global history .................. yes
Mailcap ......................... yes
Mimetypes files ................. yes
IPv6 ............................ yes
BitTorrent protocol ............. no
Data protocol ................... yes
URI rewriting ................... yes
Local CGI ....................... no
DOS Gateway Interface ........... no
Finger protocol ................. no
FSP protocol .................... no
FTP protocol .................... yes
Gemini protocol ................. no
Gopher protocol ................. no
NNTP protocol ................... no
Samba protocol .................. no
Mouse handling .................. yes
BSD sysmouse .................... no
88 colors ....................... no
256 colors ...................... no
true color ...................... no
Exmode interface ................ no
LEDs ............................ yes
Marks ........................... yes
Cascading Style Sheets .......... yes
HTML highlighting ............... no
DOM engine ...................... no
Backtrace ....................... yes
No root exec .................... no
Debug mode ...................... no
Fast mode ....................... no
Own libc stubs .................. no
Small binary .................... no
UTF-8 ........................... yes
Combining characters ............ no
Reproducible builds ............. no
Check codepoints ................ no
Regexp searching ................ TRE
System configuration directory .. /usr/local/etc/elinks
Locale catalogs directory ....... /usr/local/share/locale
Compiler flags (CFLAGS) ......... -g -O2 -Wall -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wno-array-bounds -Wno-address -fno-strict-overflow
Preprocessor flags (CPPFLAGS) ...
C++ compiler flags (CXXFLAGS)  -g -O2 -fpermissive -Wno-sign-compare
Linker flags (LDFLAGS) .......... -rdynamic
Library flags (LIBS) ............ -ltre -Wl,-z,relro  -lssl -lcrypto -lidn2 -lzstd -lz -ldl  -lexpat

I installed the libevent-dev but the configure still says no. Weird. So the other packages, libparserutils yada yada are not present on Bookwork branch of Debian. They maybe were present on previous releases of Debian but not anymore OR I probably need to enable something to access these packages. So I went to download libparserutils and the other packages manually where I could see the latest version but when I run make, I get some errors ... like it can't find Makefile.top.

mujs/libmujs-dev/libmujs2 are available from apt but they don't seem to be detected as well by configure. I mean, the Browser line and the line above this one, the ECMAScript.

moonlightz commented 8 months ago

I ended up compiling mujs and installed it to the system. I realized that also needed to use ./configure --with-muju and that indeed seems to turn ECMASupport to yes. Browser still says no. I still can't find a way to compile libcss.

┌──(pi㉿raspberrypi)-[~/libcss-0.5.0] └─$ make COMPONENT_TYPE=lib-shared 127 ⨯ Makefile:44: /Makefile.top: File or directory not found make: *** No rules for target "/Makefile.top". Stop.

rkd77 commented 8 months ago

Only libcss-0.9.1 is "supported". ecmascript must be enabled in options manager (key o).

moonlightz commented 8 months ago

Yeh, when I was posting the last comment, I had the libcss 0.5.0 open trying to compile the thing with make but this one refuses to do so. Later on, I downloaded the libcss 0.9.1 tar.gz, then tried to compile but it does the same thing. For some reason, when I run make, it just spits that it can't find the Makefile.top file.

I can't see any key o in the build.sh menu.

rkd77 commented 8 months ago

I guess you did not install netsurf-buildsystem . In docker subdir in elinks repo there are some sample scripts. If you look in Dockerfile, you'll figure it out, how to build these libraries and elinks.

rkd77 commented 8 months ago

For example win64-static.

moonlightz commented 8 months ago

Thanks for the patience. Well, you said elinks needed libcss and so on, and those libraries kinda pointed at netsurf repository. They are all there and plus some more libs. 2 days ago (moment of writing), I cloned their git and even the tar.gz, compiled+installed netsurf without any major problem. But the libearies (*.h) aren't "moved" to the /usr/include subfolders so elinks can pick them up and compile with them. Today morning I looked at the buildsystem dir of netsurf and ran make install but I'm not sure what it suppose to do. It seems to copy stuff to /opt dir. Yesterday, I looked at the docker dir of elinks dir. There are some named platforms directories. I guessed that I should looked at arm64 because the OS is aarch64/arm64. I had to install docker (which gave some trouble) and I even made confusion with docker package available in Debian. Once docker was installed, I went to arm64 and ran ./build.sh but it seemed to required sudo, I ran sudo ./build.sh. Then I wasted sometime figure out why there was temporary failure while resolving the addresses. It seems that docker is "some" sort of layer that doesn't follow the system configs. I had to add a file telling to use google's dns into /etc/docker's dir. Even so, I couldn't sucessfully finish the task. I kept opening the Dockerfile and looked at some cd /root. I tought to myself... I need probably more elinks to /root and use the root account, I did that but looking closely to the Docke rfile, the docker expects the openssl and zlib1g to be in /root but they aren't. They seem to be under /root/elinks/docker/arm64 and that's not all... it also simply fails when compiles the openssl for example... giving error 127.

And yes, I also tried creating manually the /usr/include to have /usr/include/dom .../libparserutils etc... and when I run make from elinks, it seems to proceed through the compiling but it kind fails... with errors like undefined something_string_length something_string_destroy.

I'm thinking about spending at least 2 more days to get elinks+javascript working on Debian 12 aarch64 working. If I fail, I will have to search for alternatives.

rkd77 commented 8 months ago

I'm talking about git version of elinks. Dockerfile is something like rpm's spec file or deb's debian subdirectory for building packages. win64-static is similar to Debian, because it also is based on debian bookworm. build_netsurf_buildsystem.sh looks like this:

wget http://download.netsurf-browser.org/libs/releases/buildsystem-1.9.tar.gz
tar -xf buildsystem-1.9.tar.gz
make -C buildsystem-1.9 install PREFIX=$HOME

You don't have to change anything in above script, maybe PREFIX. Next is parserutils:

export LIBRARY_PATH="$HOME/lib"
export PKG_CONFIG_PATH="$HOME/lib/pkgconfig"
export C_INCLUDE_PATH="$HOME/include"
export CFLAGS="-O2 -I$HOME/include -Wno-error"
export CXXFLAGS="-O2 -I$HOME/include -Wno-error"
export LDFLAGS="-L$HOME/lib"
export CC="x86_64-w64-mingw32-gcc"
export AR="x86_64-w64-mingw32-ar"
cd
wget http://download.netsurf-browser.org/libs/releases/libparserutils-0.2.4-src.tar.gz
rm -rf libparserutils-0.2.4
tar -xf libparserutils-0.2.4-src.tar.gz
make -C libparserutils-0.2.4 install -j1 Q= PREFIX=$HOME LIBDIR=lib COMPONENT_TYPE=lib-static

This is for crosscompilation, but if you change CC=gcc and AR=ar you'll get native compilation. You can also set COMPONENT_TYPE=lib-shared. For other netsurf's libraries similar changes. In these script libraries will be installed in ~/lib , headers in ~/include and so on. You can change $HOME to something else. Order of build scripts is in Dockerfile. Sorry, I cannot imagine how it can be simpler.

moonlightz commented 8 months ago

Thanks again for the patience. Those last instructions were really useful. With a bit of fiddling, I was able to make elinks install dir to fetch the remaining libs (libparserutils, etc). ECMAScript was finally showing up under elinks' options. I opened a test website and ... it made elinks erroring out in a loop and I needed to open a second session and kill the elinks process. I used --enable-mujs

Off-topic: Other thing that started bothering me is the lack of mouse handling even the ./configure summary at the end says mouse-handling yes. No matter what I do (--enable-mouse, --enable-sysmouse, --enable-xterm, or a combination of these), the mouse simply doesn't work. When I hover the putty window, I get simply a I-beam cursor. No such problem with regular elinks from debian repository. I guess I need to figure out first what's wrong. Last note, I thought it was the "gpm... no" but even that turned to yes (libgpm-dev), it's no use.

By the way, no idea where those elinks translations come from. I am portuguese from Portugal and when I open elinks, I can see that menu is translated but when I open it, the menu options are mixed between English and portuguese translations, even these ones are incorrectly translated (it appears to be there a mix between pt_PT and pt_BR). When such thing happens (programs and websites (they usually use the "door nail" Google translate in majority of the cases)), I really like to switch to English. Looking at po/pt.po, I can now really see the why there are tons of problems... some strings are unpopulated, some are incorrect, some really don't match, some seem to be in brazillian... I CAN probably help here because I usually translate things "here and there" and a big file like that one.. will take some days to make it ok and pretty. When I translated things in the past, my soul concerning was/is that there are plently of ambiguous strings in English and that may affect the translation to other languages.

rkd77 commented 8 months ago

Yes, js does not work. It was added in chaotic way. I wan't focus on some real scripts. First in the queue is shellinabox, but not this year. Scripts which modify html don't work well and these are 99.99%.

Mouse works for me in konsole terminal, so I would check 0.16.1.1 compiled with the same options as current git. If in 0.16.1.1 mouse is usable, git bisect to find out bad commit.

Yes, translations are welcome. .po files are regenerated from time to time. I accept pull requests with translations.

moonlightz commented 8 months ago

Well I can confirm the mouse works with 0.15.x 0.16.x 0.17.x WHEN I have an GUI like X11 with any graphical console AND with CTRL+ALT+F1..F6, then login, running elinks on text-mode, the mouse works. I created a new VM using Oracle Virttualbox. The host is Windows. On my laptop running Windows+Putty, I still can't make use of the mouse. Yet again the regular elinks from debian repos. Mouse handling and gpm is also enabled. Not sure what is happening. Not sure if this is related. https://github.com/termux/termux-packages/pull/11872