Hi

I have added support to my script for building ppc rpms. I also
commented some more and things like that. Anyway, I'm sending it to the
list as usual for it to be archived and maybe used by someone else :)

Take care
/Gabriel

ps
The specfile haven't changed, so I didn't attach it. If you need it it's
in this mailing-lists archive.
#!/usr/bin/perl

#
# Coded by Gabriel Gerhardsson, 2001
#


#
# Instructions:
# -------------
# You need this file, the spec-file and the data-files (preferably checkout module 'abispell' from cvs).
# You may need to change the paths to those two and maybe others to (depending of your setup).
#
# Then you just start this script as root and collect the finished rpms when it's done.
#


$RPM_BUILD_DIR = "/usr/src/redhat/BUILD";
$RPM_SOURCE_DIR = "/usr/src/redhat/SOURCES";
$RPM_SPEC_DIR = "/usr/src/redhat/SPECS";

# Name of specfile
$FN_SPECFILE = "abispell-general-0.0.2-2.spec";	

# The directory where the abispell directory is (from cvs, tarball or somewhere else)
# This is where the hash-files and -encoding-files is taken from
$FN_ABISPELL_DIR = "../cvs/abispell";

# Directory for temporary files during build
$FN_TEMP_DIR = "temp";

# Package name and version info
$FN_PREFIX = "abispell";
$FN_VERSION = "0.0.2";
$FN_RELEASE = "1";



`mkdir -p ${FN_TEMP_DIR}`;
`\\rm -f ${FN_TEMP_DIR}/*`;


# Little endian
@dict = 	("catala.hash", "czech.hash", "dansk.hash", "deutsch.hash", "deutsch.hash", "deutsch.hash", "ellhnika.hash", "british.hash", "british.hash", "british.hash", "british.hash", "british.hash", "american.hash", "british.hash", "esperanto.hash", "espanol.hash", "francais.hash", "francais.hash", "francais.hash", "francais.hash", "irish.hash", "galician.hash", "italian.hash", "mlatin.hash", "lietuviu.hash", "nederlands.hash", "norsk.hash", "nynorsk.hash",	"polish.hash", "portugues.hash", "portugues.hash", "russian.hash", "svenska.hash");
@includeEnc = 	(0,		1,		0,		0,		0,		0,		1,		0,		0,		0,		0,		0,		0,		0,		1,			0,		0,		0,		0,		0,		0,		0,		0,		0,		1,		0,		0,		0,			1,		0,		0,		1,		0);
@acr = 		("ca-ES",	"cs-CZ",	"da-DK", 	"de-CH", 	"de-DE", 	"de-AT", 	"el-GR", 	"en-AU", 	"en-CA", 	"en-GB", 	"en-IE", 	"en-NZ", 	"en-US", 	"en-ZA", 	"eo",	 		"es-ES", 	"fr-BE", 	"fr-CA", 	"fr-CH", 	"fr-FR", 	"ga-IE", 	"gl-ES",	"it-IT", 	"la-IT",	"lt-LT", 	"nl-NL", 	"nb-NO", 	"nn-NO", 		"pl-PL", 	"pt-PT", 	"pt-BR", 	"ru-RU", 	"sv-SE");
@name =		("Catalan",	"Czech",	"Danish",	"German",	"German",	"German",	"Greek",	"English",	"English",	"English",	"English",	"English",	"English",	"English",	"Esperanto",		"Spanish",	"French",	"French",	"French",	"French",	"Irish gaelic",	"Galician",	"Italian",	"Latin",	"Latvian",	"Dutch",	"Norwegian",	"Norwegian(nynorsk)",	"Polish",	"Portuguese",	"Portuguese",	"Russian",	"Swedish");
@build_little =	(1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,			1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,		1,			1,		1,		1,		1,		1);
@build_big =	(0,		0,		0,		1,		1,		1,		0,		1,		1,		1,		1,		1,		1,		1,		0,			1,		1,		1,		1,		1,		0,		1,		1,		1,		0,		0,		0,		0,			0,		0,		0,		0,		1);

for ($i = 0; $i < @dict; $i++) {
	if ($build_little[$i]) {
		$full_name = "${FN_PREFIX}-$acr[$i]-${FN_VERSION}-${FN_RELEASE}";
		print "--- Building: $name[$i]($acr[$i]) - Little endian ---\n";


		# Copying the contents of the rpm to the temp-dir
		`cp ${FN_ABISPELL_DIR}/le/$dict[$i] ${FN_TEMP_DIR}/`;
		if ($includeEnc[$i]) {
			`cp ${FN_ABISPELL_DIR}/enc/$dict[$i]-encoding ${FN_TEMP_DIR}/`;
		}

		# Tar the contents
		`cd ${FN_TEMP_DIR}; tar zcvf ${RPM_SOURCE_DIR}/${full_name}.tar.gz *`;

		# Copy spec-file
		`cp ${FN_SPECFILE} ${RPM_SPEC_DIR}/${full_name}.spec`;


		# Search and replace in the spec-file
		`perl -pi -e 's/LOCALE_SHORT/$acr[$i]/g' ${RPM_SPEC_DIR}/${full_name}.spec`;
		`perl -pi -e 's/LOCALE/$name[$i]/g' ${RPM_SPEC_DIR}/${full_name}.spec`;
		`perl -pi -e 's/VERSION/${FN_VERSION}/g' ${RPM_SPEC_DIR}/${full_name}.spec`;
		`perl -pi -e 's/RELEASE/${FN_RELEASE}/g' ${RPM_SPEC_DIR}/${full_name}.spec`;


		# Build the rpm
		`cd ${RPM_SPEC_DIR}; rpm -bb --target=i386 ${full_name}.spec`;

		# Try this instead for compatibility-mode on rpm >= 4.0.3(?) (Creates rpms compatible with rpm3). But know this; This has not been tested at all and is not guaranteed to work!
		# `cd ${RPM_SPEC_DIR}; rpm -bb --target=i386 --define '_noPayloadPrefix 1' --nodirtokens ${full_name}.spec`;


		`rm -f ${FN_TEMP_DIR}/*`;
		`rm -f ${RPM_SPEC_DIR}/${full_name}.spec`;
		`rm -f ${RPM_SOURCE_DIR}/${full_name}.tar.gz`;
	}

	if ($build_big[$i]) {
		$full_name = "${FN_PREFIX}-$acr[$i]-${FN_VERSION}-${FN_RELEASE}";
		print "--- Building: $name[$i]($acr[$i]) - Big endian ---\n";


		# Copying the contents of the rpm to the temp-dir
		`cp ${FN_ABISPELL_DIR}/be/$dict[$i] ${FN_TEMP_DIR}/`;
		if ($includeEnc[$i]) {
			`cp ${FN_ABISPELL_DIR}/enc/$dict[$i]-encoding ${FN_TEMP_DIR}/`;
		}

		# Tar the contents
		`cd ${FN_TEMP_DIR}; tar zcvf ${RPM_SOURCE_DIR}/${full_name}.tar.gz *`;

		# Copy spec-file
		`cp ${FN_SPECFILE} ${RPM_SPEC_DIR}/${full_name}.spec`;


		# Search and replace in the spec-file
		`perl -pi -e 's/LOCALE_SHORT/$acr[$i]/g' ${RPM_SPEC_DIR}/${full_name}.spec`;
		`perl -pi -e 's/LOCALE/$name[$i]/g' ${RPM_SPEC_DIR}/${full_name}.spec`;
		`perl -pi -e 's/VERSION/${FN_VERSION}/g' ${RPM_SPEC_DIR}/${full_name}.spec`;
		`perl -pi -e 's/RELEASE/${FN_RELEASE}/g' ${RPM_SPEC_DIR}/${full_name}.spec`;


		# Build the rpm
		`cd ${RPM_SPEC_DIR}; rpm -bb --target=ppc ${full_name}.spec`;

		# Try this instead for compatibility-mode on rpm >= 4.0.3(?) (Creates rpms compatible with rpm3). But know this; This has not been tested at all and is not guaranteed to work!
		# `cd ${RPM_SPEC_DIR}; rpm -bb --target=ppc --define '_noPayloadPrefix 1' --nodirtokens ${full_name}.spec`;


		`rm -f ${FN_TEMP_DIR}/*`;
		`rm -f ${RPM_SPEC_DIR}/${full_name}.spec`;
		`rm -f ${RPM_SOURCE_DIR}/${full_name}.tar.gz`;
	}
}


`rmdir ${FN_TEMP_DIR}`;

print "\n--- All done!\n";

Reply via email to