@profoundlogic/codermake 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,6 +63,20 @@ else
63
63
  endef
64
64
  endif
65
65
 
66
+ ######
67
+ # IBM i release detection. Sets shell variables IBMI_VERSION and IBMI_RELEASE
68
+ # from `uname -v` and `uname -r` respectively. On IBM i these correspond to V
69
+ # and R in V_R_M_ (e.g. on IBM i 7.5: IBMI_VERSION=7, IBMI_RELEASE=5).
70
+ #
71
+ # Must run in the shell that targets the IBM i: directly in the recipe for
72
+ # local builds (ibmi.mk), or inside the remote shell body of REMOTE_BUILD for
73
+ # remote builds (unix.mk) — running it on the host in unix.mk would detect the
74
+ # wrong system.
75
+ ######
76
+ define DETECT_IBMI_RELEASE
77
+ IBMI_VERSION=$$(uname -v); IBMI_RELEASE=$$(uname -r)
78
+ endef
79
+
66
80
  ######
67
81
  # RPG /COPY preprocessor - converts source member style directives to IFS paths
68
82
  # $(1) = space-separated list of source files involved in the recipe
@@ -163,10 +163,14 @@ system "crtcblmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') tgtccsid
163
163
  endef
164
164
 
165
165
  # Build ILE CL program (bound)
166
+ # tgtccsid(*job) is only supported on IBM i 7.5 and later.
166
167
  define BUILD_CLLE_PGM
167
168
  $(call SETUP_LOG,$(notdir $@))
168
169
  $(SET_LIBL)
169
- system "crtbndcl pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)"
170
+ $(DETECT_IBMI_RELEASE)
171
+ TGTCCSID_PARM=
172
+ if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi
173
+ system "crtbndcl pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)"
170
174
  endef
171
175
 
172
176
  # Build OPM CL program
@@ -178,10 +182,14 @@ system "crtclpgm pgm($(TARGET_LIB)/$(basename $(@F))) srcfile($(TARGET_LIB)/qcls
178
182
  endef
179
183
 
180
184
  # Build ILE CL module
185
+ # tgtccsid(*job) is only supported on IBM i 7.5 and later.
181
186
  define BUILD_CLLE_MODULE
182
187
  $(call SETUP_LOG,$(notdir $@))
183
188
  $(SET_LIBL)
184
- system "crtclmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)"
189
+ $(DETECT_IBMI_RELEASE)
190
+ TGTCCSID_PARM=
191
+ if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi
192
+ system "crtclmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)"
185
193
  endef
186
194
 
187
195
  # Build program from modules
@@ -110,6 +110,15 @@ endef
110
110
 
111
111
  ######
112
112
  # Reusable utility for remote builds via SSH.
113
+ #
114
+ # Source files are bundled into a tar locally, streamed over SSH, and extracted
115
+ # on the IBM i. Extraction uses PASE tar (/QOpenSys/usr/bin/tar) rather than
116
+ # QShell tar (/usr/bin/tar). QShell tar tags extracted stream files with the
117
+ # job CCSID (e.g. 37 EBCDIC) regardless of the file's actual byte content,
118
+ # which corrupts UTF-8 source containing extended characters (Ó, Í, Ú, Á, É,
119
+ # Ñ, ...): the bytes survive but the wrong CCSID tag causes the RPG compiler
120
+ # to read garbled source. PASE tar tags extracted files with CCSID 1208 (UTF-8),
121
+ # which matches what local editors produce.
113
122
  ######
114
123
  ######
115
124
  # $(1) = source root directory to tar from (use '.' for current directory)
@@ -126,7 +135,7 @@ EXIT_CODE=0
126
135
  cat "$$TAR_FILE" | $(SSH) "cat > '$$REMOTE_DIR/sources.tar'" && \
127
136
  $(SSH) "REMOTE_DIR=$$REMOTE_DIR $(QSHELL)" <<'EOF'
128
137
  cd $$REMOTE_DIR
129
- tar -xf sources.tar
138
+ /QOpenSys/usr/bin/tar -xf sources.tar
130
139
  cd $$REMOTE_DIR
131
140
  $(SET_LIBL)
132
141
  $(3)
@@ -238,9 +247,15 @@ touch '$@'
238
247
  endef
239
248
 
240
249
  # Build ILE CL program (bound)
250
+ # tgtccsid(*job) is only supported on IBM i 7.5 and later, so detect the
251
+ # target's release inside the remote shell and gate the parameter on it.
241
252
  define BUILD_CLLE_PGM
242
253
  $(call SETUP_LOG,$(notdir $@))
243
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtbndcl pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
254
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),\
255
+ $(DETECT_IBMI_RELEASE); \
256
+ TGTCCSID_PARM=; \
257
+ if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi; \
258
+ system "crtbndcl pgm($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
244
259
  touch '$@'
245
260
  endef
246
261
 
@@ -256,9 +271,15 @@ touch '$@'
256
271
  endef
257
272
 
258
273
  # Build ILE CL module
274
+ # tgtccsid(*job) is only supported on IBM i 7.5 and later, so detect the
275
+ # target's release inside the remote shell and gate the parameter on it.
259
276
  define BUILD_CLLE_MODULE
260
277
  $(call SETUP_LOG,$(notdir $@))
261
- $(call REMOTE_BUILD,$(filter-out build/%,$^),system "crtclmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') tgtccsid(*job) output(*print) dbgview(*all)")
278
+ $(call REMOTE_BUILD,$(filter-out build/%,$^),\
279
+ $(DETECT_IBMI_RELEASE); \
280
+ TGTCCSID_PARM=; \
281
+ if [ "$$IBMI_VERSION" -gt 7 ] || { [ "$$IBMI_VERSION" -eq 7 ] && [ "$$IBMI_RELEASE" -ge 5 ]; }; then TGTCCSID_PARM="tgtccsid(*job)"; fi; \
282
+ system "crtclmod module($(TARGET_LIB)/$(basename $(@F))) srcstmf('$<') incdir('.') $$TGTCCSID_PARM output(*print) dbgview(*all)")
262
283
  touch '$@'
263
284
  endef
264
285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profoundlogic/codermake",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "Make wrapper framework for IBM i development that simplifies build rules",
5
5
  "main": "dist/bin/index.js",
6
6
  "type": "module",