Skip to content

Commit 0ecdd33

Browse files
committed
Merge pull request #150 from kaorut/github_actions_setup
Add a script to the setup project to make library install image #147 (cherry picked from commit 3827a63)
1 parent e6dde9d commit 0ecdd33

File tree

7 files changed

+98
-17
lines changed

7 files changed

+98
-17
lines changed

.github/workflows/windows-visualcpp.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,17 @@ jobs:
108108
- name: Make archive
109109
shell: powershell
110110
run: |
111-
Compress-Archive -Path .\bin.setup\Release.Win32 -DestinationPath .\bin.setup\tetengo-windows-Win32-$env:TETENGO_VER.zip
112-
Compress-Archive -Path .\bin.setup\Release.x64 -DestinationPath .\bin.setup\tetengo-windows-x64-$env:TETENGO_VER.zip
111+
Compress-Archive -Path .\bin.setup\Release.Win32 -DestinationPath .\bin.setup\tetengo-windows-Win32-$env:TETENGO_VER.zip
112+
Compress-Archive -Path .\bin.setup\Release.x64 -DestinationPath .\bin.setup\tetengo-windows-x64-$env:TETENGO_VER.zip
113+
Compress-Archive -Path .\bin.libimage\Release.x64 -DestinationPath .\bin.libimage\tetengo-windows-libimage-x64-$env:TETENGO_VER.zip
113114
114115
- name: Move artifacts
115116
shell: cmd
116117
run: |
117118
mkdir artifacts
118-
move bin.setup\tetengo-windows-Win32-%TETENGO_VER%.zip artifacts
119-
move bin.setup\tetengo-windows-x64-%TETENGO_VER%.zip artifacts
119+
move bin.setup\tetengo-windows-Win32-%TETENGO_VER%.zip artifacts
120+
move bin.setup\tetengo-windows-x64-%TETENGO_VER%.zip artifacts
121+
move bin.libimage\tetengo-windows-libimage-x64-%TETENGO_VER%.zip artifacts
120122
121123
- name: Upload artifacts
122124
uses: actions/upload-artifact@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
aclocal.m4
55
autom4te.cache/
66
bin/
7+
bin.libimage/
78
bin.setup/
89
compile
910
config.guess

setup/installer/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Copyright (C) 2019-2021 kaoru https://www.tetengo.org/
33

44
script_files = \
5+
copy_libimage_files.py \
56
generate_content_wxs.py \
67
generate_content_wxs_source.py
78

setup/installer/Makefile.nmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ COPY=copy
2020
ECHO=echo
2121
MKDIR=mkdir
2222
DEL=del
23+
RMDIR=rmdir
2324

2425
OBJDIR=$(WORKDIR)\obj\$(CONFIGURATION).$(PLATFORM)
2526
BINDIR=$(WORKDIR)\bin.setup\$(CONFIGURATION).$(PLATFORM)
27+
LIBIMAGEBINDIR=$(WORKDIR)\bin.libimage\$(CONFIGURATION).$(PLATFORM)
2628
TETENGOOUTDIR=$(WORKDIR)\..\..\bin\$(CONFIGURATION).$(PLATFORM)
2729

28-
all: $(BINDIR)\tetengo.msi $(BINDIR)\setup.exe $(BINDIR)\setup.conf
30+
all: $(BINDIR)\tetengo.msi $(BINDIR)\setup.exe $(BINDIR)\setup.conf $(LIBIMAGEBINDIR)
2931

3032
$(BINDIR)\tetengo.msi: $(OBJDIR)\tetengo.en.msi $(OBJDIR)\ja.mst
3133
-$(MKDIR) $(BINDIR)
@@ -62,7 +64,12 @@ $(BINDIR)\setup.exe: $(TETENGOOUTDIR)\setup.exe
6264
$(BINDIR)\setup.conf:
6365
$(ECHO) tetengo.msi > $@
6466

67+
$(LIBIMAGEBINDIR): $(OBJDIR)\content_wxs_source.txt
68+
-$(MKDIR) $(LIBIMAGEBINDIR)
69+
$(PYTHON) "$(WORKDIR)\copy_libimage_files.py" $** $@
70+
6571
.PHONY: clean
6672
clean:
6773
-$(DEL) /f /q $(OBJDIR)\*
6874
-$(DEL) /f /q $(BINDIR)\*
75+
-$(RMDIR) /s /q $(LIBIMAGEBINDIR)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#! /usr/bin/env python3
2+
"""Copies the files for a library image
3+
4+
Copyright (C) 2019-2021 kaoru https://www.tetengo.org/
5+
"""
6+
7+
import pathlib
8+
import re
9+
import shutil
10+
import sys
11+
from typing import List, Optional, Tuple
12+
13+
14+
def main(args: List[str]) -> None:
15+
"""The main function.
16+
17+
Args:
18+
args (list[str]): Program rguments
19+
"""
20+
if len(args) < 2:
21+
print(
22+
"Usage: ./copy_libimage_files.py content_wxs_source.txt destination",
23+
file=sys.stderr,
24+
)
25+
sys.exit(0)
26+
files: List[Tuple[pathlib.Path, pathlib.Path]] = _list_files(pathlib.Path(args[0]))
27+
_copy_files(files, pathlib.Path(args[1]))
28+
29+
30+
def _list_files(source_path: pathlib.Path) -> List[Tuple[pathlib.Path, pathlib.Path]]:
31+
files: List[Tuple[pathlib.Path, pathlib.Path]] = []
32+
with source_path.open(mode="r", encoding="UTF-8") as stream:
33+
for line in stream:
34+
matched: Optional[re.Match[str]] = re.match(
35+
"^([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)[ ]+([^ ]+)", line
36+
)
37+
if not matched:
38+
continue
39+
feature: str = matched.group(1)
40+
source_directory = pathlib.Path(matched.group(2))
41+
source_path = pathlib.Path(matched.group(3))
42+
destination = pathlib.Path(matched.group(4))
43+
if (
44+
feature != "include"
45+
and feature != "lib.Release.Win32"
46+
and feature != "lib.Release.x64"
47+
):
48+
continue
49+
files.append(
50+
(source_directory / source_path, (destination / source_path).parent)
51+
)
52+
return files
53+
54+
55+
def _copy_files(
56+
files: List[Tuple[pathlib.Path, pathlib.Path]], destination_root: pathlib.Path
57+
) -> None:
58+
shutil.rmtree(destination_root, ignore_errors=True)
59+
for file in files:
60+
destination_directory: pathlib.Path = destination_root / file[1]
61+
destination_directory.mkdir(parents=True, exist_ok=True)
62+
shutil.copy(file[0], destination_directory)
63+
64+
65+
if __name__ == "__main__":
66+
main(sys.argv[1:])

setup/installer/installer.vcxproj

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,32 +72,33 @@
7272
<PropertyGroup Label="UserMacros" />
7373
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
7474
<NMakeOutput>$(OutDir)tetengo.msi</NMakeOutput>
75-
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) all</NMakeBuildCommandLine>
76-
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean all</NMakeReBuildCommandLine>
77-
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean</NMakeCleanCommandLine>
75+
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) all</NMakeBuildCommandLine>
76+
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean all</NMakeReBuildCommandLine>
77+
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean</NMakeCleanCommandLine>
7878
</PropertyGroup>
7979
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
8080
<NMakeOutput>$(OutDir)tetengo.msi</NMakeOutput>
81-
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) all</NMakeBuildCommandLine>
82-
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean all</NMakeReBuildCommandLine>
83-
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean</NMakeCleanCommandLine>
81+
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) all</NMakeBuildCommandLine>
82+
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean all</NMakeReBuildCommandLine>
83+
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean</NMakeCleanCommandLine>
8484
</PropertyGroup>
8585
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
8686
<NMakeOutput>$(OutDir)tetengo.msi</NMakeOutput>
87-
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) all</NMakeBuildCommandLine>
88-
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean all</NMakeReBuildCommandLine>
89-
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean</NMakeCleanCommandLine>
87+
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) all</NMakeBuildCommandLine>
88+
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean all</NMakeReBuildCommandLine>
89+
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean</NMakeCleanCommandLine>
9090
</PropertyGroup>
9191
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
9292
<NMakeOutput>$(OutDir)tetengo.msi</NMakeOutput>
93-
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) all</NMakeBuildCommandLine>
94-
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean all</NMakeReBuildCommandLine>
95-
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) clean</NMakeCleanCommandLine>
93+
<NMakeBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) all</NMakeBuildCommandLine>
94+
<NMakeReBuildCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean all</NMakeReBuildCommandLine>
95+
<NMakeCleanCommandLine>nmake -f $(ProjectDir)Makefile.nmake ARCH=$(PlatformTarget) PLATFORM=$(Platform) SOLUTIONDIR=$(SolutionDir) WORKDIR=$(ProjectDir) OBJDIR=$(IntDir) BINDIR=$(OutDir) LIBIMAGEBINDIR=$(SolutionDir)bin.libimage\$(Configuration).$(Platform) clean</NMakeCleanCommandLine>
9696
</PropertyGroup>
9797
<ItemDefinitionGroup>
9898
</ItemDefinitionGroup>
9999
<ItemGroup>
100100
<None Include="COPYING.rtf" />
101+
<None Include="copy_libimage_files.py" />
101102
<None Include="generate_content_wxs.py" />
102103
<None Include="generate_content_wxs_source.py" />
103104
<None Include="main.wxs" />

setup/installer/installer.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
<None Include="COPYING.rtf">
2626
<Filter>res</Filter>
2727
</None>
28+
<None Include="copy_libimage_files.py">
29+
<Filter>src</Filter>
30+
</None>
2831
</ItemGroup>
2932
<ItemGroup>
3033
<Text Include="files_to_install.txt">

0 commit comments

Comments
 (0)