
Hello, Please find attached a patch that will generate a .nsi file if --nsis is provided on the command line. This .nsi file can be use with NSIS ( http://nsis.sourceforge.net) to build an EXE installer for installing the maps with MapSource on Windows. Known limitation: for now I assume that --index and --tdbfile were present on the command line. If not the installer will probably fail because of missing files. Please let me know your feedback. Thanks, N.

Hi Nakor,
Please find attached a patch that will generate a .nsi file if --nsis is provided on the command line. This .nsi file can be use with NSIS ( http://nsis.sourceforge.net) to build an EXE installer for installing the maps with MapSource on Windows.
Known limitation: for now I assume that --index and --tdbfile were present on the command line. If not the installer will probably fail because of missing files.
Please let me know your feedback.
Thanks for the patch. I think Steve is in a better position than me to judge its merits as I have no experience in that part of mkgmap so I'll leave it to him to consider. Cheers, Mark

0> In article <264ecb9d0910281351j20df494ar217a14afa3a2e130@mail.gmail.com>, 0> Nakor <URL:mailto:nakor.wp@gmail.com> ("Nakor") wrote: Nakor> Please find attached a patch that will generate a .nsi file if --nsis is Nakor> provided on the command line. One thing I noticed: Nakor> + * @author Steve Ratcliffe I assume that's wrong?

Hi Nakor On 28/10/09 20:51, Nakor wrote:
Please find attached a patch that will generate a .nsi file if --nsis is provided on the command line. This .nsi file can be use with NSIS (http://nsis.sourceforge.net) to build an EXE installer for installing the maps with MapSource on Windows.
The thing I really like about NSIS is that you can run it on Linux too and still generate a windows installer. The package might not always have an obvious name, as on Fedora the package with makensis is called mingw32-nsis. So I think it is something should be added.
Known limitation: for now I assume that --index and --tdbfile were present on the command line. If not the installer will probably fail because of missing files.
Its OK to error out on a missing tdb file as that is not optional, but you should probably detect the presence of a mdr file though and adjust omit it from the file. I'll have to add the ability to detect MDR files to FileInfo. You should also take account of the product-id too. I will commit the patch, thanks! ..Steve

Steve, Its OK to error out on a missing tdb file as that is not optional, but
you should probably detect the presence of a mdr file though and adjust omit it from the file. I'll have to add the ability to detect MDR files to FileInfo.
You should also take account of the product-id too.
I will commit the patch, thanks!
I will definitely improve the patch based on your suggestion and other people's as well. Thanks, N.

Its OK to error out on a missing tdb file as that is not optional, but you should probably detect the presence of a mdr file though and adjust omit it from the file. I'll have to add the ability to detect MDR files to FileInfo.
You should also take account of the product-id too.
I will commit the patch, thanks!
Please find attached a modified version of the NSIS output. Changes are: * Takes in account the product-id * Now detects if an index was generated and needs to be pakcaged * .nsi file uses defines at its beginning to allow easier customization if needed (i.e. if the user wants to re-use the NSIS file and modify some values) * Added a page for displaying the license on the data Thanks, N. Index: src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java =================================================================== --- src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java (revision 1334) +++ src/uk/me/parabola/mkgmap/combiners/NsisBuilder.java (working copy) @@ -23,17 +23,22 @@ import uk.me.parabola.imgfmt.Utils; import uk.me.parabola.mkgmap.CommandArgs; +import uk.me.parabola.mkgmap.Version; public class NsisBuilder implements Combiner { private String baseFilename; private String nsisFilename; + private String licenseFilename; private String seriesName; private String id; + private int productId; + private Boolean hasIndex = true; private final List<String> mapList = new ArrayList<String>(); public void init(CommandArgs args) { int familyId = args.get("family-id", 0); + productId = args.get("product-id", 1); baseFilename = args.get("overview-mapname", "osm"); seriesName = args.get("series-name", "OSM maps"); @@ -43,6 +48,9 @@ id = tmpId.substring(3, 5) + tmpId.substring(1, 3); nsisFilename = baseFilename + ".nsi"; + licenseFilename = baseFilename + "_license.txt"; + + hasIndex = args.exists("index"); } public void onMapEnd(FileInfo finfo) { @@ -64,6 +72,14 @@ w = new FileWriter(nsisFilename); PrintWriter pw = new PrintWriter(w); + pw.format(Locale.ROOT, "!define DEFAULT_DIR \"C:\\Garmin\\Maps\\%s\"\n", seriesName); + pw.format(Locale.ROOT, "!define INSTALLER_DESCRIPTION \"%s\"\n", seriesName); + pw.format(Locale.ROOT, "!define INSTALLER_NAME \"%s\"\n", seriesName); + pw.format(Locale.ROOT, "!define MAPNAME \"%s\"\n", baseFilename); + pw.format(Locale.ROOT, "!define PRODUCT_ID \"%s\"\n", productId); + pw.format(Locale.ROOT, "!define REG_KEY \"%s\"\n", seriesName); + pw.println(); + pw.format(Locale.ROOT, "SetCompressor /SOLID lzma\n"); pw.println(); @@ -73,8 +89,8 @@ pw.format(Locale.ROOT, "; Installer pages\n"); pw.format(Locale.ROOT, "!insertmacro MUI_PAGE_WELCOME\n"); + pw.format(Locale.ROOT, "!insertmacro MUI_PAGE_LICENSE %s\n", licenseFilename); pw.format(Locale.ROOT, "!insertmacro MUI_PAGE_DIRECTORY\n"); - //pw.format(Locale.ROOT, "!insertmacro MUI_PAGE_STARTMENU Application \n"); pw.format(Locale.ROOT, "!insertmacro MUI_PAGE_INSTFILES\n"); pw.format(Locale.ROOT, "!insertmacro MUI_PAGE_FINISH\n"); pw.println(); @@ -86,27 +102,31 @@ pw.format(Locale.ROOT, "!insertmacro MUI_LANGUAGE \"English\"\n"); pw.println(); - pw.format(Locale.ROOT, "Name \"%s\"\n", seriesName); - pw.format(Locale.ROOT, "OutFile \"%s.exe\"\n", seriesName); - pw.format(Locale.ROOT, "InstallDir \"C:\\Garmin\\Maps\\%s\"\n", seriesName); + pw.format(Locale.ROOT, "Name \"${INSTALLER_DESCRIPTION}\"\n"); + pw.format(Locale.ROOT, "OutFile \"${INSTALLER_NAME}.exe\"\n"); + pw.format(Locale.ROOT, "InstallDir \"${DEFAULT_DIR}\"\n"); pw.println(); pw.format(Locale.ROOT, "Section \"MainSection\" SectionMain\n"); pw.format(Locale.ROOT, " SetOutPath \"$INSTDIR\"\n"); - pw.format(Locale.ROOT, " File \"%s.img\"\n", baseFilename); - pw.format(Locale.ROOT, " File \"%s_mdr.img\"\n", baseFilename); - pw.format(Locale.ROOT, " File \"%s.mdx\"\n", baseFilename); - pw.format(Locale.ROOT, " File \"%s.tdb\"\n", baseFilename); + pw.format(Locale.ROOT, " File \"${MAPNAME}.img\"\n"); + if (hasIndex) { + pw.format(Locale.ROOT, " File \"${MAPNAME}_mdr.img\"\n"); + pw.format(Locale.ROOT, " File \"${MAPNAME}.mdx\"\n"); + } + pw.format(Locale.ROOT, " File \"${MAPNAME}.tdb\"\n"); for (String file : mapList) { pw.format(Locale.ROOT, " File \"%s.img\"\n", file); } pw.println(); - pw.format(Locale.ROOT, " WriteRegBin HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\" \"ID\" %s\n", seriesName, id); - pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\" \"IDX\" \"$INSTDIR\\%s.mdx\"\n", seriesName, baseFilename); - pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\" \"MDR\" \"$INSTDIR\\%s_mdr.img\"\n", seriesName, baseFilename); - pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\\1\" \"BMAP\" \"$INSTDIR\\%s.img\"\n", seriesName, baseFilename); - pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\\1\" \"LOC\" \"$INSTDIR\"\n", seriesName); - pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\\1\" \"TDB\" \"$INSTDIR\\%s.tdb\"\n", seriesName, baseFilename); + pw.format(Locale.ROOT, " WriteRegBin HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"ID\" %s\n", id); + if (hasIndex) { + pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"IDX\" \"$INSTDIR\\${MAPNAME}.mdx\"\n"); + pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"MDR\" \"$INSTDIR\\${MAPNAME}_mdr.img\"\n"); + } + pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"BMAP\" \"$INSTDIR\\${MAPNAME}.img\"\n"); + pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"LOC\" \"$INSTDIR\"\n"); + pw.format(Locale.ROOT, " WriteRegStr HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"TDB\" \"$INSTDIR\\${MAPNAME}.tdb\"\n"); pw.println(); pw.format(Locale.ROOT, " WriteUninstaller \"$INSTDIR\\Uninstall.exe\"\n"); pw.println(); @@ -114,25 +134,29 @@ pw.println(); pw.format(Locale.ROOT, "Section \"Uninstall\"\n"); - pw.format(Locale.ROOT, " Delete \"$INSTDIR\\%s.img\"\n", baseFilename); + pw.format(Locale.ROOT, " Delete \"$INSTDIR\\${MAPNAME}.img\"\n"); pw.format(Locale.ROOT, " Delete \"$INSTDIR\\Uninstall.exe\"\n"); - pw.format(Locale.ROOT, " Delete \"$INSTDIR\\%s_mdr.img\"\n", baseFilename); - pw.format(Locale.ROOT, " Delete \"$INSTDIR\\%s.mdx\"\n", baseFilename); - pw.format(Locale.ROOT, " Delete \"$INSTDIR\\%s.tdb\"\n", baseFilename); + if (hasIndex) { + pw.format(Locale.ROOT, " Delete \"$INSTDIR\\${MAPNAME}_mdr.img\"\n"); + pw.format(Locale.ROOT, " Delete \"$INSTDIR\\${MAPNAME}.mdx\"\n"); + } + pw.format(Locale.ROOT, " Delete \"$INSTDIR\\${MAPNAME}.tdb\"\n"); for (String file : mapList) { pw.format(Locale.ROOT, " Delete \"$INSTDIR\\%s.img\"\n", file); } pw.println(); pw.format(Locale.ROOT, " RmDir \"$INSTDIR\"\n"); pw.println(); - pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\" \"ID\"\n", seriesName); - pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\" \"IDX\"\n", seriesName); - pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\" \"MDR\"\n", seriesName); - pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\\1\" \"BMAP\"\n", seriesName); - pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\\1\" \"LOC\"\n", seriesName); - pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\\1\" \"TDB\"\n", seriesName); - pw.format(Locale.ROOT, " DeleteRegKey /IfEmpty HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\\1\"\n", seriesName); - pw.format(Locale.ROOT, " DeleteRegKey /IfEmpty HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\%s\"\n", seriesName); + pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"ID\"\n"); + if (hasIndex) { + pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"IDX\"\n"); + pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\" \"MDR\"\n"); + } + pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"BMAP\"\n"); + pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"LOC\"\n"); + pw.format(Locale.ROOT, " DeleteRegValue HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\" \"TDB\"\n"); + pw.format(Locale.ROOT, " DeleteRegKey /IfEmpty HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\\${PRODUCT_ID}\"\n"); + pw.format(Locale.ROOT, " DeleteRegKey /IfEmpty HKLM \"SOFTWARE\\Garmin\\MapSource\\Families\\${REG_KEY}\"\n"); pw.println(); pw.format(Locale.ROOT, "SectionEnd\n"); @@ -141,5 +165,23 @@ } finally { Utils.closeFile(w); } + + try { + w = new FileWriter(licenseFilename); + PrintWriter pw = new PrintWriter(w); + + pw.format(Locale.ROOT, "OSM Street map\n"); + pw.format(Locale.ROOT, "http://www.openstreetmap.org/\n"); + pw.println(); + pw.format(Locale.ROOT, "Map data licenced under Creative Commons Attribution ShareAlike 2.0\n"); + pw.format(Locale.ROOT, "http://creativecommons.org/licenses/by-sa/2.0/\n"); + pw.println(); + pw.format(Locale.ROOT, "Map created with mkgmap-r" + Version.VERSION +"\n"); + } catch (IOException e) { + System.err.println("Could not write license file"); + } finally { + Utils.closeFile(w); + } + } }

If anyone wants to use the --nsis option, make sure to set a --family-id, otherwise the maps won't show up in MapSource. The family-name is copied from the description if you After running an NSIS installer exe made using this new option I get a message from Vista "This program might not have installed correctly", but MapSource works fine. Looking into this further, I think this is caused by the installer not adding an application in the add/remove program list. I'll try to look at this a bit better this evening. Something else, is this NSIS script supposed work with 64bit versions? Nakor wrote:
Its OK to error out on a missing tdb file as that is not optional, but you should probably detect the presence of a mdr file though and adjust omit it from the file. I'll have to add the ability to detect MDR files to FileInfo.
You should also take account of the product-id too.
I will commit the patch, thanks!
Please find attached a modified version of the NSIS output. Changes are:
* Takes in account the product-id * Now detects if an index was generated and needs to be pakcaged * .nsi file uses defines at its beginning to allow easier customization if needed (i.e. if the user wants to re-use the NSIS file and modify some values) * Added a page for displaying the license on the data
Thanks,
N.
------------------------------------------------------------------------
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hello, On Mon, Nov 16, 2009 at 7:32 AM, Lambertus <osm@na1400.info> wrote:
If anyone wants to use the --nsis option, make sure to set a --family-id, otherwise the maps won't show up in MapSource. The family-name is copied from the description if you
Thanks for the report. What is the default mkgmap behavior in this case? No family-id?
After running an NSIS installer exe made using this new option I get a message from Vista "This program might not have installed correctly", but MapSource works fine. Looking into this further, I think this is caused by the installer not adding an application in the add/remove program list. I'll try to look at this a bit better this evening.
I can try to have access to a Vista machine and look into the problem.
Something else, is this NSIS script supposed work with 64bit versions?
Sure. My machine is WIn XP 64bit and I did not have any problems. On the other hand I did not try this on a 32bit machine. Did you have any problems with 64bit? Thanks, N.

Nakor wrote:
On Mon, Nov 16, 2009 at 7:32 AM, Lambertus wrote If anyone wants to use the --nsis option, make sure to set a --family-id, otherwise the maps won't show up in MapSource. The family-name is copied from the description if you
Thanks for the report. What is the default mkgmap behavior in this case? No family-id?
The default family-id is 0 which seems good, but really isn't. With family-id=0 MapSource doesn't show the map nor lists it in the dropdown box, for me at least.
Something else, is this NSIS script supposed work with 64bit versions?
Sure. My machine is WIn XP 64bit and I did not have any problems. On the other hand I did not try this on a 32bit machine. Did you have any problems with 64bit?
No, I did not try 64bit, but because I didn't see any references for 64bit I assumed that it wasn't catered for. If you say it works fine in 64bit systems then that's great, question answered :-)

On Mon, Nov 16, 2009 at 9:17 AM, Lambertus <osm@na1400.info> wrote:
Nakor wrote:
On Mon, Nov 16, 2009 at 7:32 AM, Lambertus wrote If anyone wants to use the --nsis option, make sure to set a --family-id, otherwise the maps won't show up in MapSource. The family-name is copied from the description if you
Thanks for the report. What is the default mkgmap behavior in this case? No family-id?
The default family-id is 0 which seems good, but really isn't. With family-id=0 MapSource doesn't show the map nor lists it in the dropdown box, for me at least.
IIRC family-is 0 is a special case and needs to go somewhere else in the registry. I will look into it and post a patch if I can make t work.
Thanks, N.

On Mon, Nov 16, 2009 at 9:17 AM, Lambertus <osm@na1400.info> wrote:
Nakor wrote:
On Mon, Nov 16, 2009 at 7:32 AM, Lambertus wrote If anyone wants to use the --nsis option, make sure to set a --family-id, otherwise the maps won't show up in MapSource. The family-name is copied from the description if you
Thanks for the report. What is the default mkgmap behavior in this case? No family-id?
The default family-id is 0 which seems good, but really isn't. With family-id=0 MapSource doesn't show the map nor lists it in the dropdown box, for me at least.
Mmmh. It works for me. What are the arguments you have on mkgmap command line? Thanks, N.

My combine step: --index --overview-mapname=63240000 --series-name='OSM World Routable' --latin1 --description='OSM World Routable' --product-id=3 --family-id=2000 --tdbfile --nsis --gmapsupp *324*.img The family-id parameter I added after discovering that the map was missing from MapSource. Nakor wrote:
On Mon, Nov 16, 2009 at 9:17 AM, Lambertus <osm@na1400.info <mailto:osm@na1400.info>> wrote:
Nakor wrote: > On Mon, Nov 16, 2009 at 7:32 AM, Lambertus wrote > If anyone wants to use the --nsis option, make sure to set a > --family-id, otherwise the maps won't show up in MapSource. The > family-name is copied from the description if you > > > Thanks for the report. What is the default mkgmap behavior in this case? > No family-id? > The default family-id is 0 which seems good, but really isn't. With family-id=0 MapSource doesn't show the map nor lists it in the dropdown box, for me at least.
Mmmh. It works for me. What are the arguments you have on mkgmap command line?
Thanks,
N. ------------------------------------------------------------------------
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (5)
-
Lambertus
-
Mark Burton
-
Nakor
-
Steve Ratcliffe
-
Toby Speight