[gs-devel] [PATCH]ghostscript crosscompiling: makefile fixes
for host tools
Ray Johnston
Ray.Johnston at Artifex.com
Wed Jan 2 10:16:09 PST 2008
Ralph,
Ralph Giles wrote:
> What do you think about this Ray? I still think it would be better to
> duplicate the gp stuff in mkromfs so it can just be built with CCAUX.
>
We could easily do this for the three primary platforms (unix, mac and
windows). I guess it would help a bit.
> That doesn't help with the zlib dependency though, unless we just
> require linked an external version.
>
I think the solution that Luotao Fu proposes for zlib isn't too ugly.
> This is ugly, but we have to do something like this if we're going to
> support cross-compilation reasonably. And I think we need to do that.
>
Right. So if we have the zlib_host modules and build in the file/directory
access stuff (the gp functionality subset that we need), does this seem
acceptable?
> What does the gumstix build do?
>
It uses COMPILE_INITS=0. Note that I posted a follow up to the thread on
gs-devel, but it got held up pending moderation. I've released it now.
Regards,
Ray
------------------------------------------------------------------------
> On Wed, Jan 02, 2008 at 12:46:46PM +0100, Luotao Fu wrote:
>
>
>> ghostscript builds and calls mkromfs to generate init files. The mkromfs utility
>> is linked together by objects, which are compiled with GLCC and probably used by
>> other binaries. This means we will in fact try to link objects compiled with the
>> crosscompiler with our hostcompiler. As a solution for this problem we add a
>> bunch of extra objects, which are compiled from the same source with the host
>> compiler and we adds a _host postfix to their names.
>>
>> The target mkromfs uses EXTRALIBS flag, which are indeed not needed and can
>> causes errors if linkerflags, which are only used for target system cannot be
>> found on host. Hence we removed it.
>>
>> Signed-off-by: Luotao Fu <l.fu at pengutronix.de>
>> ---
>> src/lib.mak | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> src/unix-aux.mak | 23 ++++++++++++++++++-----
>> src/zlib.mak | 17 +++++++++++++++++
>> 3 files changed, 90 insertions(+), 5 deletions(-)
>>
>> Index: src/lib.mak
>> ===================================================================
>> --- src/lib.mak.orig
>> +++ src/lib.mak
>> @@ -237,6 +237,13 @@ $(GLOBJ)gpmisc.$(OBJ) : $(GLSRC)gpmisc.c
>> $(memory__h) $(string__h) $(gp_h) $(gpgetenv_h) $(gpmisc_h)
>> $(GLCC) $(GLO_)gpmisc.$(OBJ) $(C_) $(GLSRC)gpmisc.c
>>
>> +$(GLOBJ)gpmisc_host.$(OBJ) : $(GLSRC)gpmisc.c\
>> + $(unistd__h) $(fcntl__h) $(stat__h) $(stdio__h)\
>> + $(memory__h) $(string__h) $(gp_h) $(gpgetenv_h) $(gpmisc_h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I) \
>> + $(GLO_)gpmisc_host.$(OBJ) $(C_) $(GLSRC)gpmisc.c
>> +
>> +
>> # Command line argument list management
>> $(GLOBJ)gsargs.$(OBJ) : $(GLSRC)gsargs.c\
>> $(ctype__h) $(stdio__h) $(string__h)\
>> @@ -255,9 +262,22 @@ $(GLOBJ)gsmisc.$(OBJ) : $(GLSRC)gsmisc.c
>> $(gpcheck_h) $(gserror_h) $(gxfarith_h) $(gxfixed_h) $(stdint__h)
>> $(GLCC) $(GLO_)gsmisc.$(OBJ) $(C_) $(GLSRC)gsmisc.c
>>
>> +$(GLOBJ)gsmisc_host.$(OBJ) : $(GLSRC)gsmisc.c $(GXERR)\
>> + $(gconfigv_h) $(std_h) $(vmsmath_h)\
>> + $(ctype__h) $(malloc__h) $(math__h) $(memory__h) $(string__h)\
>> + $(gpcheck_h) $(gserror_h) $(gxfarith_h) $(gxfixed_h) $(stdint__h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I) \
>> + $(GLO_)gpmisc_host.$(OBJ) $(GLO_)gsmisc_host.$(OBJ) $(C_) $(GLSRC)gsmisc.c
>> +
>> +
>> $(GLOBJ)gslibctx.$(OBJ) : $(GLSRC)gslibctx.c $(GXERR)\
>> $(gslibctx_h) $(stdio__h)
>> $(GLCC) $(GLO_)gslibctx.$(OBJ) $(C_) $(GLSRC)gslibctx.c
>> +
>> +$(GLOBJ)gslibctx_host.$(OBJ) : $(GLSRC)gslibctx.c $(GXERR)\
>> + $(gslibctx_h) $(stdio__h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gslibctx_host.$(OBJ) $(C_) $(GLSRC)gslibctx.c
>>
>> $(GLOBJ)gsnotify.$(OBJ) : $(GLSRC)gsnotify.c $(GXERR)\
>> $(gsnotify_h) $(gsstruct_h)
>> @@ -272,6 +292,12 @@ $(GLOBJ)gsutil.$(OBJ) : $(GLSRC)gsutil.c
>> $(gsrect_h) $(gsuid_h) $(gsutil_h) $(gzstate_h) $(gxdcolor_h)
>> $(GLCC) $(GLO_)gsutil.$(OBJ) $(C_) $(GLSRC)gsutil.c
>>
>> +$(GLOBJ)gsutil_host.$(OBJ) : $(GLSRC)gsutil.c $(AK) $(memory__h) $(string__h)\
>> + $(gstypes_h) $(gconfigv_h) $(gserror_h) $(gserrors_h) $(gsmemory_h)\
>> + $(gsrect_h) $(gsuid_h) $(gsutil_h) $(gzstate_h) $(gxdcolor_h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gsutil_host.$(OBJ) $(C_) $(GLSRC)gsutil.c
>> +
>> # MD5 digest
>> md5_h=$(GLSRC)md5.h
>> # We have to use a slightly different compilation approach in order to
>> @@ -535,6 +561,13 @@ $(GLOBJ)gscdefs.$(OBJ) : $(GLSRC)gscdef.
>> $(CP_) $(GLSRC)gscdef.c $(GLGEN)gscdefs.c
>> $(GLCC) $(GLO_)gscdefs.$(OBJ) $(C_) $(GLGEN)gscdefs.c
>>
>> +$(GLOBJ)gscdefs_host.$(OBJ) : $(GLSRC)gscdef.c\
>> + $(std_h) $(gscdefs_h) $(gconfigd_h) $(TOP_MAKEFILES)
>> + $(RM_) $(GLGEN)gscdefs.c
>> + $(CP_) $(GLSRC)gscdef.c $(GLGEN)gscdefs.c
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gscdefs_host.$(OBJ) $(C_) $(GLGEN)gscdefs.c
>> +
>> $(GLOBJ)gxacpath.$(OBJ) : $(GLSRC)gxacpath.c $(GXERR)\
>> $(gsdcolor_h) $(gsrop_h) $(gsstruct_h) $(gsutil_h)\
>> $(gxdevice_h) $(gxfixed_h) $(gxistate_h) $(gxpaint_h)\
>> @@ -2698,6 +2731,10 @@ $(GLOBJ)gsromfs.$(OBJ) : $(GLOBJ)gsromfs
>> MKROMFS_ZLIB_OBJS=$(GLOBJ)compress.$(OBJ) $(GLOBJ)deflate.$(OBJ) \
>> $(GLOBJ)zutil.$(OBJ) $(GLOBJ)adler32.$(OBJ) $(GLOBJ)crc32.$(OBJ) \
>> $(GLOBJ)trees.$(OBJ)
>> +
>> +MKROMFS_ZLIB_HOST_OBJS=$(GLOBJ)compress_host.$(OBJ) $(GLOBJ)deflate_host.$(OBJ) \
>> + $(GLOBJ)zutil_host.$(OBJ) $(GLOBJ)adler32_host.$(OBJ) $(GLOBJ)crc32_host.$(OBJ) \
>> + $(GLOBJ)trees_host.$(OBJ)
>> MKROMFS_COMMON_DEPS=$(stdpre_h) $(stdint__h) $(gsiorom_h) \
>> $(gsmemret_h) $(gsmalloc_h) $(gsstype_h) $(gp_h) $(time__h)
>>
>> @@ -2763,6 +2800,12 @@ $(GLOBJ)gp_getnv.$(OBJ) : $(GLSRC)gp_get
>> $(gp_h) $(gsmemory_h) $(gstypes_h)
>> $(GLCC) $(GLO_)gp_getnv.$(OBJ) $(C_) $(GLSRC)gp_getnv.c
>>
>> +$(GLOBJ)gp_getnv_host.$(OBJ) : $(GLSRC)gp_getnv.c $(AK) $(stdio__h) $(string__h)\
>> + $(gp_h) $(gsmemory_h) $(gstypes_h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gp_getnv_host.$(OBJ) $(C_) $(GLSRC)gp_getnv.c
>> +
>> +
>> # File system implementation.
>>
>> # MS-DOS file system, also used by Desqview/X.
>> @@ -2782,10 +2825,22 @@ $(GLOBJ)gp_unifs.$(OBJ) : $(GLSRC)gp_uni
>> $(stat__h) $(dirent__h)
>> $(GLCC) $(GLO_)gp_unifs.$(OBJ) $(C_) $(GLSRC)gp_unifs.c
>>
>> +$(GLOBJ)gp_unifs_host.$(OBJ) : $(GLSRC)gp_unifs.c $(AK)\
>> + $(memory__h) $(string__h) $(stdio__h) $(unistd__h) \
>> + $(gx_h) $(gp_h) $(gpmisc_h) $(gsstruct_h) $(gsutil_h) \
>> + $(stat__h) $(dirent__h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gp_unifs_host.$(OBJ) $(C_) $(GLSRC)gp_unifs.c
>> +
>> +
>> # Unix(-like) file name syntax, *not* used by Desqview/X.
>> $(GLOBJ)gp_unifn.$(OBJ) : $(GLSRC)gp_unifn.c $(AK) $(gx_h) $(gp_h) $(gpmisc_h)
>> $(GLCC) $(GLO_)gp_unifn.$(OBJ) $(C_) $(GLSRC)gp_unifn.c
>>
>> +$(GLOBJ)gp_unifn_host.$(OBJ) : $(GLSRC)gp_unifn.c $(AK) $(gx_h) $(gp_h) $(gpmisc_h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gp_unifn_host.$(OBJ) $(C_) $(GLSRC)gp_unifn.c
>> +
>> # Pipes. These are actually the same on all platforms that have them.
>>
>> pipe_=$(GLOBJ)gdevpipe.$(OBJ)
>> Index: src/unix-aux.mak
>> ===================================================================
>> --- src/unix-aux.mak.orig
>> +++ src/unix-aux.mak
>> @@ -37,6 +37,13 @@ $(GLOBJ)gp_unix.$(OBJ): $(GLSRC)gp_unix.
>> $(gx_h) $(gsexit_h) $(gp_h)
>> $(GLCC) $(GLO_)gp_unix.$(OBJ) $(C_) $(GLSRC)gp_unix.c
>>
>> +$(GLOBJ)gp_unix_host.$(OBJ): $(GLSRC)gp_unix.c $(AK)\
>> + $(pipe__h) $(string__h) $(time__h)\
>> + $(gx_h) $(gsexit_h) $(gp_h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gp_unix_host.$(OBJ) $(C_) $(GLSRC)gp_unix.c
>> +
>> +
>> $(GLOBJ)gp_unix_cache.$(OBJ): $(GLSRC)gp_unix_cache.c $(AK)\
>> $(stdio__h) $(string__h) $(time__h) $(gconfigd_h) $(gp_h) $(md5_h)
>> $(GLCC) $(GLO_)gp_unix_cache.$(OBJ) $(C_) $(GLSRC)gp_unix_cache.c
>> @@ -46,6 +53,12 @@ $(GLOBJ)gp_stdia.$(OBJ): $(GLSRC)gp_stdi
>> $(stdio__h) $(time__h) $(unistd__h) $(gx_h) $(gp_h)
>> $(GLCC) $(GLO_)gp_stdia.$(OBJ) $(C_) $(GLSRC)gp_stdia.c
>>
>> +$(GLOBJ)gp_stdia_host.$(OBJ): $(GLSRC)gp_stdia.c $(AK)\
>> + $(stdio__h) $(time__h) $(unistd__h) $(gx_h) $(gp_h)
>> + $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJDIR)$(_I)\
>> + $(GLO_)gp_stdia_host.$(OBJ) $(C_) $(GLSRC)gp_stdia.c
>> +
>> +
>> # System V platforms other than SVR4, which lack some system calls,
>> # but have pipes.
>> sysv__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_unix.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_unifn.$(OBJ) $(GLOBJ)gp_sysv.$(OBJ)
>> @@ -77,13 +90,13 @@ $(GENHT_XE): $(GLSRC)genht.c $(AK) $(GEN
>> $(GENINIT_XE): $(GLSRC)geninit.c $(AK) $(GENINIT_DEPS)
>> $(CCAUX) $(I_)$(GLSRCDIR)$(_I) $(O_)$(GENINIT_XE) $(GLSRC)geninit.c
>>
>> -MKROMFS_OBJS=$(MKROMFS_ZLIB_OBJS) $(GLOBJ)gscdefs.$(OBJ) $(GLOBJ)gsmisc.$(OBJ) \
>> - $(GLOBJ)gpmisc.$(OBJ) $(GLOBJ)gslibctx.$(OBJ) $(GLOBJ)gp_getnv.$(OBJ) \
>> - $(GLOBJ)gp_unix.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_unifn.$(OBJ) \
>> - $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gsutil.$(OBJ)
>> +MKROMFS_OBJS=$(MKROMFS_ZLIB_HOST_OBJS) $(GLOBJ)gscdefs_host.$(OBJ) $(GLOBJ)gsmisc_host.$(OBJ) \
>> + $(GLOBJ)gpmisc_host.$(OBJ) $(GLOBJ)gslibctx_host.$(OBJ) $(GLOBJ)gp_getnv_host.$(OBJ) \
>> + $(GLOBJ)gp_unix_host.$(OBJ) $(GLOBJ)gp_unifs_host.$(OBJ) $(GLOBJ)gp_unifn_host.$(OBJ) \
>> + $(GLOBJ)gp_stdia_host.$(OBJ) $(GLOBJ)gsutil_host.$(OBJ)
>>
>> $(MKROMFS_XE): $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS)
>> - $(CCAUX) $(GENOPT) $(CFLAGS_DEBUG) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE) $(MKROMFS_OBJS) -lm $(EXTRALIBS)
>> + $(CCAUX) $(GENOPT) $(CFLAGS_DEBUG) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE) $(MKROMFS_OBJS) -lm
>>
>> # Query the environment to construct gconfig_.h.
>> # The "else true;" is required because Ultrix's implementation of sh -e
>> Index: src/zlib.mak
>> ===================================================================
>> --- src/zlib.mak.orig
>> +++ src/zlib.mak
>> @@ -74,6 +74,9 @@ $(ZGEN)zlibc.dev : $(ZLIB_MAK) $(ECHOGS_
>> $(ZOBJ)zutil.$(OBJ) : $(ZSRC)zutil.c $(ZDEP)
>> $(ZCC) $(ZO_)zutil.$(OBJ) $(C_) $(ZSRC)zutil.c
>>
>> +$(ZOBJ)zutil_host.$(OBJ) : $(ZSRC)zutil.c $(ZDEP)
>> + $(CCAUX) $(ZO_)zutil_host.$(OBJ) $(C_) $(ZSRC)zutil.c
>> +
>> # Encoding (compression) code.
>>
>> $(ZGEN)zlibe.dev : $(TOP_MAKEFILES) $(ZGEN)zlibe_$(SHARE_ZLIB).dev
>> @@ -91,16 +94,28 @@ $(ZGEN)zlibe_0.dev : $(ZLIB_MAK) $(ECHOG
>> $(ZOBJ)adler32.$(OBJ) : $(ZSRC)adler32.c $(ZDEP)
>> $(ZCC) $(ZO_)adler32.$(OBJ) $(C_) $(ZSRC)adler32.c
>>
>> +$(ZOBJ)adler32_host.$(OBJ) : $(ZSRC)adler32.c $(ZDEP)
>> + $(CCAUX) $(ZO_)adler32_host.$(OBJ) $(C_) $(ZSRC)adler32.c
>> +
>> $(ZOBJ)deflate.$(OBJ) : $(ZSRC)deflate.c $(ZDEP)
>> $(ZCC) $(ZO_)deflate.$(OBJ) $(C_) $(ZSRC)deflate.c
>>
>> +$(ZOBJ)deflate_host.$(OBJ) : $(ZSRC)deflate.c $(ZDEP)
>> + $(CCAUX) $(ZO_)deflate_host.$(OBJ) $(C_) $(ZSRC)deflate.c
>> +
>> # new file in zlib 1.2.x
>> $(ZOBJ)compress.$(OBJ) : $(ZSRC)compress.c $(ZDEP)
>> $(ZCC) $(ZO_)compress.$(OBJ) $(C_) $(ZSRC)compress.c
>>
>> +$(ZOBJ)compress_host.$(OBJ) : $(ZSRC)compress.c $(ZDEP)
>> + $(CCAUX) $(ZO_)compress_host.$(OBJ) $(C_) $(ZSRC)compress.c
>> +
>> $(ZOBJ)trees.$(OBJ) : $(ZSRC)trees.c $(ZDEP)
>> $(ZCC) $(ZO_)trees.$(OBJ) $(C_) $(ZSRC)trees.c
>>
>> +$(ZOBJ)trees_host.$(OBJ) : $(ZSRC)trees.c $(ZDEP)
>> + $(CCAUX) $(ZO_)trees_host.$(OBJ) $(C_) $(ZSRC)trees.c
>> +
>> # The zlib filters per se don't need crc32, but libpng versions starting
>> # with 0.90 do.
>>
>> @@ -117,6 +132,8 @@ $(ZGEN)crc32_0.dev : $(ZLIB_MAK) $(ECHOG
>> # constants that produces gcc warnings with -Wtraditional.
>> $(ZOBJ)crc32.$(OBJ) : $(ZSRC)crc32.c $(ZDEP)
>> $(CC_NO_WARN) $(ZCCFLAGS) $(ZO_)crc32.$(OBJ) $(C_) $(ZSRC)crc32.c
>> +$(ZOBJ)crc32_host.$(OBJ) : $(ZSRC)crc32.c $(ZDEP)
>> + $(CCAUX) $(ZCCFLAGS) $(ZO_)crc32_host.$(OBJ) $(C_) $(ZSRC)crc32.c
>>
>> # Decoding (decompression) code.
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ghostscript.com/pipermail/gs-devel/attachments/20080102/e456f962/attachment.htm
More information about the gs-devel
mailing list