Bump to 1.0.0 accepted/tizen_8.0_base accepted/tizen_base_dev sandbox/backup/meson_1.0.0_20240208 tizen_8.0_base accepted/tizen/8.0/base/20231005.044937 accepted/tizen/base/20230208.112258 accepted/tizen/base/20230209.111221 accepted/tizen/base/dev/20230602.080802 submit/tizen_base/20230106.075424 tizen_8.0_m2_release
authorTizenOpenSource <tizenopensrc@samsung.com>
Fri, 6 Jan 2023 07:52:49 +0000 (16:52 +0900)
committerTizenOpenSource <tizenopensrc@samsung.com>
Fri, 6 Jan 2023 07:52:49 +0000 (16:52 +0900)
Signed-off-by: TizenOpenSource <tizenopensrc@samsung.com>
packaging/English.lproj [new file with mode: 0644]
packaging/create_zipapp.py
packaging/createmsi.py
packaging/createpkg.py
packaging/macros.meson [new file with mode: 0644]
packaging/meson.manifest [new file with mode: 0644]
packaging/meson.spec [new file with mode: 0644]

diff --git a/packaging/English.lproj b/packaging/English.lproj
new file mode 100644 (file)
index 0000000..8f59fa8
--- /dev/null
@@ -0,0 +1,10 @@
+<html><head><title>/packaging/macpages/English.lproj/</title></head>
+<body>
+<h2>/packaging/macpages/English.lproj/</h2>
+<ul>
+<li><a href='/cgit/platform/upstream/meson/plain/packaging/macpages/?h=tizen_base'>../</a></li>
+  <li><a href='/cgit/platform/upstream/meson/plain/packaging/macpages/English.lproj/conclusion.html?h=tizen_base'>conclusion.html</a></li>
+  <li><a href='/cgit/platform/upstream/meson/plain/packaging/macpages/English.lproj/license.html?h=tizen_base'>license.html</a></li>
+  <li><a href='/cgit/platform/upstream/meson/plain/packaging/macpages/English.lproj/welcome.html?h=tizen_base'>welcome.html</a></li>
+ </ul>
+</body></html>
index 9fd0f5b..4e018bf 100755 (executable)
@@ -11,7 +11,6 @@ parser = argparse.ArgumentParser()
 parser.add_argument('source', nargs='?', default='.', help='Source directory')
 parser.add_argument('--outfile', default='meson.pyz', help='Output file for the zipapp')
 parser.add_argument('--interpreter', default='/usr/bin/env python3', help='The name of the Python interpreter to use')
-parser.add_argument('--compress', action='store_true', default=False, help='Compress files')
 
 options = parser.parse_args(sys.argv[1:])
 
@@ -20,4 +19,4 @@ source = Path(options.source).resolve()
 with tempfile.TemporaryDirectory() as d:
     shutil.copy2(source / 'meson.py', Path(d, '__main__.py'))
     shutil.copytree(source / 'mesonbuild', Path(d, 'mesonbuild'))
-    zipapp.create_archive(d, interpreter=options.interpreter, target=options.outfile, compressed=options.compress)
+    zipapp.create_archive(d, interpreter=options.interpreter, target=options.outfile)
index fe49b7b..0139877 100755 (executable)
@@ -39,6 +39,48 @@ def gen_guid():
     '''
     return str(uuid.uuid4()).upper()
 
+def get_all_modules_from_dir(dirname):
+    '''
+    Get all modules required for Meson build MSI package
+    from directories.
+    '''
+    modname = os.path.basename(dirname)
+    modules = [os.path.splitext(os.path.split(x)[1])[0] for x in glob(os.path.join(dirname, '*'))]
+    modules = ['mesonbuild.' + modname + '.' + x for x in modules if not x.startswith('_')]
+    return modules
+
+def get_more_modules():
+    '''
+        Getter for missing Modules.
+        Python packagers want to be minimal and only copy the things
+        that they can see that being used. They are blind to many things.
+    '''
+    return ['distutils.archive_util',
+            'distutils.cmd',
+            'distutils.config',
+            'distutils.core',
+            'distutils.debug',
+            'distutils.dep_util',
+            'distutils.dir_util',
+            'distutils.dist',
+            'distutils.errors',
+            'distutils.extension',
+            'distutils.fancy_getopt',
+            'distutils.file_util',
+            'distutils.spawn',
+            'distutils.util',
+            'distutils.version',
+            'distutils.command.build_ext',
+            'distutils.command.build',
+            'filecmp',
+            ]
+
+def get_modules():
+    modules = get_all_modules_from_dir('mesonbuild/modules')
+    modules += get_all_modules_from_dir('mesonbuild/scripts')
+    modules += get_more_modules()
+    return modules
+
 class Node:
     '''
        Node to hold path and directory values
@@ -83,7 +125,7 @@ class PackageGenerator:
         self.staging_dirs = ['dist', 'dist2']
         self.progfile_dir = 'ProgramFiles64Folder'
         redist_globs = ['C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC142_CRT_x64.msm',
-                        'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC143_CRT_x64.msm']
+                        'C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC143_CRT_x64.msm']
         redist_path = None
         for g in redist_globs:
             trials = glob(g)
@@ -123,6 +165,7 @@ class PackageGenerator:
             if os.path.exists(sdir):
                 shutil.rmtree(sdir)
         main_stage, ninja_stage = self.staging_dirs
+        modules = get_modules()
 
         pyinstaller = shutil.which('pyinstaller')
         if not pyinstaller:
@@ -134,9 +177,10 @@ class PackageGenerator:
             shutil.rmtree(pyinstaller_tmpdir)
         pyinst_cmd = [pyinstaller,
                       '--clean',
-                      '--additional-hooks-dir=packaging',
                       '--distpath',
                       pyinstaller_tmpdir]
+        for m in modules:
+            pyinst_cmd += ['--hidden-import', m]
         pyinst_cmd += ['meson.py']
         subprocess.check_call(pyinst_cmd)
         shutil.move(pyinstaller_tmpdir + '/meson', main_stage)
index 70da656..533b3b9 100755 (executable)
@@ -22,6 +22,8 @@ import xml.etree.ElementTree as ET
 sys.path.append(os.getcwd())
 from mesonbuild import coredata
 
+from createmsi import get_modules
+
 class PkgGenerator:
 
     def __init__(self):
@@ -44,9 +46,10 @@ class PkgGenerator:
         pyinstaller_bin = '/Users/jpakkane/Library/Python/3.8/bin/pyinstaller'
         pyinst_cmd = [pyinstaller_bin,
                       '--clean',
-                      '--additional-hooks-dir=packaging',
                       '--distpath',
                       self.pkg_dir]
+        for m in get_modules():
+            pyinst_cmd += ['--hidden-import', m]
         pyinst_cmd += ['meson.py']
         subprocess.check_call(pyinst_cmd)
         tmpdir = os.path.join(self.pkg_dir, 'meson')
diff --git a/packaging/macros.meson b/packaging/macros.meson
new file mode 100644 (file)
index 0000000..8c3b394
--- /dev/null
@@ -0,0 +1,45 @@
+%__meson %{_bindir}/meson
+%__meson_wrap_mode nodownload
+%__meson_auto_features enabled
+
+%_vpath_srcdir .
+%_vpath_builddir %{_target_platform}
+
+%meson \\\
+    %{__meson} \\\
+    --buildtype=plain \\\
+    --prefix=%{_prefix} \\\
+    --libdir=%{_libdir} \\\
+    --libexecdir=%{_libexecdir} \\\
+    --bindir=%{_bindir} \\\
+    --sbindir=%{_sbindir} \\\
+    --includedir=%{_includedir} \\\
+    --datadir=%{_datadir} \\\
+    --mandir=%{_mandir} \\\
+    --infodir=%{_infodir} \\\
+    --localedir=%{_datadir}/locale \\\
+    --sysconfdir=%{_sysconfdir} \\\
+    --localstatedir=%{_localstatedir} \\\
+    --sharedstatedir=%{_sharedstatedir} \\\
+    --wrap-mode=%{__meson_wrap_mode} \\\
+    --auto-features=%{__meson_auto_features} \\\
+    %{_vpath_srcdir} %{_vpath_builddir} \\\
+    %{nil}
+
+%meson_build \\\
+    %{__meson} compile \\\
+    -C %{_vpath_builddir} \\\
+    --verbose \\\
+    %{nil}
+
+%meson_install \\\
+    DESTDIR=%{buildroot} %{__meson} install \\\
+    -C %{_vpath_builddir} \\\
+    --no-rebuild \\\
+    %{nil}
+
+%meson_test \\\
+    %{__meson} test \\\
+        -C %{_vpath_builddir} \\\
+        --print-errorlogs \\\
+        %{nil}}
diff --git a/packaging/meson.manifest b/packaging/meson.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/meson.spec b/packaging/meson.spec
new file mode 100644 (file)
index 0000000..310ca13
--- /dev/null
@@ -0,0 +1,107 @@
+%define _name   mesonbuild
+Name:           meson
+Version:        1.0.0
+Release:        0
+Summary:        Python-based build system
+License:        Apache-2.0
+Group:          Development/Tools/Building
+Url:            http://mesonbuild.com/
+Source:         https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz
+SOURCE1001:     meson.manifest
+SOURCE1002:     macros.meson
+BuildRequires:  python3 >= 3.4
+BuildRequires:  python3-setuptools
+BuildArch:      noarch
+
+Requires:       ninja
+Requires:       python3-xml
+Requires:       python3-setuptools
+
+Provides:       meson-gui = %{version}
+Obsoletes:      meson-gui < %{version}
+
+%description
+Meson is a build system designed to optimise programmer productivity.
+It aims to do this by providing support for software development
+tools and practices, such as unit tests, coverage reports, Valgrind,
+CCache and the like. Supported languages include C, C++, Fortran,
+Java, Rust. Build definitions are written in a non-turing complete
+Domain Specific Language.
+
+%package vim
+%{!?vim_data_dir:%global vim_data_dir %{_datadir}/vim}
+Summary:        Vim support for meson.build files
+Group:          Productivity/Text/Editors
+Requires:       vim
+Supplements:    packageand(vim:%{name})
+BuildArch:      noarch
+
+%description vim
+Meson is a build system designed to optimise programmer productivity.
+It aims to do this by providing support for software development
+tools and practices, such as unit tests, coverage reports, Valgrind,
+CCache and the like. Supported languages include C, C++, Fortran,
+Java, Rust. Build definitions are written in a non-turing complete
+Domain Specific Language.
+
+This package provides support for meson.build files in Vim.
+
+%prep
+%setup -q -n meson-%{version}
+cp %{SOURCE1001} .
+cp -f %{SOURCE1002} ./data
+
+sed -i "/static/d" test\ cases/frameworks/1\ boost/meson.build
+
+# We do not have gmock available at this moment - can't run the test suite for it
+rm -rf "test cases/frameworks/3 gmock" \
+       "test cases/objc/2 nsstring"
+
+# Remove hashbang from non-exec script
+sed -i '1{/\/usr\/bin\/env/d;}' ./mesonbuild/rewriter.py
+
+%build
+python3 setup.py build
+
+%install
+python3 setup.py install \
+  --root=%{buildroot} --prefix=%{_prefix}
+
+install -Dpm 0644 data/macros.meson \
+  %{buildroot}%{_rpmconfigdir}/macros.d/macros.meson
+
+mkdir -p %{buildroot}%{vim_data_dir}/site/ftdetect
+install -Dpm 0644 data/syntax-highlighting/vim/ftdetect/meson.vim \
+  -t %{buildroot}%{vim_data_dir}/site/ftdetect
+
+mkdir -p %{buildroot}%{vim_data_dir}/site/indent
+install -Dpm 0644 data/syntax-highlighting/vim/indent/meson.vim \
+  -t %{buildroot}%{vim_data_dir}/site/indent
+
+mkdir -p %{buildroot}%{vim_data_dir}/site/syntax
+install -Dpm 0644 data/syntax-highlighting/vim/syntax/meson.vim \
+  -t %{buildroot}%{vim_data_dir}/site/syntax
+
+%remove_docs
+
+%files
+%manifest %{name}.manifest
+%license COPYING
+%{_bindir}/meson
+%{python3_sitelib}/%{_name}/
+%{python3_sitelib}/meson-*
+%{_rpmconfigdir}/macros.d/macros.meson
+%{_datadir}/polkit-1/actions/com.mesonbuild.install.policy
+
+%files vim
+%manifest %{name}.manifest
+%dir %{vim_data_dir}
+%dir %{vim_data_dir}/site
+%dir %{vim_data_dir}/site/ftdetect
+%dir %{vim_data_dir}/site/indent
+%dir %{vim_data_dir}/site/syntax
+%{vim_data_dir}/site/ftdetect/meson.vim
+%{vim_data_dir}/site/indent/meson.vim
+%{vim_data_dir}/site/syntax/meson.vim
+
+%changelog