Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work in progress update #6

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.[oa]
*.cm[ioxat]
*.cmx[as]
*.so
*.opt
*.byte
*.exe
src/doc
_*
23 changes: 7 additions & 16 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
Copyright (C) 2004 2005 2006 Florent Monnier
Copyright (C) 2022 Florent Monnier

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to modify it and redistribute it
freely.

This software is provided "AS-IS", without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
7 changes: 0 additions & 7 deletions META

This file was deleted.

151 changes: 5 additions & 146 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,147 +1,6 @@
# +-----------------------------------------------------------------+
# | Copyright (C) 2010 Florent Monnier |
# +-----------------------------------------------------------------+
# | This binding aims to provide the ImageMagick methods to OCaml. |
# +-----------------------------------------------------------------+
# | This program is free software; you can redistribute it and/or |
# | modify it under the terms of the GNU General Public License |
# | as published by the Free Software Foundation; either version 2 |
# | of the License, or (at your option) any later version. |
# | |
# | This program is distributed in the hope that it will be useful, |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# | GNU General Public License for more details. |
# | |
# | http://www.gnu.org/licenses/gpl.html |
# | |
# | You should have received a copy of the GNU General Public |
# | License along with this program; if not, |
# | write to the Free Software Foundation, Inc., |
# | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
# +-----------------------------------------------------------------+

# path to the MagickCore-config utility
MAGICK_INSTALLED_BIN := $(shell which MagickCore-config)

MAGICK_PREFIX := $(shell $(MAGICK_INSTALLED_BIN) --prefix)

MAGICK_CLIBS := $(shell $(MAGICK_INSTALLED_BIN) --libs)

MAGICK_CLIBS_ := $(shell ocaml mlarg.ml $(MAGICK_CLIBS))

MAGICK_CFLAGS := $(shell $(MAGICK_INSTALLED_BIN) --cflags)

OCAML_DIR := $(shell ocamlfind printconf stdlib)

all: byte opt
byte: magick.cma
opt: magick.cmxa magick.cmxs

imagemagick_wrap.o: imagemagick_wrap.c imagemagick_list.h imagemagick.h
gcc -fPIC -c -I"$(OCAML_DIR)" $(MAGICK_CFLAGS) imagemagick_wrap.c

imagemagick_list.o: imagemagick_list.c imagemagick.h
gcc -fPIC -c -I"$(OCAML_DIR)" $(MAGICK_CFLAGS) imagemagick_list.c

dllimagemagick_stubs.so: imagemagick_wrap.o imagemagick_list.o
ocamlmklib -o imagemagick_stubs $^ $(MAGICK_CLIBS)

magick.mli: magick.ml
ocamlc -i $< > $@

magick.cmi: magick.mli
ocamlc -c $<

magick.cmo: magick.ml magick.cmi
ocamlc -c $<

magick.cma: magick.cmo dllimagemagick_stubs.so
ocamlc -a -o $@ $< -dllib -limagemagick_stubs $(MAGICK_CLIBS_)

magick.cmx: magick.ml magick.cmi
ocamlopt -c $<

magick.cmxa: magick.cmx dllimagemagick_stubs.so
ocamlopt -a -o $@ $< -cclib -limagemagick_stubs $(MAGICK_CLIBS_)

magick.cmxs: magick.cmxa dllimagemagick_stubs.so
ocamlopt -shared -linkall -I ./ -o $@ $< -cclib -limagemagick_stubs $(MAGICK_CLIBS_)

# ocamlopt -shared -linkall -I /usr/local/lib/ocaml/3.12.1/libMagick -o /usr/local/lib/ocaml/3.12.1/libMagick/magick.cmxs /usr/local/lib/ocaml/3.12.1/libMagick/libimagemagick_stubs.a /usr/local/lib/ocaml/3.12.1/libMagick/magick.cmxa

clean:
rm -f *.[oa] *.so *.cm[ixoa] *.cmx[as]

all:
$(MAKE) -C src all
opt:
$(MAKE) -C src opt
install:
ocamlfind install magick META \
magick.mli \
magick.cmi \
magick.cma \
magick.cmxa \
magick.cmxs \
magick.a \
dllimagemagick_stubs.so \
libimagemagick_stubs.a

uninstall:
ocamlfind remove magick

IMAGE := image.png

test:
@echo
@echo " Press Q to close images"
@echo
ocaml bigarray.cma magick.cma ./examples/example_01.ml $(IMAGE)
ocaml bigarray.cma magick.cma ./examples/example_02.ml $(IMAGE)
ocaml bigarray.cma magick.cma ./examples/example_03.ml $(IMAGE)
ocaml bigarray.cma magick.cma ./examples/example_thumbnail.ml $(IMAGE)
ocaml bigarray.cma magick.cma ./examples/example_compression.ml $(IMAGE)
ocaml bigarray.cma magick.cma ./examples/drawing.ml
@echo
# @touch ./examples/.t

doc: magick.mli
if [ ! -d $@ ]; then mkdir $@ ; fi
ocamldoc $< -colorize-code -html -d $@
clean-doc:
rm -f doc/*
rmdir doc/

DIST_VERSION := 0.33
DIST_DIR := OCaml-ImageMagick-$(DIST_VERSION)
EXEMPLE_DIR := $(DIST_DIR)/examples

dist:
mkdir -p $(DIST_DIR)
cp \
README.txt \
LICENSE_GPL.txt \
Makefile \
imagemagick.h \
imagemagick_list.c \
imagemagick_list.h \
imagemagick_wrap.c \
magick.ml \
magick.mli \
mlarg.ml \
image.png \
$(DIST_DIR)/
sed -i -e "s/@VERSION@/$(DIST_VERSION)/g" $(DIST_DIR)/imagemagick.h
sed -e 's/@VERSION@/$(DIST_VERSION)/' META > $(DIST_DIR)/META
mkdir -p $(EXEMPLE_DIR)
cp \
examples/example_01.ml \
examples/example_02.ml \
examples/example_03.ml \
examples/example_compression.ml \
examples/example_thumbnail.ml \
examples/drawing.ml \
$(EXEMPLE_DIR)/
tar cf $(DIST_DIR).tar $(DIST_DIR)
gzip --best $(DIST_DIR).tar
mv $(DIST_DIR).tar.gz $(DIST_DIR).tgz
ls -l $(DIST_DIR).tgz

.PHONY: all opt byte clean clean-doc dist install uninstall
$(MAKE) -C src install
Loading