diff --git a/vms/cmnflags.mms b/vms/cmnflags.mms
new file mode 100644
index 0000000000000000000000000000000000000000..60b84dcc83d7bd920c6c8eadd0084a1fa9dfe636_dm1zL2NtbmZsYWdzLm1tcw==
--- /dev/null
+++ b/vms/cmnflags.mms
@@ -0,0 +1,8 @@
+DBGFLAGS =
+LNKFLAGS =
+
+! DBGFLAGS = /debug/noopt
+! LNKFLAGS = /debug
+
+OBJDIR = /object=[.obj_$(MMSARCH_NAME)]
+
diff --git a/vms/config.h b/vms/config.h
new file mode 100644
index 0000000000000000000000000000000000000000..60b84dcc83d7bd920c6c8eadd0084a1fa9dfe636_dm1zL2NvbmZpZy5o
--- /dev/null
+++ b/vms/config.h
@@ -0,0 +1,421 @@
+/* config.h.  for OpenVMS  */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+#define ENABLE_NLS 1
+
+/* Define to 1 if using x86 assembler optimizations. */
+/* #undef HAVE_ASM_X86 */
+
+/* Define to 1 if using x86_64 assembler optimizations. */
+/* #undef HAVE_ASM_X86_64 */
+
+/* Define to 1 if bswap_16 is available. */
+/* #undef HAVE_BSWAP_16 */
+
+/* Define to 1 if bswap_32 is available. */
+/* #undef HAVE_BSWAP_32 */
+
+/* Define to 1 if bswap_64 is available. */
+/* #undef HAVE_BSWAP_64 1 */
+
+/* Define to 1 if you have the <byteswap.h> header file. */
+/* #undef HAVE_BYTESWAP_H */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define to 1 if crc32 integrity check is enabled. */
+#define HAVE_CHECK_CRC32 1
+
+/* Define to 1 if crc64 integrity check is enabled. */
+#define HAVE_CHECK_CRC64 1
+
+/* Define to 1 if sha256 integrity check is enabled. */
+#define HAVE_CHECK_SHA256 1
+
+/* Define to 1 if the number of available CPU cores can be detected with
+   sysconf(_SC_NPROCESSORS_ONLN). */
+#define HAVE_CPUCORES_SYSCONF 1
+
+/* Define to 1 if the number of available CPU cores can be detected with
+   sysctl(). */
+/* #undef HAVE_CPUCORES_SYSCTL */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+#define HAVE_DCGETTEXT 1
+
+/* Define to 1 if decoder components are enabled. */
+#define HAVE_DECODERS 1
+
+/* Define to 1 if arm decoder is enabled. */
+#define HAVE_DECODER_ARM 1
+
+/* Define to 1 if armthumb decoder is enabled. */
+#define HAVE_DECODER_ARMTHUMB 1
+
+/* Define to 1 if delta decoder is enabled. */
+#define HAVE_DECODER_DELTA 1
+
+/* Define to 1 if ia64 decoder is enabled. */
+#define HAVE_DECODER_IA64 1
+
+/* Define to 1 if lzma1 decoder is enabled. */
+#define HAVE_DECODER_LZMA1 1
+
+/* Define to 1 if lzma2 decoder is enabled. */
+#define HAVE_DECODER_LZMA2 1
+
+/* Define to 1 if powerpc decoder is enabled. */
+#define HAVE_DECODER_POWERPC 1
+
+/* Define to 1 if sparc decoder is enabled. */
+#define HAVE_DECODER_SPARC 1
+
+/* Define to 1 if subblock decoder is enabled. */
+/* #undef HAVE_DECODER_SUBBLOCK */
+
+/* Define to 1 if x86 decoder is enabled. */
+#define HAVE_DECODER_X86 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if encoder components are enabled. */
+#define HAVE_ENCODERS 1
+
+/* Define to 1 if arm encoder is enabled. */
+#define HAVE_ENCODER_ARM 1
+
+/* Define to 1 if armthumb encoder is enabled. */
+#define HAVE_ENCODER_ARMTHUMB 1
+
+/* Define to 1 if delta encoder is enabled. */
+#define HAVE_ENCODER_DELTA 1
+
+/* Define to 1 if ia64 encoder is enabled. */
+#define HAVE_ENCODER_IA64 1
+
+/* Define to 1 if lzma1 encoder is enabled. */
+#define HAVE_ENCODER_LZMA1 1
+
+/* Define to 1 if lzma2 encoder is enabled. */
+#define HAVE_ENCODER_LZMA2 1
+
+/* Define to 1 if powerpc encoder is enabled. */
+#define HAVE_ENCODER_POWERPC 1
+
+/* Define to 1 if sparc encoder is enabled. */
+#define HAVE_ENCODER_SPARC 1
+
+/* Define to 1 if subblock encoder is enabled. */
+/* #undef HAVE_ENCODER_SUBBLOCK */
+
+/* Define to 1 if x86 encoder is enabled. */
+#define HAVE_ENCODER_X86 1
+
+/* Define to 1 if the system supports fast unaligned memory access. */
+#define HAVE_FAST_UNALIGNED_ACCESS 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `futimens' function. */
+/* #undef HAVE_FUTIMENS */
+
+/* Define to 1 if you have the `futimes' function. */
+/* #undef HAVE_FUTIMES */
+
+/* Define to 1 if you have the `futimesat' function. */
+/* #undef HAVE_FUTIMESAT */
+
+/* Define to 1 if you have the <getopt.h> header file. */
+/* #undef HAVE_GETOPT_H */
+
+/* Define to 1 if you have the `getopt_long' function. */
+/* #undef HAVE_GETOPT_LONG */
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#define HAVE_GETTEXT 1
+
+/* Define if you have the iconv() function. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 to enable bt2 match finder. */
+#define HAVE_MF_BT2 1
+
+/* Define to 1 to enable bt3 match finder. */
+#define HAVE_MF_BT3 1
+
+/* Define to 1 to enable bt4 match finder. */
+#define HAVE_MF_BT4 1
+
+/* Define to 1 to enable hc3 match finder. */
+#define HAVE_MF_HC3 1
+
+/* Define to 1 to enable hc4 match finder. */
+#define HAVE_MF_HC4 1
+
+/* Define to 1 if getopt.h declares extern int optreset. */
+/* #undef HAVE_OPTRESET */
+
+/* Define to 1 if the amount of physical memory can be detected with
+   sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES). */
+/* #undef HAVE_PHYSMEM_SYSCONF */
+
+/* Define to 1 if the amount of physical memory can be detected with sysctl().
+   */
+/* #undef HAVE_PHYSMEM_SYSCTL */
+
+/* Define to 1 if the amount of physical memory can be detected with Linux
+   sysinfo(). */
+/* #undef HAVE_PHYSMEM_SYSINFO */
+
+/* Define if you have POSIX threads libraries and header files. */
+#define HAVE_PTHREAD 1
+
+/* Define to 1 if optimizing for size. */
+/* #undef HAVE_SMALL */
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if `struct stat' is a member of `st_atimensec'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */
+
+/* Define to 1 if `struct stat' is a member of `st_atimespec.tv_nsec'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC */
+
+/* Define to 1 if `struct stat' is a member of `st_atim.st__tim.tv_nsec'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC */
+
+/* Define to 1 if `struct stat' is a member of `st_atim.tv_nsec'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC */
+
+/* Define to 1 if `struct stat' is a member of `st_uatime'. */
+/* #undef HAVE_STRUCT_STAT_ST_UATIME */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+/* #undef HAVE_SYS_PARAM_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/sysctl.h> header file. */
+/* #undef HAVE_SYS_SYSCTL_H */
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `utime' function. */
+#define HAVE_UTIME 1
+
+/* Define to 1 if you have the `utimes' function. */
+#define HAVE_UTIMES 1
+
+/* Define to 1 or 0, depending whether the compiler supports simple visibility
+   declarations. */
+#define HAVE_VISIBILITY 0
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR "[.libs]"
+
+/* Define to 1 to disable debugging code. */
+#define NDEBUG 1
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "xz"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "lasse.collin@tukaani.org"
+
+/* Define to the URL of the home page of this package. */
+#define PACKAGE_HOMEPAGE "http://tukaani.org/xz/"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "XZ Utils"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "XZ Utils 5.2.5"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "xz"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "5.2.5"
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* The size of `size_t', as computed by sizeof. */
+#define SIZEOF_SIZE_T 4
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Version number of package */
+#define VERSION "5.2.5"
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT64_T */
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT8_T */
+
+/* Define to rpl_ if the getopt replacement functions and variables should be
+   used. */
+/* #undef __GETOPT_PREFIX */
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef int32_t */
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef int64_t */
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint16_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint64_t */
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint8_t */
+
+/* Define to the type of an unsigned integer type wide enough to hold a
+   pointer, if such a type exists, and if the system does not define it. */
+/* #undef uintptr_t */
+
+#define LOCALEDIR "SYS$I18N_LOCALE"
+
+#define MYTHREAD_POSIX 1
+
+#define getopt xz_getopt
+#define optopt xz_optopt
+#define optind xz_optind
+#define opterr xz_opterr
+
+#define ASSUME_RAM 128
+
+//#define PRIx32 "X"
+//#define PRIx64 "llX"
+
+#include <signal.h>
+extern int pthread_sigmask ( int how , const sigset_t *set , sigset_t *oset );
diff --git a/vms/descrip.mms b/vms/descrip.mms
new file mode 100644
index 0000000000000000000000000000000000000000..60b84dcc83d7bd920c6c8eadd0084a1fa9dfe636_dm1zL2Rlc2NyaXAubW1z
--- /dev/null
+++ b/vms/descrip.mms
@@ -0,0 +1,14 @@
+.INCLUDE CMNFLAGS
+
+.FIRST
+	set process/parse=extend
+
+all :
+	mms/desc=descrip_src_liblzma_check.mms
+	mms/desc=descrip_src_liblzma_common.mms
+	mms/desc=descrip_src_liblzma_delta.mms
+	mms/desc=descrip_src_liblzma_lz.mms
+	mms/desc=descrip_src_liblzma_lzma.mms
+	mms/desc=descrip_src_liblzma_rangecoder.mms
+	mms/desc=descrip_src_liblzma_simple.mms
+	library/create liblzma.olb [.obj_$(MMSARCH_NAME)]*.obj
diff --git a/vms/firstincl.h b/vms/firstincl.h
new file mode 100644
index 0000000000000000000000000000000000000000..60b84dcc83d7bd920c6c8eadd0084a1fa9dfe636_dm1zL2ZpcnN0aW5jbC5o
--- /dev/null
+++ b/vms/firstincl.h
@@ -0,0 +1,32 @@
+#undef __HIDE_FORBIDDEN_NAMES
+#define __USE_INO64 1
+#define _LARGEFILE 1
+#define __NEW_STARLET 1
+#define _POSIX_EXIT 1
+#define _USE_STD_STAT 1
+#define __FAST_SETJMP 1
+#define _POSIX_EXIT 1
+#define __SIGNED_INT_TIME_T 1
+/* Define if --enable-ipv6 is specified */
+/* #undef ENABLE_IPV6 */
+/* Define if sockaddr has sa_len member */
+#define _SOCKADDR_LEN 1
+/* struct sockaddr_storage (sys/socket.h) */
+/* #undef HAVE_SOCKADDR_STORAGE */
+
+#ifndef __SOCKET_TYPEDEFS
+#define __SOCKET_TYPEDEFS
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned long u_long;
+#endif
+
+
+/* This include must be done before any test on __CRTL_VER */
+#include <decc$types.h>
+/* defined uintptr_t and intptr_t */
+#include <inttypes.h>
+
+#ifdef _DECC_V4_SOURCE
+#error "_DECC_V4_SOURCE should not be defined"
+#endif
diff --git a/vms/genmms.py b/vms/genmms.py
new file mode 100644
index 0000000000000000000000000000000000000000..60b84dcc83d7bd920c6c8eadd0084a1fa9dfe636_dm1zL2dlbm1tcy5weQ==
--- /dev/null
+++ b/vms/genmms.py
@@ -0,0 +1,86 @@
+import sys
+import os
+from os.path import join
+import argparse
+
+parser = argparse.ArgumentParser()
+group = parser.add_mutually_exclusive_group()
+group.add_argument("-d", "--delete", action="store_true")
+group.add_argument("-c", "--create", action="store_true")
+args = parser.parse_args()
+
+def genmms(libname, exclude=None, nobuiltcore=None, library='liblzma'):
+    lst = []
+    if exclude is None:
+        exclude = []
+    if nobuiltcore is None:
+        nobuiltcore = []
+    n = 0
+    mmsname = libname.replace('/', '.')
+    with open('descrip_' + libname.replace('/', '_') + '.mms', 'w') as fo:
+        print >>fo, ".INCLUDE MMSFLAGS"
+        print >>fo, """INCLUDE = /include=("./","../src/liblzma/common",\
+"../src/common","../src/liblzma/api","../src/liblzma/lzma",\
+"../src/liblzma/lz",\
+"../src/liblzma/check",\
+"../src/liblzma/simple",\
+"../src/liblzma/delta",\
+"../src/liblzma/rangecoder",\
+"../{name}")
+""".format(name=libname)
+
+        top = join('../', libname)
+        for root, dirs, files in os.walk(top, topdown=True):
+            if root != top: break
+            print root
+            first = True
+            n = 0
+            cntf = 20
+            for name in files:
+                if name[-2:].lower() == '.c':
+                    name = name[:-2]
+                    if name in exclude:
+                        continue
+                    cntf -= 1
+                    if cntf == 0:
+                        cntf = 20
+                        first = True
+                        n += 1
+                    lst.append(name)
+                    if first:
+                        first = False
+                        print >>fo, "\nOBJS%d=[.OBJ_$(MMSARCH_NAME)]%s.obj" % (n, name),
+                    else:
+                        print >>fo, ",\\\n[.OBJ_$(MMSARCH_NAME)]%s.obj" % name,
+        print >>fo
+        llst = ["$(OBJS%d)" % v for v in range(n + 1)]
+        print >>fo, """all : {lst}
+        @ write sys$output "all done in [.{name}]"
+""".format(lst=" ".join(llst), name=libname)
+        for name in lst:
+            oname = name
+            print >>fo, "[.OBJ_$(MMSARCH_NAME)]{fno}.obj : [-.{lname}]{fn}.c".format(
+                            lname=mmsname, fno=oname, fn=name)
+            defbc = '/DEF=("HAVE_CONFIG_H")'
+            print >>fo, '\t$(CC) %s $(CFLAGS) $(DFLAGS) $(INCLUDE) $(MMS$SOURCE)' % (defbc,)
+
+
+def main():
+    if not args.delete and not args.create:
+        print '--create or --delete should be specified'
+        sys.exit(1)
+    if args.delete:
+        pass
+    else:
+        genmms('src/liblzma/check',
+               ['crc32_small', 'crc32_tablegen', 'crc64_tablegen',
+                'crc64_small',])
+        genmms('src/liblzma/common')
+        genmms('src/liblzma/delta')
+        genmms('src/liblzma/lz')
+        genmms('src/liblzma/lzma', ['fastpos_tablegen',])
+        genmms('src/liblzma/rangecoder', ['price_tablegen',])
+        genmms('src/liblzma/simple')
+
+if __name__ == '__main__':
+    main()
diff --git a/vms/mmsflags.mms b/vms/mmsflags.mms
new file mode 100644
index 0000000000000000000000000000000000000000..60b84dcc83d7bd920c6c8eadd0084a1fa9dfe636_dm1zL21tc2ZsYWdzLm1tcw==
--- /dev/null
+++ b/vms/mmsflags.mms
@@ -0,0 +1,17 @@
+DFLAGS=/warn=disable=UNSUPCONVSPEC
+DFLAGS_GETPATH=
+
+.INCLUDE CMNFLAGS
+
+.IF "$(MMSARCH_NAME)" .EQ  "IA64"
+CFLAGS = /lis/show=(incl,expa)/nested=primary/name=(as_is, short)\
+/first_include=firstincl.h/float=ieee/IEEE_MODE=DENORM_RESULTS \
+/NOANSI_ALIAS/obj=$(MMS$TARGET)/accept=novaxc_keywords $(DBGFLAGS) \
+/optimize=(level=5,tune=itanium2)/architecture=itanium2
+!/deb/noopt/architecture=itanium2
+.ELSE
+CFLAGS = /name=(as_is, short)/float=ieee/IEEE_MODE=DENORM_RESULTS \
+/NOANSI_ALIAS/obj=$(MMS$TARGET)/accept=novaxc_keywords $(DBGFLAGS) \
+/optimize=(level=5,tune=ev56)/architecture=ev56
+.ENDIF
+