Skip to content

Commit

Permalink
Merge pull request #219 from bgrabitmap/dev-lazpaint
Browse files Browse the repository at this point in the history
Dev lazpaint 7.1.6
  • Loading branch information
circular17 authored Dec 2, 2020
2 parents 568e1e8 + ef676de commit 81493e1
Show file tree
Hide file tree
Showing 147 changed files with 9,955 additions and 3,667 deletions.
18 changes: 5 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,16 @@ __pycache__
*.res
*.lrt
/lazpaint/*.lrj

lazpaint/backup/

*.lrj

vectoredit/vectoredit

vectoredit/backup/

lazpaint/test_embedded/backup/

lazpaint/test_embedded/project1

lazpaint/dialog/filter/backup/

lazpaint/release/bin/lazpaint

lazpaint/tools/backup/

lazpaint/image/backup/

lazpaint/dialog/backup/
.DS_Store
lazpaint/release/bin/lazpaint.app
Expand All @@ -39,7 +28,10 @@ lazpaint/release/windows/lazpaint64
lazpaint/release/bin/i18n/lazpaint32.*
lazpaint/release/bin/i18n/lazpaint_x64.*
/lazpaint/dialog/color/backup

resources/createresource/backup/

lazpaint/units/
/bgracontrols
/bgrabitmap

*.deb
lazpaint/release/debian/lazpaint*_no_install.tar.gz
207 changes: 145 additions & 62 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,101 +1,184 @@
prefix = /usr/local
USER_DIR = $(DESTDIR)$(prefix)
BIN_DIR = $(USER_DIR)/bin
SHARE_DIR=$(USER_DIR)/share
RESOURCE_DIR=$(SHARE_DIR)/lazpaint
DOC_DIR=$(SHARE_DIR)/doc/lazpaint
SOURCE_BIN_DIR=lazpaint/release/bin
SOURCE_SCRIPT_DIR=resources/scripts
SOURCE_DEBIAN_DIR=lazpaint/release/debian
PO_FILES:=$(shell find "$(SOURCE_BIN_DIR)/i18n" -maxdepth 1 -type f -name *.po -printf "\"%f\" ")
MODEL_FILES:=$(shell find "$(SOURCE_BIN_DIR)/models" -maxdepth 1 -type f -printf "\"%f\" ")
SCRIPT_FILES:=$(shell find "$(SOURCE_SCRIPT_DIR)" -maxdepth 1 -type f -name *.py -printf "\"%f\" ")
SCRIPT_RUNTIME_FILES:=$(shell find "$(SOURCE_SCRIPT_DIR)/lazpaint" -maxdepth 1 -type f -name *.py -printf "\"%f\" ")
# On Linux, TARGET can be Gtk2 (default) or Qt5
# On FreeBSD, TARGET can be Gtk2 (default) or Qt5
# On Windows, TARGET can be Win32 (default) or Qt5

BGRABITMAP_DIR := bgrabitmap/bgrabitmap
BGRACONTROLS_DIR := bgracontrols

ifeq ($(OS),Windows_NT) # true for Windows_NT or later
SHELL := C:/Windows/System32/cmd.exe /c
UNAME := Windows
COPY := winmake\copyfile
REMOVE := winmake\remove
REMOVEDIR := winmake\removedir
CREATEDIR := winmake\createdir
ECHOFILE := type
THEN := &
RUN :=
NOERROR :=
else
UNAME := $(shell uname)
ifeq ($(UNAME),FreeBSD)
SHELL := /usr/local/bin/bash
else
SHELL := /bin/bash
endif
COPY := cp
REMOVE := rm -f
REMOVEDIR := rm -rf
CREATEDIR := mkdir -p
ECHOFILE := cat
THEN := ;
RUN := ./
NOERROR := 2>/dev/null
endif

lazdir := $(shell $(ECHOFILE) lazdir $(NOERROR))
fpcbin := $(shell $(ECHOFILE) fpcbin $(NOERROR))
package := lazpaint

ifeq ($(UNAME),Linux)
TARGET ?= Gtk2
prefix := $(shell $(ECHOFILE) prefix $(NOERROR))
ifeq ($(MULTIBIN),1)
package := lazpaint-$(shell echo $(TARGET) | tr A-Z a-z)
prefix := /../$(package)$(prefix)
endif
USER_DIR = $(DESTDIR)$(prefix)
BIN_DIR = $(USER_DIR)/bin
SHARE_DIR=$(USER_DIR)/share
RESOURCE_DIR=$(SHARE_DIR)/lazpaint
ICON_DIR=$(SHARE_DIR)/icons/hicolor
SOURCE_BIN_DIR=lazpaint/release/bin
SOURCE_SCRIPT_DIR=resources/scripts
SOURCE_ICON_DIR=resources/icon
SOURCE_DEBIAN_UPSTREAM=lazpaint/release/debian
ICON:=lazpaint/lazpaint.ico
ICONS=$(shell identify $(ICON) | awk -F '[[]|[]] | ' '{ printf "[%s]=%s ", $$2, $$4 }')
EXTRACTED_ICONS_DIR=resources/icon
EXTRACTED_ICONS=16x16 24x24 32x32 48x48 96x96 128x128 256x256
PO_FILES:=$(shell find "$(SOURCE_BIN_DIR)/i18n" -maxdepth 1 -type f -name *.po -printf "\"%f\" ")
MODEL_FILES:=$(shell find "$(SOURCE_BIN_DIR)/models" -maxdepth 1 -type f -printf "\"%f\" ")
SCRIPT_FILES:=$(shell find "$(SOURCE_SCRIPT_DIR)" -maxdepth 1 -type f -name *.py -printf "\"%f\" ")
SCRIPT_RUNTIME_FILES:=$(shell find "$(SOURCE_SCRIPT_DIR)/lazpaint" -maxdepth 1 -type f -name *.py -printf "\"%f\" ")

LAZARUSDIRECTORIES:="-Fu$(lazdir)/*" "-Fi$(lazdir)/*" "-Fu$(lazdir)/components/printers/unix" "-Fi$(lazdir)/components/printers/unix" "-Fu$(lazdir)/packager/registration" "-Fi$(lazdir)/packager/registration" "-Fu$(lazdir)/components/*" "-Fi$(lazdir)/components/*" "-Fu$(lazdir)/lcl/forms" "-Fi$(lazdir)/lcl/forms" "-Fu$(lazdir)/lcl/widgetset" "-Fi$(lazdir)/lcl/widgetset" "-Fu$(lazdir)/interfaces/*" "-Fi$(lazdir)/interfaces/*" "-Fu$(lazdir)/lcl/nonwin32" "-Fi$(lazdir)/lcl/nonwin32" "-Fu$(lazdir)/lcl/interfaces/gtk2" "-Fi$(lazdir)/lcl/interfaces/gtk2" "-Fu$(lazdir)/lcl/components/*" "-Fi$(lazdir)/lcl/components/*" "-Fu$(lazdir)/lcl/include" "-Fi$(lazdir)/lcl/include" "-Fu$(lazdir)/lcl" "-Fi$(lazdir)/lcl"
endif

ifeq ($(UNAME),FreeBSD)
TARGET ?= Gtk2
LAZARUSDIRECTORIES:="-Fu$(lazdir)/*" "-Fi$(lazdir)/*" "-Fu$(lazdir)/components/printers/unix" "-Fi$(lazdir)/components/printers/unix" "-Fu$(lazdir)/packager/registration" "-Fi$(lazdir)/packager/registration" "-Fu$(lazdir)/components/*" "-Fi$(lazdir)/components/*" "-Fu$(lazdir)/lcl/forms" "-Fi$(lazdir)/lcl/forms" "-Fu$(lazdir)/lcl/widgetset" "-Fi$(lazdir)/lcl/widgetset" "-Fu$(lazdir)/interfaces/*" "-Fi$(lazdir)/interfaces/*" "-Fu$(lazdir)/lcl/nonwin32" "-Fi$(lazdir)/lcl/nonwin32" "-Fu$(lazdir)/lcl/interfaces/gtk2" "-Fi$(lazdir)/lcl/interfaces/gtk2" "-Fu$(lazdir)/lcl/components/*" "-Fi$(lazdir)/lcl/components/*" "-Fu$(lazdir)/lcl/include" "-Fi$(lazdir)/lcl/include" "-Fu$(lazdir)/lcl" "-Fi$(lazdir)/lcl"
endif

ifeq ($(UNAME),Windows)
TARGET ?= Win32
LAZARUSDIRECTORIES:="-Fu$(lazdir)/*" "-Fi$(lazdir)/*" "-Fu$(lazdir)/components/printers/win32" "-Fi$(lazdir)/components/printers/win32" "-Fu$(lazdir)/packager/registration" "-Fi$(lazdir)/packager/registration" "-Fu$(lazdir)/components/*" "-Fi$(lazdir)/components/*" "-Fu$(lazdir)/lcl/forms" "-Fi$(lazdir)/lcl/forms" "-Fu$(lazdir)/lcl/widgetset" "-Fi$(lazdir)/lcl/widgetset" "-Fu$(lazdir)/interfaces/*" "-Fi$(lazdir)/interfaces/*" "-Fu$(lazdir)/lcl/interfaces/win32" "-Fi$(lazdir)/lcl/interfaces/win32" "-Fu$(lazdir)/lcl/components/*" "-Fi$(lazdir)/lcl/components/*" "-Fu$(lazdir)/lcl/include" "-Fi$(lazdir)/lcl/include" "-Fu$(lazdir)/lcl" "-Fi$(lazdir)/lcl"
endif

# determine buildmode/interface
BUILDMODE:=Release
INTERFACE:=LCL$(shell echo $(TARGET) | tr A-Z a-z)
ifeq ($(TARGET),Qt5)
BUILDMODE:=ReleaseQt5
endif

# Lazarus custom packages explicitely compiled
ifeq "$(FOREIGN_LPK)" "1"
FOREIGN_PACKAGES=$(BGRABITMAP_DIR)/bgrabitmappack.lpk $(BGRACONTROLS_DIR)/bgracontrols.lpk
endif

all: compile

install:
ifeq ($(OS),Windows_NT) # true for Windows_NT or later
echo Under Windows, use installation generated by InnoSetup with lazpaint/release/windows/lazpaint.iss
else ifeq ($(shell uname),Linux)
install -D "$(SOURCE_BIN_DIR)/lazpaint" "$(BIN_DIR)/lazpaint"
for f in $(PO_FILES); do install -D "$(SOURCE_BIN_DIR)/i18n/$$f" "${RESOURCE_DIR}/i18n/$$f"; done
for f in $(MODEL_FILES); do install -D "$(SOURCE_BIN_DIR)/models/$$f" "${RESOURCE_DIR}/models/$$f"; done
for f in $(SCRIPT_FILES); do install -D "$(SOURCE_SCRIPT_DIR)/$$f" "${RESOURCE_DIR}/scripts/$$f"; done
for f in $(SCRIPT_RUNTIME_FILES); do install -D "$(SOURCE_SCRIPT_DIR)/lazpaint/$$f" "${RESOURCE_DIR}/scripts/lazpaint/$$f"; done
install -D "$(SOURCE_DEBIAN_DIR)/applications/lazpaint.desktop" "$(SHARE_DIR)/applications/lazpaint.desktop"
install -D "$(SOURCE_DEBIAN_DIR)/pixmaps/lazpaint.png" "$(SHARE_DIR)/pixmaps/lazpaint.png"
install: prefix
ifeq ($(UNAME),Windows)
echo "Under Windows, use installation generated by InnoSetup with lazpaint/release/windows/lazpaint.iss"
endif

ifeq ($(UNAME),Linux)
install -D "$(SOURCE_BIN_DIR)/$(package)" "$(BIN_DIR)/lazpaint"
for f in $(PO_FILES); do install -D --mode=0644 "$(SOURCE_BIN_DIR)/i18n/$$f" "$(RESOURCE_DIR)/i18n/$$f"; done
for f in $(MODEL_FILES); do install -D --mode=0644 "$(SOURCE_BIN_DIR)/models/$$f" "${RESOURCE_DIR}/models/$$f"; done
for f in $(SCRIPT_FILES); do install -D --mode=0644 "$(SOURCE_SCRIPT_DIR)/$$f" "${RESOURCE_DIR}/scripts/$$f"; done
for f in $(SCRIPT_RUNTIME_FILES); do install -D --mode=0644 "$(SOURCE_SCRIPT_DIR)/lazpaint/$$f" "${RESOURCE_DIR}/scripts/lazpaint/$$f"; done
install -D "$(SOURCE_DEBIAN_UPSTREAM)/applications/lazpaint.desktop" "$(SHARE_DIR)/applications/lazpaint.desktop"
install -D "$(EXTRACTED_ICONS_DIR)/48x48.png" "$(SHARE_DIR)/pixmaps/lazpaint.png"
for s in $(EXTRACTED_ICONS); do install -D --mode=0644 "$(EXTRACTED_ICONS_DIR)/$$s.png" "$(ICON_DIR)/$$s/apps/lazpaint.png"; done
install -d "$(SHARE_DIR)/man/man1"
gzip -9 -n -c "$(SOURCE_DEBIAN_DIR)/man/man1/lazpaint.1" >"$(SHARE_DIR)/man/man1/lazpaint.1.gz"
gzip -9 -n -c "$(SOURCE_DEBIAN_UPSTREAM)/man/man1/lazpaint.1" >"$(SHARE_DIR)/man/man1/lazpaint.1.gz"
chmod 0644 "$(SHARE_DIR)/man/man1/lazpaint.1.gz"
install -d "$(DOC_DIR)"
gzip -9 -n -c "$(SOURCE_DEBIAN_DIR)/debian/changelog" >"$(DOC_DIR)/changelog.gz"
chmod 0644 "$(DOC_DIR)/changelog.gz"
install "$(SOURCE_DEBIAN_DIR)/debian/copyright" "$(DOC_DIR)/copyright"
install "$(SOURCE_BIN_DIR)/readme.txt" "$(DOC_DIR)/README"
else
echo Unhandled OS
endif

uninstall:
ifeq ($(OS),Windows_NT) # true for Windows_NT or later
echo Under Windows, go to Add/Remove programs
else ifeq ($(shell uname),Linux)
uninstall: prefix
ifeq ($(UNAME),Windows)
echo "Under Windows, go to Add/Remove programs to uninstall"
endif

ifeq ($(UNAME),Linux)
$(REMOVE) $(BIN_DIR)/lazpaint
$(REMOVEDIR) $(RESOURCE_DIR)
$(REMOVEDIR) $(DOC_DIR)
$(REMOVE) "$(SHARE_DIR)/applications/lazpaint.desktop"
$(REMOVE) "$(SHARE_DIR)/pixmaps/lazpaint.png"
for s in $(EXTRACTED_ICONS); do $(REMOVE) $(ICON_DIR)/$$s/apps/lazpaint.png; done
$(REMOVE) "$(SHARE_DIR)/man/man1/lazpaint.1.gz"
else
echo Unhandled OS
endif

clean: clean_lazpaintcontrols clean_vectoredit clean_lazpaint
distclean: clean clean_configure
clean: clean_bgrabitmap clean_bgracontrols clean_lazpaint

clean_lazpaintcontrols:
$(REMOVEDIR) "lazpaintcontrols/lib"
$(REMOVEDIR) "lazpaintcontrols/backup"
clean_configure:
$(REMOVE) "prefix"
$(REMOVE) "lazdir"
$(REMOVE) "fpcbin"

clean_icons:
$(REMOVEDIR) "icons"

clean_bgrabitmap:
$(REMOVEDIR) "$(BGRABITMAP_DIR)/lib"
$(REMOVEDIR) "$(BGRABITMAP_DIR)/backup"

clean_vectoredit:
$(REMOVEDIR) "vectoredit/lib"
$(REMOVEDIR) "vectoredit/backup"
clean_bgracontrols:
$(REMOVEDIR) "$(BGRACONTROLS_DIR)/lib"
$(REMOVEDIR) "$(BGRACONTROLS_DIR)/backup"

clean_lazpaint:
$(REMOVEDIR) "lazpaintcontrols/lib"
$(REMOVEDIR) "lazpaint/debug"
$(REMOVEDIR) "lazpaint/release/lib"
$(REMOVE) "lazpaint/lazpaint.res"
$(REMOVE) "lazpaint/release/bin/lazpaint"
ifeq ($(UNAME),Windows)
$(REMOVE) "lazpaint/release/bin/lazpaint.exe"
$(REMOVE) "lazpaint/release/bin/lazpaint32.exe"
$(REMOVE) "lazpaint/release/bin/lazpaint_x64.exe"
$(REMOVE) "lazpaint/release/bin/lazpaint64.exe"
else
$(REMOVE) "lazpaint/release/bin/lazpaint"
$(REMOVE) "lazpaint/release/bin/lazpaint32"
$(REMOVE) "lazpaint/release/bin/lazpaint64"
$(REMOVE) "lazpaint/release/bin/lazpaint-gtk2"
$(REMOVE) "lazpaint/release/bin/lazpaint-qt5"
endif
$(REMOVEDIR) "lazpaint/backup"
$(REMOVEDIR) "lazpaint/dialog/backup"
$(REMOVEDIR) "lazpaint/image/backup"
$(REMOVEDIR) "lazpaint/tablet/backup"
$(REMOVEDIR) "lazpaint/test_embedded/backup"
$(REMOVEDIR) "lazpaint/tools/backup"

compile: lazpaintcontrols vectoredit lazpaint
lazbuild:
#lazbuild will determine what to recompile
lazpaintcontrols: lazbuild lazpaintcontrols/lazpaintcontrols.lpk
lazbuild lazpaintcontrols/lazpaintcontrols.lpk
vectoredit: lazbuild vectoredit/vectoredit.lpi
lazbuild vectoredit/vectoredit.lpi
lazpaint: lazbuild lazpaint/lazpaint.lpi
lazbuild lazpaint/lazpaint.lpi

compile: lazdir lazpaint
force:
#lazbuild or fpc will determine what to recompile

lazpaint: force $(FOREIGN_PACKAGES) lazpaintcontrols/lazpaintcontrols.lpk lazpaint/lazpaint.lpi
ifeq "$(lazdir)" ""
lazbuild --build-mode=$(BUILDMODE) $(FOREIGN_PACKAGES) lazpaintcontrols/lazpaintcontrols.lpk lazpaint/lazpaint.lpi
else
$(COPY) "resources/lazpaint.res" "lazpaint/lazpaint.res"
$(CREATEDIR) "lazpaint/release/lib"
cd lazpaint $(THEN) $(fpcbin) -orelease/lazpaint -Fu./buttons -Fi./buttons -Fu./image -Fi./image -Fu./cursors -Fi./cursors -Fu./buttons -Fi./buttons -Fu./* -Fi./* -Fu../$(BGRACONTROLS_DIR) -Fi../$(BGRACONTROLS_DIR) -Fu../$(BGRABITMAP_DIR) -Fi../$(BGRABITMAP_DIR) $(LAZARUSDIRECTORIES) -MObjFPC -Scgi -Cg -OoREGVAR -Xs -XX -l -vewnhibq -O3 -CX -vi -FUrelease/lib/ -dLCL -d$(INTERFACE) lazpaint.lpr
endif
ifeq ($(MULTIBIN),1)
mv "$(SOURCE_BIN_DIR)/lazpaint" "$(SOURCE_BIN_DIR)/$(package)"
endif

icons:
ifneq ($(UNAME),Windows)
$(CREATEDIR) -p icons
declare -A icons=($(ICONS)); for i in "$${!icons[@]}"; do convert $(ICON)[$$i] $(SOURCE_ICON_DIR)/$${icons[$$i]}.png; done
endif

74 changes: 74 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env bash
echo For help type: ./configure --help
args=("$@")
haserror=false
defaultfpc=fpc
wantedfpc=$defaultfpc
if [ -f "debian/CONFIGURE_DEFAULT_FPCBIN" ]; then
wantedfpc=$(cat debian/CONFIGURE_DEFAULT_FPCBIN)
fi
defaultprefix=/usr/local
wantedprefix=$defaultprefix
if [ -f "debian/CONFIGURE_DEFAULT_LAZDIR" ]; then
wantedlazdir=$(cat debian/CONFIGURE_DEFAULT_LAZDIR)
else
wantedlazdir=
fi
for param in "${args[@]}"
do
if [ "$param" == "-h" ] || [ "$param" == "--help" ]; then
echo "Usage: ./configure [OPTIONS]"
echo ""
echo " --prefix=PREFIX"
echo " Specifies the install prefix."
echo " By default prefix is \"$defaultprefix\""
echo " For packages use \"/usr\""
echo ""
echo " --lazdir=BASE_DIRECTORY_OF_LAZARUS"
echo " Specifies to compile with FPC using the specified Lazarus sources."
echo " Otherwise lazbuild will be used."
echo ""
echo " --fpcbin=FPC_BINARY"
echo " Specifies the command to call Free Pascal Compiler."
echo " Default is \"$defaultfpc\""
exit 0
elif [ "${param:0:9}" == "--prefix=" ]; then
wantedprefix=${param:9}
elif [ "${param:0:9}" == "--lazdir=" ]; then
wantedlazdir=${param:9}
elif [ "${param:0:9}" == "--fpcbin=" ]; then
wantedfpc=${param:9}
else
echo "Warning: unknown option $param"
fi
done
echo "Prefix set to: $wantedprefix"
echo $wantedprefix >prefix
if [ "$wantedlazdir" == "" ]; then
echo "Using lazbuild"
rm -f lazdir
touch lazdir
rm -f fpcbin
else
echo "Using FPC with Lazarus source: $wantedlazdir"
if [ ! -d "$wantedlazdir" ]; then
echo "Error: directory not found!"
haserror=true
elif [ ! -d "$wantedlazdir/lcl" ]; then
echo "Warning: it does not seem to be the directory of Lazarus!"
fi
echo $wantedlazdir >lazdir
echo "Compiler set to: $wantedfpc"
rm -f fpcbin
echo $wantedfpc >fpcbin
fi
if [ "$haserror" = true ]; then
exit 1
else
if [ "$(uname)" == "FreeBSD" ]; then
echo "You can now type: gmake"
else
echo "You can now type: make"
fi
exit 0
fi
Loading

0 comments on commit 81493e1

Please sign in to comment.