[CMAKE]
[reactos.git] / ros_cd.cmake
1 #reactos.cab
2 add_custom_command(
3 OUTPUT ${REACTOS_BINARY_DIR}/bootcd/reactos/reactos.inf
4 COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/reactos.dff -L ${REACTOS_BINARY_DIR}/boot/bootcd/reactos -I
5 )
6 add_custom_target(
7 reactos_cab
8 COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/reactos.dff -RC ${REACTOS_BINARY_DIR}/boot/bootcd/reactos/reactos.inf -L ${REACTOS_BINARY_DIR}/boot/bootcd/reactos -N
9 DEPENDS ${REACTOS_BINARY_DIR}/bootcd/reactos/reactos.inf
10 )
11
12 file(WRITE ${REACTOS_BINARY_DIR}/boot/reactos.dff
13 "; Main ReactOS package
14
15 .Set DiskLabelTemplate=\"ReactOS\" ; Label of disk
16 .Set CabinetNameTemplate=\"reactos.cab\" ; reactos.cab
17 .Set InfFileName=\"reactos.inf\" ; reactos.inf
18
19
20 ;.Set Cabinet=on
21 ;.Set Compress=on
22
23 .InfBegin
24 [Version]
25 Signature = \"$ReactOS$\"
26
27 [Directories]
28 1 = system32
29 2 = system32\\drivers
30 3 = Fonts
31 4 =
32 5 = system32\\drivers\\etc
33 6 = inf
34 7 = bin
35 8 = media
36
37 .InfEnd
38
39 ; Contents of disk
40 .InfBegin
41 [SourceFiles]
42 .InfEnd
43 "
44 )
45 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt CAB_TARGET_ENTRIES)
46 foreach(ENTRY ${CAB_TARGET_ENTRIES})
47 string(REGEX REPLACE "^(.*)\t.*" "\\1" _targetname ${ENTRY})
48 string(REGEX REPLACE "^.*\t(.)" "\\1" _dir_num ${ENTRY})
49 get_target_property(_FILENAME ${_targetname} LOCATION)
50 file(APPEND ${REACTOS_BINARY_DIR}/boot/reactos.dff "${_FILENAME} ${_dir_num}\n")
51 add_dependencies(reactos_cab ${_targetname})
52 endforeach()
53
54 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_cab.txt CAB_TARGET_ENTRIES)
55 foreach(ENTRY ${CAB_TARGET_ENTRIES})
56 string(REGEX REPLACE "^(.*)\t.*" "\\1" _FILENAME ${ENTRY})
57 string(REGEX REPLACE "^.*\t(.)" "\\1" _dir_num ${ENTRY})
58 file(APPEND ${REACTOS_BINARY_DIR}/boot/reactos.dff "${_FILENAME} ${_dir_num}\n")
59 endforeach()
60
61 #bootcd target
62 set(BOOTCD_DIR "${REACTOS_BINARY_DIR}/boot/bootcd")
63
64 file(MAKE_DIRECTORY "${BOOTCD_DIR}")
65 file(MAKE_DIRECTORY "${BOOTCD_DIR}/loader")
66 file(MAKE_DIRECTORY "${BOOTCD_DIR}/reactos")
67 file(MAKE_DIRECTORY "${BOOTCD_DIR}/reactos/system32")
68
69 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt MINICD_TARGET_ENTRIES)
70 foreach(ENTRY ${MINICD_TARGET_ENTRIES})
71 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _targetname ${ENTRY})
72 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
73 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
74 get_target_property(_FILENAME ${_targetname} LOCATION)
75 set(filename ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD})
76 list( APPEND BOOTCD_FILES ${filename})
77 add_custom_command(
78 OUTPUT ${filename}
79 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD}
80 DEPENDS ${_targetname}
81 )
82 endforeach()
83
84 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt MINICD_ENTRIES)
85 foreach(ENTRY ${MINICD_ENTRIES})
86 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _FILENAME ${ENTRY})
87 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
88 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
89 set(filename ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD})
90 list( APPEND BOOTCD_FILES ${filename})
91 add_custom_command(
92 OUTPUT ${filename}
93 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD}
94 DEPENDS ${_FILENAME}
95 )
96 endforeach()
97
98 add_custom_target(bootcd
99 COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/boot/freeldr/bootsect/isoboot.bin ${BOOTCD_DIR} REACTOS ${REACTOS_BINARY_DIR}/minicd.iso
100 DEPENDS ${BOOTCD_FILES})
101
102 add_dependencies(bootcd reactos_cab dosmbr ext2 fat32 fat isoboot isobtrt vgafonts)
103
104 set_directory_properties(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${REACTOS_BINARY_DIR}/minicd.iso)
105
106 #livecd target
107 file(MAKE_DIRECTORY "${LIVECD_DIR}")
108 file(MAKE_DIRECTORY "${LIVECD_DIR}/loader")
109 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles")
110 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/All Users")
111 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/All Users/Desktop")
112 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/Default User")
113 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/Default User/Desktop")
114 file(MAKE_DIRECTORY "${LIVECD_DIR}/Profiles/Default User/My Documents")
115 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos")
116 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/inf")
117 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/fonts")
118 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/system32")
119 file(MAKE_DIRECTORY "${LIVECD_DIR}/reactos/system32/config")
120
121 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt LIVECD_TARGET_ENTRIES)
122 foreach(ENTRY ${LIVECD_TARGET_ENTRIES})
123 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _targetname ${ENTRY})
124 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
125 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
126 get_target_property(_FILENAME ${_targetname} LOCATION)
127 set(filename ${LIVECD_DIR}/${_DIR}/${_NAMEONCD})
128 list( APPEND LIVECD_FILES ${filename})
129 add_custom_command(
130 OUTPUT ${filename}
131 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${LIVECD_DIR}/${_DIR}/${_NAMEONCD}
132 DEPENDS ${_targetname}
133 )
134 endforeach()
135 file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt LIVECD_ENTRIES)
136
137 foreach(ENTRY ${LIVECD_ENTRIES})
138 string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _FILENAME ${ENTRY})
139 string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY})
140 string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY})
141 set(filename ${LIVECD_DIR}/${_DIR}/${_NAMEONCD})
142 list( APPEND LIVECD_FILES ${filename})
143 add_custom_command(
144 OUTPUT ${filename}
145 COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${LIVECD_DIR}/${_DIR}/${_NAMEONCD}
146 DEPENDS ${_FILENAME}
147 )
148 endforeach()
149
150 add_custom_target(livecd
151 COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/boot/freeldr/bootsect/isoboot.bin ${LIVECD_DIR} REACTOS ${REACTOS_BINARY_DIR}/livecd.iso
152 DEPENDS ${LIVECD_FILES})
153 add_dependencies(livecd isoboot livecd_hives)
154
155 set_directory_properties(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${REACTOS_BINARY_DIR}/livecd.iso)