xnedit icon indicating copy to clipboard operation
xnedit copied to clipboard

package for Windows

Open efa opened this issue 3 years ago • 82 comments

hi, I want try to create a package for Windows, with all the dependancies. Is not much difficult using the very old version from Cygwin, but I want to generate your version.

At first I want try native compile using MSYS2, then try to crosscompile using MXE. Some one has already tryed to do that? In case, any hints? thank you

efa avatar May 19 '21 16:05 efa

I have not tried to compile xnedit on windows. I have no experience with Cygwin, but I guess, if nedit worked with cygwin, xnedit should work too.

I don't think msys2 will work, because it doesn't provide a posix compatible environment.

unixwork avatar May 19 '21 18:05 unixwork

@efa try nedit-ng

1div0 avatar May 20 '21 14:05 1div0

@1div0 do you know if unicode support for nedit-ng is in active development?

unixwork avatar May 21 '21 10:05 unixwork

unicode is the main argument I'm asking for xnedit on Windows.

About nedit-ng (current git does not have Unicode support), I tryed to generate it with MINGW, the standalone package (with QT and all deps) is not less than 160 MB, while for comparison Notepad++ is 10 MB, so I cannot consider it an easy replacement

efa avatar May 21 '21 15:05 efa

@1div0 do you know if unicode support for nedit-ng is in active development?

I intended to implement it, but recently have no time and motivation for that. So sorry.

1div0 avatar May 22 '21 11:05 1div0

once solved some troubles, I will try to package the Cygwin binaries

efa avatar May 25 '21 15:05 efa

@efa nedit-ng author here :-).

I can say that Unicode is definitely on my radare, but it is not the current focus of development. Since NG is basically a complete port, there are some small areas that are not a perfect reproduction of the classic NEdit5 behavior.

Since NG is targetting being the "official NEdit 6.0", the current focus of development is to fix these small issues and then use 6.1 for larger changes.

Regarding package size, I would recommend at the very least building with visual-studio community edition. Using that approach and the Qt tools for getting a "complete package", NG was about 22MB (including Qt dependencies) for the 2019.2 release. So it definitely shouldn't be 160MB! (I'm guessing that you included ALL of Qt, not just the few components NG needs?).

Anyway, we'll get there, but for now, if Unicode is the prime feature you need, xnedit is a great option for you (though I'll certainly welcome you as a user when Unicode support arrives in NG ;-) ).

eteran avatar May 26 '21 17:05 eteran

I will open an Issue on https://github.com/eteran/nedit-ng to avoid pollution here https://github.com/eteran/nedit-ng/issues/312

efa avatar May 26 '21 21:05 efa

Running in Cygwin is always OK. I generated the first Cygwin package with all the dependencies:

D:\installer\xnedit>
  135.187 cygbrotlicommon-1.dll
   47.123 cygbrotlidec-1.dll
   67.603 cygbz2-1.dll
  185.363 cygexpat-1.dll
  256.531 cygfontconfig-1.dll
  720.915 cygfreetype-6.dll
   73.747 cyggcc_s-seh-1.dll
   82.963 cygICE-6.dll
1.030.675 cygiconv-2.dll
   42.515 cygintl-8.dll
  642.067 cygjpeg-8.dll
  509.459 cygpcre-1.dll
  189.459 cygpng16-16.dll
   29.203 cygSM-6.dll
   27.155 cyguuid-1.dll
3.618.249 cygwin1.dll
1.192.979 cygX11-6.dll
   12.819 cygXau-6.dll
  137.747 cygxcb-1.dll
   21.011 cygXdmcp-6.dll
   60.947 cygXext-6.dll
   78.355 cygXft-2.dll
2.292.755 cygXm-4.dll
   89.619 cygXmu-6.dll
   65.555 cygXpm-4.dll
   38.419 cygXrender-1.dll
  351.263 cygXt-6.dll
   85.011 cygz.dll
   29.184 xnc.exe
1.444.864 xnedit.exe
30 File     13.558.742 byte

now running the executable doesn't complaint about missing DLL. But running outside Cygwin in a CMD sandbox, miss something of font configuration:

D:\installer\xnedit>xnedit.exe
Fontconfig error: Cannot load default config file
Cannot open default font

can you figure out what is missing?

efa avatar May 27 '21 14:05 efa

Usually on unix fontconfig config is at /etc/fonts/. Additionally you need the actual fonts from /usr/share/fonts/

However I don't know the cygwin directory structure.

unixwork avatar May 27 '21 14:05 unixwork

Cygwin use the same directory structure. I added the file: .config\fontconfig\fonts.conf and defined the env var: >set FONTCONFIG_PATH=.config\fontconfig and now the error is reduced to:

D:\installer\xnedit>xnedit.exe
Cannot open default font

efa avatar May 27 '21 16:05 efa

The actual font is missing, which should be in /usr/share/fonts/

unixwork avatar May 27 '21 17:05 unixwork

this as simple doesn't work. I'm working on it

efa avatar May 28 '21 07:05 efa

do not start neither with:

D:\installer\xnedit>xnedit.exe -font DejaVuSansMono
Cannot open default font

efa avatar May 28 '21 09:05 efa

I had to figure why fontconfig doesn't find the default font. I had the fonts in:

D:\installer\xnedit>dir usr\share\fonts\dejavu

06/08/2019  11:29                36 .uuid
06/09/2016  19:29           577.708 DejaVuMathTeXGyre.ttf
06/09/2016  19:29           705.684 DejaVuSans-Bold.ttf
06/09/2016  19:29           643.292 DejaVuSans-BoldOblique.ttf
06/09/2016  19:29           355.376 DejaVuSans-ExtraLight.ttf
06/09/2016  19:29           635.416 DejaVuSans-Oblique.ttf
06/09/2016  19:29           757.076 DejaVuSans.ttf
06/09/2016  19:29           665.028 DejaVuSansCondensed-Bold.ttf
06/09/2016  19:29           611.836 DejaVuSansCondensed-BoldOblique.ttf
06/09/2016  19:29           599.292 DejaVuSansCondensed-Oblique.ttf
06/09/2016  19:29           680.264 DejaVuSansCondensed.ttf
06/09/2016  19:29           331.992 DejaVuSansMono-Bold.ttf
06/09/2016  19:29           253.580 DejaVuSansMono-BoldOblique.ttf
06/09/2016  19:29           251.932 DejaVuSansMono-Oblique.ttf
06/09/2016  19:29           340.712 DejaVuSansMono.ttf
06/09/2016  19:29           356.088 DejaVuSerif-Bold.ttf
06/09/2016  19:29           347.460 DejaVuSerif-BoldItalic.ttf
06/09/2016  19:29           345.996 DejaVuSerif-Italic.ttf
06/09/2016  19:29           380.132 DejaVuSerif.ttf
06/09/2016  19:29           331.244 DejaVuSerifCondensed-Bold.ttf
06/09/2016  19:29           346.508 DejaVuSerifCondensed-BoldItalic.ttf
06/09/2016  19:29           345.324 DejaVuSerifCondensed-Italic.ttf
06/09/2016  19:29           346.664 DejaVuSerifCondensed.ttf
              23 File     10.208.640 byte

efa avatar May 28 '21 11:05 efa

I also tryed to create a file: .Xresources and load it with: D:\installer\xnedit>xrdb -merge .Xresources check it is loaded with:

D:\installer\xnedit>xrdb -q
nedit*faceName: DejaVuSansMono
nedit*faceSize: 11
xnedit*faceName:        DejaVuSansMono
xnedit*faceSize:        11

Note: I'm not sure if I had to use nedit or xnedit in X resource file, so used both

but the results from: D:\installer\xnedit>fc-match DejaVuSansMono is empty and running xnedit the error is always "Cannot open default font"

I tryed to run 'xeyes' and it start, but that do not use fonts.

efa avatar May 28 '21 12:05 efa

fc-match must show something, otherwise it will not work in xnedit

In the fonts.conf there should be one or multiple

elements specifying the directories, where fonts are stored. For example:

<dir prefix="xdg">fonts</dir>

this does specify, that the fonts are loaded from $XDG_DATA_HOME/fonts

unixwork avatar May 28 '21 13:05 unixwork

I tryed to re-package Nedit5.5 (the oldest available with Cygwin) @32 and 64bit, and it work easily (seems it do not depend on fontconfig config files, so always start). Then I tryed to package Nedit5.6 (the newest available with Cygwin) @32 and 64bit, and it wont start. It depend on fontconfig config files. After some trouble, enabling Fontconfig debug, I understood the local fonts directory must be called .fonts and not fonts, finally I got it start. The same experience is needed with xnedit, I imagine it is derived from Nedit 5.6 Now it start, but on first start it do not find the monospace font, it is using Arial:

>fc-match mono
arial.ttf: "Arial" "Regular"

As I had understood I had to add an alias in the config file. Lets try

efa avatar Jun 06 '21 17:06 efa

bingo:

D:\installer\xnedit_64bit>sh.exe bash.exe: warning: could not find /tmp, please create! sh-4.4$ fc-match mono DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

xnedit_cygwin_package00 now I had to refine a little the start script, as it has all static and absolute paths

efa avatar Jun 06 '21 17:06 efa

hi, I ended the first beta of a script to create the Win package.

As now I left many debug prints just to check if and when something fail. It generate an installation directory, with all needed dependancies files, with a batch file to be used to run the executable. The batch file run a bash and a bash script that create all the env vars needed for XNEdit to work well. Those are partly derived from Nedit 5.5 official Win package (the last one released as I know).

I tryed to open the batch from a CMD with nothing in the PATH, from:

  • current and other path related to the executable
  • without, with one and with more than one parameters
  • with a double click from Windows Explorer
  • using "open with" in Windows Explorer on a data file, and on many data file at once
  • with Cygwin32 and 64bit

there are still some WARN messages (maybe you can help me on this) but it continue and work well. I can't exclude there can be some glithes, but seems to me it is decently stable, and I need more testers to refine further.

So, if you are interested, how can I upload the package (are 5 files)? I prefer a git pull request. Do you prefer to create a new directory for this?

Note: I had to synch to last commit as I'm working with 1.3.0, but I do not expect trouble on this.

efa avatar Jul 01 '21 12:07 efa

Just updated to tag v1.3.2

D:\installer\xnedit_64bit>tree /a /f
|   fonts.conf
|   hide.vbs
|   xnc.sh
|   xnedit.bat
|   xnedit.ico
|   XNEdit.lnk
|
+---.xnedit
|       autoload.nm
|       cygspecial.nm
|       nedit.history
|       nedit.rc
|
+---fonts
|   |   .uuid
|   |
|   \---dejavu
|           .uuid
|           DejaVuSansMono-Bold.ttf
|           DejaVuSansMono-BoldOblique.ttf
|           DejaVuSansMono-Oblique.ttf
|           DejaVuSansMono.ttf
|
\---usr
    \---bin
            awk
            bash.exe
            cat.exe
            ctags.exe
            cygbrotlicommon-1.dll
            cygbrotlidec-1.dll
            cygbz2-1.dll
            cygexpat-1.dll
            cygfontconfig-1.dll
            cygfreetype-6.dll
            cyggcc_s-seh-1.dll
            cyggmp-10.dll
            cygICE-6.dll
            cygiconv-2.dll
            cygintl-8.dll
            cygjpeg-8.dll
            cygmpfr-6.dll
            cygncursesw-10.dll
            cygpath.exe
            cygpcre-1.dll
            cygpng16-16.dll
            cygreadline7.dll
            cygsigsegv-2.dll
            cygSM-6.dll
            cyguuid-1.dll
            cygwin1.dll
            cygX11-6.dll
            cygXau-6.dll
            cygxcb-1.dll
            cygXdmcp-6.dll
            cygXext-6.dll
            cygXft-2.dll
            cygXm-4.dll
            cygXmu-6.dll
            cygXpm-4.dll
            cygXrender-1.dll
            cygXt-6.dll
            cygz.dll
            date.exe
            diff.exe
            dos2unix.exe
            echo.exe
            expand.exe
            gawk.exe
            grep.exe
            ls.exe
            nl.exe
            sed.exe
            sleep.exe
            sort.exe
            test.exe
            tr.exe
            unexpand.exe
            wc.exe
            xnc.exe
            xnedit.exe

as now the package is 21 MB and binaries are not stripped

xnedit_cygwin_package01

efa avatar Jul 01 '21 15:07 efa

Hi,

thanks for the work on the windows package. A pull request would be great. You can place your files to the resources subdirectory, maybe resources/cygwin.

unixwork avatar Jul 01 '21 17:07 unixwork

I think with https://github.com/unixwork/xnedit/pull/43 you can close this Issue. Or you can leave open the Issue to further discuss future troubles and track other PR I will do, as you want

efa avatar Jul 07 '21 20:07 efa

I tested on another PC and work the same.

On 'xnedit.bat' startup, I got this log:

D:\installer\xnedit_64bit>xnedit.bat
Starting 'xnedit.bat' ...
D:\installer\xnedit_64bit
Batch param:
Batch param:
bash.exe: warning: could not find /tmp, please create!
Starting 'xnc.sh' ...
Bash param:
PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
PATH=/cygdrive/d/installer/xnedit_64bit/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
HOME=/cygdrive/c/Users/username
HOME=/cygdrive/c/Users/username
XNEDIT_HOME=/cygdrive/d/installer/xnedit_64bit/.xnedit
DISPLAY=:0
XKEYSYMDB=/cygdrive/d/installer/xnedit_64bit/xkeysymdb
FONTCONFIG_PATH=/cygdrive/d/installer/xnedit_64bit
XDG_DATA_HOME=/cygdrive/d/installer/xnedit_64bit
Run Xnedit without parameters ...
Cannot get X Input Manager

Mostly are my debug prints, but there are two warns:

bash.exe: warning: could not find /tmp, please create!
Cannot get X Input Manager

the first one seems a bug with current Cygwin, and the simple fix does not work, I had to search a fix in them mail list.

Do you have an idea how to fix the "Cannot get X Input Manager"?

As now "xkeysymdb" is not there ($XKEYSYMDB), but copying my file, does not solve.

Note: everything seems work also with those WARNs.

efa avatar Jul 08 '21 12:07 efa

Hi,

The "Cannot get X Input Manager" is an error message that I've implemented in case the function XmImGetXIM fails. I don't know why it fails, I have to check that.

As a result of this error, some characters can't be typed. Looks like only ASCII works. I will try to fix that.

Everything else seems to work.

unixwork avatar Jul 09 '21 08:07 unixwork

note: If I run xnedit from inside Cygwin shell I do not get that error. Happen only with the distribution package I have made. So I want to fix that. Should I not be able to insert any non-ASCII characters?

efa avatar Jul 09 '21 13:07 efa

I had fixed the error "warning: could not find /tmp, please create!" creating the /tmp inside /usr, I do not know why there, but works

efa avatar Jul 09 '21 13:07 efa

exact, no non-ASCII chars can be entered using my distribution package, while in Cygwin shell xnedit works. Here the characters that works with Italian keyboard:

\1234567890'
   qwertyuiop+
asdfghjkl
<zxcvbnm,.-
|!"$%&/()=?^
QWERTYUIOP*{}
ASDFGHJKL
>ZXCVBNM;:_

so miss: £ìèéçò°ù§€

Edit menu, Insert Unicode (I tested `=0096, ~=0126 and è=0232) work

efa avatar Jul 09 '21 13:07 efa

xnedit needs the files from /usr/share/X11/locale, otherwise the input method can't be initialized.

I think the path is hard coded in x11 libs, thefore the installed usr directory needs to be mounted to /usr with the cygwin mount tool.

the following steps were successful: copy share/x11/locale to D:\installer\xnedit_64bit\usr copy mount.exe to D:\installer\xnedit_64bit\usr\bin

add the following line to xnc.sh:

usr/bin/mount D:/installer/xnedit_64bit/usr /usr

unixwork avatar Jul 10 '21 11:07 unixwork

thank you for test it, and solve the bug. I will try on my systems, maybe tomorrow

efa avatar Jul 12 '21 12:07 efa