aboutsummaryrefslogtreecommitdiffstats
path: root/cad
diff options
context:
space:
mode:
authordanfe <danfe@FreeBSD.org>2017-05-03 02:50:35 +0800
committerdanfe <danfe@FreeBSD.org>2017-05-03 02:50:35 +0800
commit1211a0df9228911c2bba6166ee8fa849b069fb47 (patch)
treed85a8789de4686b1b74eddebae3966fe406e3acf /cad
parent2805cf8da50d54779e03741c10f417065bc1b680 (diff)
downloadfreebsd-ports-gnome-1211a0df9228911c2bba6166ee8fa849b069fb47.tar.gz
freebsd-ports-gnome-1211a0df9228911c2bba6166ee8fa849b069fb47.tar.zst
freebsd-ports-gnome-1211a0df9228911c2bba6166ee8fa849b069fb47.zip
Add a port of ZCAD, simple CAD program with AutoCAD DXF 2000 file format
support. It is developed with Free Pascal and Lazarus. The project has not released any distfiles yet, so this release is based on r2259 checked out from http://svn.shamangrad.net/zcad/trunk/, cleaned up (most importantly, converted to Unix line endings), and tar+xz'ed. https://sourceforge.net/projects/zcad/
Diffstat (limited to 'cad')
-rw-r--r--cad/Makefile1
-rw-r--r--cad/zcad/Makefile93
-rw-r--r--cad/zcad/distinfo3
-rw-r--r--cad/zcad/files/makefile85
-rw-r--r--cad/zcad/files/patch-cad__source_components_zebase_uzbpaths.pas53
-rw-r--r--cad/zcad/files/patch-cad__source_other_AGraphLaz_Vectors_ExtSys.pas47
-rw-r--r--cad/zcad/files/patch-cad__source_zcad.lpi11
-rw-r--r--cad/zcad/files/patch-cad__source_zcad_commands_uzccombase.pas17
-rw-r--r--cad/zcad/files/patch-cad__source_zcad_commands_uzccominterface.pas20
-rw-r--r--cad/zcad/files/patch-cad__source_zcad_gui_uzcmainwindow.pas11
-rw-r--r--cad/zcad/files/patch-cad__source_zcad_uzclog.pas37
-rw-r--r--cad/zcad/files/patch-cad__source_zcad_uzcsysinfo.pas10
-rw-r--r--cad/zcad/pkg-descr4
-rw-r--r--cad/zcad/pkg-plist326
14 files changed, 718 insertions, 0 deletions
diff --git a/cad/Makefile b/cad/Makefile
index 98c2517d27b1..5ae739dec0bf 100644
--- a/cad/Makefile
+++ b/cad/Makefile
@@ -92,5 +92,6 @@
SUBDIR += verilog-mode.el
SUBDIR += xcircuit
SUBDIR += z88
+ SUBDIR += zcad
.include <bsd.port.subdir.mk>
diff --git a/cad/zcad/Makefile b/cad/zcad/Makefile
new file mode 100644
index 000000000000..e6393e4a65d8
--- /dev/null
+++ b/cad/zcad/Makefile
@@ -0,0 +1,93 @@
+# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= zcad
+PORTVERSION= 0.9.8
+CATEGORIES= cad
+MASTER_SITES= LOCAL/danfe
+DISTNAME= ${PORTNAME}-trunk-r2259
+
+MAINTAINER= danfe@FreeBSD.org
+COMMENT= Simple CAD program
+
+BUILD_DEPENDS= lazbuild:editors/lazarus
+
+USES= tar:xz
+USE_FPC= cairo fcl-base fcl-image fcl-json fcl-stl fcl-xml opengl \
+ pasjpeg rtl-extra rtl-objpas x11
+
+LAZARUS_VER= 1.6.4
+LAZBUILD_CMD= ${LOCALBASE}/bin/lazbuild -d --pcp=${WRKSRC}/tmppcp \
+ --lazarusdir=${LAZARUS_DIR}
+LAZARUS_DIR= ${LOCALBASE}/share/lazarus-${LAZARUS_VER}
+LCL_UNITS_DIR= ${LAZARUS_DIR}/lcl/units/${BUILDNAME}
+
+EXTRACT_CMD= LC_ALL=en_US.UTF-8 ${TAR} # for non-ASCII filenames
+
+MAKE_ENV= LAZBUILD_CMD="${LAZBUILD_CMD}"
+
+WRKSRC= ${WRKDIR}/trunk
+BUILD_WRKSRC= ${WRKSRC}/cad_source
+INSTALL_WRKSRC= ${WRKSRC}/cad
+
+MAKE_JOBS_UNSAFE= yes
+
+PORTDOCS= UserGuide.odt UserGuide.pdf
+
+OPTIONS_DEFINE= DOCS
+OPTIONS_SINGLE= GUI
+OPTIONS_SINGLE_GUI= GTK2 QT4
+OPTIONS_DEFAULT= GTK2
+
+GTK2_BUILD_DEPENDS= ${LCL_UNITS_DIR}/gtk2/interfaces.ppu:editors/lazarus-lcl-gtk2
+GTK2_USE= GNOME=gtk20 FPC=gtk2
+GTK2_MAKE_ENV= GUI=gtk2
+GTK2_VARS= LAZBUILD_CMD+=--ws=gtk2
+
+QT4_BUILD_DEPENDS= ${LCL_UNITS_DIR}/qt/interfaces.ppu:editors/lazarus-lcl-qt
+QT4_LIB_DEPENDS= libQt4Pas.so:x11-toolkits/qt4pas
+QT4_MAKE_ENV= GUI=qt
+QT4_VARS= LAZBUILD_CMD+=--ws=qt
+
+post-patch:
+ @${EGREP} -lR 'IFN?DEF LINUX' ${BUILD_WRKSRC} | ${XARGS} \
+ ${REINPLACE_CMD} -E '/IFN?DEF LINUX/s,LINUX,UNIX,g'
+ @${REINPLACE_CMD} -e '/}Linux{/d' \
+ ${BUILD_WRKSRC}/other/AGraphLaz/Vectors/VStream.pas \
+ ${BUILD_WRKSRC}/other/AGraphLaz/Vectors/VFStream.pas \
+ ${BUILD_WRKSRC}/other/AGraphLaz/Vectors/VFileSys.pas \
+ ${BUILD_WRKSRC}/other/AGraphLaz/Vectors/VStrm64.pas
+ ${CP} ${FILESDIR}/makefile ${BUILD_WRKSRC}/Makefile
+
+pre-build:
+# OpenGL component must be fixed and rebuilt locally (to avoid touching
+# filesystem outside working directory)
+ ${SED} -e 's,Linux,${OPSYS},' \
+ ${LAZARUS_DIR}/components/opengl/openglcontext.pas \
+ > ${BUILD_WRKSRC}/openglcontext.pas
+ ${CP} ${LAZARUS_DIR}/components/opengl/glgtkglxcontext.pas \
+ ${LAZARUS_DIR}/components/opengl/glqtcontext.pas \
+ ${LAZARUS_DIR}/components/opengl/openglcontext.res \
+ ${BUILD_WRKSRC}
+# Build components that do not come with precompiled *.ppu files (also
+# copy them locally first for the same reason as above)
+ ${CP} -a ${LAZARUS_DIR}/components/fpvectorial \
+ ${LAZARUS_DIR}/components/anchordocking ${WRKSRC}
+ ${LAZBUILD_CMD} ${WRKSRC}/fpvectorial/fpvectorialpkg.lpk
+ ${LAZBUILD_CMD} ${WRKSRC}/anchordocking/anchordocking.lpk
+
+do-install:
+# Not ready for hier(7)-conforming installation yet
+ @${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}
+ ${INSTALL_PROGRAM} ${INSTALL_WRKSRC}/${PORTNAME} \
+ ${STAGEDIR}${PREFIX}/${PORTNAME}
+ cd ${INSTALL_WRKSRC} && ${COPYTREE_SHARE} "blocks components \
+ fonts images languages menu programdb rtl sample \
+ template" ${STAGEDIR}${PREFIX}/${PORTNAME}
+
+do-install-DOCS-on:
+ @${MKDIR} ${STAGEDIR}${DOCSDIR}
+ ${INSTALL_DATA} ${BUILD_WRKSRC}/userguide/UserGuide.odt \
+ ${INSTALL_WRKSRC}/UserGuide.pdf ${STAGEDIR}${DOCSDIR}
+
+.include <bsd.port.mk>
diff --git a/cad/zcad/distinfo b/cad/zcad/distinfo
new file mode 100644
index 000000000000..e1b4a307bfab
--- /dev/null
+++ b/cad/zcad/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1493632254
+SHA256 (zcad-trunk-r2259.tar.xz) = 9e441aee52313b8b6eb380dd3a92a9c61e35ff0c9f0bc9e71abc38c4579faff2
+SIZE (zcad-trunk-r2259.tar.xz) = 8789888
diff --git a/cad/zcad/files/makefile b/cad/zcad/files/makefile
new file mode 100644
index 000000000000..6e38acab3b0b
--- /dev/null
+++ b/cad/zcad/files/makefile
@@ -0,0 +1,85 @@
+# $FreeBSD$
+
+OUTSUFX= lib/$(ARCH)-$(OPSYS:tl)
+
+# XXX: sometimes the build crashes with ``An unhandled exception occurred
+# at $0814EBB3'' message (EAccessViolation: Access violation). It might
+# be some concurrency issue, but it occurs even with MAKE_JOBS_UNSAFE, so
+# use the following simple workaround for the time being.
+ZEALOUS_BUILD= sh -c 'i=0 ; until $(LAZBUILD_CMD) $$0 ; do \
+ test $$i -lt 4 || return ; i=$$((i+1)) ; done'
+
+all: ../$(OUTSUFX)/zcad.compiled
+
+ZCAD_DEPS= \
+ other/AGraphLaz/lazarus/$(OUTSUFX)/ag_graph.compiled \
+ other/VirtualTreeView-Lazarus/Source/$(OUTSUFX)-$(GUI)/virtualtreeview_package.compiled \
+ components/zmath/$(OUTSUFX)/zmath.compiled \
+ components/zobjectinspector/$(OUTSUFX)/zobjectinspector.compiled
+
+AG_GRAPH_DEPS= \
+ other/AGraphLaz/lazarus/$(OUTSUFX)/ag_vectors.compiled \
+ other/AGraphLaz/lazarus/$(OUTSUFX)/ag_attr.compiled \
+ other/AGraphLaz/lazarus/$(OUTSUFX)/ag_math.compiled \
+
+VTV_DEPS= \
+ other/lclextensions/$(OUTSUFX)-$(GUI)/lclextensions_package.compiled
+
+ZMATH_DEPS= \
+ components/zebase/$(OUTSUFX)/zebase.compiled
+
+ZOBJINST_DEPS= \
+ components/zscript/$(OUTSUFX)/zscript.compiled \
+ components/zcontrols/$(OUTSUFX)/zcontrols.compiled \
+ components/zundostack/$(OUTSUFX)/zundostack.compiled
+
+ZSCRIPT_DEPS= \
+ components/zscriptbase/$(OUTSUFX)/zscriptbase.compiled
+
+ZSCRIPTBASE_DEPS= \
+ components/zcontainers/$(OUTSUFX)/zcontainers.compiled
+
+../$(OUTSUFX)/zcad.compiled: $(ZCAD_DEPS)
+ $(ZEALOUS_BUILD) zcad.lpi
+
+other/AGraphLaz/lazarus/$(OUTSUFX)/ag_graph.compiled: $(AG_GRAPH_DEPS)
+ $(ZEALOUS_BUILD) other/AGraphLaz/lazarus/ag_graph.lpk
+
+other/AGraphLaz/lazarus/$(OUTSUFX)/ag_vectors.compiled:
+ $(ZEALOUS_BUILD) other/AGraphLaz/lazarus/ag_vectors.lpk
+
+other/AGraphLaz/lazarus/$(OUTSUFX)/ag_attr.compiled:
+ $(ZEALOUS_BUILD) other/AGraphLaz/lazarus/ag_attr.lpk
+
+other/AGraphLaz/lazarus/$(OUTSUFX)/ag_math.compiled:
+ $(ZEALOUS_BUILD) other/AGraphLaz/lazarus/ag_math.lpk
+
+other/VirtualTreeView-Lazarus/Source/$(OUTSUFX)-$(GUI)/virtualtreeview_package.compiled: $(VTV_DEPS)
+ $(ZEALOUS_BUILD) other/VirtualTreeView-Lazarus/Source/virtualtreeview_package.lpk
+
+other/lclextensions/$(OUTSUFX)-$(GUI)/lclextensions_package.compiled:
+ $(ZEALOUS_BUILD) other/lclextensions/lclextensions_package.lpk
+
+components/zmath/$(OUTSUFX)/zmath.compiled: $(ZMATH_DEPS)
+ $(ZEALOUS_BUILD) components/zmath/zmath.lpk
+
+components/zebase/$(OUTSUFX)/zebase.compiled:
+ $(ZEALOUS_BUILD) components/zebase/zebase.lpk
+
+components/zobjectinspector/$(OUTSUFX)/zobjectinspector.compiled: $(ZOBJINST_DEPS)
+ $(ZEALOUS_BUILD) components/zobjectinspector/zobjectinspector.lpk
+
+components/zscript/$(OUTSUFX)/zscript.compiled: $(ZSCRIPT_DEPS)
+ $(ZEALOUS_BUILD) components/zscript/zscript.lpk
+
+components/zscriptbase/$(OUTSUFX)/zscriptbase.compiled: $(ZSCRIPTBASE_DEPS)
+ $(ZEALOUS_BUILD) components/zscriptbase/zscriptbase.lpk
+
+components/zcontainers/$(OUTSUFX)/zcontainers.compiled: $(ZMATH_DEPS)
+ $(ZEALOUS_BUILD) components/zcontainers/zcontainers.lpk
+
+components/zcontrols/$(OUTSUFX)/zcontrols.compiled:
+ $(ZEALOUS_BUILD) components/zcontrols/zcontrols.lpk
+
+components/zundostack/$(OUTSUFX)/zundostack.compiled: $(ZSCRIPT_DEPS)
+ $(ZEALOUS_BUILD) components/zundostack/zundostack.lpk
diff --git a/cad/zcad/files/patch-cad__source_components_zebase_uzbpaths.pas b/cad/zcad/files/patch-cad__source_components_zebase_uzbpaths.pas
new file mode 100644
index 000000000000..a4e5991d0893
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_components_zebase_uzbpaths.pas
@@ -0,0 +1,53 @@
+--- cad_source/components/zebase/uzbpaths.pas.orig 2017-05-01 09:50:10 UTC
++++ cad_source/components/zebase/uzbpaths.pas
+@@ -19,7 +19,8 @@
+ unit uzbpaths;
+ {$INCLUDE def.inc}
+ interface
+-uses uzbtypes,Masks,LCLProc,uzbtypesbase,{$IFNDEF DELPHI}LazUTF8,{$ENDIF}sysutils;
++uses uzbtypes,Masks,LCLProc,uzbtypesbase,{$IFNDEF DELPHI}LazUTF8,{$ENDIF}
++{$IFDEF UNIX}baseunix,{$ENDIF}sysutils;
+ type
+ TFromDirIterator=procedure (filename:GDBString);
+ TFromDirIteratorObj=procedure (filename:GDBString) of object;
+@@ -35,7 +36,7 @@ function GetPartOfPath(out part:GDBStrin
+
+ procedure FromDirIterator(const path,mask,firstloadfilename:GDBSTring;proc:TFromDirIterator;method:TFromDirIteratorObj);
+ procedure FromDirsIterator(const path,mask,firstloadfilename:GDBString;proc:TFromDirIterator;method:TFromDirIteratorObj);
+-var ProgramPath,SupportPath,TempPath:gdbstring;
++var ProgramPath,SupportPath,TempPath,UserPath:gdbstring;
+ implementation
+ //uses log;
+ function FindInPaths(Paths,FileName:GDBString):GDBString;
+@@ -147,11 +148,19 @@ begin
+ DebugLn(sysutils.Format('[FILEOPS]FindInSupportPath: file not found:"%s"',[{$IFNDEF DELPHI}utf8tosys{$ENDIF}(FileName)]));
+ end;
+ function ExpandPath(path:GDBString):GDBString;
++{$IFDEF UNIX}var sb:stat;{$ENDIF}
+ begin
+ if path='' then
+ result:=programpath
+ else if path[1]='*' then
+- result:=programpath+copy(path,2,length(path)-1)
++begin
++{$IFDEF UNIX}
++ result:=UserPath+copy(path,2,length(path)-1);
++ if ((fpstat(result,sb) = 0) and fpS_ISDIR(sb.st_mode))
++ or not FileExists(result) then
++{$ENDIF}
++ result:=programpath+copy(path,2,length(path)-1);
++end
+ else result:=path;
+ result:=StringReplace(result,'/', PathDelim,[rfReplaceAll, rfIgnoreCase]);
+ if DirectoryExists({$IFNDEF DELPHI}utf8tosys{$ENDIF}(result)) then
+@@ -242,4 +251,10 @@ initialization
+ if (TempPath[length(TempPath)]<>PathDelim)
+ then
+ TempPath:=TempPath+PathDelim;
++{$IFDEF UNIX}
++ UserPath:=GetUserDir+'.zcad/';
++ ForceDirectories(UserPath+'autosave');
++ ForceDirectories(UserPath+'components');
++ ForceDirectories(UserPath+'rtl');
++{$ENDIF}
+ end.
diff --git a/cad/zcad/files/patch-cad__source_other_AGraphLaz_Vectors_ExtSys.pas b/cad/zcad/files/patch-cad__source_other_AGraphLaz_Vectors_ExtSys.pas
new file mode 100644
index 000000000000..73435de85e7c
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_other_AGraphLaz_Vectors_ExtSys.pas
@@ -0,0 +1,47 @@
+--- cad_source/other/AGraphLaz/Vectors/ExtSys.pas.orig 2017-05-01 09:49:55 UTC
++++ cad_source/other/AGraphLaz/Vectors/ExtSys.pas
+@@ -10,7 +10,7 @@ interface
+
+ uses
+ {$IFDEF V_WIN32}{$ENDIF}
+- {$IFDEF LINUX}{$IFDEF V_DELPHI}Libc{$ELSE}Linux{,cmem}{$ENDIF},{$ENDIF}
++ {$IFDEF FREEBSD}{$IFDEF V_DELPHI}Libc{$ELSE}unixtype,sysctl{,cmem}{$ENDIF},{$ENDIF}
+ SysUtils, {$IFDEF V_D4}SysConst, {$ENDIF}ExtType, VectErr{$IFNDEF LINUX}, Windows{$ENDIF};
+
+ const
+@@ -574,12 +574,13 @@ begin
+ end;
+ Result:=MemSize;
+ {$ELSE}
+-{$IFDEF LINUX}
++{$IFDEF FREEBSD}
+ var
+- SI: TSysInfo;
++ page_count, pagesize : UInt32;
++ len : size_t = sizeof(UInt32);
+ begin
+- if sysinfo(@SI){IFDEF V_DELPHI} = 0{ENDIF} then
+- Result:=SI.totalram
++ if (FPsysctlbyname('hw.pagesize', @pagesize, @len, nil, 0) {IFDEF V_DELPHI} = 0{ENDIF}) and (FPsysctlbyname('vm.stats.vm.v_page_count', @page_count, @len, nil, 0){IFDEF V_DELPHI} = 0{ENDIF}) then
++ Result:=page_count*pagesize
+ else
+ Result:=0;
+ {$ELSE}
+@@ -598,12 +599,13 @@ begin
+ GlobalMemoryStatus({$IFDEF V_FREEPASCAL}@{$ENDIF}MemoryStatus);
+ Result:=MemoryStatus.dwAvailPhys;
+ {$ELSE}
+-{$IFDEF LINUX}
++{$IFDEF FREEBSD}
+ var
+- SI: TSysInfo;
++ free_count, pagesize : UInt32;
++ len : size_t = sizeof(UInt32);
+ begin
+- if sysinfo(@SI){IFDEF V_DELPHI} = 0{ENDIF} then
+- Result:=SI.freeram
++ if (FPsysctlbyname('hw.pagesize', @pagesize, @len, nil, 0) {IFDEF V_DELPHI} = 0{ENDIF}) and (FPsysctlbyname('vm.stats.vm.v_free_count', @free_count, @len, nil, 0){IFDEF V_DELPHI} = 0{ENDIF}) then
++ Result:=free_count*pagesize
+ else
+ Result:=0;
+ {$ELSE}
diff --git a/cad/zcad/files/patch-cad__source_zcad.lpi b/cad/zcad/files/patch-cad__source_zcad.lpi
new file mode 100644
index 000000000000..ef0a5bf29179
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_zcad.lpi
@@ -0,0 +1,11 @@
+--- cad_source/zcad.lpi.orig 2017-05-01 09:50:07 UTC
++++ cad_source/zcad.lpi
+@@ -220,7 +220,7 @@
+ <PackageName Value="AnchorDocking"/>
+ </Item15>
+ <Item16>
+- <PackageName Value="LazOpenGLContext"/>
++ <Filename Value="openglcontext.pas"/>
+ </Item16>
+ <Item17>
+ <PackageName Value="LCL"/>
diff --git a/cad/zcad/files/patch-cad__source_zcad_commands_uzccombase.pas b/cad/zcad/files/patch-cad__source_zcad_commands_uzccombase.pas
new file mode 100644
index 000000000000..ce7f0c427844
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_zcad_commands_uzccombase.pas
@@ -0,0 +1,17 @@
+--- cad_source/zcad/commands/uzccombase.pas.orig 2017-05-01 09:49:51 UTC
++++ cad_source/zcad/commands/uzccombase.pas
+@@ -332,7 +332,14 @@ begin
+ itautoseve:=false;
+ if operands='QS' then
+ begin
++{$IFDEF UNIX}
++ // On Unix, force saving under ~/.zcad/autosave
++ s1:=sysvar.SAVE.SAVE_Auto_FileName^;
++ if s1[1]='*' then
++ s1:=UserPath+copy(s1,2,length(s1)-1);
++{$ELSE}
+ s1:=ExpandPath(sysvar.SAVE.SAVE_Auto_FileName^);
++{$ENDIF}
+ s:=rsAutoSave+': '''+s1+'''';
+ HistoryOutStr(s);
+ itautoseve:=true;
diff --git a/cad/zcad/files/patch-cad__source_zcad_commands_uzccominterface.pas b/cad/zcad/files/patch-cad__source_zcad_commands_uzccominterface.pas
new file mode 100644
index 000000000000..9afbbcf69f47
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_zcad_commands_uzccominterface.pas
@@ -0,0 +1,20 @@
+--- cad_source/zcad/commands/uzccominterface.pas.orig 2017-05-01 09:49:51 UTC
++++ cad_source/zcad/commands/uzccominterface.pas
+@@ -477,7 +477,7 @@ var
+ begin
+ try
+ // create a new xml config file
+- filename:=utf8tosys(ProgramPath+'components/defaultlayout.xml');
++ filename:=utf8tosys(UserPath+'components/defaultlayout.xml');
+ SaveLayoutToFile(filename);
+ exit;
+ XMLConfig:=TXMLConfigStorage.Create(filename,false);
+@@ -702,7 +702,7 @@ var
+ begin
+ mem.init({$IFDEF DEBUGBUILD}'{A1891083-67C6-4C21-8012-6D215935F6A6}',{$ENDIF}1024);
+ SysVarUnit^.SavePasToMem(mem);
+- mem.SaveToFile(expandpath(ProgramPath+'rtl/sysvar.pas'));
++ mem.SaveToFile(expandpath(UserPath+'rtl/sysvar.pas'));
+ mem.done;
+ result:=cmd_ok;
+ end;
diff --git a/cad/zcad/files/patch-cad__source_zcad_gui_uzcmainwindow.pas b/cad/zcad/files/patch-cad__source_zcad_gui_uzcmainwindow.pas
new file mode 100644
index 000000000000..dcea423394cd
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_zcad_gui_uzcmainwindow.pas
@@ -0,0 +1,11 @@
+--- cad_source/zcad/gui/uzcmainwindow.pas.orig 2017-05-01 09:49:49 UTC
++++ cad_source/zcad/gui/uzcmainwindow.pas
+@@ -693,7 +693,7 @@ begin
+
+ mem.init({$IFDEF DEBUGBUILD}'{71D987B4-8C57-4C62-8C12-CFC24A0A9C9A}',{$ENDIF}1024);
+ SavedUnit^.SavePasToMem(mem);
+- mem.SaveToFile(expandpath(ProgramPath+'rtl'+PathDelim+'savedvar.pas'));
++ mem.SaveToFile(expandpath(UserPath+'rtl'+PathDelim+'savedvar.pas'));
+ mem.done;
+ end;
+
diff --git a/cad/zcad/files/patch-cad__source_zcad_uzclog.pas b/cad/zcad/files/patch-cad__source_zcad_uzclog.pas
new file mode 100644
index 000000000000..195e486d3b16
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_zcad_uzclog.pas
@@ -0,0 +1,37 @@
+--- cad_source/zcad/uzclog.pas.orig 2017-05-01 09:49:46 UTC
++++ cad_source/zcad/uzclog.pas
+@@ -21,10 +21,11 @@ unit uzclog;
+ {$mode objfpc}{$H+}
+ interface
+ uses UGDBOpenArrayOfByte,gzctnrvectordata,gzctnrstl,LazLoggerBase,
++ {$IFDEF UNIX}uzbpaths,{$ENDIF}
+ LazLogger,strutils,sysutils{$IFNDEF DELPHI},LazUTF8{$ENDIF};
+ const {$IFDEF DELPHI}filelog='log/zcad_delphi.log';{$ENDIF}
+ {$IFDEF FPC}
+- {$IFDEF LINUX}filelog='log/zcad_linux.log';{$ENDIF}
++ {$IFDEF UNIX}filelog='zcad_unix.log';{$ENDIF}
+ {$IFDEF WINDOWS}filelog='log/zcad_windows.log';{$ENDIF}
+ {$ENDIF}
+ lp_IncPos=1;
+@@ -131,7 +132,9 @@ var
+ begin
+ if assigned(SplashTextOut) then
+ SplashTextOut(s,true);
+- logname:={$IFNDEF DELPHI}SysToUTF8{$ENDIF}(ExtractFilePath(paramstr(0)))+filelog+'hard';
++ logname:={$IFNDEF DELPHI}SysToUTF8{$ENDIF}
++ ({$IFDEF UNIX}UserPath{$ELSE}ExtractFilePath(paramstr(0)){$ENDIF})
++ +filelog+'hard';
+ FileHandle:=0;
+ if not fileexists({$IFNDEF DELPHI}UTF8ToSys{$ENDIF}(logname)) then
+ FileHandle:=FileCreate({$IFNDEF DELPHI}UTF8ToSys{$ENDIF}(logname))
+@@ -496,7 +499,9 @@ begin
+ end;
+ initialization
+ begin
+- programlog.init({$IFNDEF DELPHI}SysToUTF8{$ENDIF}(ExtractFilePath(paramstr(0)))+filelog,LM_Error);
++ programlog.init({$IFNDEF DELPHI}SysToUTF8{$ENDIF}
++ ({$IFDEF UNIX}UserPath{$ELSE}ExtractFilePath(paramstr(0)){$ENDIF})
++ +filelog,LM_Error);
+ end;
+ finalization
+ programlog.done;
diff --git a/cad/zcad/files/patch-cad__source_zcad_uzcsysinfo.pas b/cad/zcad/files/patch-cad__source_zcad_uzcsysinfo.pas
new file mode 100644
index 000000000000..0403ed9ca39f
--- /dev/null
+++ b/cad/zcad/files/patch-cad__source_zcad_uzcsysinfo.pas
@@ -0,0 +1,10 @@
+--- cad_source/zcad/uzcsysinfo.pas.orig 2017-05-01 09:49:45 UTC
++++ cad_source/zcad/uzcsysinfo.pas
+@@ -196,6 +196,7 @@ begin
+ debugln('{N}SysParam.ProgramPath="%s"',[ProgramPath]);
+ //programlog.LogOutStr(format('SysParam.ProgramPath="%s"',[ProgramPath]),lp_OldPos,LM_Necessarily);
+ debugln('{N}SysParam.TempPath="%s"',[TempPath]);
++ debugln('{N}SysParam.UserPath="%s"',[UserPath]);
+ //programlog.LogOutStr(format('SysParam.TempPath="%s"',[TempPath]),lp_OldPos,LM_Necessarily);
+ debugln('{N}SysParam.ScreenX=%d',[SysParam.ScreenX]);
+ //programlog.LogOutStr(format('SysParam.ScreenX=%d',[SysParam.ScreenX]),lp_OldPos,LM_Necessarily);
diff --git a/cad/zcad/pkg-descr b/cad/zcad/pkg-descr
new file mode 100644
index 000000000000..c55fcb221244
--- /dev/null
+++ b/cad/zcad/pkg-descr
@@ -0,0 +1,4 @@
+ZCAD is simple CAD program with AutoCAD DXF 2000 file format support.
+It is developed with Free Pascal and Lazarus.
+
+https://sourceforge.net/projects/zcad/
diff --git a/cad/zcad/pkg-plist b/cad/zcad/pkg-plist
new file mode 100644
index 000000000000..2983c4de52e0
--- /dev/null
+++ b/cad/zcad/pkg-plist
@@ -0,0 +1,326 @@
+zcad/blocks/el/general/DEVICE_CABLE_MARK.pas
+zcad/blocks/el/general/DEVICE_CONNECTOR.pas
+zcad/blocks/el/general/DEVICE_CONNECTOR_POINT.pas
+zcad/blocks/el/general/DEVICE_CONNECTOR_SQUARE.pas
+zcad/blocks/el/general/DEVICE_CONNECTOR_TERMINAL.pas
+zcad/blocks/el/general/DEVICE_EL_CABLE_BREAK.pas
+zcad/blocks/el/general/DEVICE_EL_CABLE_DOWN.pas
+zcad/blocks/el/general/DEVICE_EL_CABLE_FROMDOWN.pas
+zcad/blocks/el/general/DEVICE_EL_CABLE_FROMUP.pas
+zcad/blocks/el/general/DEVICE_EL_CABLE_UP.pas
+zcad/blocks/el/general/DEVICE_EL_CONTACTOR.pas
+zcad/blocks/el/general/DEVICE_EL_LIGHT_FBULB.pas
+zcad/blocks/el/general/DEVICE_EL_LIGHT_LBULB.pas
+zcad/blocks/el/general/DEVICE_EL_LIGHT_SWITH.pas
+zcad/blocks/el/general/DEVICE_EL_MOTOR.pas
+zcad/blocks/el/general/DEVICE_EL_SHU.pas
+zcad/blocks/el/general/DEVICE_EL_SHUV.pas
+zcad/blocks/el/general/DEVICE_EL_SR.pas
+zcad/blocks/el/general/DEVICE_EL_YARV.pas
+zcad/blocks/el/general/DEVICE_KIP_ACTUATOR.pas
+zcad/blocks/el/general/DEVICE_KIP_AUTOMATION_BOX.pas
+zcad/blocks/el/general/DEVICE_KIP_CONNECTION_BOX.pas
+zcad/blocks/el/general/DEVICE_KIP_DETECTOR.pas
+zcad/blocks/el/general/DEVICE_KIP_DEVICE.pas
+zcad/blocks/el/general/DEVICE_KIP_KDU.pas
+zcad/blocks/el/general/DEVICE_KIP_KNOPKA.pas
+zcad/blocks/el/general/DEVICE_KIP_KNOPKA_PKE.pas
+zcad/blocks/el/general/DEVICE_KIP_KOROBKA.pas
+zcad/blocks/el/general/DEVICE_KIP_KPV.pas
+zcad/blocks/el/general/DEVICE_KIP_OZK.pas
+zcad/blocks/el/general/DEVICE_KIP_SENSOR.pas
+zcad/blocks/el/general/DEVICE_KIP_SOLENOID.pas
+zcad/blocks/el/general/DEVICE_KIP_SPZH.pas
+zcad/blocks/el/general/DEVICE_KIP_UKP.pas
+zcad/blocks/el/general/DEVICE_KIP_VALVE.pas
+zcad/blocks/el/general/DEVICE_OPS_AHL.pas
+zcad/blocks/el/general/DEVICE_OPS_DISTRIBUTION_BOX.pas
+zcad/blocks/el/general/DEVICE_OPS_GB2.pas
+zcad/blocks/el/general/DEVICE_OPS_PKU.pas
+zcad/blocks/el/general/DEVICE_OPS_SHPS.pas
+zcad/blocks/el/general/DEVICE_OPS_UZ.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGB.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGL.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGL2.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGLI.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGLR.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGOI.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGOR.pas
+zcad/blocks/el/general/DEVICE_OS_DAT_BGT.pas
+zcad/blocks/el/general/DEVICE_OS_ELLOCK.pas
+zcad/blocks/el/general/DEVICE_OS_KNOPKA.pas
+zcad/blocks/el/general/DEVICE_OS_READER.pas
+zcad/blocks/el/general/DEVICE_PS_AR1.pas
+zcad/blocks/el/general/DEVICE_PS_AR2.pas
+zcad/blocks/el/general/DEVICE_PS_AR8.pas
+zcad/blocks/el/general/DEVICE_PS_ARK_DEVICE.pas
+zcad/blocks/el/general/DEVICE_PS_BIAD_RUPOR.pas
+zcad/blocks/el/general/DEVICE_PS_BIAL.pas
+zcad/blocks/el/general/DEVICE_PS_BIAS.pas
+zcad/blocks/el/general/DEVICE_PS_BIASL.pas
+zcad/blocks/el/general/DEVICE_PS_BRIZ.pas
+zcad/blocks/el/general/DEVICE_PS_DAT_HAND.pas
+zcad/blocks/el/general/DEVICE_PS_DAT_SMOKE.pas
+zcad/blocks/el/general/DEVICE_PS_DAT_SMOKE_AVTON.pas
+zcad/blocks/el/general/DEVICE_PS_DAT_SMOKE_FALSH.pas
+zcad/blocks/el/general/DEVICE_PS_DAT_SMOKE_FALSH2.pas
+zcad/blocks/el/general/DEVICE_PS_DAT_TERMO.pas
+zcad/blocks/el/general/DEVICE_PS_ET.pas
+zcad/blocks/el/general/DEVICE_PS_GB.pas
+zcad/blocks/el/general/DEVICE_PS_KOROBKA.pas
+zcad/blocks/el/general/DEVICE_PS_KPB.pas
+zcad/blocks/el/general/DEVICE_PS_SP1.pas
+zcad/blocks/el/general/DEVICE_PS_TABLO_ARROW.pas
+zcad/blocks/el/general/DEVICE_PS_TABLO_EXIT.pas
+zcad/blocks/el/general/DEVICE_PS_TABLO_EXIT_RESERVE.pas
+zcad/blocks/el/general/DEVICE_PS_TABLO_PNVHODI.pas
+zcad/blocks/el/general/DEVICE_PS_TABLO_PUHODI.pas
+zcad/blocks/el/general/DEVICE_PS_UKVK.pas
+zcad/blocks/el/general/DEVICE_PS_VUOS.pas
+zcad/blocks/el/general/DEVICE_SPDS_AXIS.pas
+zcad/blocks/el/general/DEVICE_SS_19.pas
+zcad/blocks/el/general/DEVICE_SS_ATS.pas
+zcad/blocks/el/general/DEVICE_SS_BIAS.pas
+zcad/blocks/el/general/DEVICE_SS_MIC.pas
+zcad/blocks/el/general/DEVICE_SS_PRICLOCK.pas
+zcad/blocks/el/general/DEVICE_SS_RJSOCKET.pas
+zcad/blocks/el/general/DEVICE_SS_RT.pas
+zcad/blocks/el/general/DEVICE_SS_SECCLOCK.pas
+zcad/blocks/el/general/DEVICE_SS_VCAM.pas
+zcad/blocks/el/general/DEVICE_SS_VCAMTC.pas
+zcad/blocks/el/general/_KIP.dxf
+zcad/blocks/el/general/_OPS.dxf
+zcad/blocks/el/general/_connector.dxf
+zcad/blocks/el/general/_el.dxf
+zcad/blocks/el/general/_nok.dxf
+zcad/blocks/el/general/_spds.dxf
+zcad/blocks/el/general/_ss.dxf
+zcad/blocks/el/general/zcadblocks.lst
+zcad/blocks/ops/PS_DAT_SMOKE.dxf
+zcad/blocks/ops/PS_DAT_TERMO.dxf
+zcad/components/22inch_1680x1050.xml
+zcad/components/_sys.dxf
+zcad/components/autorun.cmd
+zcad/components/defaultlayout.xml
+zcad/components/defaultlayoutbackup.xml
+zcad/components/empty.dxf
+zcad/components/klayout.xml
+zcad/components/logo.png
+zcad/components/main.sf
+zcad/components/palette.rgb
+zcad/components/undocked.xml
+zcad/components/vdock.xml
+zcad/components/zcad.lin
+zcad/fonts/GEWIND.SHX
+zcad/fonts/OpenGostTypeA-Regular.ttf
+zcad/fonts/OpenGostTypeB-Regular.ttf
+zcad/fonts/_mipGost.shx
+zcad/fonts/ltypeshp.shx
+zcad/images/basket.png
+zcad/images/bug.png
+zcad/images/dxf.png
+zcad/images/freze.png
+zcad/images/lock.png
+zcad/images/minus.png
+zcad/images/navgroup.png
+zcad/images/navigator.ima
+zcad/images/off.png
+zcad/images/ok.png
+zcad/images/on.png
+zcad/images/ondiagram.png
+zcad/images/onplan.png
+zcad/images/plus.png
+zcad/images/print.png
+zcad/images/purge.png
+zcad/images/refresh.png
+zcad/images/unfreze.png
+zcad/images/unlock.png
+zcad/images/unprint.png
+zcad/languages/anchordockstr.ru.po
+zcad/languages/lclstrconsts.ru.po
+zcad/languages/zcad.po
+zcad/languages/zcad.ru.po
+zcad/menu/BMP/1.bmp
+zcad/menu/BMP/El_Wire.bmp
+zcad/menu/BMP/about.bmp
+zcad/menu/BMP/addtoowner.bmp
+zcad/menu/BMP/arc.bmp
+zcad/menu/BMP/array.bmp
+zcad/menu/BMP/autocable.bmp
+zcad/menu/BMP/bedit.bmp
+zcad/menu/BMP/bottom.bmp
+zcad/menu/BMP/circle.bmp
+zcad/menu/BMP/circle2p.bmp
+zcad/menu/BMP/circle3p.bmp
+zcad/menu/BMP/circlecd.bmp
+zcad/menu/BMP/close.bmp
+zcad/menu/BMP/colors.bmp
+zcad/menu/BMP/copy.bmp
+zcad/menu/BMP/copyclip.bmp
+zcad/menu/BMP/copyclipbase.bmp
+zcad/menu/BMP/cutclip.bmp
+zcad/menu/BMP/dimaligned.bmp
+zcad/menu/BMP/dimdiametric.bmp
+zcad/menu/BMP/dimlinear.bmp
+zcad/menu/BMP/dimradial.bmp
+zcad/menu/BMP/dimstyles.bmp
+zcad/menu/BMP/dist.bmp
+zcad/menu/BMP/el_cable.bmp
+zcad/menu/BMP/el_leader.bmp
+zcad/menu/BMP/erase.bmp
+zcad/menu/BMP/exit.bmp
+zcad/menu/BMP/find.bmp
+zcad/menu/BMP/help.bmp
+zcad/menu/BMP/insert.bmp
+zcad/menu/BMP/isone.bmp
+zcad/menu/BMP/isonw.bmp
+zcad/menu/BMP/isose.bmp
+zcad/menu/BMP/isosw.bmp
+zcad/menu/BMP/layer.bmp
+zcad/menu/BMP/left.bmp
+zcad/menu/BMP/line.bmp
+zcad/menu/BMP/linestyles.bmp
+zcad/menu/BMP/load.bmp
+zcad/menu/BMP/lwt.bmp
+zcad/menu/BMP/magnet.bmp
+zcad/menu/BMP/main.png
+zcad/menu/BMP/matchprop.bmp
+zcad/menu/BMP/mirror.bmp
+zcad/menu/BMP/move.bmp
+zcad/menu/BMP/mvarman.bmp
+zcad/menu/BMP/new.bmp
+zcad/menu/BMP/noimage.bmp
+zcad/menu/BMP/one.bmp
+zcad/menu/BMP/options.bmp
+zcad/menu/BMP/osnap.bmp
+zcad/menu/BMP/pandown.bmp
+zcad/menu/BMP/panleft.bmp
+zcad/menu/BMP/panright.bmp
+zcad/menu/BMP/panup.bmp
+zcad/menu/BMP/pasteclip.bmp
+zcad/menu/BMP/perspective.bmp
+zcad/menu/BMP/pline.bmp
+zcad/menu/BMP/polar.bmp
+zcad/menu/BMP/polyed.bmp
+zcad/menu/BMP/print.bmp
+zcad/menu/BMP/ps.bmp
+zcad/menu/BMP/rectangle.bmp
+zcad/menu/BMP/redo.bmp
+zcad/menu/BMP/regen.bmp
+zcad/menu/BMP/removeautocable.bmp
+zcad/menu/BMP/right.bmp
+zcad/menu/BMP/rotate.bmp
+zcad/menu/BMP/save.bmp
+zcad/menu/BMP/saveas.bmp
+zcad/menu/BMP/scale.bmp
+zcad/menu/BMP/snaptoapparentintersection.bmp
+zcad/menu/BMP/snaptocenter.bmp
+zcad/menu/BMP/snaptoend.bmp
+zcad/menu/BMP/snaptogrid.bmp
+zcad/menu/BMP/snaptoinsert.bmp
+zcad/menu/BMP/snaptointersection.bmp
+zcad/menu/BMP/snaptomid.bmp
+zcad/menu/BMP/snaptonearest.bmp
+zcad/menu/BMP/snaptoparalel.bmp
+zcad/menu/BMP/snaptoperpendicular.bmp
+zcad/menu/BMP/snaptoquadrant.bmp
+zcad/menu/BMP/snaptotangent.bmp
+zcad/menu/BMP/spec.bmp
+zcad/menu/BMP/sub.bmp
+zcad/menu/BMP/superline.bmp
+zcad/menu/BMP/text.bmp
+zcad/menu/BMP/textstyles.bmp
+zcad/menu/BMP/top.bmp
+zcad/menu/BMP/treeview.bmp
+zcad/menu/BMP/undo.bmp
+zcad/menu/BMP/varman.bmp
+zcad/menu/BMP/zoomall.bmp
+zcad/menu/BMP/zoomin.bmp
+zcad/menu/BMP/zoomout.bmp
+zcad/menu/BMP/zoomwindow.bmp
+zcad/menu/actions.acn
+zcad/menu/default.cla
+zcad/menu/electrotech.acn
+zcad/menu/mainmenu.mn
+zcad/programdb/_startup.pas
+zcad/programdb/amk/ksspv.pas
+zcad/programdb/argusspectr/оповещение/am.pas
+zcad/programdb/argusspectr/оповещение/pu.pas
+zcad/programdb/bastion/ибп/ibp.pas
+zcad/programdb/bolid/ППКОП/ppkop.pas
+zcad/programdb/bolid/ППКОП/pu.pas
+zcad/programdb/danfoss/esm.pas
+zcad/programdb/danfoss/kpi35.pas
+zcad/programdb/irset/Шлейфовые извещатели/izv.pas
+zcad/programdb/kamkabel/pvs.pas
+zcad/programdb/kamkabel/svvp.pas
+zcad/programdb/kazteplocontrol/tb.pas
+zcad/programdb/manotom/mp3u.pas
+zcad/programdb/owen/dts.pas
+zcad/programdb/paritet/ksspv.pas
+zcad/programdb/rele/rp21.pas
+zcad/programdb/rubezh/Шлейфовые извещатели/C2000-4.pas
+zcad/programdb/saranskcabel/1.pas
+zcad/programdb/sevcabel/_EQ_SEVCABLEkvvg.csv
+zcad/programdb/sevcabel/kvvg.pas
+zcad/programdb/sevcabel/vvg.pas
+zcad/programdb/sevcabel/vvgngafrls.pas
+zcad/programdb/speccable/cable.pas
+zcad/programdb/spkbtehno/cable.pas
+zcad/programdb/ufimcabel/mks.pas
+zcad/programdb/ООО Электротехника и Автоматика/op.pas
+zcad/rtl/BlockCategory.cat
+zcad/rtl/EqCategory.cat
+zcad/rtl/cables.pas
+zcad/rtl/connectors.pas
+zcad/rtl/devicebase.pas
+zcad/rtl/devices.pas
+zcad/rtl/dwg/DrawingDeviceBase.pas
+zcad/rtl/dwg/DrawingVars.pas
+zcad/rtl/objcalc/opsmark.pas
+zcad/rtl/objcalc/opsmarkdef.pas
+zcad/rtl/objdefunits/cable.pas
+zcad/rtl/objdefunits/elwire.pas
+zcad/rtl/objdefunits/include/_addtocable.pas
+zcad/rtl/objdefunits/include/_riser.pas
+zcad/rtl/objdefunits/include/_riserlink.pas
+zcad/rtl/objdefunits/include/_ss_socket.pas
+zcad/rtl/objdefunits/include/bglsensor.pas
+zcad/rtl/objdefunits/include/blocktype.pas
+zcad/rtl/objdefunits/include/cablename.pas
+zcad/rtl/objdefunits/include/connector.pas
+zcad/rtl/objdefunits/include/firesensor.pas
+zcad/rtl/objdefunits/include/objconnect.pas
+zcad/rtl/objdefunits/include/objgroup.pas
+zcad/rtl/objdefunits/include/objmaterial.pas
+zcad/rtl/objdefunits/include/objname.pas
+zcad/rtl/objdefunits/include/rip.pas
+zcad/rtl/objdefunits/include/slcabagenmodul.pas
+zcad/rtl/objdefunits/objroot.pas
+zcad/rtl/objdefunits/superline.pas
+zcad/rtl/objdefunits/trace.pas
+zcad/rtl/savedvar.pas
+zcad/rtl/styles/OPS_shleif.pas
+zcad/rtl/styles/styles.pas
+zcad/rtl/system.pas
+zcad/rtl/sysvar.pas
+zcad/rtl/sysvar_original.pas
+zcad/sample/entities.dxf
+zcad/sample/enttree/nonregular.dwg
+zcad/sample/enttree/nonregular2.dwg
+zcad/sample/enttree/regular.dwg
+zcad/sample/test_dxf/3d_mount.dxf
+zcad/sample/test_dxf/by_trace.csv
+zcad/sample/test_dxf/by_trace.dxf
+zcad/sample/test_dxf/by_trace.dxf.dbpas
+zcad/sample/test_dxf/currenttest.dxf
+zcad/sample/test_dxf/currenttest.dxf.dbpas
+zcad/sample/test_dxf/em.dxf
+zcad/sample/test_dxf/em.dxf.dbpas
+zcad/sample/test_dxf/ops.dxf
+zcad/sample/test_dxf/teapot.dxf
+zcad/sample/test_dxf/test.dxf
+zcad/sample/test_dxf/truetype.dxf
+zcad/sample/zigzag.dxf
+zcad/template/default.dxf
+zcad/zcad