From 1d866d4d5ea2ded70cfcb03f280bf0b9cbe83286 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 17 Nov 2006 00:18:33 +0100 Subject: [PATCH] W32 support --- Makefile | 14 +++++++--- Rules.mak | 3 +- misc/Local.mak.w32 | 30 ++++++++++++++++++++ misc/xca.nsi | 68 ++++++++++++++++++++++++++-------------------- 4 files changed, 81 insertions(+), 34 deletions(-) create mode 100755 misc/Local.mak.w32 diff --git a/Makefile b/Makefile index b2d4932d..6a340986 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,12 @@ TAG=RELEASE.$(TVERSION) TARGET=xca-$(TVERSION) +VERSION=$(shell cat VERSION) export TOPDIR=$(shell pwd) +sinclude Local.mak + SUBDIRS=lib widgets OBJECTS=$(patsubst %, %/target.obj, $(SUBDIRS)) INSTDIR=img misc lang doc @@ -15,14 +18,14 @@ CLEANDIRS=lang doc ui bindir=bin -all: headers xca docs +all: headers xca$(SUFFIX) docs @echo -e "\n\n\nOk, compilation was successfull. \nNow do as root: 'make install'\n" re: clean all xca.o: $(OBJECTS) $(LD) $(LDFLAGS) $(OBJECTS) $(SLIBS) -r -o $@ -xca: xca.o +xca$(SUFFIX): xca.o $(CC) $(LDFLAGS) $< $(LIBS) -o $@ docs: @@ -47,7 +50,6 @@ dist: git checkout -r $(TAG) -d $(TARGET) xca && \ (cd $(TARGET) && \ ./mkxcapro.sh && lrelease xca.pro || echo 'lrelease not found !!' && \ - cat misc/xca.nsi |sed s/VERSION/$(TVERSION)/g >misc/$(TARGET).nsi && \ cd doc && linuxdoc -B html xca.sgml || echo "no linuxdoc found -> continuing"; ) && \ tar zcf $(TARGET).tar.gz $(TARGET) && \ (cd $(TARGET) && dpkg-buildpackage -rfakeroot ) @@ -76,9 +78,13 @@ xca.dmg: xca.app test -x hdiutil hdiutil create -ov -srcfolder $< $@ +setup.exe: xca$(SUFFIX) misc/xca.nsi + $(MAKE) -C lang + $(STRIP) xca$(SUFFIX) + $(MAKENSIS) /DOPENSSL=$(OPENSSLDIR_DOS) /DQTDIR=$(QTDIR_DOS) \ + /DVERSION=$(VERSION) /NOCD misc/xca.nsi .PHONY: $(SUBDIRS) xca.app Local.mak: configure ./configure -sinclude Local.mak diff --git a/Rules.mak b/Rules.mak index 38ef568d..56e15900 100644 --- a/Rules.mak +++ b/Rules.mak @@ -33,7 +33,8 @@ moc_%.cpp: %.h %.cpp $(UIC) -o $@ $< # default compile rule -%.o: %.cpp $(TOPDIR)/Local.mak +#%.o: %.cpp $(TOPDIR)/Local.mak +%.o: %.cpp $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ # partial linking of objects in one directory diff --git a/misc/Local.mak.w32 b/misc/Local.mak.w32 new file mode 100755 index 00000000..3dcc088e --- /dev/null +++ b/misc/Local.mak.w32 @@ -0,0 +1,30 @@ +QTDIR=/D/qt/4.1.1 +OPENSSLDIR=/D/openssl-0.9.8d +MAKENSIS=wine /D/nsis/makensis.exe + +QTDIR_DOS=d:\\qt\\4.1.1\\bin +OPENSSLDIR_DOS=d:\\openssl-0.9.8d + +CPPFLAGS=-I. -I.. -I$(QTDIR)/include -I$(OPENSSLDIR)/outinc +CFLAGS=-Wall -g -ggdb + +LDFLAGS= -L$(OPENSSLDIR)/out -L$(QTDIR)/lib + +# List of all libs to be compiled statically +#SLIBS= -lcrypto + +# list of dynamic libraries +LIBS=-lQtGui4 -lQtCore4 -lqtmain -lstdc++ -lws2_32 -lcrypto -lwsock32 -lgdi32 + +MOC=wine $(QTDIR)/bin/moc +UIC=wine $(QTDIR)/bin/uic + +LRELEASE=lrelease + +CC=i586-mingw32msvc-gcc +LD=i586-mingw32msvc-ld +STRIP=i586-mingw32msvc-strip +SUFFIX=.exe + +prefix=/usr/local +basedir= diff --git a/misc/xca.nsi b/misc/xca.nsi index ee25c5cd..b787314a 100755 --- a/misc/xca.nsi +++ b/misc/xca.nsi @@ -1,29 +1,41 @@ - ; xca.nsi ; ; This is the .nsi script for creating the nullsoft windows installer ; The name of the installer -Name "X CA" -Caption "X Certification Authority" - -; The licenseagreement -LicenseText "You must accept the following BSD like license to continue." -LicenseData COPYRIGHT +Name "XCA" +Caption "XCA ${VERSION} Setup" ; The file to write -OutFile "xca-VERSION.exe" +OutFile "setup.exe" ; The default installation directory InstallDir $PROGRAMFILES\xca -; Registry key to check for directory (so if you install again, it will +; Registry key to check for directory (so if you install again, it will ; overwrite the old one automatically) InstallDirRegKey HKLM SOFTWARE\xca "Install_Dir" ; The text to prompt the user to enter a directory -ComponentText "This will install the X Certification Authority (c) 2002 by Christian@Hohnstaedt.de" +;ComponentText "This will install the XCA ${VERSION} (c) 2002 - 2006 by Christian Hohnstaedt" ; The text to prompt the user to enter a directory -DirText "Choose a directory to install in to:" +;DirText "Choose a directory to install in to:" + +;SetCompressor /SOLID lzma + +!include "MUI.nsh" + +!define MUI_ABORTWARNING + +!insertmacro MUI_PAGE_LICENSE "COPYRIGHT" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +!insertmacro MUI_LANGUAGE "English" + ; The stuff to install Section "xca (required)" @@ -34,17 +46,17 @@ Section "xca (required)" UserInfo::GetAccountType Pop $0 StrCmp $0 "Admin" 0 +3 - SetShellVarContext all - Goto done - SetShellVarContext current + SetShellVarContext all + Goto done + SetShellVarContext current Win9x: - SetShellVarContext current + SetShellVarContext current done: ; Set output path to the installation directory. SetOutPath $INSTDIR ; Put file there - File "Release\xca.exe" + File "xca.exe" File "misc\dn.txt" File "misc\eku.txt" File "misc\oids.txt" @@ -69,13 +81,11 @@ Section "xca (required)" File "img\validcert.png" File "img\validcertkey.png" File "img\crl.png" - File "Release\libdb41.dll" - File "Release\SSLeay32.dll" - File "Release\libeay32.dll" - File "Release\msvcrt.dll" - File "Release\msvcp60.dll" - File "Release\qt-mt230nc.dll" File "doc\*.html" + + File "${OPENSSL}\libeay32.dll" + File "${QTDIR}\QtGui4.dll" + File "${QTDIR}\QtCore4.dll" ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\xca "Install_Dir" "$INSTDIR" @@ -94,7 +104,7 @@ SectionEnd ; uninstall stuff -UninstallText "This will uninstall xca. Hit next to continue." +UninstallText "This will uninstall XCA ${VERSION}. Hit next to continue." ; special uninstall section. Section "Uninstall" @@ -122,18 +132,18 @@ Section "Uninstall" UserInfo::GetAccountType Pop $0 StrCmp $0 "Admin" 0 +3 - SetShellVarContext all - Goto done - SetShellVarContext current + SetShellVarContext all + Goto done + SetShellVarContext current Win9x: - SetShellVarContext current + SetShellVarContext current done: - + ; remove shortcuts, if any. Delete "$SMPROGRAMS\xca\*.*" ; remove directories used. - RMDir "$SMPROGRAMS\xca" + RMDir "$SMPROGRAMS\xca" SectionEnd ; eof