Projet mkd/Cygwin

De Wiki EELL.

Version du 7 décembre 2015 à 10:09 par JPL (discuter | contributions)
(diff) ← Version précédente | Voir la version courante (diff) | Version suivante → (diff)
Cette page n'est pas finie. Veuillez considérer le plan et le contenu comme incomplets et en préparation, temporaires et sujets à caution. Si vous souhaitez participer, il vous est recommandé de consulter sa page de discussion au préalable.

Retour vers les fichiers en développement

Sommaire

Remarques

_README-Cywin64-2015.txt 
  • Note : Les paquets make et gcc doivent être installés ainsi que le paquet gettext pour la version multilingue
Make mkd.exe version 2015 for cygwin under Windows 10.
------------------------------------------------------

This version 2015 update the release 2013 

version.h :
In english version (mkd_cywin_mkd_only), the Line GETTEXT is commented.
In multilingual version (mkd_cygwin_multilang), the line GETTEXT is uncommented.

Perform mkd.exe only under cygwin :
------------------------------------- 
you can compile this version with the command ./mkd_cygwin_only.bash with the _CYGWIN_cmd (konsole for cygwin)
this version use the normal Makefile with 
//#define GETTEXT ( commented ) in version.h
#define MinGW ( uncommented ) in version.h


Perform mkd.exe under Windows_10 and under cygwin :
---------------------------------------------------- 
you can compile the new version ./mkd_cygwin_windows.bash in the _CYGWIN_cmd (konsole for cygwin)
this version use mkd_cygwin_windows.mak with the gcc windows option -mno-cygwin
 and :
#define version
//#define GETTEXT ( commented ) in version.h
#define MinGW ( uncommented ) in version.h


Perform mkd.exe in multilingual version under cygwin :
-----------------------------------------------------
Compile the new version with the command ./mkd_multilang.bash in the _CYGWIN_cmd (konsole for cygwin)
This version use mkd_multilang.mak with the options :
CFLAGS  = -I/usr/i686-pc-cygwin/sys-root/usr/include 
LDFLAGS = -L/usr/i686-pc-cygwin/sys-root/usr/lib
#define GETTEXT uncommented in version.h
#define MinGW uncommented in version.h

Versions (en)

Version Cygwin Only (beta)

Cette version utilise le Makefile standard pour générer mkd.exe et la doc sous cygwin.

DOC 

Cette version est intéressante car on peut créer une version de tests, non gobale, avec la documentation unix standard :

"make -d install DESTDIR=../tests"

On peut, si on le désire, copier la documentation vers les répertoires cygwin :

cp -Rf ../tests/usr /.
EXE 

mkd_cygwin_only.bash : Recompiler l'exécutable pour le processeur courant (X86 ou X86_64) :

#!/bin/bash

make mkd -d
Makefile 
#!/bin/make
# file: Makefile for packaging mkd on debian or ubuntu sytems
# modified by Jean-Paul Louyot 2012-06-08
# 
# Copyright: ©EELL http://edeulo.free.fr/wiki/index.php/Projet_mkd#LE_DROIT_DE_COPIE:
# for tests type command "make -d install DESTDIR=../tests" for tests
#################
#

BIN   = $(DESTDIR)/usr/bin
CATMANDIR = $(DESTDIR)/var/cache/man
ETC   = $(DESTDIR)/etc
DOC   = $(DESTDIR)/usr/share/doc
ICONS = $(DESTDIR)/usr/share/icons/hicolor
LANG  = $(DESTDIR)/usr/share/locale
MAN   = $(DESTDIR)/usr/share/man
MIME  = $(DESTDIR)/usr/share/mime

PGM	= mkd
SRCS    = mkd.c asm.c basic.c cpp.c fortran.c pascal.c shell.c tri.c
HDRS    = version.h asm.h basic.h cpp.h fortran.h pascal.h shell.h find.inc.h \
          internationalisation.h find.inc.c
OBJS    = mkd.o asm.o cpp.o basic.o fortran.o pascal.o shell.o tri.o
LIBS    =
CFLAGS  =  -O
LDFLAGS =
SPLINTFLAG = -weak


# create bin files:
$(PGM): $(SRCS) $(HDRS) # force recompilation $(SRCS) $(HDRS)
	# rm $(PGM)
	gcc -c $(CFLAGS) $(SRCS) $(LIBS)
	gcc -o $(LDFLAGS) $(PGM) $(OBJS) $(LIBS)
	chmod 755 $(PGM)
	# -@strip $(PGM) # clean ASM and Link reloc

install: $(PGM)
	# create for tests $(DESTDIR) and copy executable in bin directory:
	install -d $(BIN) $(CATMANDIR) $(ETC) $(DOC) $(ICONS) $(LANG) $(MAN) $(MIME)
	install $(PGM) $(BIN)/.
	# install docs:
	#install -d $(DOC)/$(PGM)/html
	#install -m644 doc/*.html $(DOC)/$(PGM)/html/.
	# install icons and update cache: see update in post-install package
	install -d $(ICONS)/256x256/apps $(ICONS)/48x48/apps $(ICONS)/32x32/apps $(ICONS)/16x16/apps
	chmod 644 icons/*
	cp -f icons/mkd-256x256.png $(ICONS)/256x256/apps/mkd.png
	cp -f icons/mkd-48x48.png $(ICONS)/48x48/apps/mkd.png
	cp -f icons/mkd-32x32.png $(ICONS)/32x32/apps/mkd.png
	cp -f icons/mkd-16x16.png $(ICONS)/16x16/apps/mkd.png
	if [ -e "/usr/share/icons/hicolor/16x16/apps/mkd.png" ]; \
		then gtk-update-icon-cache -t /usr/share/icons/hicolor; fi
	# install languages:
	# Installs for tests the local languages, 'de', 'es', 'fr', it, ro, etc.:
	install -d $(LANG)/en/LC_MESSAGES $(LANG)/de/LC_MESSAGES $(LANG)/fr/LC_MESSAGES
	chmod 644 lang/*
	cp -f lang/mkd_en.mo $(LANG)/en/LC_MESSAGES/mkd.mo
	cp -f lang/mkd_fr.mo $(LANG)/fr/LC_MESSAGES/mkd.mo
	# install manuals:
	## install default manual:
	install -D -m644 lang/mkd_en.1.gz $(MAN)/man1/mkd.1.gz
	## install 'de' manual:	
	#if [ -d "/usr/share/man/de.UTF-8/man1" ]; \
	#	then \
	#		install -d $(MAN)/de.UTF-8/man1; \
	#		cp -f lang/mkd_de.1.gz $(MAN)/de.UTF-8/man1/mkd.1.gz; \
	#	elif [ -d "$(MAN)/de/" ]; \
	#		then \
	#			install -d $(MAN)/de/man1; \
	#			cp -f lang/mkd_de.1.gz $(MAN)/de/man1/mkd.1.gz; \
	#fi
	## install 'fr' manual:
	if [ -d "/usr/share/man/fr.UTF-8/man1" ]; \
		then \
			install -d $(MAN)/fr.UTF-8/man1;\
			cp -f  lang/mkd_fr.1.gz $(MAN)/fr.UTF-8/man1/mkd.1.gz; \
		elif [ -d "/usr/share/man/fr/" ]; \
			then \
				install -d $(MAN)/fr/man1; \
				cp -f lang/mkd_fr.1.gz $(MAN)/fr/man1/mkd.1.gz ; \
	fi
	# install catman only if selected manuals exist:
	if [ -e $(MAN)"/man1" ]; then catman -M $(MAN)/man1/mkd.1.gz; fi
	if [ -e $(MAN)"/de.UTF-8/man1/mkd.1.gz" ]; then catman -M $(MAN)/de.UTF-8/man1/mkd.1.gz; fi
	if [ -e $(MAN)"/de/man1/mkd.1.gz" ]; then catman -M $(MAN)/de/man1/mkd.1.gz ; fi
	if [ -e $(MAN)"/fr.UTF-8/man1/mkd.1.gz" ]; then catman -M $(MAN)/fr.UTF-8/man1/mkd.1.gz; fi
	if [ -e $(MAN)"/fr/man1/mkd.1.gz" ]; then catman -M $(MAN)/fr/man1/mkd.1.gz ; fi
	# install and update MIME database: see update in post-install package
	install -D -m644  mkd.xml $(MIME)/packages/mkd.xml
	if [-e "/usr/share/mime/packages/mkd.xml" ]; then update-mime-database /usr/share/mime/; fi

# create man only in programmers source file; not for packaging if mkd is not installed
# else type command "make -d mkd.1" to create modified file "manuals"
mkd.1: manuals
	if [ -e "/usr/bin/mkd" ]; \
	then \
		mkd -Ct F manuals mkd.1; \
		gzip -c mkd.1 > mkd_fr.1.gz; \
		mkd -Ctw M manuals mkd.1; \
		gzip -c mkd.1 > mkd_en.1.gz; \
		rm mkd.1; \
	fi
	
clean:
	# rm *.o
	# rm *~

Version Windows + Cygwin (alpha for tests)

Cette version est moins intéressante que la version compilée avec MinGW

mkd_cygwin_windows.bash 
#!/bin/bash
# file: mkd_cygwin_windows.bash for cygwin64 5 Nov 2015
make -f mkd_cygwin_windows.mak 
make -f mkd_cygwin_windows.mak clean 
make -f mkd_cygwin_windows.mak copydoc
mkd_cygwin_windows.mak 
# file: mkd_cygwin_windows.mak 
# (Makefile pour cygwin et windows_10, mkd.exe version 151105)
# problem with obsolete option -mno-cygwin
#
# terminal command : 
# make -f mkd_cygwin_windows.mak
# make -f mkd_cygwin_windows.mak clean
# make -f mkd_cygwin_windows.mak copydoc
#
# create nov 5,2015 by JPL for cygwin64
# amended November 6,2015 by Clara
# modified ... by ... for
# 
# Attention: avant de compiler, il faut valider les options de compilation
# dans version.h (notamment version UNIX ou version PC MinGW ainsi que la version multilangue avec GETTEXT)
#
# i386 and x86-64 Windows Options :
# -mconsole -mcygwin -mno-cygwin -mdll -mnop-fun-dllimport
# -mthread -municode -mwin32 -mwindows
# -fno-set-stack-executable
#
######################################

PGM     = mkd.exe
CC      = cc
BINDIR  = /usr/bin
DOCDIR  = /usr/share/doc
BINMODE = 755

SRCS    = mkd.c asm.c basic.c cpp.c fortran.c pascal.c shell.c tri.c
HDRS    = version.h mkd.h asm.h basic.h cpp.h fortran.h pascal.h shell.c \
find.inc.c find.inc.h tri.h
OBJS    = mkd.o asm.o basic.o cpp.o fortran.o pascal.o shell.o tri.o
LIBS    =
CFLAGS  = -mwindows -m64 
# -mno-cygwin
LDFLAGS = -mwindows -m64 
# -mno-cygwin
SPLINTFLAG = 

#install: $(BINDIR)/$(PGM) # $(MANUALS) 

$(BINDIR)/$(PGM): $(SRCS) $(HDRS)
	-@echo "*********** update $(PGM) :"
	$(CC) $(CFLAGS) $(SRCS) -c
#	$(CC) $(CFLAGS) -o $(PGM) $(SRCS) -c
	$(CC) $(LDFLAGS) -o $(PGM) $(OBJS) $(LIBS)
	# clean ASM and LINK reloc :
	-@strip $(PGM) 	
  #
	-@echo "***********  update $(BINDIR)/mkd.exe:" 		
	# install PGM in BINDIR
	-@if [ -d $(BINDIR) ]; then \
		chmod $(BINMODE) $(PGM); \
		cp -f $(PGM) $(BINDIR)/$(PGM); \
		#if [ $(BINDIR) != "/bin" ]; then \
		#rm -f /bin/$(PGM); \
		#ln -s $(BINDIR)/$(PGM) /bin/$(PGM); \
		#fi \
	else \
		echo "couldn't find $(BINDIR)";\
	fi
  #
  
copydoc:
	-@echo "***********  update $(DOCDIR)/mkd:"
	-@if [ -d $(DOCDIR) ]; then \
		if [ ! -d $(DOCDIR)/mkd ]; then \
			mkdir $(DOCDIR)/mkd; \
			cp -rf doc/* $(DOCDIR)/mkd/.; \
		#fi \
		else if [ -d $(DOCDIR)/mkd ]; then \
			cp -rf doc/* $(DOCDIR)/mkd/.; \
			fi \
		fi \
	else \
		echo "couldn't find $(DOCDIR)"; \
	fi  

clean:
	rm -f $(OBJS)

version multilingue (en projet)

Note : Les paquets make, gcc et gettext doivent être installés

La compilation des sources de la version officielle avec cygwin permet normalement de créer des version multilingues de mkd.exe avec gettext.

Sources gettext libintl

Cygwin X86_64

Ce projet à l'étude en fin 2015 n'a pas abouti faute de librairies associées à gettext dans la version cygwin X86_64.

Cygwin X86

Cette version n'a pas été évaluée en fin 2015

Il semble que ces libraires soient présentes dans la version i686.

Sous versions 32 bits X86 il faut dé-commenter gettext dans version.h et de mettre à jour le numéro de version

Recompiler gettext

#!/bin/sh
# Configuration:
# Cygwin under Windows:
# 	Downloaded setup-x86.exe from http://cygwin.com/install.html
# 	Installed with these packages
# 		Devel/binutils
# 		Devel/make
# 		Web/wget
# 		Devel/patch (** NEEDED IF COMPILING gettext 0.18.3 **)
# 		Devel/automake (** NEEDED IF COMPILING gettext 0.18.3 **)
# 		Devel/mingw-gcc-g++ (** NEEDED IF COMPILING FOR 32 bit **)
# 		Devel/mingw-w32api (** NEEDED IF COMPILING FOR 32 bit **)
# 		Devel/mingw64-x86_64-g++ (** NEEDED IF COMPILING FOR 64 bit **)
# Debian
#	Basic packages
# 		apt-get install binutils make wget
#	If compiling gettext 0.18.3 you need also
#		apt-get patch automake
# 	To compile for 32 bit:
# 		apt-get install mingw32 mingw32-runtime mingw32-binutils
# 	To compile for 64 bit:
# 		apt-get install mingw-w64 mingw-w64-i686-dev mingw-w64-x86-64-dev

######################
echo Setup

BLDGTXT_ROOT=~/build-gettext-windows
BLDGTXT_ARC=$BLDGTXT_ROOT/archives

BLDGTXT_VERS_ICONV=1.14
echo "libiconv version [$BLDGTXT_VERS_ICONV]:"
read BLDGTXT_TMP
if [ ! -z "$BLDGTXT_TMP" ]; then
	BLDGTXT_VERS_ICONV=$BLDGTXT_TMP
fi

BLDGTXT_VERS_GETTEXT=0.18.3.1
echo "gettext version [$BLDGTXT_VERS_GETTEXT]:"
read BLDGTXT_TMP
if [ ! -z "$BLDGTXT_TMP" ]; then
	BLDGTXT_VERS_GETTEXT=$BLDGTXT_TMP
fi

BLDGTXT_BITS=32
echo "Architecture (32 for 32bit, 64 for 64bit) [$BLDGTXT_BITS]:"
read BLDGTXT_TMP
if [ ! -z "$BLDGTXT_TMP" ]; then
	BLDGTXT_BITS=$BLDGTXT_TMP
fi
case $BLDGTXT_BITS in
	"32")
		if [ -d /usr/i686-pc-mingw32/sys-root/mingw ]; then
			BLDGTXT_BASE=/usr/i686-pc-mingw32/sys-root/mingw
			BLDGTXT_HOST=i686-pc-mingw32
		else
			if [ -d /usr/i586-mingw32msvc ]; then
				BLDGTXT_BASE=/usr/i586-mingw32msvc
				BLDGTXT_HOST=i586-mingw32msvc
			else
				echo mingw 32 bit not found.
				exit 1
			fi
		fi
		;;
	"64")
		if [ -d /usr/x86_64-w64-mingw32/sys-root/mingw ]; then
			BLDGTXT_BASE=/usr/x86_64-w64-mingw32/sys-root/mingw
			BLDGTXT_HOST=x86_64-w64-mingw32
		else
			if [ -d /usr/x86_64-w64-mingw32 ]; then
				BLDGTXT_BASE=/usr/x86_64-w64-mingw32
				BLDGTXT_HOST=x86_64-w64-mingw32
			else
				echo mingw 64 bit not found.
				exit 1
			fi
		fi
		;;
   *)
		echo "Unsupported bits: $BLDGTXT_BITS"
		exit 1
		;;
esac


BLDGTXT_HOW=shared
echo "Shared (smaller but with DLL) or static (no DLL but bigger) build ('shared' or 'static') [$BLDGTXT_HOW]:"
read BLDGTXT_TMP
if [ ! -z "$BLDGTXT_TMP" ]; then
	BLDGTXT_HOW=$BLDGTXT_TMP
fi
case $BLDGTXT_HOW in
	"shared")
		BLDGTXT_HOW_EXPANDED=" --enable-shared --enable-static "
		;;
	"static")
		BLDGTXT_HOW_EXPANDED=" --disable-shared --enable-static "
		;;
   *)
		echo "Unsupported build type: $BLDGTXT_HOW"
		exit 1
		;;
esac
######################
BLDGTXT_SRC=$BLDGTXT_ROOT/src-$BLDGTXT_HOW-$BLDGTXT_BITS
BLDGTXT_DST=$BLDGTXT_ROOT/out-$BLDGTXT_HOW-$BLDGTXT_BITS
######################
echo Setup source archives

mkdir --parents $BLDGTXT_ARC

if [ ! -f "$BLDGTXT_ARC/libiconv-$BLDGTXT_VERS_ICONV.tar.gz" ]; then
	wget --output-document=$BLDGTXT_ARC/libiconv-$BLDGTXT_VERS_ICONV.tar.gz http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$BLDGTXT_VERS_ICONV.tar.gz
fi

if [ ! -f "$BLDGTXT_ARC/gettext-$BLDGTXT_VERS_GETTEXT.tar.gz" ]; then
	wget --output-document=$BLDGTXT_ARC/gettext-$BLDGTXT_VERS_GETTEXT.tar.gz http://ftp.gnu.org/pub/gnu/gettext/gettext-$BLDGTXT_VERS_GETTEXT.tar.gz
fi

if [ $BLDGTXT_VERS_GETTEXT = "0.18.3" ]; then
	if [ ! -f "$BLDGTXT_ARC/0001-Fix-AC_CHECK_DECLS-usage.patch" ]; then
		echo "--- a/gettext-runtime/m4/intl.m4
+++ b/gettext-runtime/m4/intl.m4
@@ -1,4 +1,4 @@
-# intl.m4 serial 23 (gettext-0.18.3)
+# intl.m4 serial 24 (gettext-0.18.3)
 dnl Copyright (C) 1995-2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -61,7 +61,7 @@ AC_DEFUN([AM_INTL_SUBDIR],
 
   dnl Use the _snprintf function only if it is declared (because on NetBSD it
   dnl is defined as a weak alias of snprintf; we prefer to use the latter).
-  AC_CHECK_DECLS([_snprintf _snwprintf], , , [#include <stdio.h>])
+  AC_CHECK_DECLS([_snprintf, _snwprintf], , , [#include <stdio.h>])
 
   dnl Use the *_unlocked functions only if they are declared.
   dnl (because some of them were defined without being declared in Solaris
@@ -234,7 +234,7 @@ AC_DEFUN([gt_INTL_SUBDIR_CORE],
   dnl (because some of them were defined without being declared in Solaris
   dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
   dnl on Solaris 2.5.1 to run on Solaris 2.6).
-  AC_CHECK_DECLS([feof_unlocked fgets_unlocked], , , [#include <stdio.h>])
+  AC_CHECK_DECLS([feof_unlocked, fgets_unlocked], , , [#include <stdio.h>])
 
   AM_ICONV
 
--
" >"$BLDGTXT_ARC/0001-Fix-AC_CHECK_DECLS-usage.patch"
	fi
fi


######################
echo Clean up
cd $BLDGTXT_ROOT
rm --recursive --force $BLDGTXT_SRC
rm --recursive --force $BLDGTXT_DST
mkdir --parents $BLDGTXT_SRC
mkdir --parents $BLDGTXT_DST


######################
echo Compile iconv
cd $BLDGTXT_SRC
tar zxvf $BLDGTXT_ARC/libiconv-$BLDGTXT_VERS_ICONV.tar.gz
cd libiconv-$BLDGTXT_VERS_ICONV
./configure --prefix=$BLDGTXT_DST --host=$BLDGTXT_HOST $BLDGTXT_HOW_EXPANDED CC="$BLDGTXT_HOST-gcc" CCX="$BLDGTXT_HOST-g++" CPPFLAGS="-Wall -I$BLDGTXT_BASE/include" LDFLAGS="-L$BLDGTXT_BASE/lib"
make install


######################
echo Compile gettext
cd $BLDGTXT_SRC
tar zxvf $BLDGTXT_ARC/gettext-$BLDGTXT_VERS_GETTEXT.tar.gz
cd gettext-$BLDGTXT_VERS_GETTEXT
if [ $BLDGTXT_VERS_GETTEXT = "0.18.3" ]; then
	echo Compile gettext - Start patch
	patch -p1 < "$BLDGTXT_ARC/0001-Fix-AC_CHECK_DECLS-usage.patch"
	echo Compile gettext - Regenerate build scripts
	cd gettext-runtime
	aclocal -I m4 -I ../m4 -I gnulib-m4
	autoconf
	autoheader
	cd ..
	cd gettext-tools
	aclocal -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
	autoconf
	autoheader
	automake --add-missing --copy
	cd ..
	echo Compile gettext - End patch
fi
./configure --prefix=$BLDGTXT_DST --host=$BLDGTXT_HOST $BLDGTXT_HOW_EXPANDED CC="$BLDGTXT_HOST-gcc" CCX="$BLDGTXT_HOST-g++" CPPFLAGS="-Wall -I$BLDGTXT_BASE/include" LDFLAGS="-L$BLDGTXT_BASE/lib"
make install
echo All done. See $BLDGTXT_DST/bin
Outils personnels