Коммит 6b3f0d9b создал по автору OMP Education's avatar OMP Education Зафиксировано автором Vladislav Larionov
Просмотр файлов

[Project] Implement Document Converter

владелец 6a29bf9c
Это отличие свёрнуто
Это отличие свёрнуто
Это отличие свёрнуто
Это отличие свёрнуто
Hacking Cairo
=============
This is a high-level guide to how the cairo distribution is organized
and how to get started hacking on it. Make sure you read through the
file README before continuing.
Coding Style
------------
The easiest way to write code in the cairo style is to follow code close
to the place you are hacking, but if you want a written down set of
rules, see file CODING_STYLE.
Files for backends that depend on languages other than C (C++ or
Objective C for example) may use features specific to those languages.
For example, "//" comments are allowed, though discouraged, in those files.
Contact
-------
Various ways to get in touch with other cairo developers and maintainers
have been enumerated at:
https://cairographics.org/contact/
Most of that information is also reflected in the following sections.
Mailing Lists
-------------
There are various mailing lists that are useful when developing cairo
code. A complete list is always available at:
https://cairographics.org/lists/
It is recommended that cairo developers subscribe to all those lists.
The cairo list by itself generates much more traffic than the others
combined, so developers and contributors should not be intimidated by
the -commit and -bugs lists.
Bug Tracking System
-------------------
We use a standard bugzilla bug tracking system available at:
https://bugs.freedesktop.org/
See file named BUGS for detailed information on reporting bugs. In short,
for straight bug reports, it's best to report them there such that they
are not lost or forgotten. For discussion of new features or
complicated issues, use the mailing list.
IRC
---
It's a great idea to hang around the cairo IRC channel if you have any
interest in cairo. We use the #cairo channel on irc.freenode.net.
Make sure you introduce yourself if your nick is not easy to match to
the name you use on the mailing list.
Version Control System
----------------------
We use /git/ for version control. See:
https://cairographics.org/download/
For more information on using git, see:
https://freedesktop.org/wiki/Infrastructure/git/
Build System
------------
We use the autotools build system with cairo, but with various
customizations and advanced features. Reading configure.in is your
best bet to understanding it, or just ask on IRC.
To bootstrap the build system run ./autogen.sh. After that the
regular "./configure; make; make install" sequence can be used.
See file named INSTALL for more details.
There is limited support for a win32 build system.
See README.win32 and Makefile.win32 files in various directories.
ChangeLog
---------
We generate ChangeLog files automatically from the git commit log.
No manual ChangeLog writing is necessary.
Copyrights and Licensing
------------------------
The cairo library is dual-licensed under LGPL and MPL. See the file
named COPYING for details. The test suites are more liberal, and are
allowed to include GPL code.
When writing new code, update the file headers to add your (or your
employers) copyright line and contributor line. If adding new files
or splitting a file, copy the file header from other files.
Source Code
-----------
The library source code and headers live in the src/ directory.
See src/README for more information.
Regression Test Suite
---------------------
Cairo has a fairly extensive regression-testing suite. Indeed, without
these tests it would be impossible to make a cairo release without
introducing tens of regressions. We still manage to introduce
regressions with each release even with the hundreds of tests we already
have.
The regression test suite is located under the test/ directory.
See test/README for more information.
Performance Test Suite
----------------------
There is a performance test suite located under the perf/ directory.
A collection of traces of real-world behavior are also available in the
cairo-traces repository, which can be used in isolation or hooked in
with the main performance test suite. See perf/README for more
information.
Boilerplate
-----------
The cairo-boilerplate is a small private library used by the regression
and performance test suites. It includes the boilerplace code needed
to initialize various backends for the test suites, as well as allow
tweaking some of the internal workings of the backends for more testing.
The boilerplate code is localted under the boilerplate/ directory.
See boilerplate/README for more information.
Documentation
-------------
Cairo uses the gtk-doc system for reference API documentation.
The reference documentation is located under doc/public.
See doc/public/README for more information.
For more documentation including frequently asked questions, tutorials,
samples, roadmap, todo list, etc visit:
https://cairographics.org/documentation/
Some of those should gradually be moved to doc/.
Utilities
---------
We have developed several utilities useful for writing cairo or code
that uses cairo. These tools can be found under the util/ directory.
See util/README for more information.
Releasing
---------
Now you are a cairo maintainer, so what? See file named RELEASING.
Quick-start build instructions
------------------------------
1) Configure the package:
./configure
2) Compile it:
make
3) Install it:
make install
This final step may require temporary root access (eg. with sudo) if
you don't have write permission to the directory in which cairo will
be installed.
NOTE: If you are working with source from git/cvs rather than from a tar
file, then you should use ./autogen.sh in place of ./configure
anywhere it is mentioned in these instructions.
More detailed build instructions
--------------------------------
1) Configure the package
The first step in building cairo is to configure the package by
running the configure script. [Note: if you don't have a configure
script, skip down below to the Extremely detailed build
instructions.]
The configure script attempts to automatically detect as much as
possible about your system. So, you should primarily just accept
its defaults by running:
./configure
The configure script does accept a large number of options for
fine-tuning its behavior. See "./configure --help" for a complete
list. The most commonly used options are discussed here.
--prefix=PREFIX
This option specifies the directory under which the software
should be installed. By default configure will choose a
directory such as /usr/local. If you would like to install
cairo to some other location, pass the director to configure
with the --prefix option. For example:
./configure --prefix=/opt/cairo
would install cairo into the /opt/cairo directory. You could
also choose a prefix directory within your home directory if
you don't have write access to any system-wide directory.
After installing into a custom prefix, you will need to set
some environment variables to allow the software to be
found. Assuming the /opt/cairo prefix and assuming you are
using the bash shell, the following environment variables
should be set:
PKG_CONFIG_PATH=/opt/cairo/lib/pkgconfig
LD_LIBRARY_PATH=/opt/cairo/lib
export PKG_CONFIG_PATH LD_LIBRARY_PATH
(NOTE: On Mac OS X, at least, use DYLD_LIBRARY_PATH in place
of LD_LIBRARY_PATH above.)
--enable-XYZ
--enable-XYZ=yes
--enable-XYZ=auto
--enable-XYZ=no
--disable-XYZ
Cairo's various font and surface backends and other features can be
enabled or disabled at configure time. Features can be divided into
three categories based on their default state:
* default=yes: These are the recommended features like PNG functions
and PS/PDF/SVG backends. It is highly recommended to not disable
these features but if that's really what one wants, they can be
disabled using --disable-XYZ.
* default=auto: These are the "native" features, that is, they are
platform specific, like the Xlib surface backend. You probably
want one or two of these. They will be automatically enabled if
all their required facilities are available. Or you can use
--enable-XYZ or --disable-XYZ to make your desire clear, and then
cairo errs during configure if your intention cannot be followed.
* default=no: These are the "experimental" features, and hence by
default off. Use --enable-XYZ to enable them.
The list of all features and their default state can be seen in the
output of ./configure --help.
2) Compile the package:
This step is very simple. Just:
make
The Makefiles included with cairo are designed to work on as many
different systems as possible.
When cairo is compiled, you can also run some automated tests of
cairo with:
make check
NOTE: Some versions of X servers will cause the -xlib tests to
report failures in make check even when cairo is working just
fine. If you see failures in nothing but -xlib tests, please
examine the corresponding -xlib-out.png images and compare them to
the -ref.png reference images (the -xlib-diff.png images might also
be useful). If the results seem "close enough" please do not report
a bug against cairo as the "failures" you are seeing are just due
to subtle variations in X server implementations.
3) Install the package:
The final step is to install the package with:
make install
If you are installing to a system-wide location you may need to
temporarily acquire root access in order to perform this
operation. A good way to do this is to use the sudo program:
sudo make install
Extremely detailed build instructions
-------------------------------------
So you want to build cairo but it didn't come with a configure
script. This is probably because you have checked out the latest
in-development code via git. If you need to be on the bleeding edge,
(for example, because you're wanting to develop some aspect of cairo
itself), then you're in the right place and should read on.
However, if you don't need such a bleeding-edge version of cairo, then
you might prefer to start by building the latest stable cairo release:
https://cairographics.org/releases
or perhaps the latest (unstable) development snapshot:
https://cairographics.org/snapshots
There you'll find nicely packaged tar files that include a configure
script so you can go back the the simpler instructions above.
But you're still reading, so you're someone that loves to
learn. Excellent! We hope you'll learn enough to make some excellent
contributions to cairo. Since you're not using a packaged tar file,
you're going to need some additional tools beyond just a C compiler in
order to compile cairo. Specifically, you need the following utilities:
automake
autoconf
autoheader
aclocal
libtoolize
pkg-config [at least version 0.16]
gtk-doc (recommended)
Hopefully your platform of choice has packages readily available so
that you can easily install things with your system's package
management tool, (such as "apt-get install automake" on Debian or "yum
install automake" on Fedora, etc.). Note that Mac OS X ships with
glibtoolize instead of libtoolize.
Once you have all of those packages installed, the next step is to run
the autogen.sh script. That can be as simple as:
./autogen.sh
But before you run that command, note that the autogen.sh script
accepts all the same arguments as the configure script, (and in fact,
will generate the configure script and run it with the arguments you
provide). So go back up to step (1) above and see what additional
arguments you might want to pass, (such as prefix). Then continue with
the instructions, simply using ./autogen.sh in place of ./configure.
Happy hacking!
include $(top_srcdir)/build/Makefile.am.common
EXTRA_DIST += \
KNOWN_ISSUES \
README.win32 \
Makefile.win32 \
build/Makefile.win32.common \
build/Makefile.win32.inform \
build/Makefile.win32.features \
build/Makefile.win32.features-h \
$(NULL)
#MAINTAINERCLEANFILES += \
# $(srcdir)/build/Makefile.win32.features \
# $(srcdir)/build/Makefile.win32.features-h \
# $(NULL)
ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS}
DIST_SUBDIRS = src doc util boilerplate test perf
SUBDIRS = src doc util
# libpng is required for our test programs
if CAIRO_HAS_PNG_FUNCTIONS
SUBDIRS += boilerplate test perf
endif
doc:
cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
test retest recheck: all
cd test && $(MAKE) $(AM_MAKEFLAGS) $@
perf: all
cd perf && $(MAKE) $(AM_MAKEFLAGS) $@
check-valgrind: all
cd test && $(MAKE) $(AM_MAKEFLAGS) check-valgrind
cd perf && $(MAKE) $(AM_MAKEFLAGS) check-valgrind
.PHONY: doc test retest recheck perf check-valgrind
EXTRA_DIST += \
AUTHORS \
BIBLIOGRAPHY \
BUGS \
CODING_STYLE \
COPYING \
COPYING-LGPL-2.1 \
COPYING-MPL-1.1 \
HACKING \
INSTALL \
NEWS \
PORTING_GUIDE \
README \
RELEASING \
autogen.sh \
$(NULL)
# Meson build system files
EXTRA_DIST += \
meson.build \
meson_options.txt \
version.py \
boilerplate/make-cairo-boilerplate-constructors.py \
boilerplate/meson.build \
src/meson.build \
test/make-cairo-test-constructors.py \
test/meson.build \
test/pdiff/meson.build \
util/cairo-fdr/meson.build \
util/cairo-gobject/meson.build \
util/cairo-missing/meson.build \
util/cairo-script/meson.build \
util/cairo-sphinx/meson.build \
util/cairo-trace/meson.build \
util/meson.build \
meson-cc-tests/atomic-ops-cxx11.c \
meson-cc-tests/ipc_rmid_deferred_release.c \
meson-cc-tests/ft_has_color.c \
meson-cc-tests/mkdir-variant-1.c \
meson-cc-tests/pthread.c \
meson-cc-tests/atomic-ops-gcc-legacy.c \
meson-cc-tests/mkdir-variant-2.c \
$(NULL)
DISTCLEANFILES += config.cache
MAINTAINERCLEANFILES += \
$(srcdir)/aclocal.m4 \
$(srcdir)/autoscan.log \
$(srcdir)/build/compile \
$(srcdir)/build/config.guess \
$(srcdir)/build/config.sub \
$(srcdir)/build/depcomp \
$(srcdir)/build/install-sh \
$(srcdir)/build/ltmain.sh \
$(srcdir)/build/missing \
$(srcdir)/build/mkinstalldirs \
$(srcdir)/config.h.in \
$(srcdir)/configure.scan \
$(NULL)
DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc \
--enable-test-surfaces \
--enable-full-testing \
$(NULL)
include $(srcdir)/build/Makefile.am.changelog
include $(srcdir)/build/Makefile.am.releasing
include $(srcdir)/build/Makefile.am.analysis
Это отличие свёрнуто
default: all
# Do not edit this file.
# Edit build/Makefile.win32.common for customization
top_srcdir = .
include $(top_srcdir)/build/Makefile.win32.inform
all: cairo
cairo: inform
@$(MAKE) -C src -f Makefile.win32
perf: inform
@$(MAKE) -C perf -f Makefile.win32 perf
test: inform
@$(MAKE) -C test -f Makefile.win32 test
clean:
@$(MAKE) -C boilerplate -f Makefile.win32 clean
@$(MAKE) -C perf -f Makefile.win32 clean
@$(MAKE) -C src -f Makefile.win32 clean
@$(MAKE) -C test -f Makefile.win32 clean
Это отличие свёрнуто
Это отличие свёрнуто
Это отличие свёрнуто
Building Cairo on Windows
=========================
There are two primary ways to build Cairo on Windows. You can use a
UNIX emulation based setup, such as Cygwin or MSYS, with the
conventional configure script shipped with Cairo releases. In this
configuration, you will build with GCC and (implicitly) libtool. In
the Cygwin case you end up with a DLL that depends on Cygwin and
should be used only from Cygwin applications. In the MSYS case you end
up with a "normal" Win32 DLL that can be used either from GCC- or
Microsoft Visual C++-compiled code. In theory, this technique is no
different than the ordinary build process for the Cairo library. In
practise there are lots of small details that can go wrong.
The second way is to use a GNU-compatible make, but build using
Microsoft's Visual C++ compiler to produce native libraries. This is
the setup this README.win32 is written for. Also the DLL produced this
way is usable either from GCC- or MSVC-compiled code.
Tools required
==============
You will need GNU make, version 3.80 or later. Earlier versions or
other modern make implementations may work, but are not guaranteed to.
You will also need Microsoft Visual C++. Version 7 has been most
heavily tested, but other versions are likely to work fine.
Libraries required
==================
Cairo requires a compatible version of the pixman library. Full build
instructions are beyond the scope of this document; however, using the
same tools, it should be possible to build pixman simply by entering
the pixman/src directory and typing:
make -f Makefile.win32 CFG=release
Depending on your feature set, you may also need zlib and libpng.
Building
========
There are a few files that you will need to edit. First, you must
determine which features will be built. Edit
build/Makefile.win32.features and set the features as desired. Note
that most features have external dependencies; specifically,
CAIRO_HAS_PNG_FUNCTIONS requires libpng to be present, and
CAIRO_HAS_PS_SURFACE and CAIRO_HAS_PDF_SURFACE both require zlib.
To ensure that the compiler can find all dependencies, you may need to
edit build/Makefile.win32.common. In particular, ensure that
PIXMAN_CFLAGS contains a -I parameter pointing to the location of
your pixman header files and that PIXMAN_LIBS points to the actual
location of your pixman-1.lib file. You may also need to edit the
various occurrences of CAIRO_LIBS to point to other libraries
correctly. Note also that if you wish to link statically with zlib,
you should replace zdll.lib with zlib.lib.
Finally, from the top Cairo directory, type:
make -f Makefile.win32 CFG=release
If this command succeeds, you will end up with src/release/cairo.dll.
To successfully use Cairo from your own programs, you will probably
want to move this file to some central location. You will also
probably want to copy the Cairo header files. These should be placed
in a cairo subdirectory (for instance, c:/code/common/include/cairo).
The exact set to copy depends on your features and is reported to you
at the end of the build.
Это отличие свёрнуто
Это отличие свёрнуто
Это отличие свёрнуто
Это отличие свёрнуто
Это отличие свёрнуто
Это отличие свёрнуто
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать