Compiling the git slrn under Windows 10
I have long been a huge fan of the Usenet client slrn and I have used it under Linux for some years. However even in my early days I was somewhat intrigued by the claim seen on the slrn website that my favourite newsreader would also run under Windows. After a little experimentation with the Windows binaries generously provided by Thomas Wiegner I decided that I would emulate my customary practice under Linux and compile the development version of slrn under the 32 bit versions of first Windows 7, then Windows 8 and now Windows 10, albeit running Windows under Virtualbox. By this I mean compile slrn under a Windows environment rather than cross-compile for Windows from within a Linux environment. I eventually succeeded in an endeavour that many regarded as a little crazy and subsequently decided to write this page so that others might perhaps follow my example.
Contents of this page...
Although best read from top to bottom I have included some navigation for those who would prefer to browse rather than read in detail:
- Some required tools... Windows 10 needs a few tools
to work with the slrn code but these are an easy download away:
- MinGW-w64... Download and install the best Open Source programming toolset for compiling native Windows applications
- Git for Windows... My choice of a suitable git client for Windows so we can download the slrn source.
- Compiling slrn... Getting to grips with the
slrn source, as well as some other required libraries.
- S-Lang... Downloading, compiling and installing S-Lang 2.3.1, a required dependency for slrn.
- libiconv... Downloading and installing libiconv 1.14 for support with some different character sets.
- openssl... Downloading and installing the very latest OepnSSL libraries so slrn can make an ssl connection to the remote server.
- slrn... Downloading and compiling the slrn source from its git repository.
- Completing the setup... A few tips to make
slrn work nicely with Windows:
- Sending email... 'Reply via email' with msmtp for Windows.
- Selecting an editor... Selecting an editor to work with slrn, in this case GVim.
- Setting slrnpull... Some basic settings for running slrnpull.
- Some final slrn.rc settings... A few other titbits.
- Starting with a batch file... A Windows batch file to launch slrn.
- The final result... A quick look at the final result!
Please feel free to use the email link at the base of this page to pass on any comments, I am always keen to improve on the information presented in this page and also to hear from fellow slrn enthusiasts!
Some required tools...
Windows 10 is a decent operating system but some additions are needed: a decent compiler and some git software. First up a quality, free compiler:
MinGW-w64...
The best choice on Windows is the MinGW-w64 compiler and since I am currently
running 32bit Windows 10 I have delved through the labyrinth of download options
and found
this modern toolchain which is targeted at 32bit Windows. Once downloaded
to keep things simple I extract the contents of the archive (minus the lead
directory name) to C:\MinGW
. This extraction location is
designed to minimise a bit of Makefile editing when compiling S-Lang and
slrn itself.
You should then permanently and cautiously add the compiler to the $PATH, this area of Windows has been a little hidden in Windows 10 and can be found by the following route:
Windows Key + X --> System --> Advanced System Settings --> Environment Variables --> System Variables
Once there add the following line cautiously to the $PATH statement:
;C:\MinGW\bin;C:\MinGW\local\bin;C:\slrn
You can also create a new $NNTPSERVER
System variable and
place your NNTP server details in here, this will make things a little less
complex later. Please note that I am using C:/slrn
to place
user configuration files for slrn, some might like to place these in the
appropriate Windows 'User' directory. I shall leave that to you to make
the necessary adjustments if you wish to do this.
Before leaving this section it would be a good idea to test the compiler and you can do so as follows:
C:\Users\andrew>gcc --version gcc (i686-win32-sjlj-rev1, Built by MinGW-W64 project) 6.2.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
And this means that you are good to go!
Git for Windows...
A git client is also required and in the world of Windows 10 you could do as I have done and download Git for Windows Be aware that again this version is for 32bit Windows. There are some reasonably arcane choices to make during installation and for what it is worth I made the following choices:
- Use Git from the Windows Command Prompt
- Checkout as-is, Commit Unix-Style line endings
- Use Windows' default console window
- Uncheck: 'Enable file system caching' and 'Enable Git Credential Manager'
Feel free to email me and tell me if these settings are at all askew, I confess that I simply wanted to get access to a command line git client!
Compiling slrn...
Compiling slrn is pretty straightforward with the latest git but before actually coming to grips with slrn we will need to get the S-Lang dependency downloaded, compiled and installed.
S-Lang...
We will need to download the required S-Lang library and for this the release version
slang-2.3.1.tar.gz
should be downloaded and extracted. Compiling instructions for S-Lang under
Windows are quite clear and can be found in the file INSTALL.pc
,
have a look at the details then open a command window in the opened archive and
run the following three commands:
mkfiles\m32init.bat mingw32-make mingw32-make install
This installs S-Lang to the default C:/MinGW/local
and slrn
will pick this up when we compile its source code.
libiconv...
slrn benefits from compiling against the external library libiconv and after scouring the Internet looking for cross-compiled, recent copies of libiconv 1.14 I finally decided to man up and build my own. I have a dedicated cross-compile environment using MinGW-w64 set up on a Linux Virtual machine and libiconv was relatively simple to build for 32bit Windows:
cd $HOME && \ wget ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz && \ tar xavf libiconv-1.14.tar.gz && cd libiconv-1.14 && \ PKG_CONFIG_PATH=$HOME/build/lib/pkgconfig \ LDFLAGS=-L$HOME/build/lib \ CFLAGS="-std=gnu89 -I$HOME/build/include" \ ./configure --prefix=$HOME/build \ --build=x86_64-pc-linux-gnu \ --host=i686-w64-mingw32 \ --enable-shared --enable-static \ --disable-dependency-tracking && \ make && make install && cd $HOME/build && \ tar cavf ../libiconv-1.14-win32-ads.tar.gz bin/ include/ lib/
But in some good news for those who do not wish to delve into the
somewhat arcane world of cross-compiling I have made available
a
libiconv 1.14 package created using the above technique which can be
simply downloaded and extracted, as I have also done, to C:/MinGW/local
.
This would then be a good time to test the libiconv installation as follows:
C:\Users\andrew>iconv --version iconv (GNU libiconv 1.14) Copyright (C) 2000-2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <"http://gnu.org/licenses/gpl.html"> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Bruno Haible.
Some manual tweaking of the slrn code will still be required to use libiconv and these details are below.
OpenSSL...
Compiling against OpenSSL has proven to be something of a tussle as I tried binary package after binary package of OpenSSL for 32bit Windows. After spending about a week going around in circles I finally decided again to 'man up' and cross compile my own. Once again I have used my dedicated Linux Virtual Machine to cross-compile, commands were a very simple:
wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz && \ tar xavf openssl-1.0.2j.tar.gz && cd openssl-1.0.2j && \ ./Configure mingw shared --cross-compile-prefix=i686-w64-mingw32- --prefix=$HOME/openssl && \ make && make install && cd $HOME/openssl && \ tar cavf ../openssl-1.0.2j-win32-ads.tar.gz bin/ lib/ include/
This archive can simply then be extracted to C:/MinGW/local
for slrn to pick up during compilation. I have placed this archive
here in
case anyone wants to use this simple compile which is aimed at 32bit Windows.
You can test your own install by first creating an empty file (to convince
OpenSSL that a real config file is in place):
type NUL > C:\MinGW\bin\openssl.cfg
And then testing as follows:
C:\Users\andrew>openssl version OpenSSL 1.0.2j 26 Sep 2016
I am relatively new to cross compiling so I am keen to hear of any better technique to accomplish this end. Some adjustment will be required to fit this in with the slrn source and that is what will now be addressed.
slrn...
We will use the latest git version of slrn to take advantage of the latest updates so open a command prompt, as detailed above, and type the following:
git clone git://git.jedsoft.org/git/slrn.git
This will give you the latest development version of slrn. Before
compiling this we will need to tweak the code a little to use the external
libraries libiconv and OpenSSL. Open the file src/win32/makefile.m32in
and alter it to reflect the following:
SSL_LIBS = -lssl -lcrypto -lgdi32 MISCLIBS = $(SSL_LIBS) -lwsock32 -lwinspool -liconv
Then open the file src/slrnconf.h
and add the following:
/* Add support for libiconv */ #define HAVE_ICONV 1
Also alter the line in src/slrnconf.h
that deals with
ssl support by changing the zero value to one:
#define SLRN_HAS_SSL_SUPPORT 1
After this slrn can then be compiled from the root directory with the following three commands in sequence, note that this will now compile and install both slrn and slrnpull:
slsh win32/m32config.sl mingw32-make mingw32-make install
And thanks to the beautiful build system for this version of slrn that is all that is required, but there is still some more work to do to complete the setup.
Completing the setup...
This page is really aimed at getting the git slrn successfully compiled under Windows 10 rather than giving a general setup guide for slrn,nevertheless there are a few small issues specific to Windows that I thought I would address here if only to remind myself of some of the issues I have sorted out when reloading time comes around!
Sending email...
The ability to send email replies from within slrn is something
that should be used rarely but it can be quite handy. I formerly used 'Fake Sendmail
for Windows' for this purpose but unfortunately it has been out of development
for several years and I could not coax it to work under Windows 10. Instead download
a
Windows build of msmtp and extract the executable to C:/MinGW/local/bin
and reference this from slrn.rc
as follows:
% Use msmtp to send mail from slrn set sendmail_command "C:/Mingw/local/bin/msmtp.exe -C C:/slrn/msmtprc -t <"
The position of the configuration file, as demonstrated above, is a little
non-standard and if you run the command msmtp --version
you
can see where the default system and user variables should really
be placed! For the record these should be:
System configuration file name: C:\ProgramData\msmtprc.txt User configuration file name: C:\Users\andrew\AppData\Roaming\msmtprc.txt
But for my setup create the file C:/slrn/msmtprc
and place
something like the following for a Gmail address, this is my own personal usage:
account Gmail host smtp.gmail.com port 587 auth on tls on tls_fingerprint C3:DD:0C:82:25:E5:A0:E0:D0:0A:B0:AC:94:47:BD:89:00:AB:7F:6E from my.email@gmail.com user my.email@gmail.com password mypassword logfile C:/slrn/msmtp.log account default : Gmail
Rather than muck around with finding the appropriate certificate from Gmail I have extracted the fingerprint of the Gmail certificate (shown above) by using the following:
msmtp -C C:/slrn/msmtprc --serverinfo --tls --tls-certcheck=off --tls-fingerprint=
This gives pretty reasonably robust security when sending mail from within slrn, this being such a rare thing that I almost regret spending half a day sorting all of this out! As a sidenote: I use a slightly older version msmtp under Windows for the simple reason that the developer no longer makes a Windows binary package available for releases after msmtp 1.6.2, see here. I will cross-compile the most recent version of msmtp on the next rainy weekend, it is a bit more of a challenge as there are 3 or dependencies to build as well...
Selecting an editor...
slrn of course does not ship with an editor and I would suggest for a
typical Windows 10 user that GVim is a fine choice, I use
version 7.3.46 as
the newest version had a few syntax changes that I could not work out.
It will need a setting something like the following in slrn.rc
:
% Set your favourite editor. Use %s for the file name and %d for the line % where the cursor should be placed (usually at the beginning of the body). set editor_command "C:/Vim/vim73/gvim +%d %s"
Note that as usual it is best to install software such as GVim to a
location without spaces in the directory names, it just makes
life so much easier. Some may be interested in the additions I
have made to the default _vimrc
file that make the GVim plus
slrn experience a little more comfortable:
" My changes to the default _vimrc that make " editing with GVim for slrn a little easier: set guifont=Consolas:h13 " Looks good on my system, also used for Terminal. colors darkblue " Background colour for the Gvim window. nnoremap Q gq} " Q command to reformat paragraphs and list. set nobackup " No backup files littering the place. set textwidth=70 " Text width to keep Usenet happy. set encoding=utf-8 " Required for 'foreign' text. set fileencoding=utf-8 " Required for 'foreign' text.
I am no GVim master so I would be very happy to hear of any better options that I should be using, but these are working fine for me at the moment.
Setting slrnpull...
To successfully run slrnpull the following settings are required in
slrn.rc
:
set spool_inn_root "/MinGW/local/var/spool/news/slrnpull" set spool_root "/MinGW/local/var/spool/news/slrnpull/news" set spool_nov_root "/MinGW/local/var/spool/news/slrnpull/news" set read_active 1 set use_slrnpull 1 set post_object "slrnpull" set server_object "spool"
This is the bare minimum to successfully point slrn towards the spool and let me tell you that slrnpull runs very nicely under Windows 10! A final thought is the addition of the following:
Some final slrn.rc settings...
There are a couple of very Windows-specific settings to note and probably a few I have forgotten as well. The following is required to get a decent display of the thread tree on Windows 8's console:
set simulate_graphic_chars 1
The following is required to launch Firefox from URLs within slrn:
set non_Xbrowser "start \"\" \"C:/Program\ Files/Mozilla\ Firefox/firefox.exe\" \"%s\""
This one is not very pretty, although it works well enough, I will keepl ooking into this one to see if a cleaner method can be used. That should just about do it but I shall add any more Windows-specific requirements as I come across them.
Starting with a batch file...
Thomas Wiegner's Windows binary had a nice batch file, required to start slrn under Windows 10, and I have borrowed liberally from it:
rem This is a batch file for slrn under windows set SLRNHOME=C:\slrn set LANG=en_AU.UTF-8 set TMP=c:\WINDOWS\Temp slrn.exe
I would suggest that you run slrnpull directly from the commandline rather than from this batch file, although please feel free to disregard this advice and let me know your preferred way of running both slrnpull and slrn itself. On my own system slrnpull is used directly from the commandline and this suits my own usage just fine.
The final result...
I run the 32 bit Windows 10 as a guest with a Slackware -current host on VirtualBox 5.1.8 and even with this slightly limiting setup the performance of slrn and slrnpull is pretty impressive. The final results from this effort read:
Microsoft Windows [Version 10.0.10240] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\andrew>slrn --version slrn pre1.0.4-2 * Note: This version is a developer preview. S-Lang Library Version: 2.3.1a Operating System: Win32 COMPILE TIME OPTIONS: Backends: +nntp +slrnpull +spool External programs / libs: -canlock -inews +ssl -uudeview +iconv Features: +decoding +emphasized_text +end_of_thread +fake_refs +gen_msgid -grouplens +msgid_cache +piping +rnlock +spoilers -strict_from Using 64 bit integers for article numbers. DEFAULTS: Default server object: nntp Default posting mechanism: nntp C:\Users\andrew>
I suspect that perhaps not all that many Windows users will be reading down this far on an admittedly fairly complex page, but in part this page functions as my own backup and a method to organise my own thoughts, in this hopefully it has been a success. I will update the page with any corrections that come in and also endeavour to keep it updated when slrn development moves further onward. It should be fun!
And in conclusion...
I have enjoyed writing this page as it has taken me right out of my comfort zone and forced me to learn a few small and valuable lessons. Please contact me with any errors of fact that you have found, any errors of opinion will probably remain uncorrected. If you are feeling generous perhaps you could also assist me keep this page alive by assisting with the hosting bills for this site, if not please feel free to utilise this page in any way you see fit and remember: "Have Fun!".