Wireshark-dev: Re: [Wireshark-dev] Adding install target to Makefile.nmake

From: "John Dill" <John.Dill@xxxxxxxxxxxxxxxxx>
Date: Wed, 13 Nov 2013 17:22:02 -0500
>Message: 4
> Date: Wed, 13 Nov 2013 13:44:15 -0500
> From: "John Dill" <John.Dill@xxxxxxxxxxxxxxxxx>
> To: <wireshark-dev@xxxxxxxxxxxxx>
> Subject: Re: [Wireshark-dev] Adding install target to Makefile.nmake
> Message-ID:
>         <CD873D5C230AC04B9F3C4934376CEDDC2AA26B@green-5.greenfieldengineering.local>
>        
> Content-Type: text/plain; charset="iso-8859-1"
>
> >Message: 3
> > Date: Wed, 13 Nov 2013 16:12:09 +0000
> > From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
> > To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
> > Subject: Re: [Wireshark-dev] Adding install target to Makefile.nmake
> >         for     plugins
> > Message-ID:
> >         <CALcKHKottGppUR_v5U5JqA_d2d7ovooPr1Co_Ba0=uB3rEsYbw@xxxxxxxxxxxxxx>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > On 13 November 2013 16:01, John Dill <John.Dill@xxxxxxxxxxxxxxxxx> wrote:
> >
> > >
> > > I added an install target for my protocol dissector plugin nmake file.
> > >  Simplifies the tedious step of copying it to the Wireshark/plugins folder
> > > during development and test.  Here's the snippets that I added.
> > >
> > >
> > >
> > The nmake build already copies all needed files to a directory so that the
> > build artifacts can be run for testing.  The directory is set in
> > config.nmake as INSTALL_DIR.  Is there a reason why that directory isn't
> > suitable for your tests, it's always sufficed for mine?
>
> Probably because I didn't come across README.plugins yet... :-O

I made an update to my Makefile.nmake that adds install targets that should hopefully not clash with the Wireshark build system that seems to do most of what I need without integrating my plugin into the "permanent" group of plugins.

Someone may find it useful if they are in a similar situation.

---
!IF EXIST(..\..\$(INSTALL_DIR))
INSTALL_PLUGIN_DIR=$(INSTALL_DIR)\plugins\$(VERSION)
!ENDIF

INSTALL_APP_ROOT=$(PROGRAM_FILES)\$(PROGRAM_NAME)
WIRESHARK_APP_VER=1.10.3
!IF EXIST($(INSTALL_APP_ROOT)\plugins\$(WIRESHARK_APP_VER))
INSTALL_APP_DIR=$(INSTALL_APP_ROOT)\plugins\$(WIRESHARK_APP_VER)
!ENDIF

...

!IF EXIST(..\..\$(INSTALL_PLUGIN_DIR))
install:
	@echo "Copying $(PLUGIN_NAME).dll to $(INSTALL_PLUGIN_DIR)"
	xcopy /dy $(PLUGIN_NAME).dll "..\..\$(INSTALL_PLUGIN_DIR)"
!ELSE
install:
	@echo "Copying $(PLUGIN_NAME).dll to $(INSTALL_DIR)\plugins\$(VERSION)"
	@echo "ERROR: Wireshark plugin directory not found!  Try building Wireshark first."
!ENDIF

!IF EXIST($(INSTALL_APP_ROOT))
!  IF EXIST($(INSTALL_APP_DIR))
install-app:
	@echo "Copying $(PLUGIN_NAME).dll to $(INSTALL_APP_DIR)"
	xcopy /dy $(PLUGIN_NAME).dll "$(INSTALL_APP_DIR)"
!  ELSE
install-app:
	@echo "Copying $(PLUGIN_NAME).dll to $(INSTALL_APP_ROOT)\plugins\$(WIRESHARK_APP_VER)"
	@echo "ERROR: Wireshark version $(WIRESHARK_APP_VER) not found!  Check WIRESHARK_APP_VER in Makefile.nmake"
!  ENDIF
!ELSE
install-app:
	@echo "ERROR: Wireshark not installed!"
!ENDIF
---

'nmake -f Makefile.nmake install' should copy the plugin dll to the appropriate plugins subdirectory in the Wireshark source tree (i.e. wireshark-gtk2\plugins\1.10.x).

'nmake -f Makefile.nmake install-app' should copy the plugin dll to the plugins folder of an Windows installed release of Wireshark.

Then, when it comes to the point that the plugin is ready for distribution, I can follow the procedure set in section 3.1 of README.plugins.

Best regards,
John D.

<<winmail.dat>>